Created a setting to switch the sides of volume and brightness
This commit is contained in:
parent
acbb3d01d9
commit
c9b3dfda7e
5 changed files with 41 additions and 3 deletions
|
|
@ -6,8 +6,11 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.DateUtils;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.ListPreference;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
|
@ -21,6 +24,17 @@ import java.util.List;
|
|||
public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
||||
private SharedPreferences.OnSharedPreferenceChangeListener listener;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull final View rootView,
|
||||
@Nullable final Bundle savedInstanceState) {
|
||||
super.onViewCreated(rootView, savedInstanceState);
|
||||
findPreference(getString(R.string.switch_gesture_sides_key))
|
||||
.setEnabled(getPreferenceManager().getSharedPreferences()
|
||||
.getBoolean(getString(R.string.volume_gesture_control_key), true)
|
||||
&& getPreferenceManager().getSharedPreferences()
|
||||
.getBoolean(getString(R.string.brightness_gesture_control_key), true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||
addPreferencesFromResourceRegistry();
|
||||
|
|
@ -29,6 +43,12 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
|||
|
||||
listener = (sharedPreferences, key) -> {
|
||||
|
||||
findPreference(getString(R.string.switch_gesture_sides_key))
|
||||
.setEnabled(sharedPreferences.getBoolean(
|
||||
getString(R.string.volume_gesture_control_key), true)
|
||||
&& sharedPreferences.getBoolean(
|
||||
getString(R.string.brightness_gesture_control_key), true));
|
||||
|
||||
// on M and above, if user chooses to minimise to popup player on exit
|
||||
// and the app doesn't have display over other apps permission,
|
||||
// show a snackbar to let the user give permission
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue