mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-21 06:00:38 +01:00
show a placeholder text on the main screen, if there are no conversations
This commit is contained in:
parent
b717f415b2
commit
2d1df0322f
@ -8,9 +8,7 @@ import android.os.Bundle
|
|||||||
import android.provider.Telephony
|
import android.provider.Telephony
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import com.simplemobiletools.commons.extensions.appLaunched
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.checkAppSideloading
|
|
||||||
import com.simplemobiletools.commons.extensions.updateTextColors
|
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.FAQItem
|
import com.simplemobiletools.commons.models.FAQItem
|
||||||
import com.simplemobiletools.smsmessenger.BuildConfig
|
import com.simplemobiletools.smsmessenger.BuildConfig
|
||||||
@ -60,12 +58,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
conversations_fab.setOnClickListener {
|
|
||||||
Intent(this, NewMessageActivity::class.java).apply {
|
|
||||||
startActivity(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -75,6 +67,8 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateTextColors(main_coordinator)
|
updateTextColors(main_coordinator)
|
||||||
|
no_conversations_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
||||||
|
no_conversations_placeholder_2.underlineText()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
@ -142,6 +136,10 @@ class MainActivity : SimpleActivity() {
|
|||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val conversations = getConversations()
|
val conversations = getConversations()
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
|
conversations_list.beVisibleIf(conversations.isNotEmpty())
|
||||||
|
no_conversations_placeholder.beVisibleIf(conversations.isEmpty())
|
||||||
|
no_conversations_placeholder_2.beVisibleIf(conversations.isEmpty())
|
||||||
|
|
||||||
ConversationsAdapter(this, conversations, conversations_list, conversations_fastscroller) {
|
ConversationsAdapter(this, conversations, conversations_list, conversations_fastscroller) {
|
||||||
Intent(this, ThreadActivity::class.java).apply {
|
Intent(this, ThreadActivity::class.java).apply {
|
||||||
putExtra(THREAD_ID, (it as Conversation).id)
|
putExtra(THREAD_ID, (it as Conversation).id)
|
||||||
@ -153,6 +151,21 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
no_conversations_placeholder_2.setOnClickListener {
|
||||||
|
launchNewConversation()
|
||||||
|
}
|
||||||
|
|
||||||
|
conversations_fab.setOnClickListener {
|
||||||
|
launchNewConversation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun launchNewConversation() {
|
||||||
|
Intent(this, NewMessageActivity::class.java).apply {
|
||||||
|
startActivity(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun launchSettings() {
|
private fun launchSettings() {
|
||||||
|
@ -105,6 +105,9 @@ class ConversationsAdapter(
|
|||||||
finishActMode()
|
finishActMode()
|
||||||
} else {
|
} else {
|
||||||
removeSelectedItems(positions)
|
removeSelectedItems(positions)
|
||||||
|
if (conversations.isEmpty()) {
|
||||||
|
refreshMessages()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,34 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/no_conversations_placeholder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="@dimen/bigger_margin"
|
||||||
|
android:alpha="0.8"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
|
android:paddingRight="@dimen/activity_margin"
|
||||||
|
android:text="@string/no_conversations_found"
|
||||||
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
android:textStyle="italic"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/no_conversations_placeholder_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/no_conversations_placeholder"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="@string/start_conversation"
|
||||||
|
android:textSize="@dimen/bigger_text_size"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||||
android:id="@+id/conversations_list"
|
android:id="@+id/conversations_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user