From af3d247b7f4f082b122cb24c50d8a1c505ca1768 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 10 Nov 2016 22:44:05 +0100 Subject: [PATCH] use the inherited mConfig variable --- .../gallery/activities/MainActivity.java | 9 ++++----- .../gallery/activities/MediaActivity.java | 10 +++++----- .../gallery/activities/ViewPagerActivity.java | 2 +- .../gallery/activities/SimpleActivity.kt | 8 ++++---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 1c3fbe597..8968abe75 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -26,7 +26,6 @@ import android.widget.AdapterView; import android.widget.GridView; import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog; -import com.simplemobiletools.gallery.Config; import com.simplemobiletools.gallery.Constants; import com.simplemobiletools.gallery.R; import com.simplemobiletools.gallery.Utils; @@ -147,7 +146,7 @@ public class MainActivity extends SimpleActivity @Override protected void onDestroy() { super.onDestroy(); - Config.newInstance(getApplicationContext()).setIsFirstRun(false); + mConfig.setIsFirstRun(false); } private void tryloadGallery() { @@ -472,7 +471,7 @@ public class MainActivity extends SimpleActivity for (int i = 0; i < cnt; i++) { if (items.valueAt(i)) { final int id = items.keyAt(i); - if (getConfig().getIsFolderHidden(mDirs.get(id).getPath())) + if (mConfig.getIsFolderHidden(mDirs.get(id).getPath())) hiddenCnt++; else unhiddenCnt++; @@ -529,12 +528,12 @@ public class MainActivity extends SimpleActivity } private void hideFolders() { - getConfig().addHiddenDirectories(getSelectedPaths()); + mConfig.addHiddenDirectories(getSelectedPaths()); getDirectories(); } private void unhideFolders() { - getConfig().removeHiddenDirectories(getSelectedPaths()); + mConfig.removeHiddenDirectories(getSelectedPaths()); getDirectories(); } diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index 1a29888e6..ef559c90f 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -137,7 +137,7 @@ public class MediaActivity extends SimpleActivity public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_media, menu); - final boolean isFolderHidden = getConfig().getIsFolderHidden(mPath); + final boolean isFolderHidden = mConfig.getIsFolderHidden(mPath); menu.findItem(R.id.hide_folder).setVisible(!isFolderHidden); menu.findItem(R.id.unhide_folder).setVisible(isFolderHidden); @@ -187,16 +187,16 @@ public class MediaActivity extends SimpleActivity } private void hideDirectory() { - getConfig().addHiddenDirectory(mPath); + mConfig.addHiddenDirectory(mPath); - if (!getConfig().getShowHiddenFolders()) + if (!mConfig.getShowHiddenFolders()) finish(); else invalidateOptionsMenu(); } private void unhideDirectory() { - getConfig().removeHiddenDirectory(mPath); + mConfig.removeHiddenDirectory(mPath); invalidateOptionsMenu(); } @@ -249,7 +249,7 @@ public class MediaActivity extends SimpleActivity } } - Medium.mSorting = getConfig().getSorting(); + Medium.mSorting = mConfig.getSorting(); Collections.sort(media); final String[] invalids = invalidFiles.toArray(new String[invalidFiles.size()]); diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 5789edea7..2b78d0fbd 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -387,7 +387,7 @@ public class ViewPagerActivity extends SimpleActivity } } - Medium.mSorting = getConfig().getSorting(); + Medium.mSorting = mConfig.getSorting(); Collections.sort(media); int j = 0; for (Medium medium : media) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt index 284f44e27..c881c67e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt @@ -11,13 +11,13 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.Utils open class SimpleActivity : AppCompatActivity() { - lateinit var config: Config + lateinit var mConfig: Config override fun onCreate(savedInstanceState: Bundle?) { - config = Config.newInstance(applicationContext) - var theme = if (config.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme + mConfig = Config.newInstance(applicationContext) + var theme = if (mConfig.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme if (this is ViewPagerActivity || this is PhotoActivity || this is VideoActivity) { - theme = if (config.isDarkTheme) R.style.FullScreenTheme_Dark else R.style.FullScreenTheme + theme = if (mConfig.isDarkTheme) R.style.FullScreenTheme_Dark else R.style.FullScreenTheme } setTheme(theme) super.onCreate(savedInstanceState)