See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| # Go To Home Launcher | |
| adb shell am start -c android.intent.category.HOME -a android.intent.action.MAIN | |
| # Force stop | |
| adb shell am force-stop $PACKAGE_NAME |
| val KEY_NAME = stringPreferencesKey("name") | |
| class UserRepository( | |
| private val dataStore: DataStore<Preferences>, | |
| ) { | |
| val name: Flow<String> = dataStore.data.map { preferences -> | |
| preferences[KEY_NAME].orEmpty() | |
| } | |
| suspend fun setName(name: String) { |
| docker run --rm \ | |
| --name=mysql-runtime \ | |
| -e MYSQL_ROOT_PASSWORD=password \ | |
| -e MYSQL_DATABASE=development \ | |
| -v ./data/mysql:/var/lib/mysql \ | |
| -p 3306:3306 \ | |
| -d mysql:latest |
| fun updateWidget(context: Context) { | |
| val appWidgetManager = AppWidgetManager.getInstance(context) | |
| val favoriteAppWidget = ComponentName(context, FavoriteAppWidget::class.java) | |
| val widgetIds = appWidgetManager.getAppWidgetIds(favoriteAppWidget) | |
| val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE) | |
| .putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIds) | |
| context.sendBroadcast(intent) | |
| } |
| class ConsumerActivity : AppCompatActivity(R.layout.activity_main) { | |
| companion object { | |
| private const val KEY_SAVED_INSTANCE_STATE_MAIN_ITEM = "MAIN_ITEM" | |
| } | |
| private val adapter: MainAdapter by lazy { | |
| MainAdapter() | |
| } |
| class ItemOffsetsDecorator( | |
| private val block: (position: Int, count: Int, rect: Rect) -> Unit | |
| ): RecyclerView.ItemDecoration() { | |
| override fun getItemOffsets(outRect: Rect?, view: View?, parent: RecyclerView?, state: RecyclerView.State?) { | |
| super.getItemOffsets(outRect, view, parent, state) | |
| parent?.getChildAdapterPosition(view)?.run position@ { | |
| outRect?.run rect@ { | |
| state?.itemCount?.run count@ { | |
| block.invoke(this@position, this@count, this@rect) |
| class ParallaxPagerTransformer : ViewPager.PageTransformer { | |
| override fun transformPage(page: View, position: Float) { | |
| val pageWidth = page.width | |
| val pageWidthTimesPosition = pageWidth.times(position) | |
| val imageScreen = page.findViewById<ImageView>(R.id.img_screen) | |
| val imageBgTop = page.findViewById<ImageView>(R.id.img_bg_top) | |
| val staticPosition = position <= -1.0f || position >= 1.0f | |
| val zeroPosition = position == 0.0f |
| private fun setParentBackgroundColor(offset: Float, position: Int): Int { | |
| val bgColorList = listOf( | |
| ContextCompat.getColor(baseActivity, R.color.blue), | |
| ContextCompat.getColor(baseActivity, R.color.green) | |
| ) | |
| return ArgbEvaluator().evaluate( | |
| offset, | |
| bgColorList[if (position > bgColorList.size - 1) 0 else position], | |
| bgColorList[when { |
| # ReactiveConnectivity | |
| ReactiveConnectivity - a library for Listen Connectivity Change on Android | |
| [](https://android-arsenal.com/api?level=15) | |
| [](https://jitpack.io/#amalhanaja/ReactiveConnectivity) | |
| [](https://codebeat.co/projects/github-com-amalhanaja-reactiveconnectivity-master) | |
| ReactiveConnectivity is an Android Library to Listening NetworkConnectivity with RxJava Observables, It's written with Reactive Programming Approach. Library supports both new and legacy network monitoring. | |
| ## Installation |