Added option to reset application rule

This commit is contained in:
M66B 2015-12-27 09:07:38 +01:00
parent da73ccdc26
commit 086a6ffc52
2 changed files with 21 additions and 0 deletions

View File

@ -102,6 +102,7 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
public CheckBox cbScreenOther;
public CheckBox cbRoaming;
public ImageButton btnClear;
public ImageButton btnSettings;
public Button btnLaunch;
@ -139,6 +140,7 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
cbScreenOther = (CheckBox) itemView.findViewById(R.id.cbScreenOther);
cbRoaming = (CheckBox) itemView.findViewById(R.id.cbRoaming);
btnClear = (ImageButton) itemView.findViewById(R.id.btnClear);
btnSettings = (ImageButton) itemView.findViewById(R.id.btnSettings);
btnLaunch = (Button) itemView.findViewById(R.id.btnLaunch);
@ -409,6 +411,18 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
}
});
// Reset rule
holder.btnClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
holder.cbWifi.setChecked(rule.wifi_default);
holder.cbOther.setChecked(rule.other_default);
holder.cbScreenWifi.setChecked(rule.screen_wifi_default);
holder.cbScreenOther.setChecked(rule.screen_other_default);
holder.cbRoaming.setChecked(rule.roaming_default);
}
});
// Launch application settings
final Intent settings = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
settings.setData(Uri.parse("package:" + rule.info.packageName));

View File

@ -259,10 +259,17 @@
android:layout_marginTop="4dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/btnClear"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@android:drawable/ic_menu_delete" />
<ImageButton
android:id="@+id/btnSettings"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:src="@drawable/ic_settings_white_24dp" />
<Button