Skip to content

Commit a0ed68e

Browse files
committedFeb 8, 2024
Merge branch 'dev'
2 parents 622425d + 02126de commit a0ed68e

17 files changed

+166
-74
lines changed
 

‎app/build.gradle

+15-16
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ buildscript {
99
mavenCentral()
1010
}
1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:7.4.2'
13-
def nav_version = '2.4.1'
14-
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
12+
classpath 'com.android.tools.build:gradle:8.2.1'
13+
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.7.6"
1514
}
1615
}
1716

1817
android {
19-
compileSdkVersion 31
18+
compileSdk 34
2019
defaultConfig {
2120
applicationId "fr.nuage.souvenirs"
2221
minSdkVersion 24
23-
targetSdkVersion 30
24-
versionCode 30
25-
versionName "2.8.5"
22+
targetSdkVersion 33
23+
versionCode 31
24+
versionName "2.8.6"
2625
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2726
setProperty("archivesBaseName", "souvenirs-$versionName")
2827
}
@@ -52,32 +51,32 @@ repositories {
5251

5352
dependencies {
5453
implementation fileTree(dir: 'libs', include: ['*.jar'])
55-
implementation 'androidx.appcompat:appcompat:1.4.1'
56-
implementation 'androidx.webkit:webkit:1.4.0'
57-
def lifecycle_version = "2.4.1"
54+
implementation 'androidx.appcompat:appcompat:1.6.1'
55+
implementation 'androidx.webkit:webkit:1.9.0'
56+
def lifecycle_version = "2.7.0"
5857
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
5958
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
6059
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
6160
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
6261

63-
implementation 'com.github.bumptech.glide:glide:4.12.0'
64-
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
62+
implementation 'com.github.bumptech.glide:glide:4.16.0'
63+
annotationProcessor 'com.github.bumptech.glide:compiler:4.16.0'
6564

6665
implementation "com.github.nextcloud:Android-SingleSignOn:0.6.1"
6766
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
6867

69-
def nav_version = '2.4.2'
68+
def nav_version = '2.7.6'
7069
implementation "androidx.navigation:navigation-fragment:$nav_version"
7170
implementation "androidx.navigation:navigation-ui:$nav_version"
7271
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
73-
implementation 'com.google.android.material:material:1.7.0-alpha02'
72+
implementation 'com.google.android.material:material:1.11.0'
7473
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
75-
implementation 'androidx.preference:preference:1.2.0'
74+
implementation 'androidx.preference:preference:1.2.1'
7675

7776
}
7877

7978
buildscript {
8079
dependencies {
81-
classpath 'com.android.tools.build:gradle:7.4.2'
80+
classpath 'com.android.tools.build:gradle:8.2.1'
8281
}
8382
}

‎app/src/main/AndroidManifest.xml

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="fr.nuage.souvenirs">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<uses-feature
65
android:name="android.hardware.camera"
@@ -9,6 +8,7 @@
98
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
109
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
1110
<uses-permission android:name="android.permission.RECORD_AUDIO" />
11+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1212

1313
<queries>
1414
<package android:name="com.nextcloud.client" />
@@ -46,7 +46,8 @@
4646
<activity
4747
android:name=".AlbumListActivity"
4848
android:label="@string/app_name"
49-
android:theme="@style/AppTheme.NoActionBar">
49+
android:theme="@style/AppTheme.NoActionBar"
50+
android:exported="true">
5051
<intent-filter>
5152
<action android:name="android.intent.action.MAIN" />
5253

@@ -67,7 +68,8 @@
6768
</activity>
6869
<activity
6970
android:name=".AddImageToAlbumActivity"
70-
android:theme="@style/AppTheme.NoActionBar">
71+
android:theme="@style/AppTheme.NoActionBar"
72+
android:exported="true">
7173
<intent-filter>
7274
<action android:name="android.intent.action.SEND" />
7375
<category android:name="android.intent.category.DEFAULT" />
@@ -94,7 +96,8 @@
9496
</activity>
9597
<activity
9698
android:name=".PanoViewerActivity"
97-
android:theme="@style/AppTheme.NoActionBar">
99+
android:theme="@style/AppTheme.NoActionBar"
100+
android:exported="false">
98101
<intent-filter>
99102
<action android:name="android.intent.action.SEND" />
100103
<category android:name="android.intent.category.DEFAULT" />

‎app/src/main/java/fr/nuage/souvenirs/AddImageToAlbumActivity.java

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.Intent;
44
import android.net.Uri;
55
import android.os.Bundle;
6+
import android.os.Parcelable;
67
import android.widget.ProgressBar;
78

89
import androidx.appcompat.app.AlertDialog;
@@ -13,6 +14,8 @@
1314
import androidx.recyclerview.widget.RecyclerView;
1415

1516
import java.util.ArrayList;
17+
import java.util.Collection;
18+
import java.util.Collections;
1619
import java.util.UUID;
1720

1821
import fr.nuage.souvenirs.model.TilePageBuilder;
@@ -49,11 +52,18 @@ protected void onCreate(Bundle savedInstanceState) {
4952
videoUris.add(intent.getParcelableExtra(Intent.EXTRA_STREAM));
5053
}
5154
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
52-
if (type.startsWith("image/")) {
53-
imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
54-
} else if (type.startsWith("video/")) {
55-
videoUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
55+
imageUris = new ArrayList<>();
56+
videoUris = new ArrayList<>();
57+
for (Parcelable uri : intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)) {
58+
String mimeType = getContentResolver().getType((Uri) uri);
59+
if (mimeType.startsWith("image/")) {
60+
imageUris.add((Uri) uri);
61+
} else if (mimeType.startsWith("video/")) {
62+
videoUris.add((Uri) uri);
63+
}
5664
}
65+
Collections.reverse(imageUris);
66+
Collections.reverse(videoUris);
5767
}
5868
//load view model
5969
albumsVM = new ViewModelProvider(this,new AlbumListViewModelFactory(getApplication())).get(AlbumListViewModel.class);

‎app/src/main/java/fr/nuage/souvenirs/AlbumListActivity.java

+10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import static java.lang.Math.min;
44

5+
import android.Manifest;
56
import android.annotation.SuppressLint;
7+
import android.app.Activity;
68
import android.app.NotificationChannel;
79
import android.app.NotificationManager;
810
import android.content.ComponentName;
911
import android.content.Intent;
1012
import android.content.SharedPreferences;
13+
import android.content.pm.PackageManager;
1114
import android.content.pm.ShortcutInfo;
1215
import android.graphics.Color;
1316
import android.graphics.drawable.Icon;
@@ -19,7 +22,9 @@
1922
import androidx.appcompat.app.AppCompatActivity;
2023
import androidx.appcompat.widget.Toolbar;
2124
import androidx.coordinatorlayout.widget.CoordinatorLayout;
25+
import androidx.core.app.ActivityCompat;
2226
import androidx.core.app.Person;
27+
import androidx.core.content.ContextCompat;
2328
import androidx.core.content.pm.ShortcutInfoCompat;
2429
import androidx.core.content.pm.ShortcutManagerCompat;
2530
import androidx.core.content.res.ResourcesCompat;
@@ -100,6 +105,11 @@ private void updateShorcuts() {
100105

101106

102107
private void createNotificationChannel() {
108+
//Ask notification permission
109+
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS)!= PackageManager.PERMISSION_GRANTED) {
110+
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.POST_NOTIFICATIONS}, 0);
111+
}
112+
103113
// Create the NotificationChannel, but only on API 26+ because
104114
// the NotificationChannel class is new and not in the support library
105115
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

