mirror of https://github.com/M66B/NetGuard.git
Maded 'person' clickable
This commit is contained in:
parent
6567e41e6d
commit
6178c563f2
|
@ -39,8 +39,9 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
public TextView tvPackage;
|
||||
public CheckBox cbWifi;
|
||||
public CheckBox cbOther;
|
||||
public ImageView ivUnused;
|
||||
public LinearLayout llAttributes;
|
||||
public ImageView ivUnused;
|
||||
public LinearLayout llConfiguration;
|
||||
public CheckBox cbUnused;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
|
@ -52,8 +53,9 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
tvPackage = (TextView) itemView.findViewById(R.id.tvPackage);
|
||||
cbWifi = (CheckBox) itemView.findViewById(R.id.cbWifi);
|
||||
cbOther = (CheckBox) itemView.findViewById(R.id.cbOther);
|
||||
ivUnused = (ImageView) itemView.findViewById(R.id.ivUnused);
|
||||
llAttributes = (LinearLayout) itemView.findViewById(R.id.llAttributes);
|
||||
ivUnused = (ImageView) itemView.findViewById(R.id.ivUnused);
|
||||
llConfiguration = (LinearLayout) itemView.findViewById(R.id.llConfiguration);
|
||||
cbUnused = (CheckBox) itemView.findViewById(R.id.cbUnused);
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +108,7 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
SharedPreferences punused = context.getSharedPreferences("unused", Context.MODE_PRIVATE);
|
||||
punused.edit().remove(rule.info.packageName).apply();
|
||||
holder.ivUnused.setVisibility(View.INVISIBLE);
|
||||
holder.llConfiguration.setVisibility(View.GONE);
|
||||
holder.cbUnused.setChecked(false);
|
||||
}
|
||||
|
||||
|
@ -113,6 +116,16 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
}
|
||||
};
|
||||
|
||||
View.OnClickListener llListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (rule.wifi_blocked || rule.other_blocked) {
|
||||
rule.attributes = !rule.attributes;
|
||||
holder.llConfiguration.setVisibility(rule.attributes ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int color = rule.system ? colorAccent : colorText;
|
||||
if (rule.disabled)
|
||||
color = Color.argb(100, Color.red(color), Color.green(color), Color.blue(color));
|
||||
|
@ -133,20 +146,13 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
|
||||
holder.ivUnused.setVisibility(rule.unused ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
holder.llAttributes.setVisibility(rule.attributes ? View.VISIBLE : View.GONE);
|
||||
holder.llConfiguration.setVisibility(rule.attributes ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.cbUnused.setOnCheckedChangeListener(null);
|
||||
holder.cbUnused.setChecked(rule.unused);
|
||||
|
||||
holder.llApplication.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (rule.wifi_blocked || rule.other_blocked) {
|
||||
rule.attributes = !rule.attributes;
|
||||
holder.llAttributes.setVisibility(rule.attributes ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.llApplication.setOnClickListener(llListener);
|
||||
holder.llAttributes.setOnClickListener(llListener);
|
||||
|
||||
holder.cbUnused.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
|
|
@ -65,19 +65,26 @@
|
|||
android:layout_marginStart="12dp"
|
||||
android:button="@drawable/other" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivUnused"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/unused" />
|
||||
<LinearLayout
|
||||
android:id="@+id/llAttributes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivUnused"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:src="@drawable/unused" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llAttributes"
|
||||
android:id="@+id/llConfiguration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="?android:attr/listPreferredItemHeightSmall"
|
||||
|
|
Loading…
Reference in New Issue