mirror of
				https://github.com/SimpleMobileTools/Simple-Flashlight.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	fix #69, add a bright display widget
This commit is contained in:
		| @@ -40,7 +40,16 @@ | |||||||
|             android:theme="@style/AppTheme" /> |             android:theme="@style/AppTheme" /> | ||||||
|  |  | ||||||
|         <activity |         <activity | ||||||
|             android:name=".activities.WidgetConfigureActivity" |             android:name=".activities.WidgetTorchConfigureActivity" | ||||||
|  |             android:screenOrientation="portrait" | ||||||
|  |             android:theme="@style/MyWidgetConfigTheme"> | ||||||
|  |             <intent-filter> | ||||||
|  |                 <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> | ||||||
|  |             </intent-filter> | ||||||
|  |         </activity> | ||||||
|  |  | ||||||
|  |         <activity | ||||||
|  |             android:name=".activities.WidgetBrightDisplayConfigureActivity" | ||||||
|             android:screenOrientation="portrait" |             android:screenOrientation="portrait" | ||||||
|             android:theme="@style/MyWidgetConfigTheme"> |             android:theme="@style/MyWidgetConfigTheme"> | ||||||
|             <intent-filter> |             <intent-filter> | ||||||
| @@ -79,7 +88,7 @@ | |||||||
|             android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" /> |             android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity" /> | ||||||
|  |  | ||||||
|         <receiver |         <receiver | ||||||
|             android:name=".helpers.MyWidgetProvider" |             android:name=".helpers.MyWidgetTorchProvider" | ||||||
|             android:icon="@drawable/ic_flashlight"> |             android:icon="@drawable/ic_flashlight"> | ||||||
|             <intent-filter> |             <intent-filter> | ||||||
|                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> |                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> | ||||||
| @@ -90,6 +99,18 @@ | |||||||
|                 android:resource="@xml/widget_torch" /> |                 android:resource="@xml/widget_torch" /> | ||||||
|         </receiver> |         </receiver> | ||||||
|  |  | ||||||
|  |         <receiver | ||||||
|  |             android:name=".helpers.MyWidgetBrightDisplayProvider" | ||||||
|  |             android:icon="@drawable/ic_bright_display"> | ||||||
|  |             <intent-filter> | ||||||
|  |                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> | ||||||
|  |             </intent-filter> | ||||||
|  |  | ||||||
|  |             <meta-data | ||||||
|  |                 android:name="android.appwidget.provider" | ||||||
|  |                 android:resource="@xml/widget_bright_display" /> | ||||||
|  |         </receiver> | ||||||
|  |  | ||||||
|         <service |         <service | ||||||
|             android:name=".helpers.MyTileService" |             android:name=".helpers.MyTileService" | ||||||
|             android:icon="@drawable/img_widget_preview" |             android:icon="@drawable/img_widget_preview" | ||||||
|   | |||||||
| @@ -55,7 +55,7 @@ class SettingsActivity : SimpleActivity() { | |||||||
|  |  | ||||||
|     private fun setupCustomizeWidgetColors() { |     private fun setupCustomizeWidgetColors() { | ||||||
|         settings_customize_widget_colors_holder.setOnClickListener { |         settings_customize_widget_colors_holder.setOnClickListener { | ||||||
|             Intent(this, WidgetConfigureActivity::class.java).apply { |             Intent(this, WidgetTorchConfigureActivity::class.java).apply { | ||||||
|                 putExtra(IS_CUSTOMIZING_COLORS, true) |                 putExtra(IS_CUSTOMIZING_COLORS, true) | ||||||
|                 startActivity(this) |                 startActivity(this) | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -14,10 +14,10 @@ import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR | |||||||
| import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS | import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS | ||||||
| import com.simplemobiletools.flashlight.R | import com.simplemobiletools.flashlight.R | ||||||
| import com.simplemobiletools.flashlight.extensions.config | import com.simplemobiletools.flashlight.extensions.config | ||||||
| import com.simplemobiletools.flashlight.helpers.MyWidgetProvider | import com.simplemobiletools.flashlight.helpers.MyWidgetBrightDisplayProvider | ||||||
| import kotlinx.android.synthetic.main.widget_config.* | import kotlinx.android.synthetic.main.widget_bright_display_config.* | ||||||
| 
 | 
 | ||||||
| class WidgetConfigureActivity : SimpleActivity() { | class WidgetBrightDisplayConfigureActivity : SimpleActivity() { | ||||||
|     private var mWidgetAlpha = 0f |     private var mWidgetAlpha = 0f | ||||||
|     private var mWidgetId = 0 |     private var mWidgetId = 0 | ||||||
|     private var mWidgetColor = 0 |     private var mWidgetColor = 0 | ||||||
| @@ -27,7 +27,7 @@ class WidgetConfigureActivity : SimpleActivity() { | |||||||
|         useDynamicTheme = false |         useDynamicTheme = false | ||||||
|         super.onCreate(savedInstanceState) |         super.onCreate(savedInstanceState) | ||||||
|         setResult(Activity.RESULT_CANCELED) |         setResult(Activity.RESULT_CANCELED) | ||||||
|         setContentView(R.layout.widget_config) |         setContentView(R.layout.widget_bright_display_config) | ||||||
|         initVariables() |         initVariables() | ||||||
| 
 | 
 | ||||||
|         val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false |         val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false | ||||||
| @@ -76,7 +76,7 @@ class WidgetConfigureActivity : SimpleActivity() { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun requestWidgetUpdate() { |     private fun requestWidgetUpdate() { | ||||||
|         Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetProvider::class.java).apply { |         Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetBrightDisplayProvider::class.java).apply { | ||||||
|             putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId)) |             putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId)) | ||||||
|             sendBroadcast(this) |             sendBroadcast(this) | ||||||
|         } |         } | ||||||
| @@ -0,0 +1,104 @@ | |||||||
|  | package com.simplemobiletools.flashlight.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.commons.dialogs.ColorPickerDialog | ||||||
|  | import com.simplemobiletools.commons.extensions.adjustAlpha | ||||||
|  | import com.simplemobiletools.commons.extensions.applyColorFilter | ||||||
|  | import com.simplemobiletools.commons.extensions.setFillWithStroke | ||||||
|  | import com.simplemobiletools.commons.helpers.DEFAULT_WIDGET_BG_COLOR | ||||||
|  | import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS | ||||||
|  | import com.simplemobiletools.flashlight.R | ||||||
|  | import com.simplemobiletools.flashlight.extensions.config | ||||||
|  | import com.simplemobiletools.flashlight.extensions.updateBrightDisplayWidget | ||||||
|  | import com.simplemobiletools.flashlight.helpers.MyWidgetTorchProvider | ||||||
|  | import kotlinx.android.synthetic.main.widget_torch_config.* | ||||||
|  |  | ||||||
|  | class WidgetTorchConfigureActivity : SimpleActivity() { | ||||||
|  |     private var mWidgetAlpha = 0f | ||||||
|  |     private var mWidgetId = 0 | ||||||
|  |     private var mWidgetColor = 0 | ||||||
|  |     private var mWidgetColorWithoutTransparency = 0 | ||||||
|  |  | ||||||
|  |     public override fun onCreate(savedInstanceState: Bundle?) { | ||||||
|  |         useDynamicTheme = false | ||||||
|  |         super.onCreate(savedInstanceState) | ||||||
|  |         setResult(Activity.RESULT_CANCELED) | ||||||
|  |         setContentView(R.layout.widget_torch_config) | ||||||
|  |         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_save.setOnClickListener { saveConfig() } | ||||||
|  |         config_widget_color.setOnClickListener { pickBackgroundColor() } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun initVariables() { | ||||||
|  |         mWidgetColor = config.widgetBgColor | ||||||
|  |         mWidgetAlpha = if (mWidgetColor == DEFAULT_WIDGET_BG_COLOR) { | ||||||
|  |             1f | ||||||
|  |         } else { | ||||||
|  |             Color.alpha(mWidgetColor) / 255.toFloat() | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         mWidgetColorWithoutTransparency = Color.rgb(Color.red(mWidgetColor), Color.green(mWidgetColor), Color.blue(mWidgetColor)) | ||||||
|  |         config_widget_seekbar.setOnSeekBarChangeListener(seekbarChangeListener) | ||||||
|  |         config_widget_seekbar.progress = (mWidgetAlpha * 100).toInt() | ||||||
|  |         updateColors() | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun saveConfig() { | ||||||
|  |         config.widgetBgColor = mWidgetColor | ||||||
|  |         requestWidgetUpdate() | ||||||
|  |  | ||||||
|  |         Intent().apply { | ||||||
|  |             putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId) | ||||||
|  |             setResult(Activity.RESULT_OK, this) | ||||||
|  |         } | ||||||
|  |         finish() | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun pickBackgroundColor() { | ||||||
|  |         ColorPickerDialog(this, mWidgetColorWithoutTransparency) { wasPositivePressed, color -> | ||||||
|  |             if (wasPositivePressed) { | ||||||
|  |                 mWidgetColorWithoutTransparency = color | ||||||
|  |                 updateColors() | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun requestWidgetUpdate() { | ||||||
|  |         Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetTorchProvider::class.java).apply { | ||||||
|  |             putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId)) | ||||||
|  |             sendBroadcast(this) | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         updateBrightDisplayWidget() | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun updateColors() { | ||||||
|  |         mWidgetColor = mWidgetColorWithoutTransparency.adjustAlpha(mWidgetAlpha) | ||||||
|  |         config_widget_color.setFillWithStroke(mWidgetColor, Color.BLACK) | ||||||
|  |         config_image.background.mutate().applyColorFilter(mWidgetColor) | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private val seekbarChangeListener = object : SeekBar.OnSeekBarChangeListener { | ||||||
|  |         override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { | ||||||
|  |             mWidgetAlpha = progress.toFloat() / 100.toFloat() | ||||||
|  |             updateColors() | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         override fun onStartTrackingTouch(seekBar: SeekBar) {} | ||||||
|  |  | ||||||
|  |         override fun onStopTrackingTouch(seekBar: SeekBar) {} | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -7,22 +7,32 @@ import android.content.Intent | |||||||
| import android.graphics.Bitmap | import android.graphics.Bitmap | ||||||
| import android.graphics.Canvas | import android.graphics.Canvas | ||||||
| import android.graphics.drawable.Drawable | import android.graphics.drawable.Drawable | ||||||
| import com.simplemobiletools.flashlight.helpers.Config | import com.simplemobiletools.flashlight.helpers.* | ||||||
| import com.simplemobiletools.flashlight.helpers.IS_ENABLED |  | ||||||
| import com.simplemobiletools.flashlight.helpers.MyWidgetProvider |  | ||||||
| import com.simplemobiletools.flashlight.helpers.TOGGLE_WIDGET_UI |  | ||||||
|  |  | ||||||
| val Context.config: Config get() = Config.newInstance(applicationContext) | val Context.config: Config get() = Config.newInstance(applicationContext) | ||||||
|  |  | ||||||
| fun Context.updateWidgets(isEnabled: Boolean) { | fun Context.updateWidgets(isEnabled: Boolean) { | ||||||
|     val widgetIDs = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java)) |     val widgetIDs = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetTorchProvider::class.java)) | ||||||
|     if (widgetIDs.isNotEmpty()) { |     if (widgetIDs.isNotEmpty()) { | ||||||
|         Intent(applicationContext, MyWidgetProvider::class.java).apply { |         Intent(applicationContext, MyWidgetTorchProvider::class.java).apply { | ||||||
|             action = TOGGLE_WIDGET_UI |             action = TOGGLE_WIDGET_UI | ||||||
|             putExtra(IS_ENABLED, isEnabled) |             putExtra(IS_ENABLED, isEnabled) | ||||||
|             sendBroadcast(this) |             sendBroadcast(this) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     updateBrightDisplayWidget() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | fun Context.updateBrightDisplayWidget() { | ||||||
|  |     val widgetIDs = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetBrightDisplayProvider::class.java)) | ||||||
|  |     if (widgetIDs.isNotEmpty()) { | ||||||
|  |         Intent(applicationContext, MyWidgetBrightDisplayProvider::class.java).apply { | ||||||
|  |             action = AppWidgetManager.ACTION_APPWIDGET_UPDATE | ||||||
|  |             putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, widgetIDs) | ||||||
|  |             sendBroadcast(this) | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| fun Context.drawableToBitmap(drawable: Drawable): Bitmap { | fun Context.drawableToBitmap(drawable: Drawable): Bitmap { | ||||||
|   | |||||||
| @@ -0,0 +1,50 @@ | |||||||
|  | package com.simplemobiletools.flashlight.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.graphics.Bitmap | ||||||
|  | import android.graphics.Color | ||||||
|  | import android.widget.RemoteViews | ||||||
|  | import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor | ||||||
|  | import com.simplemobiletools.flashlight.R | ||||||
|  | import com.simplemobiletools.flashlight.activities.BrightDisplayActivity | ||||||
|  | import com.simplemobiletools.flashlight.extensions.config | ||||||
|  | import com.simplemobiletools.flashlight.extensions.drawableToBitmap | ||||||
|  |  | ||||||
|  | class MyWidgetBrightDisplayProvider : AppWidgetProvider() { | ||||||
|  |     private val OPEN_APP_INTENT_ID = 1 | ||||||
|  |  | ||||||
|  |     override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { | ||||||
|  |         appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { | ||||||
|  |             RemoteViews(context.packageName, R.layout.widget_bright_display).apply { | ||||||
|  |                 setupAppOpenIntent(context, this) | ||||||
|  |  | ||||||
|  |                 val selectedColor = context.config.widgetBgColor | ||||||
|  |                 val alpha = Color.alpha(selectedColor) | ||||||
|  |  | ||||||
|  |                 val bmp = getColoredIcon(context, selectedColor, alpha) | ||||||
|  |                 setImageViewBitmap(R.id.bright_display_btn, bmp) | ||||||
|  |  | ||||||
|  |                 appWidgetManager.updateAppWidget(it, this) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun getComponentName(context: Context) = ComponentName(context, MyWidgetBrightDisplayProvider::class.java) | ||||||
|  |  | ||||||
|  |     private fun setupAppOpenIntent(context: Context, views: RemoteViews) { | ||||||
|  |         Intent(context, BrightDisplayActivity::class.java).apply { | ||||||
|  |             val pendingIntent = PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT) | ||||||
|  |             views.setOnClickPendingIntent(R.id.bright_display_btn, pendingIntent) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private fun getColoredIcon(context: Context, color: Int, alpha: Int): Bitmap { | ||||||
|  |         val drawable = context.resources.getColoredDrawableWithColor(R.drawable.ic_bright_display, color, alpha) | ||||||
|  |         return context.drawableToBitmap(drawable) | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -14,7 +14,7 @@ import com.simplemobiletools.flashlight.R | |||||||
| import com.simplemobiletools.flashlight.extensions.config | import com.simplemobiletools.flashlight.extensions.config | ||||||
| import com.simplemobiletools.flashlight.extensions.drawableToBitmap | import com.simplemobiletools.flashlight.extensions.drawableToBitmap | ||||||
| 
 | 
 | ||||||
| class MyWidgetProvider : AppWidgetProvider() { | class MyWidgetTorchProvider : AppWidgetProvider() { | ||||||
|     override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { |     override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { | ||||||
|         performUpdate(context) |         performUpdate(context) | ||||||
|     } |     } | ||||||
| @@ -22,8 +22,8 @@ class MyWidgetProvider : AppWidgetProvider() { | |||||||
|     private fun performUpdate(context: Context) { |     private fun performUpdate(context: Context) { | ||||||
|         val selectedColor = context.config.widgetBgColor |         val selectedColor = context.config.widgetBgColor | ||||||
|         val alpha = Color.alpha(selectedColor) |         val alpha = Color.alpha(selectedColor) | ||||||
|         val bmp = getColoredCircles(context, Color.WHITE, alpha) |         val bmp = getColoredIcon(context, Color.WHITE, alpha) | ||||||
|         val intent = Intent(context, MyWidgetProvider::class.java) |         val intent = Intent(context, MyWidgetTorchProvider::class.java) | ||||||
|         intent.action = TOGGLE |         intent.action = TOGGLE | ||||||
| 
 | 
 | ||||||
|         val appWidgetManager = AppWidgetManager.getInstance(context) |         val appWidgetManager = AppWidgetManager.getInstance(context) | ||||||
| @@ -37,7 +37,7 @@ class MyWidgetProvider : AppWidgetProvider() { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun getComponentName(context: Context) = ComponentName(context, MyWidgetProvider::class.java) |     private fun getComponentName(context: Context) = ComponentName(context, MyWidgetTorchProvider::class.java) | ||||||
| 
 | 
 | ||||||
|     override fun onReceive(context: Context, intent: Intent) { |     override fun onReceive(context: Context, intent: Intent) { | ||||||
|         when (intent.action) { |         when (intent.action) { | ||||||
| @@ -57,7 +57,7 @@ class MyWidgetProvider : AppWidgetProvider() { | |||||||
|             val widgetBgColor = context.config.widgetBgColor |             val widgetBgColor = context.config.widgetBgColor | ||||||
|             val alpha = Color.alpha(widgetBgColor) |             val alpha = Color.alpha(widgetBgColor) | ||||||
|             val selectedColor = if (enable) widgetBgColor else Color.WHITE |             val selectedColor = if (enable) widgetBgColor else Color.WHITE | ||||||
|             val bmp = getColoredCircles(context, selectedColor, alpha) |             val bmp = getColoredIcon(context, selectedColor, alpha) | ||||||
| 
 | 
 | ||||||
|             val appWidgetManager = AppWidgetManager.getInstance(context) |             val appWidgetManager = AppWidgetManager.getInstance(context) | ||||||
|             appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { |             appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach { | ||||||
| @@ -68,7 +68,7 @@ class MyWidgetProvider : AppWidgetProvider() { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun getColoredCircles(context: Context, color: Int, alpha: Int): Bitmap { |     private fun getColoredIcon(context: Context, color: Int, alpha: Int): Bitmap { | ||||||
|         val drawable = context.resources.getColoredDrawableWithColor(R.drawable.ic_flashlight, color, alpha) |         val drawable = context.resources.getColoredDrawableWithColor(R.drawable.ic_flashlight, color, alpha) | ||||||
|         return context.drawableToBitmap(drawable) |         return context.drawableToBitmap(drawable) | ||||||
|     } |     } | ||||||
							
								
								
									
										6
									
								
								app/src/main/res/layout/widget_bright_display.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/src/main/res/layout/widget_bright_display.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <ImageView xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:id="@+id/bright_display_btn" | ||||||
|  |     android:layout_width="wrap_content" | ||||||
|  |     android:layout_height="wrap_content" | ||||||
|  |     android:layout_margin="5dp" /> | ||||||
							
								
								
									
										61
									
								
								app/src/main/res/layout/widget_bright_display_config.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								app/src/main/res/layout/widget_bright_display_config.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:layout_width="match_parent" | ||||||
|  |     android:layout_height="wrap_content" | ||||||
|  |     android:layout_centerHorizontal="true" | ||||||
|  |     android:layout_margin="@dimen/activity_margin" | ||||||
|  |     android:paddingBottom="@dimen/activity_margin"> | ||||||
|  |  | ||||||
|  |     <RelativeLayout | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="match_parent" | ||||||
|  |         android:layout_above="@+id/config_widget_color" | ||||||
|  |         android:layout_marginBottom="@dimen/activity_margin" | ||||||
|  |         android:gravity="center"> | ||||||
|  |  | ||||||
|  |         <ImageView | ||||||
|  |             android:id="@+id/config_image" | ||||||
|  |             android:layout_width="@dimen/main_button_size" | ||||||
|  |             android:layout_height="@dimen/main_button_size" | ||||||
|  |             android:background="@drawable/ic_bright_display" /> | ||||||
|  |     </RelativeLayout> | ||||||
|  |  | ||||||
|  |     <ImageView | ||||||
|  |         android:id="@+id/config_widget_color" | ||||||
|  |         android:layout_width="@dimen/widget_colorpicker_size" | ||||||
|  |         android:layout_height="@dimen/widget_colorpicker_size" | ||||||
|  |         android:layout_above="@+id/config_save" /> | ||||||
|  |  | ||||||
|  |     <RelativeLayout | ||||||
|  |         android:id="@+id/config_widget_seekbar_holder" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="match_parent" | ||||||
|  |         android:layout_alignTop="@+id/config_widget_color" | ||||||
|  |         android:layout_alignBottom="@+id/config_widget_color" | ||||||
|  |         android:layout_toRightOf="@+id/config_widget_color" | ||||||
|  |         android:background="@android:color/white"> | ||||||
|  |  | ||||||
|  |         <SeekBar | ||||||
|  |             android:id="@+id/config_widget_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_save" | ||||||
|  |         android:layout_width="wrap_content" | ||||||
|  |         android:layout_height="wrap_content" | ||||||
|  |         android:layout_alignParentRight="true" | ||||||
|  |         android:layout_alignParentBottom="true" | ||||||
|  |         android:background="@color/gradient_grey_start" | ||||||
|  |         android:fontFamily="sans-serif-light" | ||||||
|  |         android:paddingLeft="@dimen/activity_margin" | ||||||
|  |         android:paddingRight="@dimen/activity_margin" | ||||||
|  |         android:text="@string/ok" | ||||||
|  |         android:textColor="@color/color_primary" | ||||||
|  |         android:textSize="@dimen/big_text_size" /> | ||||||
|  |  | ||||||
|  | </RelativeLayout> | ||||||
							
								
								
									
										8
									
								
								app/src/main/res/xml/widget_bright_display.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								app/src/main/res/xml/widget_bright_display.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:configure="com.simplemobiletools.flashlight.activities.WidgetBrightDisplayConfigureActivity" | ||||||
|  |     android:initialLayout="@layout/widget_bright_display" | ||||||
|  |     android:minWidth="40dp" | ||||||
|  |     android:minHeight="40dp" | ||||||
|  |     android:previewImage="@drawable/ic_bright_display" | ||||||
|  |     android:updatePeriodMillis="86400000" /> | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|     android:configure="com.simplemobiletools.flashlight.activities.WidgetConfigureActivity" |     android:configure="com.simplemobiletools.flashlight.activities.WidgetTorchConfigureActivity" | ||||||
|     android:initialLayout="@layout/widget_torch" |     android:initialLayout="@layout/widget_torch" | ||||||
|     android:minWidth="40dp" |     android:minWidth="40dp" | ||||||
|     android:minHeight="40dp" |     android:minHeight="40dp" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user