Skip to content

Commit

Permalink
1.0.2::release
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazyeraser committed Apr 4, 2018
1 parent eef34ec commit 15b7192
Show file tree
Hide file tree
Showing 23 changed files with 212 additions and 181 deletions.
17 changes: 4 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 ->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<application
android:name="com.lazyeraser.imas.main.LIVE"
android:allowBackup="false"
android:icon="@drawable/ic_chihiro"
android:icon="@drawable/ic_derehelpler"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SharedHelper {
defaultKeyValues.put(KEY_AUTO_DATA, "true");
defaultKeyValues.put(KEY_AUTO_APP, "true");
defaultKeyValues.put(KEY_DEFAULT_TRAN, "false");
defaultKeyValues.put(KEY_ANALYTICS_ON, "false");
defaultKeyValues.put(KEY_ANALYTICS_ON, "true");
defaultKeyValues.put(KEY_ANALYTICS_ASKED, "false");
defaultKeyValues.put(KEY_USE_REVERSE_PROXY, "");
}
Expand Down
26 changes: 12 additions & 14 deletions app/src/main/java/com/lazyeraser/imas/cgss/view/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
Expand Down Expand Up @@ -129,10 +130,8 @@ protected void onCreate(Bundle savedInstanceState) {

switchFrag(cardListFrag);
if (umi.getSP(SharedHelper.KEY_AUTO_APP)){
umi.makeToast(R.string.settings_auto_app);
checkUpdate(false);
}else if (umi.getSP(SharedHelper.KEY_AUTO_DATA)){
umi.makeToast(R.string.settings_auto_data);
mainViewModel.checkDataUpdate();
}
// 监听语言设置改变
Expand Down Expand Up @@ -172,17 +171,18 @@ private void askRestart(){
sweetAlertDialog.show();
}

private Snackbar snackBar_checkUpdate;
private void checkUpdate(boolean hint){
needUpdateHint = hint;
umi.showLoading();
snackBar_checkUpdate = Snackbar.make(drawerLayout, R.string.update_checking_hint_app, Snackbar.LENGTH_INDEFINITE);
snackBar_checkUpdate.show();
if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions((Activity) mContext, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}else {
updateManager.checkUpdate(hint, b -> {
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();
}
}
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -70,24 +73,42 @@ public class CardListViewModel extends BaseViewModel {
/*-------------commands for filter---------------*/
private List<Integer> evoFilter = new ArrayList<>();
private List<Integer> rareFilter = new ArrayList<>();
private List<Integer> rareFilter_temp = new ArrayList<>();
private List<String> typeFilter = new ArrayList<>();
private List<Integer> skillFilter = new ArrayList<>();
private List<Integer> getTypeFilter = new ArrayList<>(); // 获取方式/卡池类型筛选
private Integer sortMethod;
private Integer sortType;

public final ReplyCommand<List<String>> 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<List<Integer>> 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<List<Integer>> onGetTypeSelCommand = new ReplyCommand<>(integers -> getTypeFilter = integers);

public final ReplyCommand<List<String>> onTypeSelCommand = new ReplyCommand<>(strings -> typeFilter = strings);

public final ReplyCommand<List<Integer>> onEvoSelCommand = new ReplyCommand<>(integers -> evoFilter = integers);

public final ReplyCommand<List<String>> sortTypeCommand = new ReplyCommand<>(strings -> sortType = SStaticR.sortTypeMap_Card.get(strings.get(0)));

Expand Down Expand Up @@ -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))
Expand All @@ -143,35 +164,40 @@ public void onPropertyChanged(android.databinding.Observable sender, int propert
});
sweetAlertDialog.setCanceledOnTouchOutside(false);
sweetAlertDialog.show();
}
}*/
}
});
Messenger.getDefault().register(mContext, MainActivity.TOKEN_DATA_UPDATED, this::loadData);
}

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());
sortMethod = 0; // default desc
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();
}
}


Expand Down Expand Up @@ -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;
Expand All @@ -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){
Expand All @@ -266,7 +300,7 @@ private boolean checkID(Card card){
}
}
}
}
}*/
return false;
}

Expand Down Expand Up @@ -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<List<Integer>> 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();
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 15b7192

Please sign in to comment.