@@ -224,16 +224,23 @@ private void initializeCatchAllSwitch() {
224224 // Determine current mode based on enabled components
225225 boolean isCatchAllEnabled = getPackageManager ().getComponentEnabledSetting (catchAllComponent ) != PackageManager .COMPONENT_ENABLED_STATE_DISABLED ;
226226 boolean isCommonTypesEnabled = getPackageManager ().getComponentEnabledSetting (commonTypesComponent ) != PackageManager .COMPONENT_ENABLED_STATE_DISABLED ;
227+ boolean isStrictEnabled = getPackageManager ().getComponentEnabledSetting (strictCatchComponent ) != PackageManager .COMPONENT_ENABLED_STATE_DISABLED ;
227228
228- // Default to common types if this is first run (all are disabled)
229- if (!isCatchAllEnabled && !isCommonTypesEnabled ) {
230- isCommonTypesEnabled = true ;
229+ // Determine current mode - prioritize in order: CATCH_ALL -> COMMON_TYPES -> STRICT
230+ String currentMode ;
231+ if (isCatchAllEnabled ) {
232+ currentMode = "CATCH_ALL" ;
233+ } else if (isCommonTypesEnabled ) {
234+ currentMode = "COMMON_TYPES" ;
235+ } else if (isStrictEnabled ) {
236+ currentMode = "STRICT" ;
237+ } else {
238+ // Default for new installations or if all are disabled
239+ currentMode = "COMMON_TYPES" ;
231240 }
232-
233- // Ensure only one mode is enabled
234- toggleComponent (catchAllComponent , isCatchAllEnabled && !isCommonTypesEnabled );
235- toggleComponent (commonTypesComponent , isCommonTypesEnabled && !isCatchAllEnabled );
236- toggleComponent (strictCatchComponent , !isCatchAllEnabled && !isCommonTypesEnabled );
241+
242+ // Set the appropriate mode
243+ setFileTypeMode (currentMode );
237244
238245 SwitchCompat catchAllSwitch = findViewById (R .id .landing_catch_all );
239246
@@ -242,30 +249,47 @@ private void initializeCatchAllSwitch() {
242249 public void onCheckedChanged (CompoundButton buttonView , boolean isChecked ) {
243250 if (isChecked ) {
244251 // Switch to common types mode
245- toggleComponent (catchAllComponent , false );
246- toggleComponent (commonTypesComponent , true );
247- toggleComponent (strictCatchComponent , false );
252+ setFileTypeMode ("COMMON_TYPES" );
248253 } else {
249254 // Switch to strict mode
250- toggleComponent (catchAllComponent , false );
251- toggleComponent (commonTypesComponent , false );
252- toggleComponent (strictCatchComponent , true );
255+ setFileTypeMode ("STRICT" );
253256 }
254257 }
255258 });
256259
257260 // Set switch state: checked if common types is enabled, unchecked if strict is enabled
258- catchAllSwitch .setChecked (isCommonTypesEnabled );
261+ // Note: We don't expose CATCH_ALL mode in the UI anymore, as per issue #374 request
262+ catchAllSwitch .setChecked (currentMode .equals ("COMMON_TYPES" ));
259263
260- String analyticsEvent ;
261- if (isCatchAllEnabled ) {
262- analyticsEvent = "catch_all_enabled" ;
263- } else if (isCommonTypesEnabled ) {
264- analyticsEvent = "common_types_enabled" ;
265- } else {
266- analyticsEvent = "strict_enabled" ;
264+ analyticsManager .report ("file_mode_" + currentMode .toLowerCase ());
265+ }
266+
267+ private void setFileTypeMode (String mode ) {
268+ ComponentName catchAllComponent = new ComponentName (this , "at.tomtasche.reader.ui.activity.MainActivity.CATCH_ALL" );
269+ ComponentName commonTypesComponent = new ComponentName (this , "at.tomtasche.reader.ui.activity.MainActivity.COMMON_TYPES" );
270+ ComponentName strictCatchComponent = new ComponentName (this , "at.tomtasche.reader.ui.activity.MainActivity.STRICT_CATCH" );
271+
272+ // Disable all components first
273+ toggleComponent (catchAllComponent , false );
274+ toggleComponent (commonTypesComponent , false );
275+ toggleComponent (strictCatchComponent , false );
276+
277+ // Enable the appropriate component
278+ switch (mode ) {
279+ case "CATCH_ALL" :
280+ toggleComponent (catchAllComponent , true );
281+ break ;
282+ case "COMMON_TYPES" :
283+ toggleComponent (commonTypesComponent , true );
284+ break ;
285+ case "STRICT" :
286+ toggleComponent (strictCatchComponent , true );
287+ break ;
288+ default :
289+ // Default to common types
290+ toggleComponent (commonTypesComponent , true );
291+ break ;
267292 }
268- analyticsManager .report (analyticsEvent );
269293 }
270294
271295 private void toggleComponent (ComponentName component , boolean enabled ) {
0 commit comments