adding FAQ and Settings activities

This commit is contained in:
tibbi 2022-01-05 09:48:41 +01:00
parent c5f83cc7ea
commit fe8e44b162
3 changed files with 54 additions and 6 deletions

View File

@ -17,6 +17,10 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme" />
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
android:exported="true" android:exported="true"
@ -28,10 +32,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme" />
<service <service
android:name=".helpers.SimpleKeyboardIME" android:name=".helpers.SimpleKeyboardIME"
android:label="@string/app_name" android:label="@string/app_name"
@ -46,12 +46,18 @@
<activity <activity
android:name=".activities.SettingsActivity" android:name=".activities.SettingsActivity"
android:label="@string/app_name"> android:label="@string/settings"
android:parentActivityName=".activities.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name="com.simplemobiletools.commons.activities.AboutActivity"
android:label="@string/about"
android:parentActivityName=".activities.MainActivity" />
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Red" android:name=".activities.SplashActivity.Red"
android:enabled="false" android:enabled="false"

View File

@ -1,7 +1,11 @@
package com.simplemobiletools.keyboard.activities package com.simplemobiletools.keyboard.activities
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import com.simplemobiletools.commons.extensions.appLaunched import com.simplemobiletools.commons.extensions.appLaunched
import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.keyboard.BuildConfig import com.simplemobiletools.keyboard.BuildConfig
import com.simplemobiletools.keyboard.R import com.simplemobiletools.keyboard.R
@ -12,4 +16,29 @@ class MainActivity : SimpleActivity() {
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
appLaunched(BuildConfig.APPLICATION_ID) appLaunched(BuildConfig.APPLICATION_ID)
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item)
}
return true
}
private fun launchAbout() {
val licenses = 0
val faqItems = arrayListOf(
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
)
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
}
} }

View File

@ -1 +1,14 @@
<menu></menu> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/settings"
android:icon="@drawable/ic_settings_cog_vector"
android:title="@string/settings"
app:showAsAction="ifRoom" />
<item
android:id="@+id/about"
android:icon="@drawable/ic_info_vector"
android:title="@string/about"
app:showAsAction="ifRoom" />
</menu>