Add settings

This commit is contained in:
Thomas 2023-03-19 16:26:20 +01:00
parent 327fac5f5a
commit 9fd701b102
4 changed files with 33 additions and 1 deletions

View File

@ -665,6 +665,8 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
MenuItem changeInstanceItem = menu.findItem(R.id.action_change_instance);
MenuItem exitItem = menu.findItem(R.id.action_exit);
MenuItem sepiaSearchItem = menu.findItem(R.id.action_sepia_search);
MenuItem settingsItem = menu.findItem(R.id.action_settings);
switch (typeOfConnection) {
case NORMAL:
incognitoItem.setVisible(true);
@ -674,6 +676,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
changeInstanceItem.setVisible(false);
exitItem.setVisible(false);
sepiaSearchItem.setVisible(false);
settingsItem.setVisible(false);
break;
case REMOTE_ACCOUNT:
case SURFING:
@ -681,6 +684,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
changeInstanceItem.setVisible(true);
exitItem.setVisible(true);
sepiaSearchItem.setVisible(true);
settingsItem.setVisible(true);
break;
}
@ -759,6 +763,9 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
} else if (item.getItemId() == R.id.action_sepia_search) {
Intent intent = new Intent(PeertubeMainActivity.this, SepiaSearchActivity.class);
startActivity(intent);
} else if (item.getItemId() == R.id.action_settings) {
Intent intent = new Intent(PeertubeMainActivity.this, SettingsActivity.class);
startActivity(intent);
}
return true;
}

View File

@ -1,6 +1,7 @@
package app.fedilab.android.peertube.fragment;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.typeOfConnection;
import static app.fedilab.android.peertube.activities.PeertubeMainActivity.userMe;
import android.content.Intent;
@ -20,6 +21,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@ -278,6 +280,15 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
return;
}
if (typeOfConnection == PeertubeMainActivity.TypeOfConnection.REMOTE_ACCOUNT) {
PreferenceCategory theming_category = findPreference("theming_category");
if (theming_category != null) {
getPreferenceScreen().removePreference(theming_category);
}
}
//****** My Account ******
Preference my_account = findPreference("my_account");

View File

@ -26,6 +26,12 @@
android:title="@string/sepia_search"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_baseline_settings_24"
android:title="@string/settings"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/action_about"
android:icon="@drawable/ic_baseline_info_24"

View File

@ -8,22 +8,28 @@
<Preference android:key="my_account" />
<PreferenceCategory android:title="@string/video_settings">
<!--
<androidx.preference.ListPreference
android:icon="@drawable/ic_baseline_slow_motion_video_24"
android:key="@string/set_video_mode_choice"
android:summary="@string/set_video_mode_description"
android:title="@string/set_video_mode" />
-->
<androidx.preference.SwitchPreference
android:icon="@drawable/ic_baseline_featured_video_24"
android:key="@string/set_video_minimize_choice"
android:summary="@string/set_video_minimize_description"
android:title="@string/set_video_minimize" />
<!--
<androidx.preference.ListPreference
android:icon="@drawable/ic_baseline_high_quality_24"
android:key="@string/set_video_quality_choice"
android:summary="@string/set_video_quality_description"
android:title="@string/set_quality_mode" />
-->
<androidx.preference.SwitchPreference
android:icon="@drawable/ic_baseline_play_arrow_24"
@ -81,7 +87,9 @@
android:title="@string/set_cast" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/theming">
<PreferenceCategory
android:key="theming_category"
android:title="@string/theming">
<ListPreference
app:defaultValue="SYSTEM"
app:dialogTitle="@string/type_of_theme"