Skip to content

Commit

Permalink
update 1.9.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Sep 25, 2022
1 parent 9aaeb9c commit a900651
Show file tree
Hide file tree
Showing 15 changed files with 340 additions and 65 deletions.
11 changes: 7 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (file('google-services.json').exists()) {
}

android {
compileSdkVersion 32
compileSdkVersion 30
buildToolsVersion "30.0.3"
ndkVersion '23.1.7779620'

Expand All @@ -23,9 +23,10 @@ android {
defaultConfig {
applicationId "com.xjs.ehviewer"
minSdkVersion 23
targetSdkVersion 32
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
versionCode 109
versionName "1.9.1.2"
versionName "1.9.2.0"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
"es", "ja", "ko", "fr", "de", "th"
Expand Down Expand Up @@ -73,6 +74,8 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
// sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8
}

buildFeatures {
Expand Down Expand Up @@ -114,7 +117,7 @@ dependencies {
implementation 'com.alibaba:fastjson:1.2.73'
implementation 'androidx.recyclerview:recyclerview:1.2.0'

// https://mvnrepository.com/artifact/com.fpliu.ndk.pkg.prefab.android.21/libpng
// https://mvnrepository.com/artifact/com.fpliu.ndk.pkg.prefab.android.21/libpng
implementation 'com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.firebase:firebase-analytics:19.0.2'
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/hippo/ehviewer/client/EhUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ public static String getSuitableTitle(GalleryInfo gi) {
}
}

public static boolean judgeSuitableTitle(GalleryInfo gi,String key) {
String titleB = gi.titleJpn+""+gi.title;
return titleB.contains(key);
}

@Nullable
public static String extractTitle(String title) {
if (null == title) {
Expand Down
28 changes: 16 additions & 12 deletions app/src/main/java/com/hippo/ehviewer/ui/main/UserImageChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import android.transition.Visibility;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -65,7 +65,7 @@ public class UserImageChange implements PermissionCallBack {
private Uri imageUri;
private File outputImage;

private ImageChangeCallBack imageChangeCallBack;
private final ImageChangeCallBack imageChangeCallBack;


public UserImageChange(@NonNull Activity activity,
Expand Down Expand Up @@ -180,31 +180,30 @@ private void startAlbum() {
REQUEST_STORAGE_PERMISSION, this);
}

public void saveImageForResult(int requestCode, int resultCode, @Nullable Intent data, AvatarImageView avatar, ImageView background) {
public void saveImageForResult(int requestCode, int resultCode, @Nullable Intent data, AvatarImageView avatar) {
if (resultCode != Activity.RESULT_OK) {
return;
}
if (requestCode == PICK_PHOTO) {
assert data != null;
saveImageFromAlbum(data, avatar, background);
saveImageFromAlbum(data, avatar);
} else {
saveImageFromCamera(avatar, background);
saveImageFromCamera(avatar);
}

}

private void saveImageFromCamera(AvatarImageView avatar, ImageView background) {
private void saveImageFromCamera(AvatarImageView avatar) {
Settings.saveFilePath(key,
outputImage.getPath());
if (dialogType == CHANGE_BACKGROUND) {
imageChangeCallBack.backgroundSourceChange(new File(outputImage.getPath()));
// background.setImageBitmap(BitmapFactory.decodeFile(outputImage.getPath()));
} else {
avatar.setImageBitmap(BitmapFactory.decodeFile(outputImage.getPath()));
}
}

private void saveImageFromAlbum(Intent data, AvatarImageView avatar, ImageView background) {
private void saveImageFromAlbum(Intent data, AvatarImageView avatar) {

String imagePath = null;
Uri uri = data.getData();
Expand All @@ -218,8 +217,13 @@ private void saveImageFromAlbum(Intent data, AvatarImageView avatar, ImageView b
String selection = MediaStore.Images.Media._ID + "=" + id;
imagePath = getImagePath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, selection);
} else if ("com.android.providers.downloads.documents".equals(uri.getAuthority())) {
Uri contentUri = ContentUris.withAppendedId(Uri.parse("content: //downloads/public_downloads"), Long.parseLong(docId));
imagePath = getImagePath(contentUri, null);
try {
Uri contentUri = ContentUris.withAppendedId(Uri.parse("content: //downloads/public_downloads"), Long.parseLong(docId));
imagePath = getImagePath(contentUri, null);
}catch (NumberFormatException e){
e.printStackTrace();
Toast.makeText(activity,"获取图片路径出错",Toast.LENGTH_SHORT).show();
}
}
} else {
assert uri != null;
Expand All @@ -232,10 +236,10 @@ private void saveImageFromAlbum(Intent data, AvatarImageView avatar, ImageView b
}
}
// 根据图片路径显示图片
saveImage(imagePath, avatar, background);
saveImage(imagePath, avatar);
}

private void saveImage(String imagePath, AvatarImageView avatar, ImageView background) {
private void saveImage(String imagePath, AvatarImageView avatar) {

if (imagePath == null){
return;
Expand Down
Loading

0 comments on commit a900651

Please sign in to comment.