From 921873f9a62fe714fcdeb88ceb78b41851ba06a3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 24 Jan 2019 21:47:36 +0100 Subject: [PATCH] updating Commons + many other things --- app/build.gradle | 8 +- .../clock/activities/MainActivity.kt | 6 +- .../clock/activities/ReminderActivity.kt | 3 +- .../clock/activities/SettingsActivity.kt | 9 -- .../activities/SnoozeReminderActivity.kt | 2 +- .../clock/activities/SplashActivity.kt | 2 + .../clock/adapters/AlarmsAdapter.kt | 23 ++-- .../clock/adapters/SelectTimeZonesAdapter.kt | 56 +++----- .../clock/adapters/StopwatchAdapter.kt | 12 +- .../clock/adapters/TimeZonesAdapter.kt | 23 ++-- .../clock/adapters/ViewPagerAdapter.kt | 6 +- .../clock/dialogs/AddTimeZonesDialog.kt | 7 +- .../clock/dialogs/EditAlarmDialog.kt | 2 +- .../clock/dialogs/EditTimeZoneDialog.kt | 2 +- .../clock/dialogs/MyTimePickerDialogDialog.kt | 2 +- .../clock/extensions/Context.kt | 54 +++----- .../clock/fragments/AlarmFragment.kt | 2 +- .../clock/fragments/ClockFragment.kt | 2 +- .../clock/fragments/StopwatchFragment.kt | 2 +- .../clock/fragments/TimerFragment.kt | 10 +- app/src/main/res/layout/activity_main.xml | 14 +- app/src/main/res/layout/activity_reminder.xml | 4 +- app/src/main/res/layout/activity_settings.xml | 124 +++++++----------- app/src/main/res/layout/dialog_edit_alarm.xml | 12 +- .../main/res/layout/dialog_edit_time_zone.xml | 2 +- app/src/main/res/layout/fragment_alarm.xml | 4 +- app/src/main/res/layout/fragment_clock.xml | 4 +- .../main/res/layout/fragment_stopwatch.xml | 12 +- app/src/main/res/layout/fragment_timer.xml | 6 +- .../main/res/layout/item_add_time_zone.xml | 2 +- app/src/main/res/layout/item_alarm.xml | 6 +- app/src/main/res/layout/item_lap.xml | 4 +- app/src/main/res/layout/item_time_zone.xml | 4 +- .../res/layout/widget_config_date_time.xml | 4 +- app/src/main/res/layout/widget_date_time.xml | 2 +- .../res/layout/widget_date_time_pre_oreo.xml | 8 +- .../layout/widget_date_time_with_shadow.xml | 8 +- .../widget_date_time_with_shadow_pre_oreo.xml | 8 +- build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 40 files changed, 203 insertions(+), 266 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0d30bcba..27d90802 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 28 - buildToolsVersion "28.0.2" + buildToolsVersion "28.0.3" defaultConfig { applicationId "com.simplemobiletools.clock" - minSdkVersion 16 + minSdkVersion 21 targetSdkVersion 28 versionCode 10 versionName "4.3.0" @@ -41,9 +41,9 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:4.7.10' + implementation 'com.simplemobiletools:commons:5.6.16' implementation 'com.facebook.stetho:stetho:1.5.0' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' 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 39fd4993..78b51573 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/MainActivity.kt @@ -1,9 +1,7 @@ package com.simplemobiletools.clock.activities -import android.annotation.TargetApi import android.content.Intent import android.graphics.drawable.ColorDrawable -import android.os.Build import android.os.Bundle import android.view.Menu import android.view.MenuItem @@ -18,6 +16,7 @@ import com.simplemobiletools.clock.extensions.rescheduleEnabledAlarms import com.simplemobiletools.clock.helpers.* import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.LICENSE_NUMBER_PICKER +import com.simplemobiletools.commons.helpers.LICENSE_RTL import com.simplemobiletools.commons.helpers.LICENSE_STETHO import com.simplemobiletools.commons.models.FAQItem import kotlinx.android.synthetic.main.activity_main.* @@ -118,7 +117,6 @@ class MainActivity : SimpleActivity() { } } - @TargetApi(Build.VERSION_CODES.KITKAT) private fun storeNewAlarmSound(resultData: Intent) { val newAlarmSound = storeNewYourAlarmSound(resultData) @@ -179,7 +177,7 @@ class MainActivity : SimpleActivity() { } private fun launchAbout() { - val licenses = LICENSE_STETHO or LICENSE_NUMBER_PICKER + val licenses = LICENSE_STETHO or LICENSE_NUMBER_PICKER or LICENSE_RTL val faqItems = arrayListOf( FAQItem(R.string.faq_1_title, R.string.faq_1_text), diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt index 08f69c30..976ad44e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/ReminderActivity.kt @@ -7,6 +7,7 @@ import android.net.Uri import android.os.Bundle import android.os.Handler import android.view.MotionEvent +import android.view.ViewGroup import android.view.animation.AnimationUtils import com.simplemobiletools.clock.R import com.simplemobiletools.clock.extensions.* @@ -34,7 +35,7 @@ class ReminderActivity : SimpleActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_reminder) showOverLockscreen() - updateTextColors(reminder_holder) + updateTextColors(reminder_holder as ViewGroup) val id = intent.getIntExtra(ALARM_ID, -1) isAlarmReminder = id != -1 diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt index 3387e902..6b411b00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SettingsActivity.kt @@ -25,7 +25,6 @@ class SettingsActivity : SimpleActivity() { setupPurchaseThankYou() setupCustomizeColors() setupUseEnglish() - setupAvoidWhatsNew() setupPreventPhoneFromSleeping() setupHourFormat() setupSundayFirst() @@ -72,14 +71,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupAvoidWhatsNew() { - settings_avoid_whats_new.isChecked = config.avoidWhatsNew - settings_avoid_whats_new_holder.setOnClickListener { - settings_avoid_whats_new.toggle() - config.avoidWhatsNew = settings_avoid_whats_new.isChecked - } - } - private fun setupPreventPhoneFromSleeping() { settings_prevent_phone_from_sleeping.isChecked = config.preventPhoneFromSleeping settings_prevent_phone_from_sleeping_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SnoozeReminderActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SnoozeReminderActivity.kt index 622017a1..a13be8be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SnoozeReminderActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SnoozeReminderActivity.kt @@ -1,7 +1,7 @@ package com.simplemobiletools.clock.activities import android.os.Bundle -import android.support.v7.app.AppCompatActivity +import androidx.appcompat.app.AppCompatActivity import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.dbHelper import com.simplemobiletools.clock.extensions.hideNotification diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SplashActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SplashActivity.kt index 860cd54e..3e558429 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/SplashActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/SplashActivity.kt @@ -7,6 +7,8 @@ import com.simplemobiletools.clock.helpers.TAB_CLOCK import com.simplemobiletools.commons.activities.BaseSplashActivity class SplashActivity : BaseSplashActivity() { + override fun getAppPackageName() = packageName + override fun initActivity() { when { intent?.action == "android.intent.action.SHOW_ALARMS" -> { diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/AlarmsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/AlarmsAdapter.kt index 020a5a13..c3bbca64 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/AlarmsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/AlarmsAdapter.kt @@ -7,7 +7,6 @@ import android.widget.RelativeLayout import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.config -import com.simplemobiletools.clock.extensions.dbHelper import com.simplemobiletools.clock.extensions.getFormattedTime import com.simplemobiletools.clock.interfaces.ToggleAlarmInterface import com.simplemobiletools.clock.models.Alarm @@ -30,14 +29,8 @@ class AlarmsAdapter(activity: SimpleActivity, var alarms: ArrayList, val override fun prepareActionMode(menu: Menu) {} - override fun prepareItemSelection(viewHolder: ViewHolder) {} - - override fun markViewHolderSelection(select: Boolean, viewHolder: ViewHolder?) { - viewHolder?.itemView?.alarm_frame?.isSelected = select - } - override fun actionItemPressed(id: Int) { - if (selectedPositions.isEmpty()) { + if (selectedKeys.isEmpty()) { return } @@ -50,14 +43,18 @@ class AlarmsAdapter(activity: SimpleActivity, var alarms: ArrayList, val override fun getIsItemSelectable(position: Int) = true + override fun getItemSelectionKey(position: Int) = alarms.getOrNull(position)?.id + + override fun getItemKeyPosition(key: Int) = alarms.indexOfFirst { it.id == key } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_alarm, parent) override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) { val alarm = alarms[position] - val view = holder.bindView(alarm, true, true) { itemView, layoutPosition -> + holder.bindView(alarm, true, true) { itemView, layoutPosition -> setupView(itemView, alarm) } - bindViewHolder(holder, position, view) + bindViewHolder(holder) } override fun getItemCount() = alarms.size @@ -70,18 +67,20 @@ class AlarmsAdapter(activity: SimpleActivity, var alarms: ArrayList, val private fun deleteItems() { val alarmsToRemove = ArrayList() - selectedPositions.sortedDescending().forEach { + /*selectedPositions.sortedDescending().forEach { val alarm = alarms[it] alarmsToRemove.add(alarm) } alarms.removeAll(alarmsToRemove) removeSelectedItems() - activity.dbHelper.deleteAlarms(alarmsToRemove) + activity.dbHelper.deleteAlarms(alarmsToRemove)*/ } private fun setupView(view: View, alarm: Alarm) { + val isSelected = selectedKeys.contains(alarm.id) view.apply { + alarm_frame.isSelected = isSelected alarm_time.text = activity.getFormattedTime(alarm.timeInMinutes * 60, false, true) alarm_time.setTextColor(textColor) diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/SelectTimeZonesAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/SelectTimeZonesAdapter.kt index f49fdd51..de1098d0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/SelectTimeZonesAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/SelectTimeZonesAdapter.kt @@ -1,89 +1,75 @@ package com.simplemobiletools.clock.adapters -import android.support.v7.widget.RecyclerView -import android.util.SparseArray import android.view.View import android.view.ViewGroup +import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.models.MyTimeZone import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor -import com.simplemobiletools.commons.interfaces.MyAdapterListener import kotlinx.android.synthetic.main.item_add_time_zone.view.* import java.util.* class SelectTimeZonesAdapter(val activity: SimpleActivity, val timeZones: ArrayList) : RecyclerView.Adapter() { - private val itemViews = SparseArray() - private val selectedPositions = HashSet() private val config = activity.config private val textColor = config.textColor private val backgroundColor = config.backgroundColor private val primaryColor = activity.getAdjustedPrimaryColor() + var selectedKeys = HashSet() init { val selectedTimeZones = config.selectedTimeZones timeZones.forEachIndexed { index, myTimeZone -> if (selectedTimeZones.contains(myTimeZone.id.toString())) { - selectedPositions.add(index) + selectedKeys.add(myTimeZone.id) } } } private fun toggleItemSelection(select: Boolean, pos: Int) { + val itemKey = timeZones.getOrNull(pos)?.id ?: return + if (select) { - if (itemViews[pos] != null) { - selectedPositions.add(pos) - } + selectedKeys.add(itemKey) } else { - selectedPositions.remove(pos) + selectedKeys.remove(itemKey) } - itemViews[pos]?.add_time_zone_checkbox?.isChecked = select - } - - private val adapterListener = object : MyAdapterListener { - override fun toggleItemSelectionAdapter(select: Boolean, position: Int) { - toggleItemSelection(select, position) - } - - override fun getSelectedPositions() = selectedPositions - - override fun itemLongClicked(position: Int) {} - } - - fun getSelectedItemsSet(): HashSet { - val selectedItemsSet = HashSet(selectedPositions.size) - selectedPositions.forEach { selectedItemsSet.add(timeZones[it].id.toString()) } - return selectedItemsSet + notifyItemChanged(pos) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val view = activity.layoutInflater.inflate(R.layout.item_add_time_zone, parent, false) - return ViewHolder(view, adapterListener) + return ViewHolder(view) } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - val timeZone = timeZones[position] - itemViews.put(position, holder.bindView(timeZone, textColor, primaryColor, backgroundColor)) - toggleItemSelection(selectedPositions.contains(position), position) + holder.bindView(timeZones[position], textColor, primaryColor, backgroundColor) } override fun getItemCount() = timeZones.size - class ViewHolder(view: View, val adapterListener: MyAdapterListener) : RecyclerView.ViewHolder(view) { - fun bindView(timeZone: MyTimeZone, textColor: Int, primaryColor: Int, backgroundColor: Int): View { + inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { + fun bindView(myTimeZone: MyTimeZone, textColor: Int, primaryColor: Int, backgroundColor: Int): View { + val isSelected = selectedKeys.contains(myTimeZone.id) itemView.apply { - add_time_zone_title.text = timeZone.title + add_time_zone_checkbox.isChecked = isSelected + add_time_zone_title.text = myTimeZone.title add_time_zone_title.setTextColor(textColor) add_time_zone_checkbox.setColors(textColor, primaryColor, backgroundColor) add_time_zone_holder.setOnClickListener { - adapterListener.toggleItemSelectionAdapter(!add_time_zone_checkbox.isChecked, adapterPosition) + viewClicked(myTimeZone) } } return itemView } + + private fun viewClicked(myTimeZone: MyTimeZone) { + val isSelected = selectedKeys.contains(myTimeZone.id) + toggleItemSelection(!isSelected, adapterPosition) + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/StopwatchAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/StopwatchAdapter.kt index 7b519a30..79d30168 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/StopwatchAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/StopwatchAdapter.kt @@ -26,24 +26,24 @@ class StopwatchAdapter(activity: SimpleActivity, var laps: ArrayList, recyc override fun prepareActionMode(menu: Menu) {} - override fun prepareItemSelection(viewHolder: ViewHolder) {} - - override fun markViewHolderSelection(select: Boolean, viewHolder: ViewHolder?) {} - override fun actionItemPressed(id: Int) {} override fun getSelectableItemCount() = laps.size override fun getIsItemSelectable(position: Int) = false + override fun getItemSelectionKey(position: Int) = laps.getOrNull(position)?.id + + override fun getItemKeyPosition(key: Int) = laps.indexOfFirst { it.id == key } + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = createViewHolder(R.layout.item_lap, parent) override fun onBindViewHolder(holder: MyRecyclerViewAdapter.ViewHolder, position: Int) { val lap = laps[position] - val view = holder.bindView(lap, false, false) { itemView, layoutPosition -> + holder.bindView(lap, false, false) { itemView, layoutPosition -> setupView(itemView, lap) } - bindViewHolder(holder, position, view) + bindViewHolder(holder) } override fun getItemCount() = laps.size diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/TimeZonesAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/TimeZonesAdapter.kt index 3c5960c9..fa93e0bb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/adapters/TimeZonesAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/adapters/TimeZonesAdapter.kt @@ -5,7 +5,6 @@ import android.view.View import android.view.ViewGroup import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity -import com.simplemobiletools.clock.extensions.config import com.simplemobiletools.clock.extensions.getFormattedDate import com.simplemobiletools.clock.extensions.getFormattedTime import com.simplemobiletools.clock.models.MyTimeZone @@ -29,14 +28,8 @@ class TimeZonesAdapter(activity: SimpleActivity, var timeZones: ArrayList + holder.bindView(timeZone, true, true) { itemView, layoutPosition -> setupView(itemView, timeZone) } - bindViewHolder(holder, position, view) + bindViewHolder(holder) } override fun getItemCount() = timeZones.size @@ -74,7 +71,7 @@ class TimeZonesAdapter(activity: SimpleActivity, var timeZones: ArrayList() val timeZoneIDsToRemove = ArrayList() - selectedPositions.sortedDescending().forEach { + /*selectedPositions.sortedDescending().forEach { val timeZone = timeZones[it] timeZonesToRemove.add(timeZone) timeZoneIDsToRemove.add(timeZone.id.toString()) @@ -85,7 +82,7 @@ class TimeZonesAdapter(activity: SimpleActivity, var timeZones: ArrayList dialogConfirmed() }) + .setPositiveButton(R.string.ok) { dialog, which -> dialogConfirmed() } .setNegativeButton(R.string.cancel, null) .create().apply { activity.setupDialogStuff(view, this) @@ -24,7 +24,8 @@ class AddTimeZonesDialog(val activity: SimpleActivity, private val callback: () } private fun dialogConfirmed() { - val selectedTimeZones = (view?.select_time_zones_list?.adapter as? SelectTimeZonesAdapter)?.getSelectedItemsSet() ?: LinkedHashSet() + val adapter = view?.select_time_zones_list?.adapter as? SelectTimeZonesAdapter + val selectedTimeZones = adapter?.selectedKeys?.map { it.toString() }?.toHashSet() ?: LinkedHashSet() activity.config.selectedTimeZones = selectedTimeZones callback() } 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 f5934d4d..0877d9c8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditAlarmDialog.kt @@ -3,7 +3,7 @@ package com.simplemobiletools.clock.dialogs import android.app.TimePickerDialog import android.graphics.drawable.Drawable import android.media.AudioManager -import android.support.v7.app.AlertDialog +import androidx.appcompat.app.AlertDialog import android.widget.TextView import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt index 8570620f..f054abbd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/EditTimeZoneDialog.kt @@ -1,6 +1,6 @@ package com.simplemobiletools.clock.dialogs -import android.support.v7.app.AlertDialog +import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.config diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt index 1ccefd77..052bbb54 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/dialogs/MyTimePickerDialogDialog.kt @@ -1,6 +1,6 @@ package com.simplemobiletools.clock.dialogs -import android.support.v7.app.AlertDialog +import androidx.appcompat.app.AlertDialog import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.SimpleActivity import com.simplemobiletools.clock.extensions.config diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt index fbcb8ced..b4072574 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/extensions/Context.kt @@ -1,7 +1,6 @@ package com.simplemobiletools.clock.extensions import android.annotation.SuppressLint -import android.annotation.TargetApi import android.app.* import android.appwidget.AppWidgetManager import android.content.ComponentName @@ -10,14 +9,12 @@ import android.content.Intent import android.media.AudioAttributes import android.media.AudioManager import android.net.Uri -import android.os.Build import android.os.PowerManager -import android.provider.Settings -import android.support.v4.app.AlarmManagerCompat -import android.support.v4.app.NotificationCompat import android.text.SpannableString import android.text.style.RelativeSizeSpan import android.widget.Toast +import androidx.core.app.AlarmManagerCompat +import androidx.core.app.NotificationCompat import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.ReminderActivity import com.simplemobiletools.clock.activities.SnoozeReminderActivity @@ -31,7 +28,10 @@ import com.simplemobiletools.clock.receivers.HideAlarmReceiver import com.simplemobiletools.clock.receivers.HideTimerReceiver import com.simplemobiletools.clock.services.SnoozeService import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.* +import com.simplemobiletools.commons.helpers.ALARM_SOUND_TYPE_ALARM +import com.simplemobiletools.commons.helpers.DAY_MINUTES +import com.simplemobiletools.commons.helpers.SILENT +import com.simplemobiletools.commons.helpers.isOreoPlus import java.util.* import kotlin.math.pow @@ -165,10 +165,7 @@ fun Context.scheduleNextWidgetUpdate() { val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager val triggerAtMillis = System.currentTimeMillis() + getMSTillNextMinute() - when { - isKitkatPlus() -> alarmManager.setExact(AlarmManager.RTC, triggerAtMillis, pendingIntent) - else -> alarmManager.set(AlarmManager.RTC, triggerAtMillis, pendingIntent) - } + alarmManager.setExact(AlarmManager.RTC, triggerAtMillis, pendingIntent) } fun Context.getFormattedTime(passedSeconds: Int, showSeconds: Boolean, makeAmPmSmaller: Boolean): SpannableString { @@ -195,25 +192,20 @@ fun Context.formatTo12HourFormat(showSeconds: Boolean, hours: Int, minutes: Int, return "${formatTime(showSeconds, false, newHours, minutes, seconds)} $appendable" } -@TargetApi(Build.VERSION_CODES.LOLLIPOP) fun Context.getNextAlarm(): String { - if (isLollipopPlus()) { - val milliseconds = (getSystemService(Context.ALARM_SERVICE) as AlarmManager).nextAlarmClock?.triggerTime ?: return "" - val calendar = Calendar.getInstance() - val isDaylightSavingActive = TimeZone.getDefault().inDaylightTime(Date()) - var offset = calendar.timeZone.rawOffset - if (isDaylightSavingActive) { - offset += TimeZone.getDefault().dstSavings - } - - calendar.timeInMillis = milliseconds - val dayOfWeekIndex = (calendar.get(Calendar.DAY_OF_WEEK) + 5) % 7 - val dayOfWeek = resources.getStringArray(R.array.week_days_short)[dayOfWeekIndex] - val formatted = getFormattedTime(((milliseconds + offset) / 1000L).toInt(), false, false) - return "$dayOfWeek $formatted" - } else { - return Settings.System.getString(contentResolver, Settings.System.NEXT_ALARM_FORMATTED) ?: "" + val milliseconds = (getSystemService(Context.ALARM_SERVICE) as AlarmManager).nextAlarmClock?.triggerTime ?: return "" + val calendar = Calendar.getInstance() + val isDaylightSavingActive = TimeZone.getDefault().inDaylightTime(Date()) + var offset = calendar.timeZone.rawOffset + if (isDaylightSavingActive) { + offset += TimeZone.getDefault().dstSavings } + + calendar.timeInMillis = milliseconds + val dayOfWeekIndex = (calendar.get(Calendar.DAY_OF_WEEK) + 5) % 7 + val dayOfWeek = resources.getStringArray(R.array.week_days_short)[dayOfWeekIndex] + val formatted = getFormattedTime(((milliseconds + offset) / 1000L).toInt(), false, false) + return "$dayOfWeek $formatted" } fun Context.rescheduleEnabledAlarms() { @@ -287,9 +279,7 @@ fun Context.getTimerNotification(pendingIntent: PendingIntent, addDeleteIntent: builder.setDeleteIntent(reminderActivityIntent) } - if (isLollipopPlus()) { - builder.setVisibility(Notification.VISIBILITY_PUBLIC) - } + builder.setVisibility(Notification.VISIBILITY_PUBLIC) if (config.timerVibrate) { val vibrateArray = LongArray(2) { 500 } @@ -356,9 +346,7 @@ fun Context.getAlarmNotification(pendingIntent: PendingIntent, alarm: Alarm): No .addAction(R.drawable.ic_snooze, getString(R.string.snooze), getSnoozePendingIntent(alarm)) .addAction(R.drawable.ic_cross, getString(R.string.dismiss), getHideAlarmPendingIntent(alarm)) - if (isLollipopPlus()) { - builder.setVisibility(Notification.VISIBILITY_PUBLIC) - } + builder.setVisibility(Notification.VISIBILITY_PUBLIC) if (alarm.vibrate) { val vibrateArray = LongArray(2) { 500 } diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt index a4885a98..2d9bde6c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/AlarmFragment.kt @@ -1,7 +1,7 @@ package com.simplemobiletools.clock.fragments import android.os.Bundle -import android.support.v4.app.Fragment +import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt index 855d379a..b831684f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/ClockFragment.kt @@ -2,7 +2,7 @@ package com.simplemobiletools.clock.fragments import android.os.Bundle import android.os.Handler -import android.support.v4.app.Fragment +import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt index 60cc6750..24880412 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/StopwatchFragment.kt @@ -6,10 +6,10 @@ import android.graphics.Matrix import android.os.Bundle import android.os.Handler import android.os.SystemClock -import android.support.v4.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.fragment.app.Fragment import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.simplemobiletools.clock.R diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt index 84112ff0..0c8eeebe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/fragments/TimerFragment.kt @@ -12,11 +12,11 @@ import android.os.Build import android.os.Bundle import android.os.Handler import android.os.SystemClock -import android.support.v4.app.Fragment -import android.support.v4.app.NotificationCompat import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.app.NotificationCompat +import androidx.fragment.app.Fragment import com.simplemobiletools.clock.R import com.simplemobiletools.clock.activities.ReminderActivity import com.simplemobiletools.clock.activities.SimpleActivity @@ -27,7 +27,6 @@ import com.simplemobiletools.clock.helpers.TIMER_NOTIF_ID import com.simplemobiletools.commons.dialogs.SelectAlarmSoundDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ALARM_SOUND_TYPE_ALARM -import com.simplemobiletools.commons.helpers.isLollipopPlus import com.simplemobiletools.commons.helpers.isOreoPlus import com.simplemobiletools.commons.models.AlarmSound import kotlinx.android.synthetic.main.fragment_timer.view.* @@ -271,10 +270,7 @@ class TimerFragment : Fragment() { .setAutoCancel(true) .setChannelId(channelId) - if (isLollipopPlus()) { - builder.setVisibility(Notification.VISIBILITY_PUBLIC) - } - + builder.setVisibility(Notification.VISIBILITY_PUBLIC) notificationManager.notify(TIMER_NOTIF_ID, builder.build()) } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c7d10e57..2a0ce1d7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - + - - - + diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ba81b22e..90e9cdbe 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -18,18 +18,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -40,18 +40,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -62,10 +62,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> - - - - - - + android:paddingBottom="@dimen/activity_margin"> @@ -134,10 +110,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -158,10 +134,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -187,8 +163,8 @@ android:id="@+id/clock_tab_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin" + android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/clock_tab" android:textAllCaps="true" @@ -200,10 +176,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -229,8 +205,8 @@ android:id="@+id/alarm_tab_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin" + android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/alarm_tab" android:textAllCaps="true" @@ -242,18 +218,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/bigger_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/bigger_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/bigger_margin"> + android:paddingBottom="@dimen/bigger_margin"> @@ -277,10 +253,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -301,10 +277,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -325,18 +301,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/bigger_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/bigger_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/bigger_margin"> + android:paddingBottom="@dimen/bigger_margin"> @@ -365,8 +341,8 @@ android:id="@+id/stopwatch_tab_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin" + android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/stopwatch_tab" android:textAllCaps="true" @@ -378,10 +354,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -406,8 +382,8 @@ android:id="@+id/timer_tab_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin" + android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/timer_tab" android:textAllCaps="true" @@ -419,18 +395,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/bigger_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/bigger_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/bigger_margin"> + android:paddingBottom="@dimen/bigger_margin"> @@ -459,8 +435,8 @@ android:id="@+id/widgets_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginStart="@dimen/bigger_margin" + android:layout_marginLeft="@dimen/bigger_margin" android:layout_marginTop="@dimen/activity_margin" android:text="@string/widgets" android:textAllCaps="true" @@ -472,10 +448,10 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> @@ -495,18 +471,18 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/activity_margin" android:paddingLeft="@dimen/normal_margin" + android:paddingTop="@dimen/activity_margin" android:paddingRight="@dimen/normal_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingBottom="@dimen/activity_margin"> diff --git a/app/src/main/res/layout/dialog_edit_alarm.xml b/app/src/main/res/layout/dialog_edit_alarm.xml index ef771175..c4e47d94 100644 --- a/app/src/main/res/layout/dialog_edit_alarm.xml +++ b/app/src/main/res/layout/dialog_edit_alarm.xml @@ -25,8 +25,8 @@ android:layout_width="match_parent" android:layout_height="@dimen/alarm_day_size" android:layout_below="@+id/edit_alarm_time" - android:layout_marginBottom="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin" + android:layout_marginBottom="@dimen/medium_margin" android:orientation="horizontal"/> + android:paddingTop="@dimen/normal_margin" + android:paddingBottom="@dimen/normal_margin"> @@ -69,9 +69,9 @@ android:id="@+id/edit_alarm_label_image" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignBottom="@+id/edit_alarm_label" - android:layout_alignTop="@+id/edit_alarm_label" android:layout_below="@+id/edit_alarm_sound" + android:layout_alignTop="@+id/edit_alarm_label" + android:layout_alignBottom="@+id/edit_alarm_label" android:layout_marginLeft="@dimen/tiny_margin" android:layout_marginRight="@dimen/tiny_margin" android:scaleType="fitCenter" 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 54cf8a35..0e6b870a 100644 --- a/app/src/main/res/layout/dialog_edit_time_zone.xml +++ b/app/src/main/res/layout/dialog_edit_time_zone.xml @@ -18,8 +18,8 @@ android:id="@+id/edit_time_zone_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_margin" android:layout_marginLeft="@dimen/small_margin" + android:layout_marginBottom="@dimen/activity_margin" android:singleLine="true" android:textCursorDrawable="@null" android:textSize="@dimen/normal_text_size"/> diff --git a/app/src/main/res/layout/fragment_alarm.xml b/app/src/main/res/layout/fragment_alarm.xml index c018b778..1bcf1372 100644 --- a/app/src/main/res/layout/fragment_alarm.xml +++ b/app/src/main/res/layout/fragment_alarm.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/fragment_clock.xml b/app/src/main/res/layout/fragment_clock.xml index bab04dca..41373739 100644 --- a/app/src/main/res/layout/fragment_clock.xml +++ b/app/src/main/res/layout/fragment_clock.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/fragment_stopwatch.xml b/app/src/main/res/layout/fragment_stopwatch.xml index 62dc453c..8c37f116 100644 --- a/app/src/main/res/layout/fragment_stopwatch.xml +++ b/app/src/main/res/layout/fragment_stopwatch.xml @@ -1,5 +1,5 @@ - - - + - + diff --git a/app/src/main/res/layout/fragment_timer.xml b/app/src/main/res/layout/fragment_timer.xml index 26ccf97f..8cbbf4a1 100644 --- a/app/src/main/res/layout/fragment_timer.xml +++ b/app/src/main/res/layout/fragment_timer.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/item_add_time_zone.xml b/app/src/main/res/layout/item_add_time_zone.xml index b88b6e2f..1366df17 100644 --- a/app/src/main/res/layout/item_add_time_zone.xml +++ b/app/src/main/res/layout/item_add_time_zone.xml @@ -25,9 +25,9 @@ android:id="@+id/add_time_zone_checkbox" android:layout_width="wrap_content" android:layout_height="match_parent" + android:layout_alignTop="@+id/add_time_zone_title" android:layout_alignBottom="@+id/add_time_zone_title" android:layout_alignParentRight="true" - android:layout_alignTop="@+id/add_time_zone_title" android:layout_marginRight="@dimen/activity_margin" android:clickable="false" android:gravity="center"/> diff --git a/app/src/main/res/layout/item_alarm.xml b/app/src/main/res/layout/item_alarm.xml index a3c3c148..f10bdac7 100644 --- a/app/src/main/res/layout/item_alarm.xml +++ b/app/src/main/res/layout/item_alarm.xml @@ -14,9 +14,9 @@ android:id="@+id/alarm_holder" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="@dimen/medium_margin" android:paddingLeft="@dimen/activity_margin" - android:paddingTop="@dimen/medium_margin"> + android:paddingTop="@dimen/medium_margin" + android:paddingBottom="@dimen/medium_margin"> diff --git a/app/src/main/res/layout/item_lap.xml b/app/src/main/res/layout/item_lap.xml index 4c13501b..4e4a0bf0 100644 --- a/app/src/main/res/layout/item_lap.xml +++ b/app/src/main/res/layout/item_lap.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layout/item_time_zone.xml b/app/src/main/res/layout/item_time_zone.xml index dfeac6f4..d03ed721 100644 --- a/app/src/main/res/layout/item_time_zone.xml +++ b/app/src/main/res/layout/item_time_zone.xml @@ -11,7 +11,7 @@ android:focusable="true" android:foreground="@drawable/selector"> - @@ -58,5 +58,5 @@ app:layout_constraintTop_toBottomOf="@+id/time_zone_time" tools:text="Mon, 1 January"/> - + diff --git a/app/src/main/res/layout/widget_config_date_time.xml b/app/src/main/res/layout/widget_config_date_time.xml index cf0c86ca..d5579e82 100644 --- a/app/src/main/res/layout/widget_config_date_time.xml +++ b/app/src/main/res/layout/widget_config_date_time.xml @@ -45,8 +45,8 @@ android:id="@+id/config_bg_seekbar_holder" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_alignBottom="@+id/config_bg_color" android:layout_alignTop="@+id/config_bg_color" + android:layout_alignBottom="@+id/config_bg_color" android:layout_toRightOf="@+id/config_bg_color" android:background="@android:color/white"> @@ -69,8 +69,8 @@ android:id="@+id/config_save" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" android:fontFamily="sans-serif-light" android:paddingLeft="@dimen/activity_margin" android:paddingRight="@dimen/activity_margin" diff --git a/app/src/main/res/layout/widget_date_time.xml b/app/src/main/res/layout/widget_date_time.xml index b2b167a8..f41712fd 100644 --- a/app/src/main/res/layout/widget_date_time.xml +++ b/app/src/main/res/layout/widget_date_time.xml @@ -52,7 +52,7 @@ android:layout_height="@dimen/widget_alarm_icon_size" android:layout_alignBottom="@+id/widget_next_alarm" android:layout_alignTop="@+id/widget_next_alarm" - android:src="@drawable/ic_clock"/> + android:src="@drawable/ic_alarm"/> + android:paddingRight="@dimen/small_margin" + android:paddingBottom="@dimen/small_margin"> + android:layout_alignBottom="@+id/widget_next_alarm" + android:src="@drawable/ic_alarm"/> + android:paddingRight="@dimen/small_margin" + android:paddingBottom="@dimen/small_margin"> + android:layout_alignBottom="@+id/widget_next_alarm" + android:src="@drawable/ic_alarm"/> + android:paddingRight="@dimen/small_margin" + android:paddingBottom="@dimen/small_margin"> + android:layout_alignBottom="@+id/widget_next_alarm" + android:src="@drawable/ic_alarm"/>