adding some more generic boilerplate code

This commit is contained in:
tibbi 2020-04-03 10:19:28 +02:00
parent feb4cd6e9a
commit 25876ae5c0
9 changed files with 55 additions and 20 deletions

View File

@ -8,17 +8,23 @@
tools:node="remove" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="@string/app_launcher_name"
android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity android:name=".activities.MainActivity">
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<activity android:name=".activities.MainActivity" />
</application>
</manifest>

View File

@ -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()
}
}

View File

@ -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
}
}
}

View File

@ -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)
}

View File

@ -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()
}
}

View File

@ -3,9 +3,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>

View File

@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>

View File

@ -1,3 +1,4 @@
<resources>
<string name="app_name">Simple SMS Messenger</string>
<string name="app_launcher_name">SMS Messenger</string>
</resources>

View File

@ -1,11 +1,5 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme" parent="AppTheme.Base" />
</resources>