mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Implement deletion of OSC settings
This commit is contained in:
parent
3244344fc7
commit
9d7a28e408
@ -0,0 +1,41 @@
|
|||||||
|
package com.limelight.preferences;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.preference.DialogPreference;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.limelight.R;
|
||||||
|
|
||||||
|
import static com.limelight.binding.input.virtual_controller.VirtualControllerConfigurationLoader.OSC_PREFERENCE;
|
||||||
|
|
||||||
|
public class ConfirmDeleteOscPreference extends DialogPreference {
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public ConfirmDeleteOscPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfirmDeleteOscPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfirmDeleteOscPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public ConfirmDeleteOscPreference(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
|
getContext().getSharedPreferences(OSC_PREFERENCE, Context.MODE_PRIVATE).edit().clear().apply();
|
||||||
|
Toast.makeText(getContext(), R.string.toast_reset_osc_success, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -136,6 +136,11 @@
|
|||||||
<string name="summary_checkbox_show_onscreen_controls">Show virtual controller overlay on touchscreen</string>
|
<string name="summary_checkbox_show_onscreen_controls">Show virtual controller overlay on touchscreen</string>
|
||||||
<string name="title_only_l3r3">Only show L3 and R3</string>
|
<string name="title_only_l3r3">Only show L3 and R3</string>
|
||||||
<string name="summary_only_l3r3">Hide all virtual buttons except L3 and R3</string>
|
<string name="summary_only_l3r3">Hide all virtual buttons except L3 and R3</string>
|
||||||
|
<string name="title_reset_osc">Clear saved on-screen controls layout</string>
|
||||||
|
<string name="summary_reset_osc">Resets all on-screen controls to their default size and position</string>
|
||||||
|
<string name="dialog_title_reset_osc">Reset Layout</string>
|
||||||
|
<string name="dialog_text_reset_osc">Are you sure you want to delete your saved on-screen controls layout?</string>
|
||||||
|
<string name="toast_reset_osc_success">On-screen controls reset to default</string>
|
||||||
|
|
||||||
<string name="category_ui_settings">UI Settings</string>
|
<string name="category_ui_settings">UI Settings</string>
|
||||||
<string name="title_language_list">Language</string>
|
<string name="title_language_list">Language</string>
|
||||||
|
@ -84,6 +84,15 @@
|
|||||||
android:key="checkbox_only_show_L3R3"
|
android:key="checkbox_only_show_L3R3"
|
||||||
android:summary="@string/summary_only_l3r3"
|
android:summary="@string/summary_only_l3r3"
|
||||||
android:title="@string/title_only_l3r3" />
|
android:title="@string/title_only_l3r3" />
|
||||||
|
<com.limelight.preferences.ConfirmDeleteOscPreference
|
||||||
|
android:title="@string/title_reset_osc"
|
||||||
|
android:summary="@string/summary_reset_osc"
|
||||||
|
android:dialogTitle="@string/dialog_title_reset_osc"
|
||||||
|
android:dialogMessage="@string/dialog_text_reset_osc"
|
||||||
|
android:positiveButtonText="@string/yes"
|
||||||
|
android:negativeButtonText="@string/no"
|
||||||
|
/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/category_host_settings">
|
<PreferenceCategory android:title="@string/category_host_settings">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user