mirror of
				https://github.com/SimpleMobileTools/Simple-Dialer.git
				synced 2025-06-05 21:49:23 +02:00 
			
		
		
		
	Added an option to hide numpad for phones with a physical numpad
This commit is contained in:
		| @@ -17,6 +17,7 @@ import android.view.KeyEvent | ||||
| import android.view.MotionEvent | ||||
| import android.view.View | ||||
| import android.view.ViewConfiguration | ||||
| import androidx.core.view.isVisible | ||||
| import com.reddit.indicatorfastscroll.FastScrollItemIndicator | ||||
| import com.simplemobiletools.commons.extensions.* | ||||
| import com.simplemobiletools.commons.helpers.* | ||||
| @@ -53,6 +54,21 @@ class DialpadActivity : SimpleActivity() { | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         if (config.hideDialpadNumbers) { | ||||
|             dialpad_1_holder.isVisible = false | ||||
|             dialpad_2_holder.isVisible = false | ||||
|             dialpad_3_holder.isVisible = false | ||||
|             dialpad_4_holder.isVisible = false | ||||
|             dialpad_5_holder.isVisible = false | ||||
|             dialpad_6_holder.isVisible = false | ||||
|             dialpad_7_holder.isVisible = false | ||||
|             dialpad_8_holder.isVisible = false | ||||
|             dialpad_9_holder.isVisible = false | ||||
|             dialpad_plus_holder.isVisible = true | ||||
|             dialpad_0_holder.visibility = View.INVISIBLE | ||||
|         } | ||||
|  | ||||
|  | ||||
|         setupOptionsMenu() | ||||
|         speedDialValues = config.getSpeedDialValues() | ||||
|         privateCursor = getMyContactsCursor(favoritesOnly = false, withPhoneNumbersOnly = true) | ||||
| @@ -89,6 +105,7 @@ class DialpadActivity : SimpleActivity() { | ||||
|         setupCharClick(dialpad_8_holder, '8') | ||||
|         setupCharClick(dialpad_9_holder, '9') | ||||
|         setupCharClick(dialpad_0_holder, '0') | ||||
|         setupCharClick(dialpad_plus_holder, '+') | ||||
|         setupCharClick(dialpad_asterisk_holder, '*', longClickable = false) | ||||
|         setupCharClick(dialpad_hashtag_holder, '#', longClickable = false) | ||||
|  | ||||
|   | ||||
| @@ -43,6 +43,7 @@ class SettingsActivity : SimpleActivity() { | ||||
|         setupGroupSubsequentCalls() | ||||
|         setupStartNameWithSurname() | ||||
|         setupDialpadVibrations() | ||||
|         setupDialpadNumbers() | ||||
|         setupDialpadBeeps() | ||||
|         setupShowCallConfirmation() | ||||
|         setupDisableProximitySensor() | ||||
| @@ -234,6 +235,14 @@ class SettingsActivity : SimpleActivity() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun setupDialpadNumbers() { | ||||
|         settings_hide_dialpad_numbers.isChecked = config.hideDialpadNumbers | ||||
|         settings_hide_dialpad_numbers_holder.setOnClickListener { | ||||
|             settings_hide_dialpad_numbers.toggle() | ||||
|             config.hideDialpadNumbers = settings_hide_dialpad_numbers.isChecked | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun setupDialpadBeeps() { | ||||
|         settings_dialpad_beeps.isChecked = config.dialpadBeeps | ||||
|         settings_dialpad_beeps_holder.setOnClickListener { | ||||
|   | ||||
| @@ -76,6 +76,10 @@ class Config(context: Context) : BaseConfig(context) { | ||||
|         get() = prefs.getBoolean(DIALPAD_VIBRATION, true) | ||||
|         set(dialpadVibration) = prefs.edit().putBoolean(DIALPAD_VIBRATION, dialpadVibration).apply() | ||||
|  | ||||
|     var hideDialpadNumbers: Boolean | ||||
|         get() = prefs.getBoolean(HIDE_DIALPAD_NUMBERS, false) | ||||
|         set(hideDialpadNumbers) = prefs.edit().putBoolean(HIDE_DIALPAD_NUMBERS, hideDialpadNumbers).apply() | ||||
|  | ||||
|     var dialpadBeeps: Boolean | ||||
|         get() = prefs.getBoolean(DIALPAD_BEEPS, true) | ||||
|         set(dialpadBeeps) = prefs.edit().putBoolean(DIALPAD_BEEPS, dialpadBeeps).apply() | ||||
|   | ||||
| @@ -17,6 +17,7 @@ const val FAVORITES_CUSTOM_ORDER_SELECTED = "favorites_custom_order_selected" | ||||
| const val WAS_OVERLAY_SNACKBAR_CONFIRMED = "was_overlay_snackbar_confirmed" | ||||
| const val DIALPAD_VIBRATION = "dialpad_vibration" | ||||
| const val DIALPAD_BEEPS = "dialpad_beeps" | ||||
| const val HIDE_DIALPAD_NUMBERS = "hide_dialpad_numbers" | ||||
| const val ALWAYS_SHOW_FULLSCREEN = "always_show_fullscreen" | ||||
| const val ALL_TABS_MASK = TAB_CONTACTS or TAB_FAVORITES or TAB_CALL_HISTORY | ||||
|  | ||||
|   | ||||
| @@ -227,6 +227,22 @@ | ||||
|  | ||||
|                 </RelativeLayout> | ||||
|  | ||||
|                 <RelativeLayout | ||||
|                     android:id="@+id/settings_hide_dialpad_numbers_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:background="@drawable/ripple_background"> | ||||
|  | ||||
|                     <com.simplemobiletools.commons.views.MyAppCompatCheckbox | ||||
|                         android:id="@+id/settings_hide_dialpad_numbers" | ||||
|                         style="@style/SettingsCheckboxStyle" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:text="Hide dialpad numbers" /> | ||||
|  | ||||
|                 </RelativeLayout> | ||||
|  | ||||
|                 <RelativeLayout | ||||
|                     android:id="@+id/settings_dialpad_vibration_holder" | ||||
|                     style="@style/SettingsHolderCheckboxStyle" | ||||
|   | ||||
| @@ -18,6 +18,7 @@ | ||||
|         android:layout_marginStart="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/one" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_2_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_2_holder" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
| @@ -40,6 +41,7 @@ | ||||
|         android:layout_marginBottom="@dimen/medium_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/two" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/dialpad_5_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_3_holder" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_1_holder"> | ||||
| @@ -61,7 +63,8 @@ | ||||
|             android:layout_centerHorizontal="true" | ||||
|             android:layout_marginBottom="@dimen/medium_margin" | ||||
|             android:gravity="center_horizontal" | ||||
|             android:text="ABC" /> | ||||
|             android:text="ABC" | ||||
|             android:visibility="gone" /> | ||||
|     </RelativeLayout> | ||||
|  | ||||
|     <RelativeLayout | ||||
| @@ -71,6 +74,7 @@ | ||||
|         android:layout_marginEnd="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/three" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_2_holder" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_2_holder" | ||||
| @@ -103,6 +107,7 @@ | ||||
|         android:layout_marginStart="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/four" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_5_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_5_holder" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
| @@ -135,6 +140,7 @@ | ||||
|         android:layout_marginBottom="@dimen/medium_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/five" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/dialpad_8_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_6_holder" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_4_holder"> | ||||
| @@ -166,6 +172,7 @@ | ||||
|         android:layout_marginEnd="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/six" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_5_holder" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_5_holder" | ||||
| @@ -198,6 +205,7 @@ | ||||
|         android:layout_marginStart="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/seven" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_8_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_8_holder" | ||||
|         app:layout_constraintStart_toStartOf="parent" | ||||
| @@ -230,6 +238,7 @@ | ||||
|         android:layout_marginBottom="@dimen/medium_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/eight" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toTopOf="@+id/dialpad_0_holder" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_9_holder" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_7_holder"> | ||||
| @@ -261,6 +270,7 @@ | ||||
|         android:layout_marginEnd="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/nine" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="@+id/dialpad_8_holder" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_8_holder" | ||||
| @@ -315,6 +325,7 @@ | ||||
|         android:layout_marginBottom="@dimen/activity_margin" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/zero" | ||||
|         android:visibility="visible" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_hashtag_holder" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_asterisk_holder"> | ||||
| @@ -343,6 +354,31 @@ | ||||
|  | ||||
|     </RelativeLayout> | ||||
|  | ||||
|     <RelativeLayout | ||||
|         android:id="@+id/dialpad_plus_holder" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginBottom="16dp" | ||||
|         android:background="?attr/selectableItemBackgroundBorderless" | ||||
|         android:contentDescription="@string/zero" | ||||
|         android:visibility="gone" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toStartOf="@+id/dialpad_hashtag_holder" | ||||
|         app:layout_constraintStart_toEndOf="@+id/dialpad_asterisk_holder"> | ||||
|  | ||||
|         <com.simplemobiletools.commons.views.MyTextView | ||||
|             android:id="@+id/dialpad_plus_alt" | ||||
|             android:layout_width="wrap_content" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_centerHorizontal="true" | ||||
|             android:gravity="center" | ||||
|             android:paddingStart="@dimen/small_margin" | ||||
|             android:paddingTop="@dimen/small_margin" | ||||
|             android:text="+" | ||||
|             android:textSize="@dimen/actionbar_text_size" /> | ||||
|  | ||||
|     </RelativeLayout> | ||||
|  | ||||
|     <RelativeLayout | ||||
|         android:id="@+id/dialpad_hashtag_holder" | ||||
|         android:layout_width="0dp" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user