This file contains hidden or 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 HmsPushService: HmsMessageService() { | |
companion object{ | |
private const val TAG = "HmsPushService" | |
} | |
override fun onNewToken(p0: String?) {} | |
override fun onMessageReceived(remoteMessage:RemoteMessage?){ | |
super.onMessageReceived(remoteMessage) | |
remoteMessage?.dataOfMap?.let { | |
// Show notification and do other stuffs e.g. pendingIntent |
This file contains hidden or 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
pipelines: // start of the pipeline | |
default: // means that on every push or merge on main or master branch will trigger the pipeline | |
- step: //step 1 | |
name: Android Sdk Setup | |
image: androidsdk/android-30 // we are using official android 30 sdk | |
caches: | |
- gradle // to cache gradle and not to download the gradle each time. | |
script: | |
- bash ./gradlew assembleDebug // you can write other scripts in here. | |
artifacts: |
This file contains hidden or 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
- step: | |
name: Installing node.js and npm appcenter-cli | |
image: node:10.0.0 | |
script: | |
- npm install // node js package manager installation | |
- npm install -g appcenter-cli // install app center cli using node js | |
- appcenter apps list --token "your_token" // in case you want to see all the applications on your account (optional command) | |
- appcenter distribute release --group Collaborators --file "app/build/outputs/apk/debug/app-debug.apk" --release-notes 'Test release Notes' --app organization_name_or_your_account_name/app_name --token "your_token" --quiet |
This file contains hidden or 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
pipelines: // start of the pipeline | |
default: // means that on every push or merge on main or master branch will trigger the pipeline | |
- step: //step 1 | |
name: Android Sdk Setup | |
image: androidsdk/android-30 // we are using official android 30 sdk | |
caches: | |
- gradle // to cache gradle and not to download the gradle each time. | |
script: | |
- bash ./gradlew assembleDebug // you can write other scripts in here. | |
artifacts: |
This file contains hidden or 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
//Initiate the adapter with type | |
var mAdapter = BaseAdapter<String>() | |
//Sample data | |
mAdapter.listOfItems = mutableListOf("2","3","2","3","2","3") | |
mAdapter.expressionViewHolderBinding = {eachItem,viewBinding-> | |
//eachItem will provide the each item in the list, in this case its a string type | |
//cast the viewBinding with yout layout binding class |
This file contains hidden or 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 BaseAdapter<T>: RecyclerView.Adapter<BaseViewHolder<T>>(){ | |
var listOfItems:MutableList<T>? = mutableListOf() | |
set(value) { | |
field = value | |
notifyDataSetChanged() | |
} | |
var expressionViewHolderBinding: ((T,ViewBinding) -> Unit)? = null | |
var expressionOnCreateViewHolder:((ViewGroup)->ViewBinding)? = null | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<T> { | |
return expressionOnCreateViewHolder?.let { it(parent) }?.let { BaseViewHolder(it, expressionViewHolderBinding!!) }!! |
This file contains hidden or 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 BaseViewHolder<T> internal constructor(private val binding:ViewBinding,private val experssion:(T,ViewBinding)->Unit) | |
:RecyclerView.ViewHolder(binding.root){ | |
fun bind(item:T){ | |
experssion(item,binding) | |
} | |
} |