Fadhili Sumaye commited on
Commit
28d7022
·
1 Parent(s): a112c25

UX: Hide connection settings behind a secret 5-tap developer trigger on the app logo

Browse files
app/src/main/java/com/example/pestdetection/MainActivity.java CHANGED
@@ -38,6 +38,8 @@ public class MainActivity extends AppCompatActivity {
38
  ProgressBar progressBar;
39
  Button btnSelect, btnCamera, btnUpload;
40
  View resultCard;
 
 
41
 
42
  private ConnectivityManager connectivityManager;
43
  private ConnectivityManager.NetworkCallback networkCallback;
@@ -85,6 +87,21 @@ public class MainActivity extends AppCompatActivity {
85
  btnCamera = findViewById(R.id.btnCamera);
86
  btnUpload = findViewById(R.id.btnUpload);
87
  resultCard = findViewById(R.id.resultCard);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  resultText = findViewById(R.id.resultText);
89
  treatmentText = findViewById(R.id.treatmentText);
90
  tvConnectionStatus = findViewById(R.id.tvConnectionStatus);
 
38
  ProgressBar progressBar;
39
  Button btnSelect, btnCamera, btnUpload;
40
  View resultCard;
41
+ View settingsCard;
42
+ int titleClickCount = 0;
43
 
44
  private ConnectivityManager connectivityManager;
45
  private ConnectivityManager.NetworkCallback networkCallback;
 
87
  btnCamera = findViewById(R.id.btnCamera);
88
  btnUpload = findViewById(R.id.btnUpload);
89
  resultCard = findViewById(R.id.resultCard);
90
+ settingsCard = findViewById(R.id.settingsCard);
91
+
92
+ TextView tvAppName = findViewById(R.id.tvAppName);
93
+ if (tvAppName != null) {
94
+ tvAppName.setOnClickListener(v -> {
95
+ titleClickCount++;
96
+ if (titleClickCount >= 5) {
97
+ if (settingsCard != null) {
98
+ settingsCard.setVisibility(View.VISIBLE);
99
+ Toast.makeText(MainActivity.this, "Developer Mode: Server settings unlocked", Toast.LENGTH_SHORT).show();
100
+ }
101
+ titleClickCount = 0;
102
+ }
103
+ });
104
+ }
105
  resultText = findViewById(R.id.resultText);
106
  treatmentText = findViewById(R.id.treatmentText);
107
  tvConnectionStatus = findViewById(R.id.tvConnectionStatus);
app/src/main/res/layout/activity_main.xml CHANGED
@@ -77,6 +77,7 @@
77
  android:layout_width="0dp"
78
  android:layout_height="wrap_content"
79
  android:layout_marginTop="20dp"
 
80
  app:cardCornerRadius="16dp"
81
  app:cardElevation="2dp"
82
  app:cardBackgroundColor="@color/surface_card"
 
77
  android:layout_width="0dp"
78
  android:layout_height="wrap_content"
79
  android:layout_marginTop="20dp"
80
+ android:visibility="gone"
81
  app:cardCornerRadius="16dp"
82
  app:cardElevation="2dp"
83
  app:cardBackgroundColor="@color/surface_card"