open a new ThreadActivity on clicking on a message

This commit is contained in:
tibbi 2020-04-03 17:26:01 +02:00
parent 10bda77c50
commit 067c1d3876
5 changed files with 31 additions and 1 deletions

View File

@ -31,6 +31,8 @@
<activity android:name=".activities.MainActivity" />
<activity android:name=".activities.ThreadActivity" />
<activity
android:name=".activities.SettingsActivity"
android:label="@string/settings"

View File

@ -17,6 +17,7 @@ import com.simplemobiletools.smsmessenger.BuildConfig
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.adapters.MessagesAdapter
import com.simplemobiletools.smsmessenger.extensions.config
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
import com.simplemobiletools.smsmessenger.models.Message
import kotlinx.android.synthetic.main.activity_main.*
@ -78,7 +79,10 @@ class MainActivity : SimpleActivity() {
storeStateVariables()
val messages = getMessages()
MessagesAdapter(this, messages, messages_list, messages_fastscroller) {
Intent(this, ThreadActivity::class.java).apply {
putExtra(THREAD_ID, (it as Message).thread)
startActivity(this)
}
}.apply {
messages_list.adapter = this
}

View File

@ -0,0 +1,14 @@
package com.simplemobiletools.smsmessenger.activities
import android.os.Bundle
import com.simplemobiletools.smsmessenger.R
import com.simplemobiletools.smsmessenger.helpers.THREAD_ID
class ThreadActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_thread)
val threadID = intent.getIntExtra(THREAD_ID, 0)
}
}

View File

@ -0,0 +1,3 @@
package com.simplemobiletools.smsmessenger.helpers
const val THREAD_ID = "thread_id"

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/thread_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>