diff --git a/app/src/main/java/com/emanuelef/remote_capture/fragments/FirewallStatus.java b/app/src/main/java/com/emanuelef/remote_capture/fragments/FirewallStatus.java index 6a0e0c3c..6588f69c 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/fragments/FirewallStatus.java +++ b/app/src/main/java/com/emanuelef/remote_capture/fragments/FirewallStatus.java @@ -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())); diff --git a/app/src/main/java/com/emanuelef/remote_capture/fragments/MalwareStatusFragment.java b/app/src/main/java/com/emanuelef/remote_capture/fragments/MalwareStatusFragment.java index df6a1b23..69aadabb 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/fragments/MalwareStatusFragment.java +++ b/app/src/main/java/com/emanuelef/remote_capture/fragments/MalwareStatusFragment.java @@ -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); diff --git a/app/src/main/res/layout/firewall_status.xml b/app/src/main/res/layout/firewall_status.xml index f2041f2a..17f8bd66 100644 --- a/app/src/main/res/layout/firewall_status.xml +++ b/app/src/main/res/layout/firewall_status.xml @@ -26,13 +26,6 @@ android:textStyle="bold" tools:text="@string/firewall_is_enabled" /> -