‎app/src/main/java/fr/nuage/souvenirs/model/Album.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ public JSONObject toJSON() {
9191
json.put("name",name);
9292
json.put("id",id.toString());
9393
JSONArray jPages = new JSONArray();
94-
for( Page p: pages ) {
94+
ArrayList<Page> mPages = pages;
95+
for( Page p: mPages ) {
9596
jPages.put(p.toJSON());
9697
}
9798
json.put("pages",jPages);

‎app/src/main/java/fr/nuage/souvenirs/model/ImageElement.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ public MutableLiveData<Integer> getLiveDataTransformType() {
250250
}
251251

252252
private void deleteImageFile() {
253-
if ((getImagePath() != null) && !(pageParent.getAlbum().getAlbumImage().equals(getImagePath()) )) {
253+
if (getImagePath() != null) {
254+
//check if the image is the album image, in that case, do not delete image
255+
if ((pageParent.getAlbum().getAlbumImage() != null) && (pageParent.getAlbum().getAlbumImage().equals(getImagePath()) )) {
256+
return;
257+
}
254258
File imageFile = new File(getImagePath());
255259
if (imageFile.exists()) {
256260
imageFile.delete();
@@ -356,7 +360,7 @@ public int getImageWidth() {
356360
case ExifInterface.ORIENTATION_ROTATE_90:
357361
return options.outHeight;
358362
}
359-
} catch (IOException e) {
363+
} catch (IOException ignored) {
360364
}
361365
return options.outWidth;
362366
}
@@ -380,7 +384,7 @@ public int getImageHeight() {
380384
case ExifInterface.ORIENTATION_ROTATE_90:
381385
return options.outWidth;
382386
}
383-
} catch (IOException e) {
387+
} catch (IOException ignored) {
384388
}
385389
return options.outHeight;
386390
}

‎app/src/main/java/fr/nuage/souvenirs/view/EditPageFragment.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
150150

151151
//listen to pages list change
152152
albumVM.getLdPages().observe(getViewLifecycleOwner(), pages -> {
153-
pageEditAdapter.setPages(pages);
153+
if (pages != null) {
154+
pageEditAdapter.setPages(pages);
155+
}
154156
});
155157
//listen to page change
156158
albumVM.getFocusPageId().observe(getViewLifecycleOwner(), uuid -> {

‎app/src/main/java/fr/nuage/souvenirs/view/PageEditAdapter.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ public PageView getPageView() {
4545

4646
public PageEditAdapter(AlbumViewModel albumViewModel, Fragment fragment, ArrayList<PageViewModel> pages) {
4747
super();
48-
this.pages = pages;
48+
if (pages == null) {
49+
this.pages = new ArrayList<>();
50+
} else {
51+
this.pages = pages;
52+
}
4953
this.albumViewModel = albumViewModel;
5054
this.fragment = fragment;
5155
}

0 commit comments

Comments
 (0)
Failed to load comments.