launch the NewMessageActivity on pressing FAB

This commit is contained in:
tibbi 2020-04-05 13:01:39 +02:00
parent ef455cd961
commit 560935b61e
4 changed files with 51 additions and 40 deletions

View File

@ -28,7 +28,7 @@
<activity <activity
android:name=".activities.SplashActivity" android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme"/> android:theme="@style/SplashTheme" />
<activity android:name=".activities.MainActivity" /> <activity android:name=".activities.MainActivity" />
@ -36,7 +36,10 @@
android:name=".activities.ThreadActivity" android:name=".activities.ThreadActivity"
android:parentActivityName=".activities.MainActivity" /> android:parentActivityName=".activities.MainActivity" />
<activity android:name=".activities.NewMessageActivity"> <activity
android:name=".activities.NewMessageActivity"
android:parentActivityName=".activities.MainActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SENDTO" /> <action android:name="android.intent.action.SENDTO" />
@ -116,8 +119,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -129,8 +132,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -142,8 +145,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -155,8 +158,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -168,8 +171,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -181,8 +184,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -194,8 +197,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -207,8 +210,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -220,8 +223,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -233,8 +236,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -246,8 +249,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -259,8 +262,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -272,8 +275,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -285,8 +288,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -297,8 +300,8 @@
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -310,8 +313,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -323,8 +326,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -336,8 +339,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
@ -349,8 +352,8 @@
android:targetActivity=".activities.SplashActivity"> android:targetActivity=".activities.SplashActivity">
<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-alias> </activity-alias>
</application> </application>

View File

@ -61,6 +61,12 @@ class MainActivity : SimpleActivity() {
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST) startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
} }
} }
messages_fab.setOnClickListener {
Intent(this, NewMessageActivity::class.java).apply {
startActivity(this)
}
}
} }
override fun onResume() { override fun onResume() {

View File

@ -19,5 +19,6 @@ class NewMessageActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_new_message) setContentView(R.layout.activity_new_message)
title = getString(R.string.create_new_message)
} }
} }

View File

@ -3,6 +3,7 @@
<string name="app_launcher_name">SMS Messenger</string> <string name="app_launcher_name">SMS Messenger</string>
<string name="type_a_message">Type a message…</string> <string name="type_a_message">Type a message…</string>
<string name="message_not_sent">Message has not been sent.</string> <string name="message_not_sent">Message has not been sent.</string>
<string name="create_new_message">Create new message</string>
<!-- Notifications --> <!-- Notifications -->
<string name="channel_received_sms">Received SMS</string> <string name="channel_received_sms">Received SMS</string>