Skip to content

Commit e8cd1de

Browse files
slavickmarc-medley
andauthored
v22 (#218)
* Translation addition (cs) and updates. Includes translation contributor list. (#211) * translation changes: adds (cs), updates (he, iw, it), serving_sizes_cruciferous adds item (all languages) * add `about_translators` string * Uses ISO 639-1 code in (zh) contributors list to match other translatation useage. See nutritionfactsorg/daily-dozen-localization#16 (comment) * Replace fractional measurements with unicode characters * Add translation contributor list to About activity * Update versionCode and versionName * Ignore annoying files * Update targetSdkVersion to 31 * Set exported="true" where necessary * Add FLAG_IMMUTABLE to PendingIntents * Change all alarms to be inexact to remove the need to ask user for permission * Czech update (including 21 Tweaks), removed unneeded ".csv", contributors update. (#212) * Update versionCode and versionName * Czech minor update (2022.11.24) (#213) * Czech minor update (2022.11.24) * Czech: O autorovi --> O aplikaci * Update to com.android.tools.build:gradle:7.3.1 and remove com.jakewharton.hugo * Update compileSdkVersion and targetSdkVersion to 33. Update other dependencies to latest versions. * Update versionCode and versionName * Enable multidex as the build failed with "Cannot fit requested classes in a single dex file" * Declare AD_ID permission due to use of firebase * Update versionCode * Add catch for SecurityException * Adds Slovak (sk). updates contributor lists. (#217) * Adds Slovak (sk) * updates translation contributor list (all languages) * removed staging files which were not intented to be part of the pull request. * adds *_LOCAL to .gitignore. * Update versionCode and versionName * Update permissions request for recent Android releases * Update versionCode and versionName; reformat file * Update versionCode and versionName * Change versionName to 22 Co-authored-by: --marc <[email protected]>
1 parent 979e897 commit e8cd1de

File tree

32 files changed

+1759
-618
lines changed

32 files changed

+1759
-618
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99
/captures
1010
fabric.properties
1111
DailyDozenDB*
12+
ajcore*
13+
output-metadata.json
14+
15+
## place for local-only items.
16+
*_LOCAL

app/build.gradle

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ buildscript {
33
mavenCentral()
44
google()
55
}
6-
7-
dependencies {
8-
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
9-
}
106
}
117
apply plugin: 'com.android.application'
12-
apply plugin: 'com.jakewharton.hugo'
138
apply plugin: 'com.google.gms.google-services'
149
apply plugin: 'com.google.firebase.crashlytics'
1510

@@ -25,30 +20,30 @@ configurations {
2520
}
2621

2722
android {
28-
compileSdkVersion 30
29-
buildToolsVersion '30.0.2'
23+
compileSdkVersion 33
3024

3125
buildFeatures.viewBinding = true
3226

3327
compileOptions {
34-
sourceCompatibility JavaVersion.VERSION_1_8
35-
targetCompatibility JavaVersion.VERSION_1_8
28+
sourceCompatibility JavaVersion.VERSION_1_8
29+
targetCompatibility JavaVersion.VERSION_1_8
3630
}
3731
defaultConfig {
3832
applicationId "org.nutritionfacts.dailydozen"
39-
minSdkVersion 16
40-
targetSdkVersion 30
33+
minSdkVersion 19
34+
multiDexEnabled true
35+
targetSdkVersion 33
4136
vectorDrawables.useSupportLibrary = true
42-
versionCode 73
43-
versionName "21.3"
37+
versionCode 82
38+
versionName "22"
4439
}
4540
buildTypes {
4641
debug {
47-
manifestPlaceholders = [crashlyticsCollectionEnabled:"false"]
48-
ext.enableCrashlytics=false
42+
manifestPlaceholders = [crashlyticsCollectionEnabled: "false"]
43+
ext.enableCrashlytics = false
4944
}
5045
release {
51-
manifestPlaceholders = [crashlyticsCollectionEnabled:"true"]
46+
manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
5247
// minifyEnabled true
5348
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
5449
}
@@ -66,11 +61,11 @@ android {
6661
}
6762

6863
dependencies {
69-
implementation 'com.google.firebase:firebase-analytics:19.0.2'
70-
implementation 'com.google.firebase:firebase-crashlytics:18.2.3'
71-
implementation 'androidx.appcompat:appcompat:1.3.1'
64+
implementation 'com.google.firebase:firebase-analytics:21.2.0'
65+
implementation 'com.google.firebase:firebase-crashlytics:18.3.2'
66+
implementation 'androidx.appcompat:appcompat:1.5.1'
7267
implementation 'androidx.cardview:cardview:1.0.0'
73-
implementation 'com.google.android.material:material:1.4.0'
68+
implementation 'com.google.android.material:material:1.7.0'
7469
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
7570
implementation 'com.darwinsys:hirondelle-date4j:1.5.1'
7671
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<manifest package="org.nutritionfacts.dailydozen"
22
xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
android:installLocation="auto">
45

56
<uses-permission android:name="android.permission.INTERNET" />
67
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
8+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" tools:ignore="ScopedStorage"/>
9+
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
810

911
<application
1012
android:name=".DailyDozenApplication"
1113
android:icon="@mipmap/ic_launcher"
1214
android:label="@string/app_name"
15+
android:requestLegacyExternalStorage="true"
1316
android:supportsRtl="true"
1417
android:theme="@style/AppTheme">
1518
<meta-data
@@ -24,6 +27,7 @@
2427

2528
<activity
2629
android:name=".activity.MainActivity"
30+
android:exported="true"
2731
android:launchMode="singleTask"
2832
android:screenOrientation="portrait"
2933
android:configChanges="orientation|keyboardHidden">
@@ -138,7 +142,7 @@
138142
android:name=".receiver.AlarmReceiver"
139143
android:process=":remote"/>
140144

141-
<receiver android:name=".receiver.DeviceBootReceiver">
145+
<receiver android:name=".receiver.DeviceBootReceiver" android:exported="true">
142146
<intent-filter>
143147
<action android:name="android.intent.action.BOOT_COMPLETED"/>
144148
</intent-filter>

app/src/main/java/org/nutritionfacts/dailydozen/controller/PermissionController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ public class PermissionController {
1212
private static final int WRITE_EXTERNAL_STORAGE_REQUEST = 1;
1313

1414
public static boolean canWriteExternalStorage(final Activity activity) {
15-
final int permissionStatus = ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
16-
return Build.VERSION.SDK_INT < 23 || permissionStatus == PackageManager.PERMISSION_GRANTED;
15+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
16+
return ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
17+
}
18+
return true;
1719
}
1820

1921
public static void askForWriteExternalStorage(final Activity activity) {

app/src/main/java/org/nutritionfacts/dailydozen/controller/Prefs.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.nutritionfacts.dailydozen.model.enums.Units;
1010
import org.nutritionfacts.dailydozen.model.pref.UpdateReminderPref;
1111

12-
import hugo.weaving.DebugLog;
1312
import timber.log.Timber;
1413

1514
public class Prefs {
@@ -81,12 +80,10 @@ public void setUserHasSeenFirstStarExplosion() {
8180
setBooleanPref(USER_HAS_SEEN_FIRST_STAR_EXPLOSION, true);
8281
}
8382

84-
@DebugLog
8583
public void setUpdateReminderPref(UpdateReminderPref pref) {
8684
setStringPref(PREF_UPDATE_REMINDER, new Gson().toJson(pref));
8785
}
8886

89-
@DebugLog
9087
public UpdateReminderPref getUpdateReminderPref() {
9188
return new Gson().fromJson(getStringPref(PREF_UPDATE_REMINDER), UpdateReminderPref.class);
9289
}

app/src/main/java/org/nutritionfacts/dailydozen/model/Food.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import java.util.List;
1616

17-
import hugo.weaving.DebugLog;
1817
import timber.log.Timber;
1918

2019
@Table(name = "foods")
@@ -63,7 +62,6 @@ public String toString() {
6362
return name;
6463
}
6564

66-
@DebugLog
6765
public static void ensureAllFoodsExistInDatabase(final String[] foodNames,
6866
final String[] foodIdNames,
6967
final int[] recommendedServings) {

app/src/main/java/org/nutritionfacts/dailydozen/model/Tweak.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import java.util.List;
1515

16-
import hugo.weaving.DebugLog;
16+
import timber.log.Timber;
1717

1818
@Table(name = "tweaks")
1919
public class Tweak extends TruncatableModel implements RDA {
@@ -61,7 +61,6 @@ public String toString() {
6161
return name;
6262
}
6363

64-
@DebugLog
6564
public static void ensureAllTweaksExistInDatabase(final String[] tweakNames,
6665
final String[] tweakIdNames,
6766
final int[] recommendedAmounts) {
@@ -110,7 +109,11 @@ private static void createTweakIfDoesNotExist(final String tweakName,
110109
}
111110

112111
if (needToSave) {
113-
tweak.save();
112+
try {
113+
tweak.save();
114+
} catch (java.lang.SecurityException e) {
115+
Timber.e(e, "Caught SecurityException in createTweakIfDoesNotExist");
116+
}
114117
}
115118
}
116119

app/src/main/java/org/nutritionfacts/dailydozen/task/BackupTask.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Map;
2525
import java.util.Set;
2626

27-
import hugo.weaving.DebugLog;
2827
import timber.log.Timber;
2928

3029
public class BackupTask extends BaseTask<Boolean> {
@@ -86,7 +85,6 @@ public void setDataAfterLoading(Boolean success) {
8685
Bus.backupCompleteEvent(success);
8786
}
8887

89-
@DebugLog
9088
private String getDayJsonLine(Day day) {
9189
final DayEntries dayEntries = new DayEntries();
9290
dayEntries.setDate(day.getDateString());

app/src/main/java/org/nutritionfacts/dailydozen/task/GenerateDataTask.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.util.TimeZone;
1818

1919
import hirondelle.date4j.DateTime;
20-
import hugo.weaving.DebugLog;
2120

2221
public class GenerateDataTask extends BaseTask<Boolean> {
2322
private final ProgressListener progressListener;
@@ -77,7 +76,6 @@ public void setDataAfterLoading(Boolean success) {
7776
}
7877
}
7978

80-
@DebugLog
8179
private void createUserDataForDay(List<Food> allFoods, List<Tweak> allTweaks, DateTime current) {
8280
ActiveAndroid.beginTransaction();
8381

app/src/main/java/org/nutritionfacts/dailydozen/task/RestoreTask.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.io.LineNumberReader;
3030
import java.util.Map;
3131

32-
import hugo.weaving.DebugLog;
3332
import timber.log.Timber;
3433

3534
public class RestoreTask extends BaseTask<Boolean> {
@@ -118,12 +117,10 @@ public void setDataAfterLoading(Boolean success) {
118117
Bus.restoreCompleteEvent(success);
119118
}
120119

121-
@DebugLog
122120
private void deleteAllExistingData() {
123121
Common.truncateAllDatabaseTables();
124122
}
125123

126-
@DebugLog
127124
private void restoreLineCSV(final String[] headers, final String line) {
128125
if (TextUtils.isEmpty(line)) {
129126
return;
@@ -157,7 +154,6 @@ private void restoreLineCSV(final String[] headers, final String line) {
157154
}
158155
}
159156

160-
@DebugLog
161157
private void restoreLineJSON(final String line) {
162158
if (TextUtils.isEmpty(line)) {
163159
return;

0 commit comments

Comments
 (0)