add a toggle for autoplaying videos
This commit is contained in:
parent
37bda0c72e
commit
6e0f60b770
11 changed files with 56 additions and 0 deletions
|
@ -102,4 +102,12 @@ public class Config {
|
||||||
public boolean getIsFolderHidden(String path) {
|
public boolean getIsFolderHidden(String path) {
|
||||||
return getHiddenFolders().contains(path);
|
return getHiddenFolders().contains(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAutoplayVideos() {
|
||||||
|
return mPrefs.getBoolean(Constants.AUTOPLAY_VIDEOS, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoplayVideos(boolean autoplay) {
|
||||||
|
mPrefs.edit().putBoolean(Constants.AUTOPLAY_VIDEOS, autoplay).apply();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ public class Constants {
|
||||||
public static final String DIRECTORY_SORT_ORDER = "directory_sort_order";
|
public static final String DIRECTORY_SORT_ORDER = "directory_sort_order";
|
||||||
public static final String HIDDEN_FOLDERS = "hidden_folders";
|
public static final String HIDDEN_FOLDERS = "hidden_folders";
|
||||||
public static final String SHOW_HIDDEN_FOLDERS = "show_hidden_folders";
|
public static final String SHOW_HIDDEN_FOLDERS = "show_hidden_folders";
|
||||||
|
public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
|
||||||
|
|
||||||
// sorting
|
// sorting
|
||||||
public static final int SORT_BY_NAME = 1;
|
public static final int SORT_BY_NAME = 1;
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class SettingsActivity extends SimpleActivity {
|
||||||
@BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch;
|
@BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch;
|
||||||
@BindView(R.id.settings_same_sorting) SwitchCompat mSameSortingSwitch;
|
@BindView(R.id.settings_same_sorting) SwitchCompat mSameSortingSwitch;
|
||||||
@BindView(R.id.settings_show_hidden_folders) SwitchCompat mShowHiddenFoldersSwitch;
|
@BindView(R.id.settings_show_hidden_folders) SwitchCompat mShowHiddenFoldersSwitch;
|
||||||
|
@BindView(R.id.settings_autoplay_videos) SwitchCompat mAutoplayVideosSwitch;
|
||||||
|
|
||||||
private static Config mConfig;
|
private static Config mConfig;
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ public class SettingsActivity extends SimpleActivity {
|
||||||
setupDarkTheme();
|
setupDarkTheme();
|
||||||
setupSameSorting();
|
setupSameSorting();
|
||||||
setupShowHiddenFolders();
|
setupShowHiddenFolders();
|
||||||
|
setupAutoplayVideos();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDarkTheme() {
|
private void setupDarkTheme() {
|
||||||
|
@ -42,6 +44,10 @@ public class SettingsActivity extends SimpleActivity {
|
||||||
mShowHiddenFoldersSwitch.setChecked(mConfig.getShowHiddenFolders());
|
mShowHiddenFoldersSwitch.setChecked(mConfig.getShowHiddenFolders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupAutoplayVideos() {
|
||||||
|
mAutoplayVideosSwitch.setChecked(mConfig.getAutoplayVideos());
|
||||||
|
}
|
||||||
|
|
||||||
@OnClick(R.id.settings_dark_theme_holder)
|
@OnClick(R.id.settings_dark_theme_holder)
|
||||||
public void handleDarkTheme() {
|
public void handleDarkTheme() {
|
||||||
mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked());
|
mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked());
|
||||||
|
@ -61,6 +67,12 @@ public class SettingsActivity extends SimpleActivity {
|
||||||
mConfig.setShowHiddenFolders(mShowHiddenFoldersSwitch.isChecked());
|
mConfig.setShowHiddenFolders(mShowHiddenFoldersSwitch.isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OnClick(R.id.settings_autoplay_videos_holder)
|
||||||
|
public void handleAutoplayVideos() {
|
||||||
|
mAutoplayVideosSwitch.setChecked(!mAutoplayVideosSwitch.isChecked());
|
||||||
|
mConfig.setAutoplayVideos(mAutoplayVideosSwitch.isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
private void restartActivity() {
|
private void restartActivity() {
|
||||||
TaskStackBuilder.create(getApplicationContext()).addNextIntentWithParentStack(getIntent()).startActivities();
|
TaskStackBuilder.create(getApplicationContext()).addNextIntentWithParentStack(getIntent()).startActivities();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,5 +94,33 @@
|
||||||
android:clickable="false"/>
|
android:clickable="false"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_autoplay_videos_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/settings_padding"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/settings_autoplay_videos_label"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:paddingLeft="@dimen/settings_padding"
|
||||||
|
android:paddingStart="@dimen/settings_padding"
|
||||||
|
android:text="@string/autoplay_videos"/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.SwitchCompat
|
||||||
|
android:id="@+id/settings_autoplay_videos"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">Dunkles Design</string>
|
<string name="dark_theme">Dunkles Design</string>
|
||||||
<string name="same_sorting">Selbe Sortierung für Dateien und Ordner</string>
|
<string name="same_sorting">Selbe Sortierung für Dateien und Ordner</string>
|
||||||
<string name="show_hidden_folders">Zeige versteckte Ordner</string>
|
<string name="show_hidden_folders">Zeige versteckte Ordner</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke.</string>
|
<string name="notice">Diese App nutzt die folgenden Drittanbieterbilbiotheken, die mein Leben einfacher machen. Danke.</string>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">Tema oscuro</string>
|
<string name="dark_theme">Tema oscuro</string>
|
||||||
<string name="same_sorting">Ordenar del mismo modo los archivos y las carpetas</string>
|
<string name="same_sorting">Ordenar del mismo modo los archivos y las carpetas</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias.</string>
|
<string name="notice">Esta aplicación usa las siguientes bibliotecas de terceros que hacen mi vida más fácil. Gracias.</string>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">Tema scuro</string>
|
<string name="dark_theme">Tema scuro</string>
|
||||||
<string name="same_sorting">Same sorting for files and folders</string>
|
<string name="same_sorting">Same sorting for files and folders</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie.</string>
|
<string name="notice">Questa app usa le seguenti librerie di terze parti per semplificarmi la vita. Grazie.</string>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">ダークテーマ</string>
|
<string name="dark_theme">ダークテーマ</string>
|
||||||
<string name="same_sorting">Same sorting for files and folders</string>
|
<string name="same_sorting">Same sorting for files and folders</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">このアプリは、私の人生を容易にするために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。</string>
|
<string name="notice">このアプリは、私の人生を容易にするために、次のサードパーティのライブラリーを使用しています。 ありがとうございます。</string>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">Tema escuro</string>
|
<string name="dark_theme">Tema escuro</string>
|
||||||
<string name="same_sorting">A mesma ordenação para ficheiros e pastas</string>
|
<string name="same_sorting">A mesma ordenação para ficheiros e pastas</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado.</string>
|
<string name="notice">Esta aplicação usa as seguintes bibliotecas de terceiros para facilitar a minha vida. Obrigado.</string>
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<string name="dark_theme">Mörkt tema</string>
|
<string name="dark_theme">Mörkt tema</string>
|
||||||
<string name="same_sorting">Same sorting for files and folders</string>
|
<string name="same_sorting">Same sorting for files and folders</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack.</string>
|
<string name="notice">Denna app använder följande tredjepartsbibliotek för att göra mitt liv enklare. Tack.</string>
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<string name="dark_theme">Dark theme</string>
|
<string name="dark_theme">Dark theme</string>
|
||||||
<string name="same_sorting">Same sorting for files and folders</string>
|
<string name="same_sorting">Same sorting for files and folders</string>
|
||||||
<string name="show_hidden_folders">Show hidden folders</string>
|
<string name="show_hidden_folders">Show hidden folders</string>
|
||||||
|
<string name="autoplay_videos">Start videos automatically</string>
|
||||||
|
|
||||||
<!-- License -->
|
<!-- License -->
|
||||||
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>
|
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>
|
||||||
|
|
Loading…
Reference in a new issue