1.Migrate to Android Gradle plugin 4.0.0

This commit is contained in:
ZaneYork 2020-08-05 16:06:16 +08:00
parent b15b84dc95
commit 4e32e188f0
22 changed files with 106 additions and 78 deletions

30
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

View File

@ -18,3 +18,9 @@
2. 生成SMAPI依赖的文件 2. 生成SMAPI依赖的文件
3. 修改安装包添加SMAPI的启动代码 3. 修改安装包添加SMAPI的启动代码
4. 签名安装包并发起Mod版游戏的安装 4. 签名安装包并发起Mod版游戏的安装
### 下载地址
1. [GitHub](https://github.com/ZaneYork/SMAPI-Android-Installer/releases)
2. [Coolapk](https://www.coolapk.com/apk/256582)
3. ~~Google Play~~ 已下架,开发者账户被谷歌无理由关联封禁,从此谷歌一生黑

View File

@ -36,6 +36,9 @@ android {
} }
compileOptions { compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
@ -60,14 +63,13 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
def nav_version = "2.3.0-beta01" implementation "androidx.navigation:navigation-fragment:2.3.0"
implementation "androidx.navigation:navigation-fragment:$nav_version" implementation "androidx.navigation:navigation-ui:2.3.0"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on // https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.65' implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.65.01'
implementation 'com.afollestad.material-dialogs:core:3.3.0' implementation 'com.afollestad.material-dialogs:core:3.3.0'
implementation 'com.afollestad.material-dialogs:input:3.3.0' implementation 'com.afollestad.material-dialogs:input:3.3.0'
implementation 'com.afollestad.material-dialogs:lifecycle:3.3.0' implementation 'com.afollestad.material-dialogs:lifecycle:3.3.0'
@ -83,19 +85,20 @@ dependencies {
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 // https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
// https://mvnrepository.com/artifact/commons-io/commons-io // https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.6' implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation 'com.lzy.net:okgo:3.0.4' implementation 'com.lzy.net:okgo:3.0.4'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.3' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.3' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.10.3' implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.0'
implementation 'com.github.didikee:AndroidDonate:0.1.0' implementation 'com.github.didikee:AndroidDonate:0.1.0'
implementation 'com.hjq:language:3.0' implementation 'com.hjq:language:3.0'
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'net.sourceforge.streamsupport:android-retrostreams:1.7.1'
testImplementation 'junit:junit:4.12' api 'org.greenrobot:greendao:3.3.0'
api 'org.greenrobot:greendao-generator:3.3.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
@ -106,6 +109,7 @@ dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12' compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.12'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
api 'com.smart.library.util:bspatch:0.0.2' api 'com.smart.library.util:bspatch:0.0.2'
} }

View File

@ -51,9 +51,9 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java9.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java9.util.stream.StreamSupport; import java.util.stream.StreamSupport;
/** /**
* Default implementation of {@link ApkSignerEngine}. * Default implementation of {@link ApkSignerEngine}.
@ -438,8 +438,8 @@ public class DefaultApkSignerEngine implements ApkSignerEngine {
isDebuggable(entryName)) { isDebuggable(entryName)) {
Optional<V1SchemeVerifier.NamedDigest> extractedDigest = Optional<V1SchemeVerifier.NamedDigest> extractedDigest =
StreamSupport.stream(V1SchemeVerifier.getDigestsToVerify( V1SchemeVerifier.getDigestsToVerify(
entry.getValue(), "-Digest", mMinSdkVersion, Integer.MAX_VALUE)) entry.getValue(), "-Digest", mMinSdkVersion, Integer.MAX_VALUE).stream()
.filter(d -> d.jcaDigestAlgorithm == alg) .filter(d -> d.jcaDigestAlgorithm == alg)
.findFirst(); .findFirst();

View File

@ -30,8 +30,8 @@ import com.android.apksig.util.DataSink;
import com.android.apksig.util.DataSinks; import com.android.apksig.util.DataSinks;
import com.android.apksig.util.DataSource; import com.android.apksig.util.DataSource;
import com.android.apksig.util.DataSources; import com.android.apksig.util.DataSources;
import com.android.apksig.util.RunnablesExecutor; import com.android.apksig.util.RunnablesExecutor;
import java.io.IOException; import java.io.IOException;
import java.nio.BufferUnderflowException; import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -58,15 +58,10 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function; import java.util.function.Supplier;
import java9.util.function.Supplier; import java.util.stream.Collectors;
import java9.util.stream.Collectors; import java.util.stream.StreamSupport;
import java9.util.stream.StreamSupport;
public class ApkSigningBlockUtils { public class ApkSigningBlockUtils {
@ -417,7 +412,7 @@ public class ApkSigningBlockUtils {
DataSource centralDir, DataSource centralDir,
DataSource eocd) throws IOException, NoSuchAlgorithmException, DigestException { DataSource eocd) throws IOException, NoSuchAlgorithmException, DigestException {
Map<ContentDigestAlgorithm, byte[]> contentDigests = new HashMap<>(); Map<ContentDigestAlgorithm, byte[]> contentDigests = new HashMap<>();
Set<ContentDigestAlgorithm> oneMbChunkBasedAlgorithm = StreamSupport.stream(digestAlgorithms) Set<ContentDigestAlgorithm> oneMbChunkBasedAlgorithm = digestAlgorithms.stream()
.filter(a -> a == ContentDigestAlgorithm.CHUNKED_SHA256 || .filter(a -> a == ContentDigestAlgorithm.CHUNKED_SHA256 ||
a == ContentDigestAlgorithm.CHUNKED_SHA512) a == ContentDigestAlgorithm.CHUNKED_SHA512)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
@ -1102,7 +1097,7 @@ public class ApkSigningBlockUtils {
if (bestSigAlgorithmOnSdkVersion.isEmpty()) { if (bestSigAlgorithmOnSdkVersion.isEmpty()) {
throw new NoSupportedSignaturesException("No supported signature"); throw new NoSupportedSignaturesException("No supported signature");
} }
return StreamSupport.stream(bestSigAlgorithmOnSdkVersion.values()) return bestSigAlgorithmOnSdkVersion.values().stream()
.sorted((sig1, sig2) -> Integer.compare( .sorted((sig1, sig2) -> Integer.compare(
sig1.algorithm.getId(), sig2.algorithm.getId())) sig1.algorithm.getId(), sig2.algorithm.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -25,7 +25,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java9.util.stream.Stream; import java.util.stream.Stream;
/** Pseudo {@link DataSource} that chains the given {@link DataSource} as a continuous one. */ /** Pseudo {@link DataSource} that chains the given {@link DataSource} as a continuous one. */
public class ChainedDataSource implements DataSource { public class ChainedDataSource implements DataSource {

View File

@ -4,7 +4,7 @@ import android.content.Intent;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java9.util.function.BiConsumer; import java.util.function.BiConsumer;
public class ActivityResultHandler { public class ActivityResultHandler {
public static int REQUEST_CODE_APP_INSTALL = 1001; public static int REQUEST_CODE_APP_INSTALL = 1001;

View File

@ -52,10 +52,10 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.Deflater; import java.util.zip.Deflater;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import java9.util.Objects; import java.util.Objects;
import java9.util.function.Consumer; import java.util.function.Consumer;
import java9.util.stream.Collectors; import java.util.stream.Collectors;
import java9.util.stream.StreamSupport;
import pxb.android.axml.NodeVisitor; import pxb.android.axml.NodeVisitor;
/** /**
@ -191,7 +191,7 @@ public class ApkPatcher {
ApkFilesManifest apkFilesManifest = apkFilesManifests.get(0); ApkFilesManifest apkFilesManifest = apkFilesManifests.get(0);
List<ManifestEntry> manifestEntries = apkFilesManifest.getManifestEntries(); List<ManifestEntry> manifestEntries = apkFilesManifest.getManifestEntries();
errorMessage.set(null); errorMessage.set(null);
List<ZipUtils.ZipEntrySource> entries = StreamSupport.stream(manifestEntries).map(entry -> { List<ZipUtils.ZipEntrySource> entries = manifestEntries.stream().map(entry -> {
if (entry.isAdvanced() && !advanced) { if (entry.isAdvanced() && !advanced) {
return null; return null;
} }
@ -384,7 +384,7 @@ public class ApkPatcher {
thread.interrupt(); thread.interrupt();
} }
if (result.containsErrors()) { if (result.containsErrors()) {
errorMessage.set(StreamSupport.stream(result.getErrors()).map(ApkVerifier.IssueWithParams::toString).collect(Collectors.joining(","))); errorMessage.set(result.getErrors().stream().map(ApkVerifier.IssueWithParams::toString).collect(Collectors.joining(",")));
return null; return null;
} }
emitProgress(95); emitProgress(95);

View File

@ -44,8 +44,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java9.util.function.BiConsumer; import java.util.function.BiConsumer;
import java9.util.function.Consumer; import java.util.function.Consumer;
import pxb.android.axml.AxmlReader; import pxb.android.axml.AxmlReader;
import pxb.android.axml.AxmlVisitor; import pxb.android.axml.AxmlVisitor;
import pxb.android.axml.AxmlWriter; import pxb.android.axml.AxmlWriter;

View File

@ -2,7 +2,7 @@ package com.zane.smapiinstaller.logic;
import java.util.List; import java.util.List;
import java9.util.function.Predicate; import java.util.function.Predicate;
/** /**
* @author Zane * @author Zane

View File

@ -39,11 +39,10 @@ import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java9.util.Objects; import java.util.Objects;
import java9.util.function.Consumer; import java.util.function.Consumer;
import java9.util.function.Predicate; import java.util.function.Predicate;
import java9.util.stream.Collectors; import java.util.stream.Collectors;
import java9.util.stream.StreamSupport;
/** /**
* Mod资源管理器 * Mod资源管理器
@ -171,7 +170,7 @@ public class ModAssetsManager {
if (installedMods.size() > 1) { if (installedMods.size() > 1) {
DialogUtils.showAlertDialog(root, R.string.error, DialogUtils.showAlertDialog(root, R.string.error,
String.format(context.getString(R.string.duplicate_mod_found), String.format(context.getString(R.string.duplicate_mod_found),
StreamSupport.stream(installedMods).map(item -> FileUtils.toPrettyPath(item.getAssetPath())).collect(Collectors.joining(",")))); installedMods.stream().map(item -> FileUtils.toPrettyPath(item.getAssetPath())).collect(Collectors.joining(","))));
return false; return false;
} else if (installedMods.size() == 0) { } else if (installedMods.size() == 0) {
installedMods = installedModMap.get(mod.getUniqueID().replace("ZaneYork.CustomLocalization", "SMAPI.CustomLocalization")); installedMods = installedModMap.get(mod.getUniqueID().replace("ZaneYork.CustomLocalization", "SMAPI.CustomLocalization"));
@ -228,7 +227,7 @@ public class ModAssetsManager {
for (String key : installedModMap.keySet()) { for (String key : installedModMap.keySet()) {
ImmutableList<ModManifestEntry> installedMods = installedModMap.get(key); ImmutableList<ModManifestEntry> installedMods = installedModMap.get(key);
if (installedMods.size() > 1) { if (installedMods.size() > 1) {
list.add(StreamSupport.stream(installedMods).map(item -> FileUtils.toPrettyPath(item.getAssetPath())).collect(Collectors.joining(","))); list.add(installedMods.stream().map(item -> FileUtils.toPrettyPath(item.getAssetPath())).collect(Collectors.joining(",")));
} }
} }
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -254,7 +253,7 @@ public class ModAssetsManager {
* @param returnCallback 回调函数 * @param returnCallback 回调函数
*/ */
private void checkUnsatisfiedDependencies(ImmutableListMultimap<String, ModManifestEntry> installedModMap, Consumer<Boolean> returnCallback) { private void checkUnsatisfiedDependencies(ImmutableListMultimap<String, ModManifestEntry> installedModMap, Consumer<Boolean> returnCallback) {
List<String> dependencyErrors = StreamSupport.stream(installedModMap.values()) List<String> dependencyErrors = installedModMap.values().stream()
.map(mod -> checkModDependencyError(mod, installedModMap)) .map(mod -> checkModDependencyError(mod, installedModMap))
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -281,7 +280,7 @@ public class ModAssetsManager {
* @param returnCallback 回调函数 * @param returnCallback 回调函数
*/ */
private void checkContentpacks(ImmutableListMultimap<String, ModManifestEntry> installedModMap, Consumer<Boolean> returnCallback) { private void checkContentpacks(ImmutableListMultimap<String, ModManifestEntry> installedModMap, Consumer<Boolean> returnCallback) {
List<String> dependencyErrors = StreamSupport.stream(installedModMap.values()) List<String> dependencyErrors = installedModMap.values().stream()
.map(mod -> checkContentPackDependencyError(mod, installedModMap)) .map(mod -> checkContentPackDependencyError(mod, installedModMap))
.filter(Objects::nonNull).collect(Collectors.toList()); .filter(Objects::nonNull).collect(Collectors.toList());
if (!dependencyErrors.isEmpty()) { if (!dependencyErrors.isEmpty()) {
@ -304,7 +303,7 @@ public class ModAssetsManager {
if (checkUpdating.get()) { if (checkUpdating.get()) {
return; return;
} }
List<ModUpdateCheckRequestDto.ModInfo> list = StreamSupport.stream(findAllInstalledMods(false)) List<ModUpdateCheckRequestDto.ModInfo> list = findAllInstalledMods(false).stream()
.filter(mod -> mod.getUpdateKeys() != null && !mod.getUpdateKeys().isEmpty()) .filter(mod -> mod.getUpdateKeys() != null && !mod.getUpdateKeys().isEmpty())
.map(ModUpdateCheckRequestDto.ModInfo::fromModManifestEntry) .map(ModUpdateCheckRequestDto.ModInfo::fromModManifestEntry)
.distinct() .distinct()
@ -334,7 +333,7 @@ public class ModAssetsManager {
checkUpdating.set(false); checkUpdating.set(false);
List<ModUpdateCheckResponseDto> checkResponseDtos = response.body(); List<ModUpdateCheckResponseDto> checkResponseDtos = response.body();
if (checkResponseDtos != null) { if (checkResponseDtos != null) {
List<ModUpdateCheckResponseDto> list = StreamSupport.stream(checkResponseDtos).filter(dto -> dto.getSuggestedUpdate() != null).collect(Collectors.toList()); List<ModUpdateCheckResponseDto> list = checkResponseDtos.stream().filter(dto -> dto.getSuggestedUpdate() != null).collect(Collectors.toList());
callback.accept(list); callback.accept(list);
} }
} }
@ -347,7 +346,7 @@ public class ModAssetsManager {
private String checkModDependencyError(ModManifestEntry mod, ImmutableListMultimap<String, ModManifestEntry> installedModMap) { private String checkModDependencyError(ModManifestEntry mod, ImmutableListMultimap<String, ModManifestEntry> installedModMap) {
if (mod.getDependencies() != null) { if (mod.getDependencies() != null) {
List<ModManifestEntry> unsatisfiedDependencies = StreamSupport.stream(mod.getDependencies()) List<ModManifestEntry> unsatisfiedDependencies = mod.getDependencies().stream()
.filter(dependency -> isDependencyIsExist(dependency, installedModMap)) .filter(dependency -> isDependencyIsExist(dependency, installedModMap))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (unsatisfiedDependencies.size() > 0) { if (unsatisfiedDependencies.size() > 0) {

View File

@ -16,7 +16,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java9.util.function.Predicate; import java.util.function.Predicate;
/** /**
* 在线列表更新管理器 * 在线列表更新管理器

View File

@ -27,10 +27,9 @@ import java.util.List;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
import java9.util.Objects; import java.util.Objects;
import java9.util.function.Predicate; import java.util.function.Predicate;
import java9.util.stream.Collectors; import java.util.stream.Collectors;
import java9.util.stream.StreamSupport;
class ConfigViewModel extends ViewModel implements ListenableObject<List<ModManifestEntry>> { class ConfigViewModel extends ViewModel implements ListenableObject<List<ModManifestEntry>> {
@ -114,7 +113,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
AppConfig activeTranslator = ConfigUtils.getConfig(app, AppConfigKey.ACTIVE_TRANSLATOR, TranslateUtil.NONE); AppConfig activeTranslator = ConfigUtils.getConfig(app, AppConfigKey.ACTIVE_TRANSLATOR, TranslateUtil.NONE);
if (!StringUtils.equals(activeTranslator.getValue(), TranslateUtil.NONE)) { if (!StringUtils.equals(activeTranslator.getValue(), TranslateUtil.NONE)) {
String translator = activeTranslator.getValue(); String translator = activeTranslator.getValue();
List<String> descriptions = StreamSupport.stream(this.modList).map(ModManifestEntry::getDescription).filter(Objects::nonNull).collect(Collectors.toList()); List<String> descriptions = this.modList.stream().map(ModManifestEntry::getDescription).filter(Objects::nonNull).collect(Collectors.toList());
String language = LanguagesManager.getAppLanguage(app).getLanguage(); String language = LanguagesManager.getAppLanguage(app).getLanguage();
Query<TranslationResult> query = daoSession.getTranslationResultDao().queryBuilder().where( Query<TranslationResult> query = daoSession.getTranslationResultDao().queryBuilder().where(
TranslationResultDao.Properties.Origin.in(descriptions), TranslationResultDao.Properties.Origin.in(descriptions),
@ -123,7 +122,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
).build(); ).build();
List<TranslationResult> translationResults = query.list(); List<TranslationResult> translationResults = query.list();
ImmutableMap<String, TranslationResult> translateMap = Maps.uniqueIndex(translationResults, TranslationResult::getOrigin); ImmutableMap<String, TranslationResult> translateMap = Maps.uniqueIndex(translationResults, TranslationResult::getOrigin);
List<String> untranslatedText = StreamSupport.stream(modList).map(mod -> { List<String> untranslatedText = modList.stream().map(mod -> {
if (translateMap.containsKey(mod.getDescription())) { if (translateMap.containsKey(mod.getDescription())) {
mod.setTranslatedDescription(translateMap.get(mod.getDescription()).getTranslation()); mod.setTranslatedDescription(translateMap.get(mod.getDescription()).getTranslation());
return null; return null;
@ -167,7 +166,7 @@ class ConfigViewModel extends ViewModel implements ListenableObject<List<ModMani
if (StringUtils.isBlank(text)) { if (StringUtils.isBlank(text)) {
filteredModList = modList; filteredModList = modList;
} else { } else {
filteredModList = StreamSupport.stream(modList).filter(mod -> { filteredModList = modList.stream().filter(mod -> {
if (StringUtils.containsIgnoreCase(mod.getName(), text)) { if (StringUtils.containsIgnoreCase(mod.getName(), text)) {
return true; return true;
} }

View File

@ -29,7 +29,7 @@ import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import java9.util.function.Predicate; import java.util.function.Predicate;
/** /**
* @author Zane * @author Zane

View File

@ -20,7 +20,6 @@ import com.zane.smapiinstaller.constant.DialogAction;
import com.zane.smapiinstaller.logic.ApkPatcher; import com.zane.smapiinstaller.logic.ApkPatcher;
import com.zane.smapiinstaller.logic.CommonLogic; import com.zane.smapiinstaller.logic.CommonLogic;
import com.zane.smapiinstaller.logic.ModAssetsManager; import com.zane.smapiinstaller.logic.ModAssetsManager;
import com.zane.smapiinstaller.ui.main.MainTabsFragment;
import com.zane.smapiinstaller.ui.main.MainTabsFragmentDirections; import com.zane.smapiinstaller.ui.main.MainTabsFragmentDirections;
import com.zane.smapiinstaller.utils.ConfigUtils; import com.zane.smapiinstaller.utils.ConfigUtils;
import com.zane.smapiinstaller.utils.DialogUtils; import com.zane.smapiinstaller.utils.DialogUtils;

View File

@ -21,8 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import java9.util.Optional; import java.util.Optional;
import java9.util.stream.StreamSupport;
/** /**
* {@link RecyclerView.Adapter} that can display a {@link ModUpdateCheckResponseDto.UpdateInfo} * {@link RecyclerView.Adapter} that can display a {@link ModUpdateCheckResponseDto.UpdateInfo}
@ -68,7 +67,7 @@ public class ModUpdateAdapter extends RecyclerView.Adapter<ModUpdateAdapter.View
public void setUpdateInfo(ModUpdateCheckResponseDto updateInfo) { public void setUpdateInfo(ModUpdateCheckResponseDto updateInfo) {
this.updateInfo = updateInfo; this.updateInfo = updateInfo;
String id = updateInfo.getId(); String id = updateInfo.getId();
Optional<ModManifestEntry> mod = StreamSupport.stream(installedModMap.get(id)).sorted((a, b) -> VersionUtil.compareVersion(a.getVersion(), b.getVersion())).findFirst(); Optional<ModManifestEntry> mod = installedModMap.get(id).stream().sorted((a, b) -> VersionUtil.compareVersion(a.getVersion(), b.getVersion())).findFirst();
if (mod.isPresent()) { if (mod.isPresent()) {
ModManifestEntry modManifestEntry = mod.get(); ModManifestEntry modManifestEntry = mod.get();
textModName.setText(modManifestEntry.getName()); textModName.setText(modManifestEntry.getName());

View File

@ -16,7 +16,7 @@ import com.zane.smapiinstaller.logic.CommonLogic;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java9.util.function.BiConsumer; import java.util.function.BiConsumer;
/** /**
* 对话框相关工具类 * 对话框相关工具类

View File

@ -18,8 +18,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java9.util.stream.Collectors; import java.util.stream.Collectors;
import java9.util.stream.StreamSupport;
/** /**
* @author Zane * @author Zane
@ -34,7 +33,7 @@ public class TranslateUtil {
if(textList == null || textList.size() == 0) { if(textList == null || textList.size() == 0) {
return; return;
} }
textList = StreamSupport.stream(textList).filter(item -> StringUtils.isNoneBlank(item) && !item.contains("\n")).collect(Collectors.toList()); textList = textList.stream().filter(item -> StringUtils.isNoneBlank(item) && !item.contains("\n")).collect(Collectors.toList());
if(textList.isEmpty()) { if(textList.isEmpty()) {
return; return;
} }

View File

@ -6,8 +6,6 @@ import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import java9.util.stream.StreamSupport;
/** /**
* 版本比较工具 * 版本比较工具
* @author Zane * @author Zane
@ -58,7 +56,7 @@ public class VersionUtil {
* @return 是否为空版本段 * @return 是否为空版本段
*/ */
private static boolean isZero(List<String> versionSections) { private static boolean isZero(List<String> versionSections) {
return !StreamSupport.stream(versionSections).filter(version -> { return !versionSections.stream().anyMatch(version -> {
try { try {
int i = Integer.parseInt(version); int i = Integer.parseInt(version);
if (i == 0) { if (i == 0) {
@ -67,7 +65,7 @@ public class VersionUtil {
} catch (Exception ignored) { } catch (Exception ignored) {
} }
return true; return true;
}).findAny().isPresent(); });
} }
/** /**

View File

@ -13,7 +13,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java9.util.function.Consumer; import java.util.function.Consumer;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@ -8,10 +8,10 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.6.3' classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0-beta01" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Sun Mar 01 22:21:39 CST 2020 #Wed Aug 05 15:43:33 CST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip