mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
use the inherited mConfig variable
This commit is contained in:
parent
805f726022
commit
af3d247b7f
4 changed files with 14 additions and 15 deletions
|
@ -26,7 +26,6 @@ import android.widget.AdapterView;
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
|
|
||||||
import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog;
|
import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog;
|
||||||
import com.simplemobiletools.gallery.Config;
|
|
||||||
import com.simplemobiletools.gallery.Constants;
|
import com.simplemobiletools.gallery.Constants;
|
||||||
import com.simplemobiletools.gallery.R;
|
import com.simplemobiletools.gallery.R;
|
||||||
import com.simplemobiletools.gallery.Utils;
|
import com.simplemobiletools.gallery.Utils;
|
||||||
|
@ -147,7 +146,7 @@ public class MainActivity extends SimpleActivity
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
Config.newInstance(getApplicationContext()).setIsFirstRun(false);
|
mConfig.setIsFirstRun(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryloadGallery() {
|
private void tryloadGallery() {
|
||||||
|
@ -472,7 +471,7 @@ public class MainActivity extends SimpleActivity
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
if (items.valueAt(i)) {
|
if (items.valueAt(i)) {
|
||||||
final int id = items.keyAt(i);
|
final int id = items.keyAt(i);
|
||||||
if (getConfig().getIsFolderHidden(mDirs.get(id).getPath()))
|
if (mConfig.getIsFolderHidden(mDirs.get(id).getPath()))
|
||||||
hiddenCnt++;
|
hiddenCnt++;
|
||||||
else
|
else
|
||||||
unhiddenCnt++;
|
unhiddenCnt++;
|
||||||
|
@ -529,12 +528,12 @@ public class MainActivity extends SimpleActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideFolders() {
|
private void hideFolders() {
|
||||||
getConfig().addHiddenDirectories(getSelectedPaths());
|
mConfig.addHiddenDirectories(getSelectedPaths());
|
||||||
getDirectories();
|
getDirectories();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unhideFolders() {
|
private void unhideFolders() {
|
||||||
getConfig().removeHiddenDirectories(getSelectedPaths());
|
mConfig.removeHiddenDirectories(getSelectedPaths());
|
||||||
getDirectories();
|
getDirectories();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class MediaActivity extends SimpleActivity
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu_media, 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.hide_folder).setVisible(!isFolderHidden);
|
||||||
menu.findItem(R.id.unhide_folder).setVisible(isFolderHidden);
|
menu.findItem(R.id.unhide_folder).setVisible(isFolderHidden);
|
||||||
|
|
||||||
|
@ -187,16 +187,16 @@ public class MediaActivity extends SimpleActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideDirectory() {
|
private void hideDirectory() {
|
||||||
getConfig().addHiddenDirectory(mPath);
|
mConfig.addHiddenDirectory(mPath);
|
||||||
|
|
||||||
if (!getConfig().getShowHiddenFolders())
|
if (!mConfig.getShowHiddenFolders())
|
||||||
finish();
|
finish();
|
||||||
else
|
else
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unhideDirectory() {
|
private void unhideDirectory() {
|
||||||
getConfig().removeHiddenDirectory(mPath);
|
mConfig.removeHiddenDirectory(mPath);
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class MediaActivity extends SimpleActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Medium.mSorting = getConfig().getSorting();
|
Medium.mSorting = mConfig.getSorting();
|
||||||
Collections.sort(media);
|
Collections.sort(media);
|
||||||
|
|
||||||
final String[] invalids = invalidFiles.toArray(new String[invalidFiles.size()]);
|
final String[] invalids = invalidFiles.toArray(new String[invalidFiles.size()]);
|
||||||
|
|
|
@ -387,7 +387,7 @@ public class ViewPagerActivity extends SimpleActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Medium.mSorting = getConfig().getSorting();
|
Medium.mSorting = mConfig.getSorting();
|
||||||
Collections.sort(media);
|
Collections.sort(media);
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (Medium medium : media) {
|
for (Medium medium : media) {
|
||||||
|
|
|
@ -11,13 +11,13 @@ import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.Utils
|
import com.simplemobiletools.gallery.Utils
|
||||||
|
|
||||||
open class SimpleActivity : AppCompatActivity() {
|
open class SimpleActivity : AppCompatActivity() {
|
||||||
lateinit var config: Config
|
lateinit var mConfig: Config
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
config = Config.newInstance(applicationContext)
|
mConfig = Config.newInstance(applicationContext)
|
||||||
var theme = if (config.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme
|
var theme = if (mConfig.isDarkTheme) R.style.AppTheme_Dark else R.style.AppTheme
|
||||||
if (this is ViewPagerActivity || this is PhotoActivity || this is VideoActivity) {
|
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)
|
setTheme(theme)
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
Loading…
Reference in a new issue