diff --git a/app/build.gradle b/app/build.gradle index 4672e37..5ec7970 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.lazyeraser.imas.derehelper" minSdkVersion 17 targetSdkVersion 25 - versionCode 11 - versionName "1.0.1" + versionCode 12 + versionName "1.0.2" multiDexEnabled true vectorDrawables.useSupportLibrary = true } @@ -24,23 +24,14 @@ android { checkReleaseBuilds false abortOnError false } - signingConfigs { - release { - storeFile file(System.properties['key.file']) - storePassword System.properties['key.pwd'] - keyAlias System.properties['key.ali'] - keyPassword System.properties['key.ali.pwd'] - v2SigningEnabled false - } - } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release +// signingConfig signingConfigs.release } debug { - signingConfig signingConfigs.release +// signingConfig signingConfigs.release } } android.applicationVariants.all { variant -> diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f76619f..4bc060f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ { - umi.dismissLoading(); - if(!b){ + updateManager.checkUpdate(hint, haveUpdate -> { + snackBar_checkUpdate.dismiss(); + if(!haveUpdate){ if (umi.getSP(SharedHelper.KEY_AUTO_DATA) && !needUpdateHint){ - umi.makeToast(R.string.settings_auto_data); mainViewModel.checkDataUpdate(); } } @@ -195,11 +195,10 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == 1 && permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)){ if (grantResults[0] == PackageManager.PERMISSION_GRANTED){ - updateManager.checkUpdate(needUpdateHint, b -> { - umi.dismissLoading(); - if(!b){ + updateManager.checkUpdate(needUpdateHint, haveUpdate -> { + snackBar_checkUpdate.dismiss(); + if(!haveUpdate){ if (umi.getSP(SharedHelper.KEY_AUTO_DATA) && !needUpdateHint){ - umi.makeToast(R.string.settings_auto_data); mainViewModel.checkDataUpdate(); } } @@ -260,11 +259,10 @@ private void initDialog(){ public void onPropertyChanged(Observable observable, int i) { if (mainViewModel.upToDate.get()){ if (manualCheck){ - umi.dismissLoading(); upToDateDialog.show(); - }else { + }/*else { Messenger.getDefault().sendNoMsg(TOKEN_DATA_UPDATED); - } + }*/ mainViewModel.upToDate.set(false); manualCheck = false; } diff --git a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardListViewModel.java b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardListViewModel.java index 0e90bc6..4b1bd62 100644 --- a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardListViewModel.java +++ b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardListViewModel.java @@ -37,7 +37,10 @@ import cn.pedant.SweetAlert.SweetAlertDialog; import me.tatarka.bindingcollectionadapter.ItemView; import rx.Observable; +import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; +import rx.functions.Action1; +import rx.observables.ConnectableObservable; import rx.schedulers.Schedulers; /** @@ -70,6 +73,7 @@ public class CardListViewModel extends BaseViewModel { /*-------------commands for filter---------------*/ private List evoFilter = new ArrayList<>(); private List rareFilter = new ArrayList<>(); + private List rareFilter_temp = new ArrayList<>(); private List typeFilter = new ArrayList<>(); private List skillFilter = new ArrayList<>(); private List getTypeFilter = new ArrayList<>(); // 获取方式/卡池类型筛选 @@ -77,17 +81,34 @@ public class CardListViewModel extends BaseViewModel { private Integer sortType; public final ReplyCommand> onRareSelCommand = new ReplyCommand<>(strings -> { - rareFilter.clear(); + rareFilter_temp.clear(); for (String string : strings) { - rareFilter.add(SStaticR.rarityMap_rev.get(string)); + rareFilter_temp.add(SStaticR.rarityMap_rev.get(string)); } + solveRareFilter(); + }); + + public final ReplyCommand> onEvoSelCommand = new ReplyCommand<>(integers -> { + evoFilter = integers; + solveRareFilter(); }); + private void solveRareFilter(){ + rareFilter.clear(); + if (evoFilter.contains(0)){ + rareFilter.addAll(rareFilter_temp); + } + if (evoFilter.contains(1)){ + for (Integer integer : rareFilter_temp) { + rareFilter.add(integer + 1); + } + } + } + public final ReplyCommand> onGetTypeSelCommand = new ReplyCommand<>(integers -> getTypeFilter = integers); public final ReplyCommand> onTypeSelCommand = new ReplyCommand<>(strings -> typeFilter = strings); - public final ReplyCommand> onEvoSelCommand = new ReplyCommand<>(integers -> evoFilter = integers); public final ReplyCommand> sortTypeCommand = new ReplyCommand<>(strings -> sortType = SStaticR.sortTypeMap_Card.get(strings.get(0))); @@ -125,7 +146,7 @@ public void onPropertyChanged(android.databinding.Observable sender, int propert }else { umi.dismissLoading(); } - if (!umi.getSP(SharedHelper.KEY_ANALYTICS_ASKED)){ + /*if (!umi.getSP(SharedHelper.KEY_ANALYTICS_ASKED)){ SweetAlertDialog sweetAlertDialog = new SweetAlertDialog(mContext) .setTitleText(mContext.getString(R.string.analytics_ask_title)) .setContentText(mContext.getString(R.string.analytics_ask_content)) @@ -143,7 +164,7 @@ public void onPropertyChanged(android.databinding.Observable sender, int propert }); sweetAlertDialog.setCanceledOnTouchOutside(false); sweetAlertDialog.show(); - } + }*/ } }); Messenger.getDefault().register(mContext, MainActivity.TOKEN_DATA_UPDATED, this::loadData); @@ -151,13 +172,13 @@ public void onPropertyChanged(android.databinding.Observable sender, int propert private void initFilter(){ Messenger.getDefault().sendNoMsg(CardListFrag.TOKEN_RESET_FILTER); - rareFilter.clear(); + rareFilter_temp.clear(); typeFilter.clear(); skillFilter.clear(); evoFilter.clear(); SStaticR.skillTypeMap.put(mContext.getString(R.string.skill_empty), Integer.MAX_VALUE); - rareFilter.add(SStaticR.rarityMap_rev.get("SSR")); - rareFilter.add(SStaticR.rarityMap_rev.get("SR")); + rareFilter_temp.add(SStaticR.rarityMap_rev.get("SSR")); + rareFilter_temp.add(SStaticR.rarityMap_rev.get("SR")); typeFilter.addAll(SStaticR.typeMap.values()); skillFilter.addAll(SStaticR.skillTypeMap.values()); getTypeFilter.addAll(getTypeMap_UI.keySet()); @@ -165,13 +186,18 @@ private void initFilter(){ sortType = 0; // default ID evoFilter.add(0); evoFilter.add(1); + solveRareFilter(); } private void loadData(){ itemViewModel.clear(); umi.showLoading(); - prepareGetType(); - loadData(mContext, cardDataList, null); +// prepareGetType(); + if (getTypeMap.size() == 4){ + loadData(mContext, cardDataList, null); + }else { + prepareGetType(); + } } @@ -237,7 +263,10 @@ private boolean checkSkillType(Card card){ } private boolean checkRare(Card card){ - for (Integer integer : evoFilter) { + if (rareFilter.contains(card.getRarity().getRarity())){ + return true; + } + /*for (Integer integer : evoFilter) { if (card.getEvolution_id() != 0){ if (rareFilter.contains(card.getRarity().getRarity())){ return true; @@ -247,12 +276,17 @@ private boolean checkRare(Card card){ return true; } } - } + }*/ return false; } private boolean checkID(Card card){ - for (Integer integer : evoFilter) { + for (Integer i : getTypeFilter) { + if (getTypeMap.get(i).contains(card.getSeries_id())){ + return true; + } + } + /*for (Integer integer : evoFilter) { if (card.getEvolution_id() != 0){ for (Integer i : getTypeFilter) { if (getTypeMap.get(i).contains(card.getId()) && integer == 0){ @@ -266,7 +300,7 @@ private boolean checkID(Card card){ } } } - } + }*/ return false; } @@ -353,15 +387,24 @@ private void filterCards(){ // 读取各卡池类型包含的card_id private void prepareGetType(){ + DBHelper.refresh(mContext, DBHelper.DB_NAME_master); for (Integer integer : getTypeMap_sql.keySet()) { try { Observable> observable = Observable.just(DBHelper.with(mContext, DBHelper.DB_NAME_master) .getBeanListByRaw(getTypeMap_sql.get(integer), Integer.class, "id")); observable.subscribeOn(Schedulers.io()) - .subscribe(ids -> getTypeMap.put(integer, ids)); + .subscribe(ids -> { + if (ids != null && ids.size() > 0){ + getTypeMap.put(integer, ids); + } + if (getTypeMap.size() == 4){ + loadData(mContext, cardDataList, null); + } + }); }catch (Exception e){ e.printStackTrace(); } } + } } diff --git a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardViewModel.java b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardViewModel.java index f2543de..e39f976 100644 --- a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardViewModel.java +++ b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/CardViewModel.java @@ -261,13 +261,14 @@ private void init(Card theCard, Context context){ skillB.append("/"); if (theCard.getSkill().getValue() > 100){ skillB.append(theCard.getSkill().getValue() - 100); - if (theCard.getSkill().getValue_2() <= 100){ + skillB.append("%/"); + /*if (theCard.getSkill().getValue_2() <= 100){ skillB.append("%/"); }else { skillB.append("%|"); skillB.append(theCard.getSkill().getValue_2() - 100); skillB.append("%/"); - } + }*/ } String skillType = SStaticR.skillTypeNameMap.containsKey(theCard.getSkill().getSkill_type_id()) ? SStaticR.skillTypeNameMap.get(theCard.getSkill().getSkill_type_id()) : mContext.getString(R.string.type_unknown); diff --git a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/MainViewModel.java b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/MainViewModel.java index d61cdc4..462fb02 100644 --- a/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/MainViewModel.java +++ b/app/src/main/java/com/lazyeraser/imas/cgss/viewmodel/MainViewModel.java @@ -5,6 +5,7 @@ import android.databinding.ObservableBoolean; import android.databinding.ObservableField; import android.databinding.ObservableFloat; +import android.support.design.widget.Snackbar; import android.support.v4.util.Pair; import android.text.TextUtils; import android.widget.Toast; @@ -70,17 +71,15 @@ public class MainViewModel extends BaseViewModel { public MainViewModel(BaseActivity mContext) { super(mContext); - /*if (umi.getSP(SharedHelper.KEY_AUTO_DATA)) { - checkDataUpdate(); - }*/ if (umi.getSP(SharedHelper.KEY_ANALYTICS_ON)){ Utils.turnOnGA(mContext); } } - + private Snackbar snackBar_checkDataUpdate; public void checkDataUpdate() { - umi.showLoading(); + snackBar_checkDataUpdate = Snackbar.make(mContext.getBView(), R.string.update_checking_hint_data, Snackbar.LENGTH_INDEFINITE); + snackBar_checkDataUpdate.show(); newIds_card.clear(); allIds_card.clear(); //cards @@ -112,7 +111,12 @@ public void checkDataUpdate() { if (aBoolean) { checkData(); } - }, throwable -> upToDate.set(true)); + }, throwable -> { + upToDate.set(true); + if (snackBar_checkDataUpdate != null){ + snackBar_checkDataUpdate.dismiss(); + } + }); } private void checkData() { @@ -139,7 +143,9 @@ private void checkData() { update = true; } if (update){ - umi.dismissLoading(); + if (snackBar_checkDataUpdate != null){ + snackBar_checkDataUpdate.dismiss(); + } haveUpdate.set(true); android.databinding.Observable.OnPropertyChangedCallback agreeCallBack = new android.databinding.Observable.OnPropertyChangedCallback() { @Override @@ -160,6 +166,9 @@ public void onPropertyChanged(android.databinding.Observable observable, int i) agree.addOnPropertyChangedCallback(agreeCallBack); }else { upToDate.set(true); + if (snackBar_checkDataUpdate != null){ + snackBar_checkDataUpdate.dismiss(); + } } }, ExceptionHandler::handleException); @@ -194,7 +203,7 @@ private void updateManifest(String truthVersion) { addFileDownloadMission(masterHash, DBHelper.DB_NAME_master, mContext.getFilesDir().getAbsolutePath()); } // update music (beatMap - List musicList = DBHelper.with(mContext, DBHelper.DB_NAME_manifest) + /* List musicList = DBHelper.with(mContext, DBHelper.DB_NAME_manifest) .getBeanListLike(DBHelper.CGSS_TABLE_NAME_Manifest, Manifest.class, "name", "%musicscores_%.bdb"); String musicDataPath = mFilePath + "/musicscores"; @@ -202,7 +211,7 @@ private void updateManifest(String truthVersion) { if (!FileHelper.isFileExists(musicDataPath, manifest.getName())) { addFileDownloadMission(manifest.getHash(), manifest.getName(), musicDataPath); } - } + }*/ hashToDownload.addAll(fileToDownload.keySet()); total = fileToDownload.size(); solved = 0; diff --git a/app/src/main/java/com/lazyeraser/imas/main/BaseActivity.java b/app/src/main/java/com/lazyeraser/imas/main/BaseActivity.java index ea3e36a..52452e8 100644 --- a/app/src/main/java/com/lazyeraser/imas/main/BaseActivity.java +++ b/app/src/main/java/com/lazyeraser/imas/main/BaseActivity.java @@ -78,10 +78,13 @@ public BaseActivity setVariable(int id, Object v){ return this; } - public View getBView(@IdRes int id){ - return binding.getRoot().findViewById(id); + public View getBView(){ + return binding.getRoot(); } + public View getBView(@IdRes int id){ + return getBView().findViewById(id); + } @Override @@ -148,7 +151,7 @@ public void initActionBar(int type, @DrawableRes Integer idStart, @DrawableRes I ImageView actionBarBtn_Start = (ImageView) findViewById(R.id.actionBar_btn_start_img); if (idStart == null) { // Picasso.with(mContext).load(R.drawable.umi_ic_back).into(actionBarBtn_Start); - actionBarBtn_Start.setImageResource(R.drawable.umi_ic_back); + actionBarBtn_Start.setImageResource(R.drawable.ic_back); } TextView actionBarBtn_Txt = (TextView) findViewById(R.id.actionBar_txtBtn); ImageView actionBarBtn_End = (ImageView) findViewById(R.id.actionBar_btn_end_img); diff --git a/app/src/main/res/drawable-hdpi/ic_derehelpler.png b/app/src/main/res/drawable-hdpi/ic_derehelpler.png new file mode 100644 index 0000000..1af3b40 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_derehelpler.png b/app/src/main/res/drawable-ldpi/ic_derehelpler.png new file mode 100644 index 0000000..7049e1c Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_derehelpler.png b/app/src/main/res/drawable-mdpi/ic_derehelpler.png new file mode 100644 index 0000000..c0e54e5 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_derehelpler.png b/app/src/main/res/drawable-xhdpi/ic_derehelpler.png new file mode 100644 index 0000000..ddbb860 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_derehelpler.png b/app/src/main/res/drawable-xxhdpi/ic_derehelpler.png new file mode 100644 index 0000000..289c028 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable/derehelper.png b/app/src/main/res/drawable/derehelper.png new file mode 100644 index 0000000..e91e8fc Binary files /dev/null and b/app/src/main/res/drawable/derehelper.png differ diff --git a/app/src/main/res/drawable/ic_back.xml b/app/src/main/res/drawable/ic_back.xml new file mode 100644 index 0000000..9b2ab84 --- /dev/null +++ b/app/src/main/res/drawable/ic_back.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_derehelper_blank.png b/app/src/main/res/drawable/ic_derehelper_blank.png new file mode 100644 index 0000000..befd0b7 Binary files /dev/null and b/app/src/main/res/drawable/ic_derehelper_blank.png differ diff --git a/app/src/main/res/drawable/ic_derehelpler.png b/app/src/main/res/drawable/ic_derehelpler.png new file mode 100644 index 0000000..e91e8fc Binary files /dev/null and b/app/src/main/res/drawable/ic_derehelpler.png differ diff --git a/app/src/main/res/drawable/umi_ic_back.png b/app/src/main/res/drawable/umi_ic_back.png deleted file mode 100644 index d9811ef..0000000 Binary files a/app/src/main/res/drawable/umi_ic_back.png and /dev/null differ diff --git a/app/src/main/res/layout/frag_about.xml b/app/src/main/res/layout/frag_about.xml index ed14f8a..18f4104 100644 --- a/app/src/main/res/layout/frag_about.xml +++ b/app/src/main/res/layout/frag_about.xml @@ -9,6 +9,7 @@ type="com.lazyeraser.imas.cgss.viewmodel.AboutViewModel" /> + + bind:imgR="@{R.drawable.derehelper}"/> - - - - - - - - - - - + android:id="@+id/item_card_line0"> - - + + + android:layout_alignParentEnd="true" + android:orientation="horizontal" + android:layout_marginEnd="8dp" + android:layout_toEndOf="@+id/chara_name" + android:layout_alignBottom="@+id/chara_name"> + + + + + + + + + + + + + + + android:hint="card title" + android:textSize="@dimen/txt_1" + android:textColor="@color/txtGrayL" + android:text="@{viewModel.cardTitle}"/> - - - - + android:textColor="@color/txtGrayL" + android:layout_alignParentEnd="true" + android:maxLines="1" + android:gravity="end" + android:textAlignment="gravity" + android:ellipsize="end" + android:layout_marginEnd="8dp" + android:textSize="@dimen/txt_1" + android:hint="skill explain" + android:text="@{viewModel.skill}"/> + + 下载加速 搜索 罗马音/姓名/片假名/CV + 检查APP更新中 + 检查数据更新中 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0dc0654..45b713e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - DereHelper + DereHelper No skill Language changed APP needs restart @@ -147,4 +147,6 @@ Search Romaji/Name/Hiragana/CV + Checking Database Update + Checking APP Update diff --git a/appupdate/version.json b/appupdate/version.json index 539712a..36d0a18 100644 --- a/appupdate/version.json +++ b/appupdate/version.json @@ -1,11 +1,11 @@ { "appname": "DereHelper", - "apkname": "DereHelper-1.0.1.apk", - "verName": " 1.0.1", - "md5": "c17ae13240579a2d0f775b1fe11a0d08", - "url": "http://346lab.org/derehelper/apk/DereHelper-1.0.1.apk", - "verInfo": "1.新增角色搜索功能\n2.修复部分数据更新场景的写入错误", - "verInfo_jp": "1.キャラ検索機能追加\n2.データダウンロードのバグ修正", - "verInfo_en": "1.NEW feature for chara list: Search.\n2.Fix bug in updating data", - "verCode": 11 + "apkname": "DereHelper-1.0.2.apk", + "verName": " 1.0.2", + "md5": "9a327ee43c7342c0708d635edbc084c5", + "url": "http://346lab.org/derehelper/apk/DereHelper-1.0.2.apk", + "verInfo": "1.修正某些场景下查看谱面的闪退\n2.调整部分界面\n3.APP图标变更,APP名称统一为DereHelper", + "verInfo_jp": "1.軽微な不具合の修正\n2.UI調整", + "verInfo_en": "1.Fix bugs in beatmap viewing", + "verCode": 12 } \ No newline at end of file