Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v27 #256

Merged
merged 28 commits into from
Oct 5, 2024
Merged

v27 #256

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e3c72c
Fix issue with app mode toggle not updating
slavick Jul 27, 2024
eef6cb6
Fix `NonConstantResourceld` warning advising to avoid using non-final…
slavick Jul 27, 2024
c82fca4
Add activeandroid-3.1.0-SNAPSHOT.jar to the project directly
slavick Jul 27, 2024
e45d96a
Update to latest gradle
slavick Sep 7, 2024
803ee59
Update to latest firebase
slavick Sep 7, 2024
b800ab6
Fix deprecation warning
slavick Sep 7, 2024
8f975c5
Enable code minification and fix java heap space errors when building…
slavick Sep 7, 2024
4bbeea5
Allow horizontal screen rotation
slavick Sep 7, 2024
92308b5
Update to latest timber to fix build warning
slavick Sep 7, 2024
c5889f0
Fix "Wrong locale name" inspection
slavick Sep 7, 2024
45893c8
Remove unnecessary properties
slavick Sep 7, 2024
cdc466f
No longer need API check
slavick Sep 7, 2024
4c66f50
Merge API 17 specific files
slavick Sep 7, 2024
5472988
Merge API 21 specific files
slavick Sep 7, 2024
37186b2
Refactor to simplify line separator retrieval
slavick Sep 7, 2024
85dc325
Combine identical exception handlers
slavick Sep 7, 2024
1c76203
Refactor backup to not hold lines in memory
slavick Sep 8, 2024
c73fa38
Add landscape layouts for viewing history
slavick Sep 8, 2024
3930bb1
Enable and update proguard rules to fix minifyEnabled causing crash o…
slavick Sep 9, 2024
e7f6884
Update to use recommended proguard file (https://developer.android.co…
slavick Sep 10, 2024
2bf1cf3
Improve restore performance by 4x
slavick Sep 12, 2024
e922727
Fix code inspection warnings
slavick Sep 14, 2024
13f70c9
Remove debug logging
slavick Sep 15, 2024
581539a
Improve performance of GenerateDataTask
slavick Sep 15, 2024
52eefd2
Fix bug where restoring from json would lose the first day's entries
slavick Sep 29, 2024
030fa88
Update to latest gradle
slavick Sep 29, 2024
226add7
Update to latest crashlytics
slavick Sep 29, 2024
ed264de
Update versionCode and versionName
slavick Sep 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ configurations {
}

android {
buildFeatures.viewBinding = true

buildFeatures {
buildConfig = true
viewBinding = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -33,8 +35,8 @@ android {
compileSdk 34
targetSdkVersion 34
vectorDrawables.useSupportLibrary = true
versionCode 90
versionName "26"
versionCode 91
versionName "27"
}
buildTypes {
debug {
Expand All @@ -43,8 +45,8 @@ android {
}
release {
manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

Expand All @@ -61,18 +63,18 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:22.0.2'
implementation 'com.google.firebase:firebase-crashlytics:19.0.3'
implementation 'com.google.firebase:firebase-analytics:22.1.0'
implementation 'com.google.firebase:firebase-crashlytics:19.1.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.darwinsys:hirondelle-date4j:1.5.1'
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'
implementation('com.joanzapata.iconify:android-iconify-fontawesome:2.2.2') { exclude group: "com.android.support" }
implementation('com.github.PhilJay:MPAndroidChart:v2.2.5') { exclude group: "com.android.support" }
implementation('org.greenrobot:eventbus:3.3.1') { exclude group: "com.android.support" }
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.jakewharton.timber:timber:5.0.1'
implementation "io.noties.markwon:core:4.6.2"
}
Binary file added app/libs/activeandroid-3.1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
# ActiveAndroid
-keep class com.activeandroid.** { *; }

-keep class org.nutritionfacts.dailydozen.model.** { *; }

# MPAndroidChart
-keep class com.github.mikephil.charting.** { *; }
-dontwarn io.realm.**
Expand Down
13 changes: 1 addition & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
android:name=".activity.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">

<intent-filter>
Expand All @@ -55,14 +54,12 @@

<activity
android:name=".activity.AboutActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:label="@string/about_this_app"/>

<activity
android:name=".activity.DailyReminderSettingsActivity"
android:label="@string/daily_reminder_settings"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -72,12 +69,10 @@

<activity
android:name=".activity.DebugActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"/>
android:configChanges="orientation|keyboardHidden"/>

<activity
android:name=".activity.HistoryActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -87,7 +82,6 @@

<activity
android:name=".activity.FoodInfoActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -98,7 +92,6 @@
<activity
android:name=".activity.ServingsHistoryActivity"
android:label="@string/daily_servings_history"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -108,7 +101,6 @@

<activity
android:name=".activity.TweakInfoActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -119,7 +111,6 @@
<activity
android:name=".activity.TweakServingsHistoryActivity"
android:label="@string/daily_tweaks_history"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -130,7 +121,6 @@
<activity
android:name=".activity.WeightHistoryActivity"
android:label="@string/weight_history"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand All @@ -140,7 +130,6 @@

<activity android:name=".activity.FaqActivity"
android:label="@string/faq_title"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:parentActivityName=".activity.MainActivity">
<meta-data
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/likeanimation/LikeButtonView.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
Expand Down Expand Up @@ -47,7 +45,6 @@ public LikeButtonView(Context context, AttributeSet attrs, int defStyleAttr) {
init();
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public LikeButtonView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/org/nutritionfacts/dailydozen/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public static void showToast(final Context context, final int stringId) {
showToast(context, context.getString(stringId));
}

public static String getLineSeparator() {
return System.getProperty("line.separator");
}

public static void openUrlInExternalBrowser(final Context context, final int urlId) {
openUrlInExternalBrowser(context, context.getString(urlId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void initLinksInWelcome() {
}

private void initLinksInText() {
final String aboutText = TextUtils.join(Common.getLineSeparator(),
final String aboutText = TextUtils.join(System.lineSeparator(),
getResources().getStringArray(R.array.about_text_lines));
final SpannableStringBuilder ssb = new SpannableStringBuilder(aboutText);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.nutritionfacts.dailydozen.activity;

import android.content.res.Configuration;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
Expand Down Expand Up @@ -69,7 +70,12 @@ private void displayFoodInfo() {
if (food != null && !TextUtils.isEmpty(food.getName())) {
final String foodName = food.getName();

initImage(foodName);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
initImage(foodName);
binding.foodInfoImage.setVisibility(View.VISIBLE);
} else {
binding.foodInfoImage.setVisibility(View.GONE);
}
initServingTypes(food);
initFoodTypes(foodName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,20 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
toggleTweaksMenuItemVisibility();
updateAppModeToggle();
return super.onPrepareOptionsMenu(menu);
}

private void updateAppModeToggle() {
if (inDailyDozenMode) {
setTitle(R.string.app_name);
menuToggleModes.setTitle(R.string.twenty_one_tweaks);
} else {
setTitle(R.string.twenty_one_tweaks);
menuToggleModes.setTitle(R.string.app_name);
}
}

private void toggleTweaksMenuItemVisibility() {
if (menuToggleModes != null) {
menuToggleModes.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
Expand All @@ -188,57 +199,50 @@ private void toggleTweaksMenuItemVisibility() {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
switch (itemId) {
case R.id.menu_toggle_modes:
inDailyDozenMode = !inDailyDozenMode;
if (inDailyDozenMode) {
setTitle(R.string.app_name);
item.setTitle(R.string.twenty_one_tweaks);
} else {
setTitle(R.string.twenty_one_tweaks);
item.setTitle(R.string.app_name);
}
initDatePager();
return true;
case R.id.menu_latest_videos:
Common.openUrlInExternalBrowser(this, R.string.url_latest_videos);
return true;
case R.id.menu_how_not_to_die:
Common.openUrlInExternalBrowser(this, R.string.url_how_not_to_die);
return true;
case R.id.menu_cookbook:
Common.openUrlInExternalBrowser(this, R.string.url_cookbook);
return true;
case R.id.menu_how_not_to_diet:
Common.openUrlInExternalBrowser(this, R.string.url_how_not_to_diet);
return true;
case R.id.menu_daily_dozen_challenge:
Common.openUrlInExternalBrowser(this, R.string.url_daily_dozen_challenge);
return true;
case R.id.menu_faq:
startActivity(new Intent(this, FaqActivity.class));
return true;
case R.id.menu_donate:
Common.openUrlInExternalBrowser(this, R.string.url_donate);
return true;
case R.id.menu_subscribe:
Common.openUrlInExternalBrowser(this, R.string.url_subscribe);
return true;
case R.id.menu_open_source:
Common.openUrlInExternalBrowser(this, R.string.url_open_source);
return true;
case R.id.menu_daily_reminder_settings:
startActivity(new Intent(this, DailyReminderSettingsActivity.class));
return true;
case R.id.menu_backup:
backup();
return true;
case R.id.menu_about:
startActivity(new Intent(this, AboutActivity.class));
return true;
case R.id.menu_debug:
startActivityForResult(new Intent(this, DebugActivity.class), Args.DEBUG_SETTINGS_REQUEST);
return true;
if (itemId == R.id.menu_toggle_modes) {
inDailyDozenMode = !inDailyDozenMode;
updateAppModeToggle();
initDatePager();
return true;
} else if (itemId == R.id.menu_latest_videos) {
Common.openUrlInExternalBrowser(this, R.string.url_latest_videos);
return true;
} else if (itemId == R.id.menu_how_not_to_die) {
Common.openUrlInExternalBrowser(this, R.string.url_how_not_to_die);
return true;
} else if (itemId == R.id.menu_cookbook) {
Common.openUrlInExternalBrowser(this, R.string.url_cookbook);
return true;
} else if (itemId == R.id.menu_how_not_to_diet) {
Common.openUrlInExternalBrowser(this, R.string.url_how_not_to_diet);
return true;
} else if (itemId == R.id.menu_daily_dozen_challenge) {
Common.openUrlInExternalBrowser(this, R.string.url_daily_dozen_challenge);
return true;
} else if (itemId == R.id.menu_faq) {
startActivity(new Intent(this, FaqActivity.class));
return true;
} else if (itemId == R.id.menu_donate) {
Common.openUrlInExternalBrowser(this, R.string.url_donate);
return true;
} else if (itemId == R.id.menu_subscribe) {
Common.openUrlInExternalBrowser(this, R.string.url_subscribe);
return true;
} else if (itemId == R.id.menu_open_source) {
Common.openUrlInExternalBrowser(this, R.string.url_open_source);
return true;
} else if (itemId == R.id.menu_daily_reminder_settings) {
startActivity(new Intent(this, DailyReminderSettingsActivity.class));
return true;
} else if (itemId == R.id.menu_backup) {
backup();
return true;
} else if (itemId == R.id.menu_about) {
startActivity(new Intent(this, AboutActivity.class));
return true;
} else if (itemId == R.id.menu_debug) {
startActivityForResult(new Intent(this, DebugActivity.class), Args.DEBUG_SETTINGS_REQUEST);
return true;
}
return super.onOptionsItemSelected(item);
}
Expand Down Expand Up @@ -343,7 +347,7 @@ public File getBackupFile() {

private void shareBackupFile() {
final File backupFile = getBackupFile();
final String backupInstructions = TextUtils.join(Common.getLineSeparator(),
final String backupInstructions = TextUtils.join(System.lineSeparator(),
getResources().getStringArray(R.array.backup_instructions_lines));
final Uri backupFileUri = FileProvider.getUriForFile(this, Common.FILE_PROVIDER_AUTHORITY, backupFile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void onEvent(LoadHistoryCompleteEvent event) {
CombinedChart.DrawOrder.BAR, CombinedChart.DrawOrder.LINE
});

binding.dailyServingsChart.setVisibleXRange(5, 5);
binding.dailyServingsChart.setVisibleXRange(5, 10);

binding.dailyServingsChart.getXAxis().setDrawLabels(true);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.nutritionfacts.dailydozen.activity;

import android.content.res.Configuration;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import org.nutritionfacts.dailydozen.Common;
import org.nutritionfacts.dailydozen.R;
Expand Down Expand Up @@ -36,7 +38,12 @@ private void displayTweakInfo() {
final Tweak tweak = getTweak();

if (tweak != null && !TextUtils.isEmpty(tweak.getName())) {
initImage(tweak.getName());
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
initImage(tweak.getName());
binding.tweakInfoImage.setVisibility(View.VISIBLE);
} else {
binding.tweakInfoImage.setVisibility(View.GONE);
}
initTweakShort(tweak.getName());
initTweakText(tweak.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void onEvent(LoadHistoryCompleteEvent event) {
CombinedChart.DrawOrder.BAR, CombinedChart.DrawOrder.LINE
});

binding.dailyServingsChart.setVisibleXRange(5, 5);
binding.dailyServingsChart.setVisibleXRange(5, 10);

binding.dailyServingsChart.getXAxis().setDrawLabels(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void onEvent(LoadHistoryCompleteEvent event) {
CombinedChart.DrawOrder.BAR, CombinedChart.DrawOrder.LINE
});

binding.dailyServingsChart.setVisibleXRange(5, 5);
binding.dailyServingsChart.setVisibleXRange(5, 10);

binding.dailyServingsChart.getXAxis().setDrawLabels(true);

Expand Down
Loading