From 25876ae5c0b2ec282bed2003f23f13b870ba2883 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 3 Apr 2020 10:19:28 +0200 Subject: [PATCH] adding some more generic boilerplate code --- app/src/main/AndroidManifest.xml | 12 +++++++++--- .../kotlin/com/simplemobiletools/smsmessenger/App.kt | 11 +++++++++++ .../smsmessenger/activities/MainActivity.kt | 11 +++++++++-- .../smsmessenger/activities/SimpleActivity.kt | 12 ++++++++++++ .../smsmessenger/activities/SplashActivity.kt | 11 +++++++++++ app/src/main/res/layout/activity_main.xml | 5 ----- app/src/main/res/values/colors.xml | 4 +--- app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/styles.xml | 8 +------- 9 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/App.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SimpleActivity.kt create mode 100644 app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SplashActivity.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c2717907..565ca08e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,17 +8,23 @@ tools:node="remove" /> - + + - + + diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/App.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/App.kt new file mode 100644 index 00000000..5f76354e --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/App.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.smsmessenger + +import android.app.Application +import com.simplemobiletools.commons.extensions.checkUseEnglish + +class App : Application() { + override fun onCreate() { + super.onCreate() + checkUseEnglish() + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt index a463c6a1..ce64f5ca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/MainActivity.kt @@ -1,13 +1,20 @@ package com.simplemobiletools.smsmessenger.activities import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity +import com.simplemobiletools.commons.extensions.appLaunched +import com.simplemobiletools.commons.extensions.checkAppSideloading +import com.simplemobiletools.smsmessenger.BuildConfig import com.simplemobiletools.smsmessenger.R -class MainActivity : AppCompatActivity() { +class MainActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + appLaunched(BuildConfig.APPLICATION_ID) + + if (checkAppSideloading()) { + return + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SimpleActivity.kt new file mode 100644 index 00000000..fa881a7e --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SimpleActivity.kt @@ -0,0 +1,12 @@ +package com.simplemobiletools.smsmessenger.activities + +import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.smsmessenger.R + +open class SimpleActivity : BaseSimpleActivity() { + override fun getAppIconIDs() = arrayListOf( + R.mipmap.ic_launcher + ) + + override fun getAppLauncherName() = getString(R.string.app_launcher_name) +} diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SplashActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SplashActivity.kt new file mode 100644 index 00000000..4737e242 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/SplashActivity.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.smsmessenger.activities + +import android.content.Intent +import com.simplemobiletools.commons.activities.BaseSplashActivity + +class SplashActivity : BaseSplashActivity() { + override fun initActivity() { + startActivity(Intent(this, MainActivity::class.java)) + finish() + } +} diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 8b64e069..e119ba87 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,9 +3,4 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 030098fe..d781ec5f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,4 @@ - #6200EE - #3700B3 - #03DAC5 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 95ec7432..57f81e75 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ Simple SMS Messenger + SMS Messenger diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5885930d..9c3b80f3 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,11 +1,5 @@ - - +