This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
... | |
dependencies { | |
... | |
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.borusan.eta.base | |
import android.content.IntentFilter | |
import android.net.ConnectivityManager | |
import android.os.Bundle | |
import android.view.View | |
import androidx.lifecycle.ViewModelProvider | |
import androidx.lifecycle.ViewModelProviders | |
import com.borusan.eta.R | |
import com.borusan.eta.internal.util.functional.lazyThreadSafetyNone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConnectivityReceiver : BroadcastReceiver() { | |
override fun onReceive(context: Context, arg1: Intent) { | |
if (connectivityReceiverListener != null) { | |
connectivityReceiverListener!!.onNetworkConnectionChanged(isConnectedOrConnecting(context)) | |
} | |
} | |
private fun isConnectedOrConnecting(context: Context): Boolean { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A lifecycle-aware observable that sends only new updates after subscription, used for events like | |
* navigation and Snackbar messages. | |
* | |
* | |
* This avoids a common problem with events: on configuration change (like rotation) an update | |
* can be emitted if the observer is active. This LiveData only calls the observable if there's an | |
* explicit call to setValue() or call(). | |
* | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
live { | |
resValue "string", "api_url", "https://services.allianz.com.tr/oneApp-web/api/" | |
resValue "string", "api_url_digitalx", "https://services.allianz.com.tr/DigitalInteractionApi/api/v1/" | |
resValue "string", "systype", "prod" | |
} | |
prep { | |
versionNameSuffix "prep" | |
resValue "string", "api_url", "https://test-services.allianz.com.tr/oneApp-web/api/" | |
resValue "string", "api_url_digitalx", "https://test-services.allianz.com.tr/DigitalInteractionApi-prep/api/v1/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun initRecyclerview() { | |
headerAdapter = HeaderAdapter(MergeAdapterDataSource.getHeader()) | |
titleAdapter = TitleAdapter(MergeAdapterDataSource.getTitle()) | |
imageAdapter = ImageAdapter(MergeAdapterDataSource.getImage()) | |
mergeAdapter = MergeAdapter(headerAdapter, titleAdapter, imageAdapter) | |
recyclerView.apply { | |
layoutManager = LinearLayoutManager(this@MainActivity) | |
adapter = mergeAdapter | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lateinit var headerAdapter: HeaderAdapter | |
private lateinit var titleAdapter: TitleAdapter | |
private lateinit var imageAdapter: ImageAdapter | |
private lateinit var mergeAdapter: MergeAdapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<androidx.recyclerview.widget.RecyclerView | |
android:id="@+id/recyclerView" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ImageView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/img_item" | |
android:layout_width="match_parent" | |
android:layout_height="200dp" | |
android:layout_margin="16dp" | |
android:scaleType="fitXY" | |
tools:src="@drawable/ic_launcher_background" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageAdapter(private val image: Image) : RecyclerView.Adapter<ImageAdapter.DataViewHolder>() { | |
class DataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { | |
fun bind(image: Image) { | |
itemView.img_item.setImageResource(image.image) | |
} | |
} | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = | |
DataViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_image, parent, false)) |
NewerOlder