mirror of
https://github.com/yogeshpaliyal/KeyPass.git
synced 2026-01-12 01:09:40 -06:00
create common application class, fix fab styling (#287)
* create common application class, fix fab styling * fix: remove unused imports and add last line * fix: spotless issues * common application changes
This commit is contained in:
committed by
GitHub
parent
84c5a98346
commit
872098a04e
@@ -80,13 +80,6 @@ dependencies {
|
||||
implementation 'androidx.preference:preference-ktx:1.2.0'
|
||||
|
||||
|
||||
|
||||
// ViewModel
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
// LiveData
|
||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
|
||||
|
||||
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
|
||||
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
|
||||
|
||||
|
||||
@@ -61,11 +61,7 @@
|
||||
<meta-data
|
||||
android:name="preloaded_fonts"
|
||||
android:resource="@array/preloaded_fonts" /> <!-- If you want to disable android.startup completely. -->
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
android:exported="false"
|
||||
tools:node="remove" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,15 +1,9 @@
|
||||
package com.yogeshpaliyal.keypass
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.hilt.work.HiltWorkerFactory
|
||||
import androidx.work.Configuration
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.yogeshpaliyal.common.CommonMyApplication
|
||||
import com.yogeshpaliyal.keypass.ui.CrashActivity
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import javax.inject.Inject
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
/*
|
||||
* @author Yogesh Paliyal
|
||||
@@ -18,28 +12,9 @@ import kotlin.system.exitProcess
|
||||
* created on 22-01-2021 22:41
|
||||
*/
|
||||
@HiltAndroidApp
|
||||
class MyApplication : Application(), Configuration.Provider {
|
||||
class MyApplication : CommonMyApplication() {
|
||||
|
||||
@Inject
|
||||
lateinit var workerFactory: HiltWorkerFactory
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
||||
Log.d("MyApplication", "crashed ")
|
||||
val intent = CrashActivity.getIntent(this, throwable.localizedMessage)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
}
|
||||
|
||||
override fun getWorkManagerConfiguration(): Configuration {
|
||||
return Configuration.Builder()
|
||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
||||
.setWorkerFactory(workerFactory)
|
||||
.build()
|
||||
override fun getCrashActivityIntent(throwable: Throwable): Intent {
|
||||
return CrashActivity.getIntent(this, throwable.localizedMessage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
app:fabAlignmentMode="center"
|
||||
app:fabCradleMargin="@dimen/bottom_app_bar_fab_cradle_margin"
|
||||
app:menuAlignmentMode="start"
|
||||
app:fabCradleRoundedCornerRadius="@dimen/bottom_app_bar_fab_cradle_corner_radius"
|
||||
app:hideOnScroll="true"
|
||||
app:menu="@menu/bottom_app_bar"
|
||||
@@ -93,8 +93,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_anchor="@id/bottomAppBar"
|
||||
app:srcCompat="@drawable/asl_add_save"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearance.KeyPass.Cirle"/>
|
||||
app:fabAnchorMode="embed"
|
||||
app:srcCompat="@drawable/asl_add_save"/>
|
||||
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
@@ -210,7 +210,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/grid_2"
|
||||
app:layout_anchor="@id/bottomAppBar"
|
||||
app:shapeAppearanceOverlay="@style/ShapeAppearance.KeyPass.Cirle"
|
||||
app:srcCompat="@drawable/ic_round_done_24" />
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ buildscript {
|
||||
room_version = "2.5.0"
|
||||
navigation_version = '2.5.3'
|
||||
ext.hilt_version = '2.44.2'
|
||||
compose_version = '1.0.1'
|
||||
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
|
||||
@@ -75,4 +75,9 @@ dependencies {
|
||||
|
||||
api "androidx.biometric:biometric:1.1.0"
|
||||
|
||||
// ViewModel
|
||||
api "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
// LiveData
|
||||
api "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yogeshpaliyal.common">
|
||||
package="com.yogeshpaliyal.common"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<application>
|
||||
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
android:exported="false"
|
||||
tools:node="remove" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yogeshpaliyal.common
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
import androidx.hilt.work.HiltWorkerFactory
|
||||
import androidx.work.Configuration
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import javax.inject.Inject
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
abstract class CommonMyApplication : Application(), Configuration.Provider {
|
||||
|
||||
@Inject
|
||||
lateinit var workerFactory: HiltWorkerFactory
|
||||
|
||||
abstract fun getCrashActivityIntent(throwable: Throwable): Intent
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
|
||||
Log.d("MyApplication", "crashed ")
|
||||
val intent = getCrashActivityIntent(throwable)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
startActivity(intent)
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
}
|
||||
|
||||
override fun getWorkManagerConfiguration(): Configuration {
|
||||
return Configuration.Builder()
|
||||
.setMinimumLoggingLevel(android.util.Log.INFO)
|
||||
.setWorkerFactory(workerFactory)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,6 @@ dependencies {
|
||||
implementation "androidx.compose.ui:ui:1.3.3"
|
||||
implementation "androidx.compose.material:material:1.3.1"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:1.3.3"
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
|
||||
implementation 'androidx.activity:activity-compose:1.5.1'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.3.3"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:1.3.2"
|
||||
|
||||
Reference in New Issue
Block a user