mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
adding some speed dial parsing related things
This commit is contained in:
@ -1,11 +1,20 @@
|
|||||||
package com.simplemobiletools.contacts.pro.activities
|
package com.simplemobiletools.contacts.pro.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
import com.simplemobiletools.contacts.pro.R
|
import com.simplemobiletools.contacts.pro.R
|
||||||
|
import com.simplemobiletools.contacts.pro.extensions.config
|
||||||
|
import com.simplemobiletools.contacts.pro.models.SpeedDial
|
||||||
|
|
||||||
class ManageSpeedDialActivity : SimpleActivity() {
|
class ManageSpeedDialActivity : SimpleActivity() {
|
||||||
|
var speedDialValues = ArrayList<SpeedDial>()
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_manage_speed_dial)
|
setContentView(R.layout.activity_manage_speed_dial)
|
||||||
|
|
||||||
|
val speedDialType = object : TypeToken<List<SpeedDial>>() {}.type
|
||||||
|
speedDialValues = Gson().fromJson<ArrayList<SpeedDial>>(config.speedDial, speedDialType) ?: ArrayList(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,4 +56,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
var showDialpadLetters: Boolean
|
var showDialpadLetters: Boolean
|
||||||
get() = prefs.getBoolean(SHOW_DIALPAD_LETTERS, true)
|
get() = prefs.getBoolean(SHOW_DIALPAD_LETTERS, true)
|
||||||
set(showDialpadLetters) = prefs.edit().putBoolean(SHOW_DIALPAD_LETTERS, showDialpadLetters).apply()
|
set(showDialpadLetters) = prefs.edit().putBoolean(SHOW_DIALPAD_LETTERS, showDialpadLetters).apply()
|
||||||
|
|
||||||
|
var speedDial: String
|
||||||
|
get() = prefs.getString(SPEED_DIAL, "")!!
|
||||||
|
set(speedDial) = prefs.edit().putString(SPEED_DIAL, speedDial).apply()
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ const val SHOW_TABS = "show_tabs"
|
|||||||
const val SHOW_CALL_CONFIRMATION = "show_call_confirmation"
|
const val SHOW_CALL_CONFIRMATION = "show_call_confirmation"
|
||||||
const val SHOW_DIALPAD_BUTTON = "show_dialpad_button"
|
const val SHOW_DIALPAD_BUTTON = "show_dialpad_button"
|
||||||
const val SHOW_DIALPAD_LETTERS = "show_dialpad_letters"
|
const val SHOW_DIALPAD_LETTERS = "show_dialpad_letters"
|
||||||
|
const val SPEED_DIAL = "speed_dial"
|
||||||
|
|
||||||
const val CONTACT_ID = "contact_id"
|
const val CONTACT_ID = "contact_id"
|
||||||
const val SMT_PRIVATE = "smt_private" // used at the contact source of local contacts hidden from other apps
|
const val SMT_PRIVATE = "smt_private" // used at the contact source of local contacts hidden from other apps
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
package com.simplemobiletools.contacts.pro.models
|
||||||
|
|
||||||
|
data class SpeedDial(val id: Int, var number: String, var displayName: String)
|
@ -1,13 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/manage_speed_dial_scrollview"
|
android:id="@+id/manage_speed_dial_scrollview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:id="@+id/manage_speed_dial_wrapper"
|
android:id="@+id/manage_speed_dial_wrapper"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:ignore="HardcodedText">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/manage_speed_dial_label"
|
android:id="@+id/manage_speed_dial_label"
|
||||||
@ -17,5 +20,86 @@
|
|||||||
android:text="@string/speed_dial_label"
|
android:text="@string/speed_dial_label"
|
||||||
android:textSize="@dimen/bigger_text_size" />
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
</RelativeLayout>
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="1."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="2."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="3."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_4"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="4."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_5"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="5."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_6"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="6."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_7"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="7."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_8"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="8."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/speed_dial_9"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
|
android:text="9."
|
||||||
|
android:textSize="@dimen/bigger_text_size" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
Reference in New Issue
Block a user