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" /> tools:node="remove" />
<application <application
android:name=".App"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" 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"> android:theme="@style/AppTheme">
<activity android:name=".activities.MainActivity">
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
</application>
<activity android:name=".activities.MainActivity" />
</application>
</manifest> </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 package com.simplemobiletools.smsmessenger.activities
import android.os.Bundle 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 import com.simplemobiletools.smsmessenger.R
class MainActivity : AppCompatActivity() { class MainActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) 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_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout> </RelativeLayout>

View File

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

View File

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

View File

@ -1,11 +1,5 @@
<resources> <resources>
<!-- Base application theme. --> <style name="AppTheme" parent="AppTheme.Base" />
<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>
</resources> </resources>