Explain what to be sure about

This commit is contained in:
M66B 2016-02-03 07:33:06 +01:00
parent b33ed72d3c
commit bdfc007218
4 changed files with 22 additions and 5 deletions

View File

@ -495,7 +495,7 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
holder.btnClear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Util.areYouSure(view.getContext(), new Util.DoubtListener() {
Util.areYouSure(view.getContext(), R.string.msg_clear_rules, new Util.DoubtListener() {
@Override
public void onSure() {
holder.cbWifi.setChecked(rule.wifi_default);
@ -616,7 +616,7 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
holder.btnClearAccess.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Util.areYouSure(view.getContext(), new Util.DoubtListener() {
Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() {
@Override
public void onSure() {
dh.clearAccess(rule.info.applicationInfo.uid);

View File

@ -48,6 +48,9 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import java.io.BufferedReader;
import java.io.IOException;
@ -416,9 +419,13 @@ public class Util {
public void onSure();
}
public static void areYouSure(Context context, final DoubtListener listener) {
public static void areYouSure(Context context, int explanation, final DoubtListener listener) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.sure, null);
TextView tvExplanation = (TextView) view.findViewById(R.id.tvExplanation);
tvExplanation.setText(explanation);
new AlertDialog.Builder(context)
.setView(R.layout.sure)
.setView(view)
.setCancelable(true)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override

View File

@ -27,10 +27,18 @@
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/tvExplanation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="@style/TextMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/msg_sure"
android:textAppearance="@style/TextMedium" />
android:textAppearance="@style/TextMedium"
android:textStyle="bold" />
</LinearLayout>

View File

@ -122,6 +122,8 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="msg_mbsec">%7.3f MB/s</string>
<string name="msg_filter">Using filtering will cause Android to attribute data and power usage to NetGuard - Android assumes the data and power are being used by NetGuard, rather than the original applications</string>
<string name="msg_log_disabled">Traffic logging is disabled, use the switch above to enable logging. Traffic logging might result in extra battery usage.</string>
<string name="msg_clear_rules">This will reset the rules and conditions to their default values</string>
<string name="msg_reset_access">This will delete access attempt log lines without allow/block rules</string>
<string name="title_conditions">Conditions</string>
<string name="title_screen_wifi">Allow Wi-Fi when screen is on</string>