mirror of
				https://github.com/SimpleMobileTools/Simple-Flashlight.git
				synced 2025-06-05 21:59:19 +02:00 
			
		
		
		
	apply all selected colors on the main screen
This commit is contained in:
		| @@ -28,7 +28,6 @@ class MainActivity : SimpleActivity() { | |||||||
|  |  | ||||||
|     private var mBus: Bus? = null |     private var mBus: Bus? = null | ||||||
|     private var mCameraImpl: MyCameraImpl? = null |     private var mCameraImpl: MyCameraImpl? = null | ||||||
|     private var translucentWhite = 0 |  | ||||||
|     private var mStoredUseEnglish = false |     private var mStoredUseEnglish = false | ||||||
|  |  | ||||||
|     override fun onCreate(savedInstanceState: Bundle?) { |     override fun onCreate(savedInstanceState: Bundle?) { | ||||||
| @@ -37,9 +36,7 @@ class MainActivity : SimpleActivity() { | |||||||
|         appLaunched() |         appLaunched() | ||||||
|  |  | ||||||
|         mBus = BusProvider.instance |         mBus = BusProvider.instance | ||||||
|         translucentWhite = resources.getColor(R.color.translucent_white) |         changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn) | ||||||
|         changeIconColor(translucentWhite, bright_display_btn) |  | ||||||
|         changeIconColor(translucentWhite, stroboscope_btn) |  | ||||||
|  |  | ||||||
|         bright_display_btn.setOnClickListener { |         bright_display_btn.setOnClickListener { | ||||||
|             startActivity(Intent(applicationContext, BrightDisplayActivity::class.java)) |             startActivity(Intent(applicationContext, BrightDisplayActivity::class.java)) | ||||||
| @@ -63,13 +60,18 @@ class MainActivity : SimpleActivity() { | |||||||
|         mCameraImpl!!.handleCameraSetup() |         mCameraImpl!!.handleCameraSetup() | ||||||
|         checkState(MyCameraImpl.isFlashlightOn) |         checkState(MyCameraImpl.isFlashlightOn) | ||||||
|  |  | ||||||
|  |         changeIconColor(config.backgroundColor.getContrastColor(), bright_display_btn) | ||||||
|         bright_display_btn.beVisibleIf(config.brightDisplay) |         bright_display_btn.beVisibleIf(config.brightDisplay) | ||||||
|         stroboscope_btn.beVisibleIf(config.stroboscope) |         stroboscope_btn.beVisibleIf(config.stroboscope) | ||||||
|         if (!config.stroboscope) { |         if (!config.stroboscope) { | ||||||
|             mCameraImpl!!.stopStroboscope() |             mCameraImpl!!.stopStroboscope() | ||||||
|             stroboscope_bar.beInvisible() |             stroboscope_bar.beInvisible() | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         updateTextColors(main_holder) |         updateTextColors(main_holder) | ||||||
|  |         if (stroboscope_bar.isInvisible()) { | ||||||
|  |             changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn) | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     override fun onStart() { |     override fun onStart() { | ||||||
| @@ -169,8 +171,8 @@ class MainActivity : SimpleActivity() { | |||||||
|  |  | ||||||
|     private fun cameraPermissionGranted() { |     private fun cameraPermissionGranted() { | ||||||
|         if (mCameraImpl!!.toggleStroboscope()) { |         if (mCameraImpl!!.toggleStroboscope()) { | ||||||
|             stroboscope_bar.beInvisibleIf(stroboscope_bar.visibility == View.VISIBLE) |             stroboscope_bar.beInvisibleIf(stroboscope_bar.isVisible()) | ||||||
|             changeIconColor(if (stroboscope_bar.visibility == View.VISIBLE) config.primaryColor else translucentWhite, stroboscope_btn) |             changeIconColor(if (stroboscope_bar.isVisible()) config.primaryColor else config.backgroundColor.getContrastColor(), stroboscope_btn) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -196,12 +198,12 @@ class MainActivity : SimpleActivity() { | |||||||
|         changeIconColor(config.primaryColor, toggle_btn) |         changeIconColor(config.primaryColor, toggle_btn) | ||||||
|         window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |         window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | ||||||
|  |  | ||||||
|         changeIconColor(translucentWhite, stroboscope_btn) |         changeIconColor(config.backgroundColor.getContrastColor(), stroboscope_btn) | ||||||
|         stroboscope_bar.beInvisible() |         stroboscope_bar.beInvisible() | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun disableFlashlight() { |     private fun disableFlashlight() { | ||||||
|         changeIconColor(translucentWhite, toggle_btn) |         changeIconColor(config.backgroundColor.getContrastColor(), toggle_btn) | ||||||
|         window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) |         window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ | |||||||
|             android:shape="oval"> |             android:shape="oval"> | ||||||
|             <stroke |             <stroke | ||||||
|                 android:width="13dp" |                 android:width="13dp" | ||||||
|                 android:color="@color/translucent_white"/> |                 android:color="@android:color/white"/> | ||||||
|             <solid android:color="@android:color/transparent"/> |             <solid android:color="@android:color/transparent"/> | ||||||
|         </shape> |         </shape> | ||||||
|     </item> |     </item> | ||||||
| @@ -33,7 +33,7 @@ | |||||||
|             android:shape="oval"> |             android:shape="oval"> | ||||||
|             <stroke |             <stroke | ||||||
|                 android:width="13dp" |                 android:width="13dp" | ||||||
|                 android:color="@color/translucent_white"/> |                 android:color="@android:color/white"/> | ||||||
|             <solid android:color="@android:color/transparent"/> |             <solid android:color="@android:color/transparent"/> | ||||||
|         </shape> |         </shape> | ||||||
|     </item> |     </item> | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ | |||||||
|     android:id="@+id/main_holder" |     android:id="@+id/main_holder" | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="match_parent" |     android:layout_height="match_parent" | ||||||
|     android:background="@android:color/black" |  | ||||||
|     android:gravity="center" |     android:gravity="center" | ||||||
|     android:orientation="vertical" |     android:orientation="vertical" | ||||||
|     android:padding="@dimen/activity_margin"> |     android:padding="@dimen/activity_margin"> | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ | |||||||
|  |  | ||||||
|     <Button |     <Button | ||||||
|         android:id="@+id/config_widget_color" |         android:id="@+id/config_widget_color" | ||||||
|         android:layout_width="50dp" |         android:layout_width="@dimen/widget_colorpicker_size" | ||||||
|         android:layout_height="50dp" |         android:layout_height="@dimen/widget_colorpicker_size" | ||||||
|         android:layout_above="@+id/config_save"/> |         android:layout_above="@+id/config_save"/> | ||||||
|  |  | ||||||
|     <RelativeLayout |     <RelativeLayout | ||||||
| @@ -48,10 +48,10 @@ | |||||||
|     <Button |     <Button | ||||||
|         android:id="@+id/config_save" |         android:id="@+id/config_save" | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="50dp" |         android:layout_height="wrap_content" | ||||||
|         android:layout_alignParentBottom="true" |         android:layout_alignParentBottom="true" | ||||||
|         android:layout_alignParentRight="true" |         android:layout_alignParentRight="true" | ||||||
|         android:background="@color/translucent_black" |         android:background="@color/gradient_grey_start" | ||||||
|         android:fontFamily="sans-serif-light" |         android:fontFamily="sans-serif-light" | ||||||
|         android:paddingLeft="@dimen/activity_margin" |         android:paddingLeft="@dimen/activity_margin" | ||||||
|         android:paddingRight="@dimen/activity_margin" |         android:paddingRight="@dimen/activity_margin" | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <resources> | <resources> | ||||||
|     <color name="translucent_white">#eeffffff</color> |     <!-- Default colors --> | ||||||
|     <color name="translucent_black">#88000000</color> |     <color name="default_text_color">@color/theme_dark_text_color</color> | ||||||
|  |     <color name="default_background_color">@color/theme_dark_background_color</color> | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user