From dfd13c528698d54072d2e73c67c5ff6cd364673d Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 19 Nov 2021 16:42:37 +0100 Subject: [PATCH] tweaking some dialog UI --- app/build.gradle | 2 +- .../clock/activities/MainActivity.kt | 7 +---- .../clock/dialogs/EditAlarmDialog.kt | 23 +++++++++----- .../clock/dialogs/EditTimerDialog.kt | 8 ++--- app/src/main/res/layout/alarm_day.xml | 7 ++--- app/src/main/res/layout/dialog_edit_alarm.xml | 31 +++++++++++++------ .../main/res/layout/dialog_edit_time_zone.xml | 17 +++++----- app/src/main/res/layout/dialog_edit_timer.xml | 21 ++++++++----- .../main/res/layout/dialog_my_time_picker.xml | 13 ++++---- .../res/layout/dialog_select_time_zones.xml | 5 ++- app/src/main/res/layout/item_alarm.xml | 25 +++++++-------- app/src/main/res/layout/item_timer.xml | 4 +-- 12 files changed, 91 insertions(+), 72 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5e2415e4..e7180130 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -67,7 +67,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:6cc19172f0' + implementation 'com.github.SimpleMobileTools:Simple-Commons:307941253d' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.2' implementation 'com.shawnlin:number-picker:2.4.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt index 1d80297f..0b9e6fd2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt @@ -19,8 +19,7 @@ import com.simplemobiletools.commons.helpers.LICENSE_RTL import com.simplemobiletools.commons.helpers.LICENSE_STETHO import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.models.FAQItem -import kotlinx.android.synthetic.main.activity_main.main_tabs_holder -import kotlinx.android.synthetic.main.activity_main.view_pager +import kotlinx.android.synthetic.main.activity_main.* class MainActivity : SimpleActivity() { private var storedTextColor = 0 @@ -72,10 +71,6 @@ class MainActivity : SimpleActivity() { if (config.preventPhoneFromSleeping) { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) } - } - - override fun onStop() { - super.onStop() config.lastUsedViewPagerPage = view_pager.currentItem } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt index b569f577..e457b7bb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -31,7 +31,14 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba view.apply { edit_alarm_time.setOnClickListener { - TimePickerDialog(context, context.getDialogTheme(), timeSetListener, alarm.timeInMinutes / 60, alarm.timeInMinutes % 60, context.config.use24HourFormat).show() + TimePickerDialog( + context, + context.getDialogTheme(), + timeSetListener, + alarm.timeInMinutes / 60, + alarm.timeInMinutes % 60, + context.config.use24HourFormat + ).show() } edit_alarm_sound.colorCompoundDrawable(textColor) @@ -43,15 +50,15 @@ class EditAlarmDialog(val activity: SimpleActivity, val alarm: Alarm, val callba updateSelectedAlarmSound(it) } }, onAlarmSoundDeleted = { - if (alarm.soundUri == it.uri) { - val defaultAlarm = context.getDefaultAlarmSound(RingtoneManager.TYPE_ALARM) - updateSelectedAlarmSound(defaultAlarm) - } - activity.checkAlarmsWithDeletedSoundUri(it.uri) - }) + if (alarm.soundUri == it.uri) { + val defaultAlarm = context.getDefaultAlarmSound(RingtoneManager.TYPE_ALARM) + updateSelectedAlarmSound(defaultAlarm) + } + activity.checkAlarmsWithDeletedSoundUri(it.uri) + }) } - edit_alarm_vibrate.colorCompoundDrawable(textColor) + edit_alarm_vibrate_icon.setColorFilter(textColor) edit_alarm_vibrate.isChecked = alarm.vibrate edit_alarm_vibrate_holder.setOnClickListener { edit_alarm_vibrate.toggle() diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt index 87d4d092..ffbd1e85 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimerDialog.kt @@ -30,7 +30,7 @@ class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callba changeDuration(timer) } - edit_timer_vibrate.colorCompoundDrawable(textColor) + edit_timer_vibrate_icon.setColorFilter(textColor) edit_timer_vibrate.isChecked = timer.vibrate edit_timer_vibrate.setTextColor(textColor) edit_timer_vibrate_holder.setOnClickListener { @@ -72,7 +72,7 @@ class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callba activity.setupDialogStuff(view, this) { getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { timer.label = view.edit_timer_label.value - activity.timerHelper.insertOrUpdateTimer(timer){ + activity.timerHelper.insertOrUpdateTimer(timer) { activity.config.timerLastConfig = timer callback() dismiss() @@ -101,8 +101,8 @@ class EditTimerDialog(val activity: SimpleActivity, val timer: Timer, val callba private fun changeDuration(timer: Timer) { MyTimePickerDialogDialog(activity, timer.seconds) { seconds -> val timerSeconds = if (seconds <= 0) 10 else seconds - timer.seconds = timerSeconds - view.edit_timer_initial_time.text = timerSeconds.getFormattedDuration() + timer.seconds = timerSeconds + view.edit_timer_initial_time.text = timerSeconds.getFormattedDuration() } } diff --git a/app/src/main/res/layout/alarm_day.xml b/app/src/main/res/layout/alarm_day.xml index 704b8ce8..0ee5a8c2 100644 --- a/app/src/main/res/layout/alarm_day.xml +++ b/app/src/main/res/layout/alarm_day.xml @@ -1,12 +1,11 @@ - + tools:text="M" /> diff --git a/app/src/main/res/layout/dialog_edit_alarm.xml b/app/src/main/res/layout/dialog_edit_alarm.xml index e475e423..910382b4 100644 --- a/app/src/main/res/layout/dialog_edit_alarm.xml +++ b/app/src/main/res/layout/dialog_edit_alarm.xml @@ -8,14 +8,16 @@ + android:layout_height="wrap_content"> @@ -36,6 +38,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/alarm_day_size" android:layout_below="@+id/edit_alarm_time" + android:layout_marginStart="@dimen/activity_margin" android:layout_marginTop="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin" android:orientation="horizontal" /> @@ -46,18 +49,28 @@ android:layout_height="wrap_content" android:layout_below="@+id/edit_alarm_days_holder" android:background="?attr/selectableItemBackground" - android:paddingStart="@dimen/tiny_margin" + android:paddingStart="@dimen/activity_margin" android:paddingTop="@dimen/normal_margin" + android:paddingEnd="@dimen/activity_margin" android:paddingBottom="@dimen/normal_margin"> - + + @@ -68,9 +81,9 @@ android:layout_height="wrap_content" android:layout_below="@+id/edit_alarm_vibrate_holder" android:background="?attr/selectableItemBackground" - android:drawableLeft="@drawable/ic_bell_vector" + android:drawableStart="@drawable/ic_bell_vector" android:drawablePadding="@dimen/normal_margin" - android:paddingStart="@dimen/tiny_margin" + android:paddingStart="@dimen/activity_margin" android:paddingTop="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin" android:textSize="@dimen/normal_text_size" @@ -83,7 +96,7 @@ android:layout_below="@+id/edit_alarm_sound" android:layout_alignTop="@+id/edit_alarm_label" android:layout_alignBottom="@+id/edit_alarm_label" - android:layout_marginStart="@dimen/tiny_margin" + android:layout_marginStart="@dimen/activity_margin" android:layout_marginEnd="@dimen/tiny_margin" android:scaleType="fitCenter" android:src="@drawable/ic_label_vector" /> diff --git a/app/src/main/res/layout/dialog_edit_time_zone.xml b/app/src/main/res/layout/dialog_edit_time_zone.xml index 0e6b870a..0a93d67e 100644 --- a/app/src/main/res/layout/dialog_edit_time_zone.xml +++ b/app/src/main/res/layout/dialog_edit_time_zone.xml @@ -1,6 +1,5 @@ - + android:layout_marginStart="@dimen/tiny_margin" + android:text="@string/title" /> + android:textSize="@dimen/normal_text_size" /> + android:layout_marginStart="@dimen/tiny_margin" + android:text="@string/time_zone" /> + tools:text="GMT-11:00 Midway" /> diff --git a/app/src/main/res/layout/dialog_edit_timer.xml b/app/src/main/res/layout/dialog_edit_timer.xml index 7eee2199..afca4e76 100644 --- a/app/src/main/res/layout/dialog_edit_timer.xml +++ b/app/src/main/res/layout/dialog_edit_timer.xml @@ -10,8 +10,7 @@ android:id="@+id/edit_timer_holder" android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="@dimen/activity_margin"> - + android:layout_marginTop="@dimen/activity_margin"> - + + + android:layoutDirection="rtl" + android:padding="@dimen/medium_margin" + android:text="@string/vibrate" /> diff --git a/app/src/main/res/layout/dialog_my_time_picker.xml b/app/src/main/res/layout/dialog_my_time_picker.xml index e6ab883d..e69f7b22 100644 --- a/app/src/main/res/layout/dialog_my_time_picker.xml +++ b/app/src/main/res/layout/dialog_my_time_picker.xml @@ -1,6 +1,5 @@ - + app:np_textSize="@dimen/big_text_size" /> + app:np_textSize="@dimen/big_text_size" /> + app:np_textSize="@dimen/big_text_size" /> + app:np_textSize="@dimen/big_text_size" /> + app:np_textSize="@dimen/big_text_size" /> diff --git a/app/src/main/res/layout/dialog_select_time_zones.xml b/app/src/main/res/layout/dialog_select_time_zones.xml index fbe873de..ceeb97ad 100644 --- a/app/src/main/res/layout/dialog_select_time_zones.xml +++ b/app/src/main/res/layout/dialog_select_time_zones.xml @@ -1,6 +1,5 @@ - + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" /> diff --git a/app/src/main/res/layout/item_alarm.xml b/app/src/main/res/layout/item_alarm.xml index f10bdac7..7ee75061 100644 --- a/app/src/main/res/layout/item_alarm.xml +++ b/app/src/main/res/layout/item_alarm.xml @@ -1,6 +1,5 @@ - @@ -26,33 +25,33 @@ android:includeFontPadding="false" android:maxLines="1" android:textSize="@dimen/alarm_text_size" - tools:text="07:00"/> + tools:text="07:00" /> + tools:text="Mon, Tue, Wed, Thu, Fri" /> + tools:text="Good morning!" /> + android:layout_alignParentEnd="true" + android:paddingStart="@dimen/activity_margin" + android:paddingEnd="@dimen/medium_margin" /> diff --git a/app/src/main/res/layout/item_timer.xml b/app/src/main/res/layout/item_timer.xml index 226af59e..e251fcb6 100644 --- a/app/src/main/res/layout/item_timer.xml +++ b/app/src/main/res/layout/item_timer.xml @@ -13,9 +13,9 @@ + android:paddingBottom="@dimen/activity_margin">