use black status bar at fullscreen media when set so

This commit is contained in:
tibbi 2017-12-19 10:55:01 +01:00
parent ef2d34ac45
commit 8b9810bab9
7 changed files with 19 additions and 11 deletions

View File

@ -43,7 +43,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.2.19' implementation 'com.simplemobiletools:commons:3.3.1'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'

View File

@ -89,7 +89,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
supportFragmentManager.beginTransaction().replace(R.id.fragment_holder, mFragment).commit() supportFragmentManager.beginTransaction().replace(R.id.fragment_holder, mFragment).commit()
} }
if (config.darkBackground) { if (config.blackBackground) {
fragment_holder.background = ColorDrawable(Color.BLACK) fragment_holder.background = ColorDrawable(Color.BLACK)
} }
@ -102,6 +102,9 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background))
if (config.blackBackground) {
updateStatusbarColor(Color.BLACK)
}
} }
private fun sendViewPagerIntent(path: String) { private fun sendViewPagerIntent(path: String) {

View File

@ -148,10 +148,10 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupDarkBackground() { private fun setupDarkBackground() {
settings_dark_background.isChecked = config.darkBackground settings_black_background.isChecked = config.blackBackground
settings_dark_background_holder.setOnClickListener { settings_black_background_holder.setOnClickListener {
settings_dark_background.toggle() settings_black_background.toggle()
config.darkBackground = settings_dark_background.isChecked config.blackBackground = settings_black_background.isChecked
} }
} }

View File

@ -116,6 +116,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
setupRotation() setupRotation()
invalidateOptionsMenu() invalidateOptionsMenu()
if (config.blackBackground) {
updateStatusbarColor(Color.BLACK)
}
} }
override fun onPause() { override fun onPause() {
@ -198,8 +202,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
reloadViewPager() reloadViewPager()
scanPath(mPath) scanPath(mPath)
if (config.darkBackground) if (config.blackBackground) {
view_pager.background = ColorDrawable(Color.BLACK) view_pager.background = ColorDrawable(Color.BLACK)
}
if (config.hideSystemUI) if (config.hideSystemUI)
fragmentClicked() fragmentClicked()

View File

@ -252,7 +252,7 @@ class PhotoFragment : ViewPagerFragment() {
} }
override fun onReady() { override fun onReady() {
background = ColorDrawable(if (context.config.darkBackground) Color.BLACK else context.config.backgroundColor) background = ColorDrawable(if (context.config.blackBackground) Color.BLACK else context.config.backgroundColor)
setDoubleTapZoomScale(getDoubleTapZoomScale(sWidth, sHeight)) setDoubleTapZoomScale(getDoubleTapZoomScale(sWidth, sHeight))
} }

View File

@ -156,7 +156,7 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false) get() = prefs.getBoolean(DISPLAY_FILE_NAMES, false)
set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply() set(display) = prefs.edit().putBoolean(DISPLAY_FILE_NAMES, display).apply()
var darkBackground: Boolean var blackBackground: Boolean
get() = prefs.getBoolean(DARK_BACKGROUND, false) get() = prefs.getBoolean(DARK_BACKGROUND, false)
set(darkBackground) = prefs.edit().putBoolean(DARK_BACKGROUND, darkBackground).apply() set(darkBackground) = prefs.edit().putBoolean(DARK_BACKGROUND, darkBackground).apply()

View File

@ -209,7 +209,7 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_dark_background_holder" android:id="@+id/settings_black_background_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
@ -217,7 +217,7 @@
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat <com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_dark_background" android:id="@+id/settings_black_background"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@null" android:background="@null"