fix #3, allow creating an analogue clock widget
@ -79,7 +79,16 @@
|
||||
android:theme="@style/Theme.Transparent" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetDateTimeConfigureActivity"
|
||||
android:name=".activities.WidgetDigitalConfigureActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/MyWidgetConfigTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetAnalogueConfigureActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/MyWidgetConfigTheme">
|
||||
<intent-filter>
|
||||
@ -108,7 +117,7 @@
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".helpers.MyWidgetDateTimeProvider"
|
||||
android:name=".helpers.MyDigitalTimeWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/digital_clock">
|
||||
|
||||
@ -122,6 +131,21 @@
|
||||
android:resource="@xml/widget_digital_clock_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".helpers.MyAnalogueTimeWidgetProvider"
|
||||
android:exported="true"
|
||||
android:label="@string/analogue_clock">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_analogue_clock_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name=".receivers.UpdateWidgetReceiver"
|
||||
android:exported="true">
|
||||
|
@ -178,7 +178,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
|
||||
private fun setupCustomizeWidgetColors() {
|
||||
settings_customize_widget_colors_holder.setOnClickListener {
|
||||
Intent(this, WidgetDateTimeConfigureActivity::class.java).apply {
|
||||
Intent(this, WidgetDigitalConfigureActivity::class.java).apply {
|
||||
putExtra(IS_CUSTOMIZING_COLORS, true)
|
||||
startActivity(this)
|
||||
}
|
||||
|
@ -0,0 +1,123 @@
|
||||
package com.simplemobiletools.clock.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.widget.SeekBar
|
||||
import com.simplemobiletools.clock.R
|
||||
import com.simplemobiletools.clock.extensions.config
|
||||
import com.simplemobiletools.clock.helpers.MyAnalogueTimeWidgetProvider
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import kotlinx.android.synthetic.main.widget_config_analogue.*
|
||||
|
||||
class WidgetAnalogueConfigureActivity : SimpleActivity() {
|
||||
private var mBgAlpha = 0f
|
||||
private var mWidgetId = 0
|
||||
private var mBgColor = 0
|
||||
private var mBgColorWithoutTransparency = 0
|
||||
private var mWidgetLockedDialog: WidgetLockedDialog? = null
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
useDynamicTheme = false
|
||||
super.onCreate(savedInstanceState)
|
||||
setResult(Activity.RESULT_CANCELED)
|
||||
setContentView(R.layout.widget_config_analogue)
|
||||
initVariables()
|
||||
|
||||
val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
||||
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
||||
|
||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) {
|
||||
finish()
|
||||
}
|
||||
|
||||
config_analogue_save.setOnClickListener { saveConfig() }
|
||||
config_analogue_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
config_analogue_bg_seekbar.setColors(getProperTextColor(), primaryColor, primaryColor)
|
||||
|
||||
if (!isCustomizingColors && !isOrWasThankYouInstalled()) {
|
||||
mWidgetLockedDialog = WidgetLockedDialog(this) {
|
||||
if (!isOrWasThankYouInstalled()) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
window.decorView.setBackgroundColor(0)
|
||||
|
||||
if (mWidgetLockedDialog != null && isOrWasThankYouInstalled()) {
|
||||
mWidgetLockedDialog?.dismissDialog()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initVariables() {
|
||||
mBgColor = config.widgetBgColor
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
|
||||
config_analogue_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_analogue_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
storeWidgetColors()
|
||||
requestWidgetUpdate()
|
||||
|
||||
Intent().apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId)
|
||||
setResult(Activity.RESULT_OK, this)
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun storeWidgetColors() {
|
||||
config.apply {
|
||||
widgetBgColor = mBgColor
|
||||
}
|
||||
}
|
||||
|
||||
private fun pickBackgroundColor() {
|
||||
ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color ->
|
||||
if (wasPositivePressed) {
|
||||
mBgColorWithoutTransparency = color
|
||||
updateBackgroundColor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestWidgetUpdate() {
|
||||
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyAnalogueTimeWidgetProvider::class.java).apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId))
|
||||
sendBroadcast(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateBackgroundColor() {
|
||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||
config_analogue_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
|
||||
config_analogue_background.applyColorFilter(mBgColor)
|
||||
config_analogue_save.setBackgroundColor(mBgColor)
|
||||
}
|
||||
|
||||
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
|
||||
mBgAlpha = progress.toFloat() / 100.toFloat()
|
||||
updateBackgroundColor()
|
||||
}
|
||||
|
||||
override fun onStartTrackingTouch(seekBar: SeekBar) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {}
|
||||
}
|
||||
}
|
@ -9,17 +9,15 @@ import android.widget.SeekBar
|
||||
import com.simplemobiletools.clock.R
|
||||
import com.simplemobiletools.clock.extensions.config
|
||||
import com.simplemobiletools.clock.extensions.getFormattedDate
|
||||
import com.simplemobiletools.clock.extensions.getFormattedTime
|
||||
import com.simplemobiletools.clock.helpers.MyWidgetDateTimeProvider
|
||||
import com.simplemobiletools.clock.helpers.getPassedSeconds
|
||||
import com.simplemobiletools.clock.helpers.MyDigitalTimeWidgetProvider
|
||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||
import kotlinx.android.synthetic.main.widget_config_date_time.*
|
||||
import kotlinx.android.synthetic.main.widget_config_digital.*
|
||||
import java.util.*
|
||||
|
||||
class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
class WidgetDigitalConfigureActivity : SimpleActivity() {
|
||||
private var mBgAlpha = 0f
|
||||
private var mWidgetId = 0
|
||||
private var mBgColor = 0
|
||||
@ -31,7 +29,7 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
useDynamicTheme = false
|
||||
super.onCreate(savedInstanceState)
|
||||
setResult(Activity.RESULT_CANCELED)
|
||||
setContentView(R.layout.widget_config_date_time)
|
||||
setContentView(R.layout.widget_config_digital)
|
||||
initVariables()
|
||||
|
||||
val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
||||
@ -41,12 +39,12 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
finish()
|
||||
}
|
||||
|
||||
config_save.setOnClickListener { saveConfig() }
|
||||
config_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||
config_text_color.setOnClickListener { pickTextColor() }
|
||||
config_digital_save.setOnClickListener { saveConfig() }
|
||||
config_digital_bg_color.setOnClickListener { pickBackgroundColor() }
|
||||
config_digital_text_color.setOnClickListener { pickTextColor() }
|
||||
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||
config_digital_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
||||
|
||||
if (!isCustomizingColors && !isOrWasThankYouInstalled()) {
|
||||
mWidgetLockedDialog = WidgetLockedDialog(this) {
|
||||
@ -71,8 +69,8 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
mBgAlpha = Color.alpha(mBgColor) / 255.toFloat()
|
||||
mBgColorWithoutTransparency = Color.rgb(Color.red(mBgColor), Color.green(mBgColor), Color.blue(mBgColor))
|
||||
|
||||
config_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
config_digital_bg_seekbar.setOnSeekBarChangeListener(bgSeekbarChangeListener)
|
||||
config_digital_bg_seekbar.progress = (mBgAlpha * 100).toInt()
|
||||
updateBackgroundColor()
|
||||
updateCurrentDateTime()
|
||||
|
||||
@ -81,11 +79,7 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun updateCurrentDateTime() {
|
||||
val calendar = Calendar.getInstance()
|
||||
config_time.text = getFormattedTime(getPassedSeconds(), false, false).toString()
|
||||
config_date.text = getFormattedDate(calendar)
|
||||
config_time.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
config_date.setShadowLayer(1f, 0f, 1f, Color.BLACK)
|
||||
config_digital_date.text = getFormattedDate(Calendar.getInstance())
|
||||
}
|
||||
|
||||
private fun saveConfig() {
|
||||
@ -125,24 +119,24 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun requestWidgetUpdate() {
|
||||
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetDateTimeProvider::class.java).apply {
|
||||
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyDigitalTimeWidgetProvider::class.java).apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId))
|
||||
sendBroadcast(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTextColor() {
|
||||
config_text_color.setFillWithStroke(mTextColor, Color.BLACK)
|
||||
config_save.setTextColor(mTextColor)
|
||||
config_time.setTextColor(mTextColor)
|
||||
config_date.setTextColor(mTextColor)
|
||||
config_digital_text_color.setFillWithStroke(mTextColor, Color.BLACK)
|
||||
config_digital_save.setTextColor(mTextColor)
|
||||
config_digital_time.setTextColor(mTextColor)
|
||||
config_digital_date.setTextColor(mTextColor)
|
||||
}
|
||||
|
||||
private fun updateBackgroundColor() {
|
||||
mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha)
|
||||
config_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
|
||||
config_background.applyColorFilter(mBgColor)
|
||||
config_save.setBackgroundColor(mBgColor)
|
||||
config_digital_bg_color.setFillWithStroke(mBgColor, Color.BLACK)
|
||||
config_digital_background.applyColorFilter(mBgColor)
|
||||
config_digital_save.setBackgroundColor(mBgColor)
|
||||
}
|
||||
|
||||
private val bgSeekbarChangeListener = object : SeekBar.OnSeekBarChangeListener {
|
@ -177,11 +177,29 @@ fun Context.hideNotification(id: Int) {
|
||||
fun Context.hideTimerNotification(timerId: Int) = hideNotification(timerId)
|
||||
|
||||
fun Context.updateWidgets() {
|
||||
val component = ComponentName(applicationContext, MyWidgetDateTimeProvider::class.java)
|
||||
updateDigitalWidgets()
|
||||
updateAnalogueWidgets()
|
||||
}
|
||||
|
||||
fun Context.updateDigitalWidgets() {
|
||||
val component = ComponentName(applicationContext, MyDigitalTimeWidgetProvider::class.java)
|
||||
val widgetIds = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(component) ?: return
|
||||
if (widgetIds.isNotEmpty()) {
|
||||
val ids = intArrayOf(R.xml.widget_digital_clock_info)
|
||||
Intent(applicationContext, MyWidgetDateTimeProvider::class.java).apply {
|
||||
Intent(applicationContext, MyDigitalTimeWidgetProvider::class.java).apply {
|
||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
|
||||
sendBroadcast(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.updateAnalogueWidgets() {
|
||||
val component = ComponentName(applicationContext, MyAnalogueTimeWidgetProvider::class.java)
|
||||
val widgetIds = AppWidgetManager.getInstance(applicationContext)?.getAppWidgetIds(component) ?: return
|
||||
if (widgetIds.isNotEmpty()) {
|
||||
val ids = intArrayOf(R.xml.widget_analogue_clock_info)
|
||||
Intent(applicationContext, MyAnalogueTimeWidgetProvider::class.java).apply {
|
||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
|
||||
sendBroadcast(this)
|
||||
|
@ -0,0 +1,54 @@
|
||||
package com.simplemobiletools.clock.helpers
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.appwidget.AppWidgetProvider
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.widget.RemoteViews
|
||||
import com.simplemobiletools.clock.R
|
||||
import com.simplemobiletools.clock.activities.SplashActivity
|
||||
import com.simplemobiletools.clock.extensions.config
|
||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
||||
import com.simplemobiletools.commons.extensions.getLaunchIntent
|
||||
|
||||
class MyAnalogueTimeWidgetProvider : AppWidgetProvider() {
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
performUpdate(context)
|
||||
}
|
||||
|
||||
private fun performUpdate(context: Context) {
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context) ?: return
|
||||
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
|
||||
RemoteViews(context.packageName, R.layout.widget_analogue).apply {
|
||||
updateColors(context, this)
|
||||
setupAppOpenIntent(context, this)
|
||||
appWidgetManager.updateAppWidget(it, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateColors(context: Context, views: RemoteViews) {
|
||||
views.apply {
|
||||
applyColorFilter(R.id.widget_background, context.config.widgetBgColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getComponentName(context: Context) = ComponentName(context, this::class.java)
|
||||
|
||||
private fun setupAppOpenIntent(context: Context, views: RemoteViews) {
|
||||
(context.getLaunchIntent() ?: Intent(context, SplashActivity::class.java)).apply {
|
||||
putExtra(OPEN_TAB, TAB_CLOCK)
|
||||
val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
|
||||
views.setOnClickPendingIntent(R.id.widget_date_time_holder, pendingIntent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAppWidgetOptionsChanged(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int, newOptions: Bundle?) {
|
||||
super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions)
|
||||
performUpdate(context)
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ import com.simplemobiletools.commons.extensions.setText
|
||||
import com.simplemobiletools.commons.extensions.setVisibleIf
|
||||
import java.util.*
|
||||
|
||||
class MyWidgetDateTimeProvider : AppWidgetProvider() {
|
||||
class MyDigitalTimeWidgetProvider : AppWidgetProvider() {
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
performUpdate(context)
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
49
app/src/main/res/layout/widget_analogue.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/widget_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_date_time_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/small_margin"
|
||||
android:paddingRight="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<AnalogClock
|
||||
android:id="@+id/widget_text_clock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:autoSizeMaxTextSize="300sp"
|
||||
android:autoSizeMinTextSize="2sp"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:format12Hour="h:mm"
|
||||
android:format24Hour="k:mm"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="00:00" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
74
app/src/main/res/layout/widget_config_analogue.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/config_analogue_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/activity_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_analogue_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/small_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_analogue_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/config_analogue_time"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<AnalogClock
|
||||
android:id="@+id/config_analogue_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/widget_analogue_time_height"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="@dimen/widget_time_text_size_small"
|
||||
tools:text="00:00" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_analogue_bg_color"
|
||||
android:layout_width="@dimen/widget_colorpicker_size"
|
||||
android:layout_height="@dimen/widget_colorpicker_size"
|
||||
android:layout_above="@+id/config_analogue_save" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_analogue_seekbar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/config_analogue_bg_color"
|
||||
android:layout_alignBottom="@+id/config_analogue_bg_color"
|
||||
android:layout_toEndOf="@+id/config_analogue_bg_color"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySeekBar
|
||||
android:id="@+id/config_analogue_bg_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin" />
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/config_analogue_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:text="@string/ok"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/big_text_size" />
|
||||
|
||||
</RelativeLayout>
|
@ -1,42 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/config_date_time_holder"
|
||||
android:id="@+id/config_digital_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/activity_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_date_time_wrapper"
|
||||
android:id="@+id/config_digital_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/small_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_background"
|
||||
android:id="@+id/config_digital_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/config_date"
|
||||
android:layout_alignBottom="@+id/config_digital_date"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/config_time"
|
||||
<TextClock
|
||||
android:id="@+id/config_digital_time"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/widget_time_height"
|
||||
android:layout_height="@dimen/widget_digital_time_height"
|
||||
android:gravity="center_horizontal"
|
||||
android:format12Hour="h:mm"
|
||||
android:format24Hour="k:mm"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:includeFontPadding="false"
|
||||
android:textSize="@dimen/widget_time_text_size_small"
|
||||
tools:text="00:00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/config_date"
|
||||
android:id="@+id/config_digital_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/config_time"
|
||||
android:layout_below="@+id/config_digital_time"
|
||||
android:gravity="center_horizontal"
|
||||
android:includeFontPadding="false"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
@ -45,22 +50,22 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_bg_color"
|
||||
android:id="@+id/config_digital_bg_color"
|
||||
android:layout_width="@dimen/widget_colorpicker_size"
|
||||
android:layout_height="@dimen/widget_colorpicker_size"
|
||||
android:layout_above="@+id/config_text_color" />
|
||||
android:layout_above="@+id/config_digital_text_color" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_bg_seekbar_holder"
|
||||
android:id="@+id/config_digital_seekbar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignTop="@+id/config_bg_color"
|
||||
android:layout_alignBottom="@+id/config_bg_color"
|
||||
android:layout_toEndOf="@+id/config_bg_color"
|
||||
android:layout_alignTop="@+id/config_digital_bg_color"
|
||||
android:layout_alignBottom="@+id/config_digital_bg_color"
|
||||
android:layout_toEndOf="@+id/config_digital_bg_color"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySeekBar
|
||||
android:id="@+id/config_bg_seekbar"
|
||||
android:id="@+id/config_digital_bg_seekbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
@ -69,13 +74,13 @@
|
||||
</RelativeLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config_text_color"
|
||||
android:id="@+id/config_digital_text_color"
|
||||
android:layout_width="@dimen/widget_colorpicker_size"
|
||||
android:layout_height="@dimen/widget_colorpicker_size"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/config_save"
|
||||
android:id="@+id/config_digital_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
97
app/src/main/res/layout/widget_digital.xml
Normal file
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/widget_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/widget_round_background" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/widget_date_time_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/small_margin"
|
||||
android:paddingRight="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/widget_text_clock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="4"
|
||||
android:autoSizeMaxTextSize="300sp"
|
||||
android:autoSizeMinTextSize="2sp"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:format12Hour="h:mm"
|
||||
android:format24Hour="k:mm"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="00:00" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:autoSizeMinTextSize="2sp"
|
||||
android:autoSizeStepGranularity="1sp"
|
||||
android:autoSizeTextType="uniform"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Mon, 1 January" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/widget_alarm_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/widget_next_alarm_image"
|
||||
android:layout_width="@dimen/widget_alarm_icon_size"
|
||||
android:layout_height="@dimen/widget_alarm_icon_size"
|
||||
android:layout_alignTop="@+id/widget_next_alarm"
|
||||
android:layout_alignBottom="@+id/widget_next_alarm"
|
||||
android:src="@drawable/ic_alarm_vector" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/widget_next_alarm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_toEndOf="@+id/widget_next_alarm_image"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:shadowColor="@android:color/black"
|
||||
android:shadowDy="1"
|
||||
android:shadowRadius="1"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="Tue, 18:30" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
@ -5,10 +5,8 @@
|
||||
<dimen name="reminder_background_min_size">70dp</dimen>
|
||||
<dimen name="lap_time_size">80dp</dimen>
|
||||
<dimen name="widget_alarm_icon_size">18dp</dimen>
|
||||
<dimen name="widget_time_height">48dp</dimen>
|
||||
<dimen name="min_widget_height">30dp</dimen>
|
||||
<dimen name="min_widget_width">180dp</dimen>
|
||||
<dimen name="min_widget_resize_width">110dp</dimen>
|
||||
<dimen name="widget_digital_time_height">48dp</dimen>
|
||||
<dimen name="widget_analogue_time_height">96dp</dimen>
|
||||
<dimen name="fab_list_bottom_padding">68dp</dimen>
|
||||
<dimen name="timer_button_small_size">50dp</dimen>
|
||||
<dimen name="timer_button_size">56dp</dimen>
|
||||
|
10
app/src/main/res/xml/widget_analogue_clock_info.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:configure="com.simplemobiletools.clock.activities.WidgetAnalogueConfigureActivity"
|
||||
android:initialLayout="@layout/widget_analogue"
|
||||
android:minWidth="110dp"
|
||||
android:minHeight="40dp"
|
||||
android:minResizeWidth="40dp"
|
||||
android:previewImage="@drawable/img_digital_widget_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000" />
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:configure="com.simplemobiletools.clock.activities.WidgetDateTimeConfigureActivity"
|
||||
android:initialLayout="@layout/widget_date_time"
|
||||
android:minWidth="@dimen/min_widget_width"
|
||||
android:minHeight="@dimen/min_widget_height"
|
||||
android:minResizeWidth="@dimen/min_widget_resize_width"
|
||||
android:previewImage="@drawable/img_widget_preview"
|
||||
android:configure="com.simplemobiletools.clock.activities.WidgetDigitalConfigureActivity"
|
||||
android:initialLayout="@layout/widget_digital"
|
||||
android:minWidth="180dp"
|
||||
android:minHeight="40dp"
|
||||
android:minResizeWidth="40dp"
|
||||
android:previewImage="@drawable/img_digital_widget_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000" />
|
||||
|