mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2024-12-16 02:09:03 +01:00
tweaking some dialog UI
This commit is contained in:
parent
adac520044
commit
dfd13c5286
@ -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'
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/alarm_day_textview"
|
||||
android:layout_width="@dimen/alarm_day_size"
|
||||
android:layout_height="@dimen/alarm_day_size"
|
||||
android:layout_marginRight="@dimen/small_margin"
|
||||
android:layout_marginEnd="@dimen/small_margin"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
tools:text="M"/>
|
||||
tools:text="M" />
|
||||
|
@ -8,14 +8,16 @@
|
||||
<RelativeLayout
|
||||
android:id="@+id/edit_alarm_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/edit_alarm_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/activity_margin"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/tiny_margin"
|
||||
android:textSize="@dimen/alarm_text_size"
|
||||
tools:text="07:00" />
|
||||
|
||||
@ -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">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
<ImageView
|
||||
android:id="@+id/edit_alarm_vibrate_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/edit_alarm_vibrate"
|
||||
android:layout_alignBottom="@+id/edit_alarm_vibrate"
|
||||
android:src="@drawable/ic_vibrate_vector" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/edit_alarm_vibrate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@+id/edit_alarm_vibrate_icon"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:drawableLeft="@drawable/ic_vibrate_vector"
|
||||
android:drawablePadding="@dimen/normal_margin"
|
||||
android:layoutDirection="rtl"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:text="@string/vibrate" />
|
||||
|
||||
</RelativeLayout>
|
||||
@ -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" />
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/edit_time_zone_holder"
|
||||
android:layout_width="match_parent"
|
||||
@ -12,30 +11,32 @@
|
||||
android:id="@+id/edit_time_zone_title_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title"/>
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:text="@string/title" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/edit_time_zone_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/small_margin"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/edit_time_zone_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/time_zone"/>
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:text="@string/time_zone" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/edit_time_zone_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:paddingTop="@dimen/small_margin"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="GMT-11:00 Midway"/>
|
||||
tools:text="GMT-11:00 Midway" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -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">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/edit_timer_initial_time"
|
||||
@ -33,16 +32,24 @@
|
||||
android:padding="@dimen/activity_margin"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_timer_initial_time">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
<ImageView
|
||||
android:id="@+id/edit_timer_vibrate_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/edit_timer_vibrate"
|
||||
android:layout_alignBottom="@+id/edit_timer_vibrate"
|
||||
android:src="@drawable/ic_vibrate_vector" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/edit_timer_vibrate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@+id/edit_timer_vibrate_icon"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:drawableStart="@drawable/ic_vibrate_vector"
|
||||
android:drawablePadding="@dimen/normal_margin"
|
||||
android:text="@string/vibrate"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
android:layoutDirection="rtl"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:text="@string/vibrate" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/my_time_picker_holder"
|
||||
android:layout_width="match_parent"
|
||||
@ -17,7 +16,7 @@
|
||||
app:np_max="23"
|
||||
app:np_min="0"
|
||||
app:np_selectedTextSize="@dimen/big_text_size"
|
||||
app:np_textSize="@dimen/big_text_size"/>
|
||||
app:np_textSize="@dimen/big_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/my_time_picker_colon_one"
|
||||
@ -26,7 +25,7 @@
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:text=":"
|
||||
app:np_textSize="@dimen/big_text_size"/>
|
||||
app:np_textSize="@dimen/big_text_size" />
|
||||
|
||||
<com.shawnlin.numberpicker.NumberPicker
|
||||
android:id="@+id/my_time_picker_minutes"
|
||||
@ -37,7 +36,7 @@
|
||||
app:np_max="59"
|
||||
app:np_min="0"
|
||||
app:np_selectedTextSize="@dimen/big_text_size"
|
||||
app:np_textSize="@dimen/big_text_size"/>
|
||||
app:np_textSize="@dimen/big_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/my_time_picker_colon_two"
|
||||
@ -45,7 +44,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:text=":"
|
||||
app:np_textSize="@dimen/big_text_size"/>
|
||||
app:np_textSize="@dimen/big_text_size" />
|
||||
|
||||
<com.shawnlin.numberpicker.NumberPicker
|
||||
android:id="@+id/my_time_picker_seconds"
|
||||
@ -56,6 +55,6 @@
|
||||
app:np_max="59"
|
||||
app:np_min="0"
|
||||
app:np_selectedTextSize="@dimen/big_text_size"
|
||||
app:np_textSize="@dimen/big_text_size"/>
|
||||
app:np_textSize="@dimen/big_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/select_time_zones_holder"
|
||||
android:layout_width="match_parent"
|
||||
@ -12,6 +11,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
|
||||
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/alarm_frame"
|
||||
android:layout_width="match_parent"
|
||||
@ -14,7 +13,7 @@
|
||||
android:id="@+id/alarm_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin">
|
||||
|
||||
@ -26,33 +25,33 @@
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:textSize="@dimen/alarm_text_size"
|
||||
tools:text="07:00"/>
|
||||
tools:text="07:00" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/alarm_days"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/alarm_time"
|
||||
android:layout_toLeftOf="@+id/alarm_switch"
|
||||
android:layout_toStartOf="@+id/alarm_switch"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="@dimen/tiny_margin"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
tools:text="Mon, Tue, Wed, Thu, Fri"/>
|
||||
tools:text="Mon, Tue, Wed, Thu, Fri" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/alarm_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/alarm_days"
|
||||
android:layout_toLeftOf="@+id/alarm_switch"
|
||||
android:layout_toStartOf="@+id/alarm_switch"
|
||||
android:ellipsize="end"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="@dimen/tiny_margin"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:textSize="@dimen/bigger_text_size"
|
||||
tools:text="Good morning!"/>
|
||||
tools:text="Good morning!" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/alarm_switch"
|
||||
@ -60,9 +59,9 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/alarm_time"
|
||||
android:layout_alignBottom="@id/alarm_label"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/medium_margin"/>
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingEnd="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
@ -13,9 +13,9 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingStart="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin">
|
||||
android:paddingBottom="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/timer_time"
|
||||
|
Loading…
Reference in New Issue
Block a user