Add toggle button for sum
This commit is contained in:
woheller69 2025-11-03 08:38:06 +01:00
parent 10aced4a5d
commit 0256736c59
6 changed files with 36 additions and 2 deletions

View file

@ -21,8 +21,8 @@ android {
applicationId "org.woheller69.solxpect"
minSdkVersion 26
targetSdk 35
versionCode 27
versionName "2.7"
versionCode 28
versionName "2.8"
buildConfigField "String", "BASE_URL", "\"https://api.open-meteo.com/v1/\""
buildConfigField "String", "TILES_URL","\"https://tile.openstreetmap.org/\""
@ -52,4 +52,5 @@ dependencies {
implementation 'net.lingala.zip4j:zip4j:2.9.1'
implementation 'com.github.woheller69:CompassView:948f3db329'
implementation 'androidx.webkit:webkit:1.5.0'
implementation 'com.github.woheller69:FreeDroidWarn:V1.6'
}

View file

@ -174,6 +174,14 @@ public class ForecastCityActivity extends NavigationActivity implements IUpdatea
refreshActionButton.getActionView().setOnClickListener(v -> m.performIdentifierAction(refreshActionButton.getItemId(), 0));
if (isRefreshing) startRefreshAnimation();
SharedPreferences prefManager = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean modeSum = prefManager.getBoolean("pref_summarize",false);
if (modeSum) {
menu.findItem(R.id.menu_summarize).getIcon().setAlpha(255);
} else {
menu.findItem(R.id.menu_summarize).getIcon().setAlpha(50);
}
return true;
}
@ -210,6 +218,11 @@ public class ForecastCityActivity extends NavigationActivity implements IUpdatea
alertDialogBuilder.setPositiveButton(getString(android.R.string.ok), (dialog, which) -> { });
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
} else if (id==R.id.menu_summarize){
SharedPreferences prefManager = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
boolean modeSum = prefManager.getBoolean("pref_summarize",false);
prefManager.edit().putBoolean("pref_summarize",!modeSum).commit();
recreate();
}
return super.onOptionsItemSelected(item);

View file

@ -24,6 +24,7 @@ import android.os.Looper;
import android.view.MenuItem;
import org.woheller69.freeDroidWarn.FreeDroidWarn;
import org.woheller69.weather.BuildConfig;
import org.woheller69.weather.R;
import org.woheller69.weather.database.SQLiteHelper;
@ -55,6 +56,7 @@ public class NavigationActivity extends AppCompatActivity implements OnNavigatio
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mHandler = new Handler(Looper.getMainLooper());
FreeDroidWarn.showWarningOnUpgrade(this, BuildConfig.VERSION_CODE);
prefManager = new AppPreferencesManager(PreferenceManager.getDefaultSharedPreferences(this));
if (prefManager.showStarDialog(this)) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M240,800v-80l260,-240 -260,-240v-80h480v120L431,280l215,200 -215,200h289v120L240,800Z"
android:fillColor="#FFFFFF"/>
</vector>

View file

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_summarize"
android:orderInCategory="70"
android:visible="true"
android:icon="@drawable/ic_sum_24dp"
app:showAsAction="always"
android:title="@string/settings_summarize" />
<item
android:id="@+id/menu_sun_position"
android:orderInCategory="80"

View file

@ -0,0 +1,2 @@
Toggle button for sum
Add warning with link to Keep Android Open