mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
add an option for showing character counter at sending messages
This commit is contained in:
@@ -34,6 +34,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupManageBlockedNumbers()
|
setupManageBlockedNumbers()
|
||||||
setupChangeDateTimeFormat()
|
setupChangeDateTimeFormat()
|
||||||
setupFontSize()
|
setupFontSize()
|
||||||
|
setupShowCharacterCounter()
|
||||||
updateTextColors(settings_scrollview)
|
updateTextColors(settings_scrollview)
|
||||||
|
|
||||||
if (blockedNumbersAtPause != -1 && blockedNumbersAtPause != getBlockedNumbers().hashCode()) {
|
if (blockedNumbersAtPause != -1 && blockedNumbersAtPause != getBlockedNumbers().hashCode()) {
|
||||||
@@ -106,4 +107,12 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupShowCharacterCounter() {
|
||||||
|
settings_show_character_counter.isChecked = config.showCharacterCounter
|
||||||
|
settings_show_character_counter_holder.setOnClickListener {
|
||||||
|
settings_show_character_counter.toggle()
|
||||||
|
config.showCharacterCounter = settings_show_character_counter.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -263,6 +263,7 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
thread_send_message.applyColorFilter(textColor)
|
thread_send_message.applyColorFilter(textColor)
|
||||||
confirm_manage_contacts.applyColorFilter(textColor)
|
confirm_manage_contacts.applyColorFilter(textColor)
|
||||||
thread_add_attachment.applyColorFilter(textColor)
|
thread_add_attachment.applyColorFilter(textColor)
|
||||||
|
thread_character_counter.beVisibleIf(config.showCharacterCounter)
|
||||||
|
|
||||||
thread_send_message.setOnClickListener {
|
thread_send_message.setOnClickListener {
|
||||||
sendMessage()
|
sendMessage()
|
||||||
@@ -271,6 +272,7 @@ class ThreadActivity : SimpleActivity() {
|
|||||||
thread_send_message.isClickable = false
|
thread_send_message.isClickable = false
|
||||||
thread_type_message.onTextChangeListener {
|
thread_type_message.onTextChangeListener {
|
||||||
checkSendMessageAvailability()
|
checkSendMessageAvailability()
|
||||||
|
thread_character_counter.text = it.length.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_manage_contacts.setOnClickListener {
|
confirm_manage_contacts.setOnClickListener {
|
||||||
|
@@ -13,4 +13,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getUseSIMIdAtNumber(number: String) = prefs.getInt(USE_SIM_ID_PREFIX + number, 0)
|
fun getUseSIMIdAtNumber(number: String) = prefs.getInt(USE_SIM_ID_PREFIX + number, 0)
|
||||||
|
|
||||||
|
var showCharacterCounter: Boolean
|
||||||
|
get() = prefs.getBoolean(SHOW_CHARACTER_COUNTER, false)
|
||||||
|
set(showCharacterCounter) = prefs.edit().putBoolean(SHOW_CHARACTER_COUNTER, showCharacterCounter).apply()
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,7 @@ const val THREAD_ATTACHMENT_URI = "thread_attachment_uri"
|
|||||||
const val THREAD_ATTACHMENT_URIS = "thread_attachment_uris"
|
const val THREAD_ATTACHMENT_URIS = "thread_attachment_uris"
|
||||||
const val USE_SIM_ID_PREFIX = "use_sim_id_"
|
const val USE_SIM_ID_PREFIX = "use_sim_id_"
|
||||||
const val NOTIFICATION_CHANNEL = "simple_sms_messenger"
|
const val NOTIFICATION_CHANNEL = "simple_sms_messenger"
|
||||||
|
const val SHOW_CHARACTER_COUNTER = "show_character_counter"
|
||||||
|
|
||||||
private const val PATH = "com.simplemobiletools.smsmessenger.action."
|
private const val PATH = "com.simplemobiletools.smsmessenger.action."
|
||||||
const val MARK_AS_READ = PATH + "mark_as_read"
|
const val MARK_AS_READ = PATH + "mark_as_read"
|
||||||
|
@@ -149,5 +149,28 @@
|
|||||||
android:clickable="false" />
|
android:clickable="false" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_show_character_counter_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:paddingStart="@dimen/normal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:paddingEnd="@dimen/normal_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||||
|
android:id="@+id/settings_show_character_counter"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/show_character_counter"
|
||||||
|
app:switchPadding="@dimen/medium_margin" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@@ -66,6 +66,7 @@
|
|||||||
android:layout_marginStart="@dimen/medium_margin"
|
android:layout_marginStart="@dimen/medium_margin"
|
||||||
android:layout_marginEnd="@dimen/medium_margin"
|
android:layout_marginEnd="@dimen/medium_margin"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/confirm_selection"
|
||||||
android:paddingStart="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:paddingEnd="@dimen/medium_margin"
|
android:paddingEnd="@dimen/medium_margin"
|
||||||
android:src="@drawable/ic_check_vector"
|
android:src="@drawable/ic_check_vector"
|
||||||
@@ -125,6 +126,7 @@
|
|||||||
android:layout_marginEnd="@dimen/small_margin"
|
android:layout_marginEnd="@dimen/small_margin"
|
||||||
android:alpha="0.9"
|
android:alpha="0.9"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/attachment"
|
||||||
android:padding="@dimen/normal_margin"
|
android:padding="@dimen/normal_margin"
|
||||||
android:src="@drawable/ic_plus_vector" />
|
android:src="@drawable/ic_plus_vector" />
|
||||||
|
|
||||||
@@ -166,14 +168,17 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/thread_select_sim_icon"
|
android:id="@+id/thread_select_sim_icon"
|
||||||
android:layout_width="@dimen/normal_icon_size"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/normal_icon_size"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginTop="@dimen/small_margin"
|
android:layout_marginTop="@dimen/small_margin"
|
||||||
android:layout_toStartOf="@+id/thread_send_message"
|
android:layout_toStartOf="@+id/thread_character_counter"
|
||||||
android:alpha="0.9"
|
android:alpha="0.9"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="@dimen/normal_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:paddingTop="@dimen/normal_margin"
|
||||||
|
android:paddingEnd="@dimen/medium_margin"
|
||||||
|
android:paddingBottom="@dimen/normal_margin"
|
||||||
android:src="@drawable/ic_sim_vector"
|
android:src="@drawable/ic_sim_vector"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@@ -190,6 +195,21 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="1" />
|
tools:text="1" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/thread_character_counter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignTop="@+id/thread_send_message"
|
||||||
|
android:layout_alignBottom="@+id/thread_send_message"
|
||||||
|
android:layout_toStartOf="@+id/thread_send_message"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingStart="@dimen/small_margin"
|
||||||
|
android:paddingEnd="@dimen/small_margin"
|
||||||
|
android:text="0"
|
||||||
|
android:textSize="@dimen/normal_text_size"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/thread_send_message"
|
android:id="@+id/thread_send_message"
|
||||||
android:layout_width="@dimen/normal_icon_size"
|
android:layout_width="@dimen/normal_icon_size"
|
||||||
@@ -201,6 +221,7 @@
|
|||||||
android:alpha="0.4"
|
android:alpha="0.4"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
|
android:contentDescription="@string/ok"
|
||||||
android:padding="@dimen/medium_margin"
|
android:padding="@dimen/medium_margin"
|
||||||
android:src="@drawable/ic_send_vector" />
|
android:src="@drawable/ic_send_vector" />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user