diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -56,7 +56,7 @@ - - - - - - - - - - - - - - - - - - - + + + + menuActions = Map.of( @@ -132,7 +153,7 @@ //onBackPressed solution required from Android 16 backPressedCallback.setEnabled(true); this.getOnBackPressedDispatcher().addCallback(backPressedCallback); - boolean showingArrivalsFromIntent = false; + //boolean showingArrivalsFromIntent = false; final Toolbar mToolbar = findViewById(R.id.default_toolbar); setSupportActionBar(mToolbar); @@ -150,27 +171,7 @@ drawerToggle.syncState(); mDrawer.addDrawerListener(drawerToggle); - mDrawer.addDrawerListener(new DrawerLayout.DrawerListener() { - @Override - public void onDrawerSlide(@NonNull View drawerView, float slideOffset) { - - } - - @Override - public void onDrawerOpened(@NonNull View drawerView) { - hideKeyboard(); - } - - @Override - public void onDrawerClosed(@NonNull View drawerView) { - - } - - @Override - public void onDrawerStateChanged(int newState) { - } - }); - + mDrawer.addDrawerListener(drawerListener); mNavView = findViewById(R.id.nvView); @@ -186,32 +187,38 @@ // Intercept calls from URL intent boolean tryedFromIntent = false; - String busStopID = null; - Uri data = getIntent().getData(); - if (data != null) { - - busStopID = getBusStopIDFromUri(data); - Log.d(DEBUG_TAG, "Opening Intent: busStopID: "+busStopID); - tryedFromIntent = true; - } + String initialBusStopID = null; + var intent = getIntent(); + if(intent != null){ + var data = intent.getData(); + if(data != null){ + //var rest = data.getSchemeSpecificPart(); + //Log.d(DEBUG_TAG, "the rest is: "+rest); - // Intercept calls from other activities - if (!tryedFromIntent) { - Bundle b = getIntent().getExtras(); - if (b != null) { - busStopID = b.getString("bus-stop-ID"); + initialBusStopID = getBusStopIDFromUri(data); + tryedFromIntent = true; + Log.d(DEBUG_TAG, "Opening Intent: initialBusStopID: "+initialBusStopID); - /* - * I'm not very sure if you are coming from an Intent. - * Some launchers work in strange ways. - */ - tryedFromIntent = busStopID != null; + } + // Intercept calls from other activities + if(!tryedFromIntent){ + Bundle b =intent.getExtras(); + if (b != null) { + initialBusStopID = b.getString("bus-stop-ID"); + + /* + * I'm not very sure if you are coming from an Intent. + * Some launchers work in strange ways. + */ + tryedFromIntent = initialBusStopID != null; + } } } + //---------------------------- END INTENT CHECK QUEUE -------------------------------------- - if (busStopID == null) { + if (initialBusStopID == null) { // Show keyboard if can't start from intent // JUST DON'T // showKeyboard(); @@ -223,12 +230,6 @@ Toast.makeText(getApplicationContext(), R.string.insert_bus_stop_number_error, Toast.LENGTH_SHORT).show(); } - } else { - // If you are here an intent has worked successfully - //setBusStopSearchByIDEditText(busStopID); - //Log.d(DEBUG_TAG, "Requesting arrivals for stop "+busStopID+" from intent"); - requestArrivalsForStopID(busStopID); //this shows the fragment, too - showingArrivalsFromIntent = true; } //database check @@ -268,10 +269,12 @@ String vl = PreferenceManager.getDefaultSharedPreferences(this).getString(SettingsFragment.PREF_KEY_STARTUP_SCREEN, ""); Log.d(DEBUG_TAG, "The default screen to open is: "+vl); - if (showingArrivalsFromIntent){ - //do nothing but exclude a case + var framan = getSupportFragmentManager(); + + if (initialBusStopID!=null) { + Log.d(DEBUG_TAG, "Opening Main Fragment on arrivals, bus Stop: "+initialBusStopID); + createShowMainFragment(framan, MainScreenFragment.makeArgsArrivals(initialBusStopID), false); }else if (savedInstanceState==null) { - var framan = getSupportFragmentManager(); //we are not restarting the activity from nothing switch (vl){ case "map" -> {requestMapFragment(false);} diff --git a/app/src/main/java/it/reyboz/bustorino/fragments/MainScreenFragment.java b/app/src/main/java/it/reyboz/bustorino/fragments/MainScreenFragment.java --- a/app/src/main/java/it/reyboz/bustorino/fragments/MainScreenFragment.java +++ b/app/src/main/java/it/reyboz/bustorino/fragments/MainScreenFragment.java @@ -413,6 +413,7 @@ break; case ARRIVALS: // pendingStopID is consumed in onResume → requestArrivalsForStopID + swipeRefreshLayout.setVisibility(View.VISIBLE); break; case STOP_SEARCH: if (pendingSearchQuery != null && pendingSearchQuery.length() >= 2) { diff --git a/app/src/main/res/values-night-v27/themes.xml b/app/src/main/res/values-night-v27/themes.xml new file mode 100644 --- /dev/null +++ b/app/src/main/res/values-night-v27/themes.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,11 +1,16 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values-v19/styles.xml b/app/src/main/res/values-v19/styles.xml deleted file mode 100644 --- a/app/src/main/res/values-v19/styles.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml new file mode 100644 --- /dev/null +++ b/app/src/main/res/values-v27/styles.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-v35/styles.xml b/app/src/main/res/values-v35/styles.xml deleted file mode 100644 --- a/app/src/main/res/values-v35/styles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -79,15 +79,13 @@ @color/orange_700 @color/teal_500 @color/white + @color/black_800 - - + false + + + \ No newline at end of file