mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-06-16 21:10:57 +08:00
Make connections card clickable
Clicking it shows the related connections
This commit is contained in:
parent
51224accb6
commit
30b73bab84
@ -61,7 +61,7 @@ public class FirewallStatus extends Fragment {
|
||||
SharedPreferences mPrefs;
|
||||
private SwitchCompat mToggle;
|
||||
private ImageView mStatusIcon;
|
||||
private Button mConnectionsBtn;
|
||||
private View mConnectionsCard;
|
||||
private TextView mStatus;
|
||||
private TextView mNumBlocked;
|
||||
private TextView mNumChecked;
|
||||
@ -86,7 +86,7 @@ public class FirewallStatus extends Fragment {
|
||||
mStatus = view.findViewById(R.id.status);
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mStatusIcon = view.findViewById(R.id.status_icon);
|
||||
mConnectionsBtn = view.findViewById(R.id.show_connections);
|
||||
mConnectionsCard = view.findViewById(R.id.show_connections);
|
||||
mNumBlocked = view.findViewById(R.id.num_blocked);
|
||||
mNumChecked = view.findViewById(R.id.num_checked);
|
||||
mNumRules = view.findViewById(R.id.num_rules);
|
||||
@ -96,7 +96,7 @@ public class FirewallStatus extends Fragment {
|
||||
mWarnColor = ContextCompat.getColor(ctx, R.color.warning);
|
||||
mGrayColor = ContextCompat.getColor(ctx, R.color.lightGray);
|
||||
|
||||
mConnectionsBtn.setOnClickListener(v -> {
|
||||
mConnectionsCard.setOnClickListener(v -> {
|
||||
FilterDescriptor filter = new FilterDescriptor();
|
||||
filter.onlyBLocked = true;
|
||||
|
||||
@ -154,9 +154,6 @@ public class FirewallStatus extends Fragment {
|
||||
boolean is_running = CaptureService.isServiceActive();
|
||||
boolean is_enabled = CaptureService.isFirewallEnabled(ctx, mPrefs);
|
||||
|
||||
int num_blocked = ((reg != null) ? reg.getNumBlockedConnections() : 0);
|
||||
mConnectionsBtn.setVisibility((num_blocked > 0) ? View.VISIBLE : View.GONE);
|
||||
|
||||
if(!is_running) {
|
||||
mStatusIcon.setImageResource(R.drawable.ic_shield);
|
||||
mStatusIcon.setColorFilter(mGrayColor);
|
||||
@ -180,7 +177,7 @@ public class FirewallStatus extends Fragment {
|
||||
if(mToggle != null)
|
||||
mToggle.setChecked(is_enabled);
|
||||
|
||||
mNumBlocked.setText(Utils.formatIntShort(num_blocked));
|
||||
mNumBlocked.setText(Utils.formatIntShort(((reg != null) ? reg.getNumBlockedConnections() : 0)));
|
||||
mNumChecked.setText(Utils.formatIntShort(CaptureService.getNumCheckedFirewallConnections()));
|
||||
mLastBlock.setText(Utils.formatEpochMin(ctx, ((reg != null) ? reg.getLastFirewallBlock() / 1000 : 0)));
|
||||
mNumRules.setText(Utils.formatIntShort(mBlocklist.getSize()));
|
||||
|
||||
@ -55,7 +55,7 @@ public class MalwareStatusFragment extends Fragment {
|
||||
private Blacklists mBlacklists;
|
||||
private Handler mHandler;
|
||||
private ImageView mStatusIcon;
|
||||
private Button mConnectionsBtn;
|
||||
private View mConnectionsCard;
|
||||
private TextView mStatus;
|
||||
private TextView mNumMalicious;
|
||||
private TextView mNumUpToDate;
|
||||
@ -79,7 +79,7 @@ public class MalwareStatusFragment extends Fragment {
|
||||
mStatus = view.findViewById(R.id.status);
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mStatusIcon = view.findViewById(R.id.status_icon);
|
||||
mConnectionsBtn = view.findViewById(R.id.show_connections);
|
||||
mConnectionsCard = view.findViewById(R.id.show_connections);
|
||||
mNumMalicious = view.findViewById(R.id.num_malicious);
|
||||
mNumUpToDate = view.findViewById(R.id.num_up_to_date);
|
||||
mNumChecked = view.findViewById(R.id.num_checked);
|
||||
@ -93,7 +93,7 @@ public class MalwareStatusFragment extends Fragment {
|
||||
mGrayColor = ContextCompat.getColor(ctx, R.color.lightGray);
|
||||
mTextColor = ContextCompat.getColor(ctx, R.color.highContrast);
|
||||
|
||||
mConnectionsBtn.setOnClickListener(v -> {
|
||||
mConnectionsCard.setOnClickListener(v -> {
|
||||
FilterDescriptor filter = new FilterDescriptor();
|
||||
filter.onlyBlacklisted = true;
|
||||
|
||||
@ -143,10 +143,7 @@ public class MalwareStatusFragment extends Fragment {
|
||||
mStatusIcon.setImageResource(R.drawable.ic_exclamation_triangle_solid);
|
||||
mStatusIcon.setColorFilter(mDangerColor);
|
||||
mStatus.setText(R.string.malware_status_detected);
|
||||
mConnectionsBtn.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mConnectionsBtn.setVisibility(View.GONE);
|
||||
|
||||
if(!is_running) {
|
||||
mStatusIcon.setImageResource(R.drawable.ic_bug);
|
||||
mStatusIcon.setColorFilter(mGrayColor);
|
||||
|
||||
@ -26,13 +26,6 @@
|
||||
android:textStyle="bold"
|
||||
tools:text="@string/firewall_is_enabled" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/show_connections"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/connections_view"
|
||||
style="?attr/borderlessButtonStyle" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@ -76,8 +69,9 @@
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:id="@+id/show_connections"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1">
|
||||
|
||||
@ -25,13 +25,6 @@
|
||||
android:textStyle="bold"
|
||||
tools:text="@string/malware_status_detected" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/show_connections"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/connections_view"
|
||||
style="?attr/borderlessButtonStyle" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@ -75,8 +68,9 @@
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:id="@+id/show_connections"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnWeight="1">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user