diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index b4e45b2..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-Saver
\ No newline at end of file
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
new file mode 100644
index 0000000..24aac07
Binary files /dev/null and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..30aa626
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 96cc43e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 97626ba..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 508b3d9..7ac24c7 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -11,12 +11,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7158618..b0c7b20 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,62 +1,38 @@
-
-
-
-
+
-
-
+
+
+
+
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
- 1.8
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 14ca75a..068c7bb 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/CoCoin.iml b/CoCoin.iml
new file mode 100644
index 0000000..bd7804e
--- /dev/null
+++ b/CoCoin.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CoCoin.zip b/CoCoin.zip
new file mode 100644
index 0000000..fed7a66
Binary files /dev/null and b/CoCoin.zip differ
diff --git a/MaterialWidget/build.gradle b/MaterialWidget/build.gradle
index 827e8df..116034a 100644
--- a/MaterialWidget/build.gradle
+++ b/MaterialWidget/build.gradle
@@ -3,7 +3,8 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.13.0'
+ classpath 'com.android.tools.build:gradle:3.2.1'
+
}
}
@@ -14,14 +15,17 @@ repositories {
}
android {
- compileSdkVersion 21
- buildToolsVersion "21.1.1"
+ compileSdkVersion 28
+// buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 14
- targetSdkVersion 21
+ targetSdkVersion 28
versionCode 1
versionName "1.0"
+
+// .JavaPreCompileTask.preCompile
+
}
buildTypes {
release {
@@ -35,7 +39,7 @@ android {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:support-v4:21.0.0'
- compile 'com.android.support:support-annotations:20.0.0'
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'com.android.support:support-v4:28.0.0'
+ implementation 'com.android.support:support-annotations:28.0.0'
}
diff --git a/MaterialWidget/src/main/java/com/material/widget/CheckBox.java b/MaterialWidget/src/main/java/com/material/widget/CheckBox.java
index 2f7d49f..a25d374 100644
--- a/MaterialWidget/src/main/java/com/material/widget/CheckBox.java
+++ b/MaterialWidget/src/main/java/com/material/widget/CheckBox.java
@@ -3,7 +3,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.*;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.CompoundButton;
diff --git a/MaterialWidget/src/main/java/com/material/widget/CircleButton.java b/MaterialWidget/src/main/java/com/material/widget/CircleButton.java
index da75e9d..91fe0cb 100644
--- a/MaterialWidget/src/main/java/com/material/widget/CircleButton.java
+++ b/MaterialWidget/src/main/java/com/material/widget/CircleButton.java
@@ -6,7 +6,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
diff --git a/MaterialWidget/src/main/java/com/material/widget/CircularProgress.java b/MaterialWidget/src/main/java/com/material/widget/CircularProgress.java
index 7d8b046..df37195 100644
--- a/MaterialWidget/src/main/java/com/material/widget/CircularProgress.java
+++ b/MaterialWidget/src/main/java/com/material/widget/CircularProgress.java
@@ -8,7 +8,7 @@
import android.graphics.*;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
diff --git a/MaterialWidget/src/main/java/com/material/widget/FloatingEditText.java b/MaterialWidget/src/main/java/com/material/widget/FloatingEditText.java
index 110052d..ba78e68 100644
--- a/MaterialWidget/src/main/java/com/material/widget/FloatingEditText.java
+++ b/MaterialWidget/src/main/java/com/material/widget/FloatingEditText.java
@@ -6,7 +6,7 @@
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.os.Build;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
diff --git a/MaterialWidget/src/main/java/com/material/widget/PaperButton.java b/MaterialWidget/src/main/java/com/material/widget/PaperButton.java
index 0c12c88..9482b30 100644
--- a/MaterialWidget/src/main/java/com/material/widget/PaperButton.java
+++ b/MaterialWidget/src/main/java/com/material/widget/PaperButton.java
@@ -5,7 +5,7 @@
import android.content.res.TypedArray;
import android.graphics.*;
import android.os.Build;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.MotionEvent;
diff --git a/MaterialWidget/src/main/java/com/material/widget/RadioButton.java b/MaterialWidget/src/main/java/com/material/widget/RadioButton.java
index 512c506..9530d06 100644
--- a/MaterialWidget/src/main/java/com/material/widget/RadioButton.java
+++ b/MaterialWidget/src/main/java/com/material/widget/RadioButton.java
@@ -6,7 +6,7 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.CompoundButton;
diff --git a/MaterialWidget/src/main/java/com/material/widget/Slider.java b/MaterialWidget/src/main/java/com/material/widget/Slider.java
index 199ecfa..793437e 100644
--- a/MaterialWidget/src/main/java/com/material/widget/Slider.java
+++ b/MaterialWidget/src/main/java/com/material/widget/Slider.java
@@ -3,7 +3,7 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.*;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
diff --git a/MaterialWidget/src/main/java/com/material/widget/Switch.java b/MaterialWidget/src/main/java/com/material/widget/Switch.java
index cfcbd4d..32ba640 100644
--- a/MaterialWidget/src/main/java/com/material/widget/Switch.java
+++ b/MaterialWidget/src/main/java/com/material/widget/Switch.java
@@ -4,7 +4,7 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.CompoundButton;
diff --git a/MaterialWidget/src/main/java/com/material/widget/TabIndicator.java b/MaterialWidget/src/main/java/com/material/widget/TabIndicator.java
index f1572c9..6bae9fc 100644
--- a/MaterialWidget/src/main/java/com/material/widget/TabIndicator.java
+++ b/MaterialWidget/src/main/java/com/material/widget/TabIndicator.java
@@ -8,9 +8,9 @@
import android.graphics.*;
import android.os.Build;
import android.os.Handler;
-import android.support.annotation.NonNull;
-import android.support.v4.view.ViewPager;
-import android.support.v4.view.ViewPager.OnPageChangeListener;
+import androidx.annotation.NonNull;
+import androidx.core.view.ViewPager;
+import androidx.core.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ActionMode;
diff --git a/MaterialWidget/src/main/java/com/material/widget/TrackSlider.java b/MaterialWidget/src/main/java/com/material/widget/TrackSlider.java
index e07ce8a..143786e 100644
--- a/MaterialWidget/src/main/java/com/material/widget/TrackSlider.java
+++ b/MaterialWidget/src/main/java/com/material/widget/TrackSlider.java
@@ -5,7 +5,7 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
diff --git a/app/app.iml b/app/app.iml
index 09e0b58..f480eb7 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -1,5 +1,5 @@
-
+
@@ -9,7 +9,6 @@
-
@@ -23,159 +22,205 @@
-
-
-
+
+
+
-
+
+
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index d96fa9e..22900b4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,25 +1,15 @@
apply plugin: 'com.android.application'
-apply plugin: 'bugly'
-
-repositories {
- jcenter()
- maven { url "https://jitpack.io" }
-}
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.1"
-
+ compileSdkVersion 28
defaultConfig {
- applicationId "com.nightonke.cocoin"
- minSdkVersion 16
- targetSdkVersion 23
+ applicationId "com.gaganag50.delete"
+ minSdkVersion 21
+ targetSdkVersion 28
versionCode 1
- versionName "1.2.0"
- // when update version, don't forget change the application class and @string/app_splash_name
-
- renderscriptTargetApi 20
- renderscriptSupportModeEnabled true
+ versionName "1.0"
+// multiDexEnabled true //important
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -27,115 +17,141 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
+ implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
+
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+ implementation 'androidx.core:core:1.1.0-alpha03'
+ implementation 'com.nineoldandroids:library:2.4.0'
+ implementation 'com.daimajia.easing:library:2.0@aar'
+ implementation 'com.daimajia.androidanimations:library:2.3@aar'
+ // ripple effect
+ implementation('com.balysv:material-ripple:1.0.2')
- compile 'com.android.support:appcompat-v7:23.0.1'
+ // material edittext
+ implementation('com.rengwuxian.materialedittext:library:2.1.4')
- // animation
- compile 'com.nineoldandroids:library:2.4.0'
- compile 'com.daimajia.easing:library:1.0.1@aar'
- compile 'com.daimajia.androidanimations:library:1.1.3@aar'
+ // material viewpager
+ implementation('com.github.florent37:materialviewpager:1.1.2@aar') {
+ transitive = true
+ }
+ implementation('com.flaviofaria:kenburnsview:1.0.7')
+ implementation('com.jpardogo.materialtabstrip:library:1.1.0')
+ implementation('com.github.bumptech.glide:glide:4.7.1')
+ implementation('com.github.dmytrodanylyk.circular-progress-button:library:1.1.3')
- // ripple effect
- compile 'com.balysv:material-ripple:1.0.2'
+ // floating action button
+ implementation('com.melnykov:floatingactionbutton:1.3.0')
+// the viewpager shown first time to use CoCoin
+ implementation("com.dev.sacot41:scviewpager:0.0.4")
+ implementation("androidx.core:core:1.1.0-alpha03")
+ implementation('com.squareup.picasso:picasso:2.3.2')
+ implementation 'com.nineoldandroids:library:2.4.0'
- // material edittext
- compile 'com.rengwuxian.materialedittext:library:2.1.4'
+ implementation('com.daimajia.slider:library:1.1.5@aar') {
+ exclude module: 'design'
- // butterknife
- compile 'com.jakewharton:butterknife:6.1.0'
+ }
- // material viewpager
- compile ('com.github.florent37:materialviewpager:1.1.2@aar'){
+
+
+ implementation('com.github.florent37:materialviewpager:1.1.2@aar') {
transitive = true
}
+ implementation('com.flaviofaria:kenburnsview:1.0.7')
- // progress-button
- compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
+ implementation('com.jpardogo.materialtabstrip:library:1.1.0')
+
+ implementation('com.github.bumptech.glide:glide:4.7.1')
+
+ // progress-button
+ implementation('com.github.dmytrodanylyk.circular-progress-button:library:1.1.3')
// date range picker
- compile 'com.wdullaer:materialdatetimepicker:2.1.1'
+ implementation 'com.wdullaer:materialdatetimepicker:2.1.1'
// floating action button
- compile 'com.melnykov:floatingactionbutton:1.3.0'
+ implementation('com.melnykov:floatingactionbutton:1.3.0')
// the viewpager shown first time to use CoCoin
- compile "com.dev.sacot41:scviewpager:0.0.4"
+ implementation("com.dev.sacot41:scviewpager:0.0.4")
+ implementation("androidx.core:core:1.1.0-alpha03")
- // image slider
- compile "com.android.support:support-v4:+"
- compile 'com.squareup.picasso:picasso:2.3.2'
- compile 'com.daimajia.slider:library:1.1.5@aar'
+ implementation('com.squareup.picasso:picasso:2.3.2')
- // expandable layout
- compile 'com.github.aakira:expandable-layout:1.4.1@aar'
+ implementation('com.daimajia.slider:library:1.1.5@aar')
- // guillotine menu
- compile 'com.balysv.materialmenu:material-menu:1.5.4'
+ // expandable layout
+ implementation('com.github.aakira:expandable-layout:1.4.1@aar')
+ implementation('com.balysv.materialmenu:material-menu:1.5.4')
// charts
- compile 'com.github.lecho:hellocharts-library:1.5.8@aar'
+ implementation('com.github.lecho:hellocharts-library:1.5.8@aar')
// snack bar
- compile 'com.nispok:snackbar:2.11.+'
+ implementation('com.nispok:snackbar:2.11.0')
// icons
- compile 'net.steamcrafted:materialiconlib:1.0.8'
-
- // toasts
- compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
+ implementation('net.steamcrafted:materialiconlib:1.0.8')
+ implementation('com.github.johnpersano:supertoasts:1.3.4@aar')
// memory leak
- debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
- releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
+ debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1'
+ releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
// swipe recyclerview
- compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.4@aar'){
- transitive=true
- }
+ implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.4@aar') {
+ transitive = true
+ }
// circle image view
- compile 'de.hdodenhof:circleimageview:2.0.0'
+ implementation('de.hdodenhof:circleimageview:2.2.0')
// search bar
- compile 'com.miguelcatalan:materialsearchview:1.3.0'
+ implementation('com.miguelcatalan:materialsearchview:1.3.0')
// the little check and X
- compile 'com.wnafee:vector-compat:1.0.5'
+ implementation('com.wnafee:vector-compat:1.0.5')
// fast scroller
- compile 'xyz.danoz:recyclerviewfastscroller:0.1.3'
+ implementation('xyz.danoz:recyclerviewfastscroller:0.1.3')
// dialogs
- compile('com.github.afollestad.material-dialogs:commons:0.8.5.1@aar') {
+ implementation('com.github.afollestad.material-dialogs:commons:0.8.5.1@aar') {
transitive = true
}
+// the radio check circle
+ implementation('com.github.rey5137:material:1.2.1')
- // the radio check circle
- compile 'com.github.rey5137:material:1.2.1'
- // bmob
- compile 'cn.bmob.android:bmob-sdk:3.4.5'
- compile 'com.squareup.okhttp:okhttp:2.4.0'
- compile 'com.squareup.okio:okio:1.4.0'
+ implementation('com.squareup.okhttp:okhttp:2.4.0')
+ implementation('com.squareup.okio:okio:1.14.0')
// logo
- compile 'com.koushikdutta.ion:ion:2.+'
+ implementation('com.koushikdutta.ion:ion:2.2.1')
// bugly
- compile 'com.tencent.bugly:crashreport:1.2.8'
+ implementation('com.tencent.bugly:crashreport:1.2.8')
- // splash activity
- compile ('com.github.ozodrukh:CircularReveal:1.3.1@aar') {
+ implementation 'com.github.yalantis:Side-Menu.Android:1.0.1'
+ implementation('com.github.ozodrukh:CircularReveal:1.1.1@aar') {
transitive = true;
}
+// implementation 'com.jakewharton:butterknife:8.8.1'
+// annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
-}
-bugly {
- appId = '900018935'
- appKey = 'jtmCjcTp0DZuptCW'
-}
\ No newline at end of file
+ implementation 'cn.bmob.android:bmob-sdk:3.4.5'
+ implementation 'com.jakewharton:butterknife:9.0.0-rc2'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 11c9e6a..53e8fc0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
@@ -19,7 +20,10 @@
android:icon="@drawable/cocoin_logo"
android:label="@string/app_name"
android:largeHeap="true"
- android:theme="@style/AppTheme">
+ android:theme="@style/Theme.AppCompat.Light.NoActionBar"
+ tools:replace="android:appComponentFactory"
+ android:appComponentFactory="anystrings be placeholder"
+ >
diff --git a/app/src/main/java/com/nightonke/saver/activity/AboutActivity.java b/app/src/main/java/com/nightonke/saver/activity/AboutActivity.java
index 2043879..8c0d8b6 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AboutActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AboutActivity.java
@@ -4,10 +4,10 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookCustomViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookCustomViewActivity.java
index e86fe01..b942207 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookCustomViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookCustomViewActivity.java
@@ -3,9 +3,9 @@
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookListViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookListViewActivity.java
index 9a0edd9..d6dd6cb 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookListViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookListViewActivity.java
@@ -11,16 +11,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.util.Log;
import android.view.Menu;
@@ -79,6 +69,16 @@
import java.util.LinkedList;
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+import androidx.core.view.GravityCompat;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.FindListener;
@@ -92,48 +92,34 @@ public class AccountBookListViewActivity extends AppCompatActivity
MySwipeableItemAdapter.OnItemDeleteListener,
MySwipeableItemAdapter.OnItemClickListener {
+ private final int EDITTING_RECORD = 0;
+ private final double MIN_MONEY = 0;
+ private final double MAX_MONEY = 99999;
private MaterialSearchView searchView;
-
private Context mContext;
-
private DrawerLayout mDrawer;
private ActionBarDrawerToggle mDrawerToggle;
private Toolbar toolbar;
-
private RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
private RecyclerView.Adapter adapter;
private RecyclerView.Adapter wrappedAdapter;
private RecyclerViewSwipeManager recyclerViewSwipeManager;
private RecyclerViewTouchActionGuardManager recyclerViewTouchActionGuardManager;
-
private MySwipeableItemAdapter mAdapter;
-
private TextView emptyTip;
-
private int lastPosition;
private boolean undid = false;
-
- private final int EDITTING_RECORD = 0;
-
private VerticalRecyclerViewFastScroller verticalRecyclerViewFastScroller;
-
private double originalSum;
-
private CircleImageView profileImage;
private SliderLayout mDemoSlider;
private FrameLayout infoLayout;
-
private TextView titleExpense;
private TextView titleSum;
private SliderLayout titleSlider;
-
private TextView userName;
private TextView userEmail;
-
- private final double MIN_MONEY = 0;
- private final double MAX_MONEY = 99999;
-
private double LEFT_MONEY = CoCoinUtil.INPUT_MIN_EXPENSE;
private double RIGHT_MONEY = CoCoinUtil.INPUT_MAX_EXPENSE;
private int TAG_ID = -1;
@@ -154,6 +140,29 @@ public class AccountBookListViewActivity extends AppCompatActivity
private TextView rightTime;
private ImageView tagImage;
private TextView tagName;
+ private MaterialDialog progressDialog;
+ private MaterialDialog dialog;
+ private View dialogView;
+ private double inputNumber = -1;
+ private boolean isFrom = true;
+ private int fromYear, fromMonth, fromDay;
+ private Calendar to = Calendar.getInstance();
+ private Calendar from = Calendar.getInstance();
+ private MyGridView myGridView;
+ private DialogTagChooseGridViewAdapter dialogTagChooseGridViewAdapter;
+ private MaterialDialog tagSelectDialog;
+ private View tagSelectDialogView;
+ private DoubleSliderClickListener doubleSliderClickListener = new DoubleSliderClickListener() {
+ @Override
+ public void onSingleClick(BaseSliderView v) {
+
+ }
+
+ @Override
+ public void onDoubleClick(BaseSliderView v) {
+ if (recyclerView != null) recyclerView.scrollToPosition(0);
+ }
+ };
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -162,8 +171,8 @@ protected void onCreate(Bundle savedInstanceState) {
mContext = this;
- userName = (TextView)findViewById(R.id.user_name);
- userEmail = (TextView)findViewById(R.id.user_email);
+ userName = (TextView) findViewById(R.id.user_name);
+ userEmail = (TextView) findViewById(R.id.user_email);
userName.setTypeface(CoCoinUtil.typefaceLatoRegular);
userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
@@ -201,9 +210,9 @@ protected void onCreate(Bundle savedInstanceState) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
- } else{
+ } else {
// do something for phones running an SDK before lollipop
- View statusBarView = (View)findViewById(R.id.status_bar_view);
+ View statusBarView = (View) findViewById(R.id.status_bar_view);
statusBarView.getLayoutParams().height = CoCoinUtil.getStatusBarHeight();
}
@@ -259,7 +268,7 @@ public void onSearchViewClosed() {
}
});
- emptyTip = (TextView)findViewById(R.id.empty_tip);
+ emptyTip = (TextView) findViewById(R.id.empty_tip);
emptyTip.setTypeface(CoCoinUtil.GetTypeface());
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
@@ -323,7 +332,7 @@ public void onItemViewClicked(View v, boolean pinned) {
recyclerViewSwipeManager.attachRecyclerView(recyclerView);
verticalRecyclerViewFastScroller
- = (VerticalRecyclerViewFastScroller)findViewById(R.id.fast_scroller);
+ = (VerticalRecyclerViewFastScroller) findViewById(R.id.fast_scroller);
// Connect the recycler to the scroller (to let the scroller scroll the list)
verticalRecyclerViewFastScroller.setRecyclerView(recyclerView);
@@ -342,12 +351,12 @@ public void onItemViewClicked(View v, boolean pinned) {
verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
}
- infoLayout = (FrameLayout)mDrawer.findViewById(R.id.info_layout);
+ infoLayout = (FrameLayout) mDrawer.findViewById(R.id.info_layout);
LinearLayout.LayoutParams infoLayoutParams = new LinearLayout.LayoutParams(infoLayout.getLayoutParams());
infoLayoutParams.setMargins(0, CoCoinUtil.getStatusBarHeight() - CoCoinUtil.dpToPx(30), 0, 0);
infoLayout.setLayoutParams(infoLayoutParams);
- profileImage= (CircleImageView)mDrawer.findViewById(R.id.profile_image);
+ profileImage = (CircleImageView) mDrawer.findViewById(R.id.profile_image);
profileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -359,11 +368,11 @@ public void onClick(View v) {
}
});
- mDemoSlider = (SliderLayout)findViewById(R.id.slider);
+ mDemoSlider = (SliderLayout) findViewById(R.id.slider);
HashMap urls = CoCoinUtil.GetDrawerTopUrl();
- for(String name : urls.keySet()){
+ for (String name : urls.keySet()) {
CustomSliderView customSliderView = new CustomSliderView(this);
// initialize a SliderLayout
customSliderView
@@ -376,11 +385,11 @@ public void onClick(View v) {
mDemoSlider.setDuration(4000);
mDemoSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
- titleExpense = (TextView)findViewById(R.id.title_expense);
+ titleExpense = (TextView) findViewById(R.id.title_expense);
titleExpense.setTypeface(CoCoinUtil.typefaceLatoLight);
- titleExpense.setText(CoCoinUtil.GetInMoney((int)(double)RecordManager.getInstance(mContext).SELECTED_SUM));
+ titleExpense.setText(CoCoinUtil.GetInMoney((int) (double) RecordManager.getInstance(mContext).SELECTED_SUM));
- titleSum = (TextView)findViewById(R.id.title_sum);
+ titleSum = (TextView) findViewById(R.id.title_sum);
titleSum.setTypeface(CoCoinUtil.typefaceLatoLight);
titleSum.setText(RecordManager.getInstance(mContext).SELECTED_RECORDS.size() + "'s");
@@ -407,43 +416,43 @@ public void onClick(View v) {
// titleSlider.setDuration(3000);
// titleSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
- ((TextView)findViewById(R.id.tag_title)).setTypeface(CoCoinUtil.GetTypeface());
- ((TextView)findViewById(R.id.tag_title_expense)).setTypeface(CoCoinUtil.GetTypeface());
- ((TextView)findViewById(R.id.tag_title_time)).setTypeface(CoCoinUtil.GetTypeface());
- ((TextView)findViewById(R.id.tag_title_tag)).setTypeface(CoCoinUtil.GetTypeface());
+ ((TextView) findViewById(R.id.tag_title)).setTypeface(CoCoinUtil.GetTypeface());
+ ((TextView) findViewById(R.id.tag_title_expense)).setTypeface(CoCoinUtil.GetTypeface());
+ ((TextView) findViewById(R.id.tag_title_time)).setTypeface(CoCoinUtil.GetTypeface());
+ ((TextView) findViewById(R.id.tag_title_tag)).setTypeface(CoCoinUtil.GetTypeface());
- setMoney = (TextView)findViewById(R.id.select_expense);
+ setMoney = (TextView) findViewById(R.id.select_expense);
setMoney.setTypeface(CoCoinUtil.GetTypeface());
setMoney.setOnClickListener(this);
- noMoney = (TextView)findViewById(R.id.no_expense);
+ noMoney = (TextView) findViewById(R.id.no_expense);
noMoney.setTypeface(CoCoinUtil.GetTypeface());
noMoney.setOnClickListener(this);
- setTime = (TextView)findViewById(R.id.select_time);
+ setTime = (TextView) findViewById(R.id.select_time);
setTime.setTypeface(CoCoinUtil.GetTypeface());
setTime.setOnClickListener(this);
- noTime = (TextView)findViewById(R.id.no_time);
+ noTime = (TextView) findViewById(R.id.no_time);
noTime.setTypeface(CoCoinUtil.GetTypeface());
noTime.setOnClickListener(this);
- setTag = (TextView)findViewById(R.id.select_tag);
+ setTag = (TextView) findViewById(R.id.select_tag);
setTag.setTypeface(CoCoinUtil.GetTypeface());
setTag.setOnClickListener(this);
- noTag = (TextView)findViewById(R.id.no_tag);
+ noTag = (TextView) findViewById(R.id.no_tag);
noTag.setTypeface(CoCoinUtil.GetTypeface());
noTag.setOnClickListener(this);
- select = (TextView)findViewById(R.id.select);
+ select = (TextView) findViewById(R.id.select);
select.setTypeface(CoCoinUtil.GetTypeface());
select.setOnClickListener(this);
- leftExpense = (TextView)findViewById(R.id.left_expense);
+ leftExpense = (TextView) findViewById(R.id.left_expense);
leftExpense.setTypeface(CoCoinUtil.GetTypeface());
- rightExpense = (TextView)findViewById(R.id.right_expense);
+ rightExpense = (TextView) findViewById(R.id.right_expense);
rightExpense.setTypeface(CoCoinUtil.GetTypeface());
- leftTime = (TextView)findViewById(R.id.left_time);
+ leftTime = (TextView) findViewById(R.id.left_time);
leftTime.setTypeface(CoCoinUtil.GetTypeface());
- rightTime = (TextView)findViewById(R.id.right_time);
+ rightTime = (TextView) findViewById(R.id.right_time);
rightTime.setTypeface(CoCoinUtil.GetTypeface());
- tagImage = (ImageView)findViewById(R.id.tag_image);
- tagName = (TextView)findViewById(R.id.tag_name);
+ tagImage = (ImageView) findViewById(R.id.tag_image);
+ tagName = (TextView) findViewById(R.id.tag_name);
tagName.setTypeface(CoCoinUtil.GetTypeface());
setConditions();
@@ -452,11 +461,14 @@ public void onClick(View v) {
}
private void setConditions() {
- if (LEFT_MONEY == MIN_MONEY) leftExpense.setText(mContext.getResources().getString(R.string.any));
- else leftExpense.setText(CoCoinUtil.GetInMoney((int)LEFT_MONEY));
- if (RIGHT_MONEY == MAX_MONEY) rightExpense.setText(mContext.getResources().getString(R.string.any));
- else rightExpense.setText(CoCoinUtil.GetInMoney((int)RIGHT_MONEY));
- if (LEFT_CALENDAR == null) leftTime.setText(mContext.getResources().getString(R.string.any));
+ if (LEFT_MONEY == MIN_MONEY)
+ leftExpense.setText(mContext.getResources().getString(R.string.any));
+ else leftExpense.setText(CoCoinUtil.GetInMoney((int) LEFT_MONEY));
+ if (RIGHT_MONEY == MAX_MONEY)
+ rightExpense.setText(mContext.getResources().getString(R.string.any));
+ else rightExpense.setText(CoCoinUtil.GetInMoney((int) RIGHT_MONEY));
+ if (LEFT_CALENDAR == null)
+ leftTime.setText(mContext.getResources().getString(R.string.any));
else {
String dateString
= CoCoinUtil.GetMonthShort(LEFT_CALENDAR.get(Calendar.MONTH) + 1)
@@ -464,7 +476,8 @@ private void setConditions() {
LEFT_CALENDAR.get(Calendar.YEAR);
leftTime.setText(dateString);
}
- if (RIGHT_CALENDAR == null) rightTime.setText(mContext.getResources().getString(R.string.any));
+ if (RIGHT_CALENDAR == null)
+ rightTime.setText(mContext.getResources().getString(R.string.any));
else {
String dateString
= CoCoinUtil.GetMonthShort(RIGHT_CALENDAR.get(Calendar.MONTH) + 1)
@@ -482,10 +495,10 @@ private void setConditions() {
}
private void changeTitleSlider() {
- titleExpense = (TextView)findViewById(R.id.title_expense);
- titleExpense.setText(CoCoinUtil.GetInMoney((int)(double)RecordManager.getInstance(mContext).SELECTED_SUM));
+ titleExpense = (TextView) findViewById(R.id.title_expense);
+ titleExpense.setText(CoCoinUtil.GetInMoney((int) (double) RecordManager.getInstance(mContext).SELECTED_SUM));
- titleSum = (TextView)findViewById(R.id.title_sum);
+ titleSum = (TextView) findViewById(R.id.title_sum);
titleSum.setText(RecordManager.getInstance(mContext).SELECTED_RECORDS.size() + "'s");
// titleSlider.stopAutoCycle();
@@ -498,14 +511,11 @@ private void changeTitleSlider() {
// titleSlider.startAutoCycle();
}
- private MaterialDialog progressDialog;
@Override
public void onSelectSumChanged() {
changeTitleSlider();
}
- private MaterialDialog dialog;
- private View dialogView;
@Override
public void onItemClick(int position) {
position = RecordManager.SELECTED_RECORDS.size() - 1 - position;
@@ -513,10 +523,10 @@ public void onItemClick(int position) {
double spend = RecordManager.SELECTED_RECORDS.get(position).getMoney();
int tagId = RecordManager.SELECTED_RECORDS.get(position).getTag();
if ("zh".equals(CoCoinUtil.GetLanguage())) {
- subTitle = CoCoinUtil.GetSpendString((int)spend) +
+ subTitle = CoCoinUtil.GetSpendString((int) spend) +
"于" + CoCoinUtil.GetTagName(tagId);
} else {
- subTitle = "Spend " + (int)spend +
+ subTitle = "Spend " + (int) spend +
"in " + CoCoinUtil.GetTagName(tagId);
}
dialog = new MaterialDialog.Builder(mContext)
@@ -527,100 +537,12 @@ public void onItemClick(int position) {
.positiveText(R.string.get)
.show();
dialogView = dialog.getCustomView();
- TextView remark = (TextView)dialogView.findViewById(R.id.remark);
- TextView date = (TextView)dialogView.findViewById(R.id.date);
+ TextView remark = (TextView) dialogView.findViewById(R.id.remark);
+ TextView date = (TextView) dialogView.findViewById(R.id.date);
remark.setText(RecordManager.SELECTED_RECORDS.get(position).getRemark());
date.setText(RecordManager.SELECTED_RECORDS.get(position).getCalendarString());
}
- public class SelectRecordsByRemark extends AsyncTask {
-
- private String sub;
-
- public SelectRecordsByRemark(String sub) {
- this.sub = sub;
- }
-
- @Override
- protected String doInBackground(String... params) {
- RecordManager.getInstance(mContext).SELECTED_SUM = 0d;
- if (RecordManager.getInstance(mContext).SELECTED_RECORDS == null) {
- RecordManager.getInstance(mContext).SELECTED_RECORDS = new LinkedList<>();
- } else {
- RecordManager.getInstance(mContext).SELECTED_RECORDS.clear();
- }
- int size = RecordManager.getInstance(mContext).RECORDS.size();
- for (int i = 0; i < size; i++) {
- CoCoinRecord record = new CoCoinRecord();
- record.set(RecordManager.getInstance(mContext).RECORDS.get(i));
- if (inRemark(record, sub)) {
- RecordManager.getInstance(mContext).SELECTED_SUM += record.getMoney();
- RecordManager.getInstance(mContext).SELECTED_RECORDS.add(record);
- }
- }
-
- originalSum = RecordManager.getInstance(mContext).SELECTED_SUM;
- return null;
- }
- @Override
- protected void onPostExecute(String result) {
- mAdapter.notifyDataSetChanged();
-
- changeTitleSlider();
-
- if (RecordManager.SELECTED_RECORDS.size() == 0) {
- emptyTip.setVisibility(View.VISIBLE);
- verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
- } else {
- emptyTip.setVisibility(View.GONE);
- verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
- }
-
- if (progressDialog != null) progressDialog.cancel();
- }
- }
-
- public class SelectRecords extends AsyncTask {
-
- @Override
- protected String doInBackground(String... params) {
- RecordManager.getInstance(mContext).SELECTED_SUM = 0d;
- if (RecordManager.getInstance(mContext).SELECTED_RECORDS == null) {
- RecordManager.getInstance(mContext).SELECTED_RECORDS = new LinkedList<>();
- } else {
- RecordManager.getInstance(mContext).SELECTED_RECORDS.clear();
- }
- int size = RecordManager.getInstance(mContext).RECORDS.size();
- for (int i = 0; i < size; i++) {
- CoCoinRecord record = new CoCoinRecord();
- record.set(RecordManager.getInstance(mContext).RECORDS.get(i));
- if (inMoney(record) && inTag(record) && inTime(record)) {
- RecordManager.getInstance(mContext).SELECTED_SUM += record.getMoney();
- RecordManager.getInstance(mContext).SELECTED_RECORDS.add(record);
- }
- }
-
- originalSum = RecordManager.getInstance(mContext).SELECTED_SUM;
- return null;
- }
- @Override
- protected void onPostExecute(String result) {
- mAdapter.notifyDataSetChanged();
-
- changeTitleSlider();
-
- if (RecordManager.SELECTED_RECORDS.size() == 0) {
- emptyTip.setVisibility(View.VISIBLE);
- verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
- } else {
- emptyTip.setVisibility(View.GONE);
- verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
- }
-
- if (progressDialog != null) progressDialog.cancel();
- }
- }
-
private void selectRecords() {
mDrawer.closeDrawers();
progressDialog = new MaterialDialog.Builder(this)
@@ -643,7 +565,8 @@ private boolean inTag(CoCoinRecord record) {
private boolean inTime(CoCoinRecord record) {
if (LEFT_CALENDAR == null || RIGHT_CALENDAR == null) return true;
- else return !record.getCalendar().before(LEFT_CALENDAR) && !record.getCalendar().after(RIGHT_CALENDAR);
+ else
+ return !record.getCalendar().before(LEFT_CALENDAR) && !record.getCalendar().after(RIGHT_CALENDAR);
}
private boolean inRemark(CoCoinRecord record, String sub) {
@@ -909,7 +832,8 @@ private void loadLogo() {
public void onSuccess(List object) {
// there has been an old logo in the server/////////////////////////////////////////////////////////
String url = object.get(0).getFile().getFileUrl(CoCoinApplication.getAppContext());
- if (BuildConfig.DEBUG) Log.d("CoCoin", "Logo in server: " + url);
+ if (BuildConfig.DEBUG)
+ Log.d("CoCoin", "Logo in server: " + url);
Ion.with(CoCoinApplication.getAppContext()).load(url)
.write(new File(CoCoinApplication.getAppContext().getFilesDir()
+ CoCoinUtil.LOGO_NAME))
@@ -922,10 +846,12 @@ public void onCompleted(Exception e, File file) {
}
});
}
+
@Override
public void onError(int code, String msg) {
// the picture is lost
- if (BuildConfig.DEBUG) Log.d("CoCoin", "Can't find the old logo in server.");
+ if (BuildConfig.DEBUG)
+ Log.d("CoCoin", "Can't find the old logo in server.");
}
});
} else {
@@ -974,7 +900,6 @@ public void onClick(View v) {
}
}
- private double inputNumber = -1;
private void setExpense() {
inputNumber = -1;
new MaterialDialog.Builder(mContext)
@@ -983,7 +908,7 @@ private void setExpense() {
.positiveText(R.string.ok)
.negativeText(R.string.cancel)
.inputType(InputType.TYPE_CLASS_NUMBER)
- .input("≥" + (int)(double)CoCoinUtil.INPUT_MIN_EXPENSE, "", new MaterialDialog.InputCallback() {
+ .input("≥" + (int) (double) CoCoinUtil.INPUT_MIN_EXPENSE, "", new MaterialDialog.InputCallback() {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
try {
@@ -993,7 +918,8 @@ public void onInput(MaterialDialog dialog, CharSequence input) {
} catch (NumberFormatException n) {
inputNumber = -1;
}
- if (inputNumber == -1) dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
+ if (inputNumber == -1)
+ dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
else dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
}
})
@@ -1009,7 +935,7 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
.positiveText(R.string.ok)
.negativeText(R.string.cancel)
.inputType(InputType.TYPE_CLASS_NUMBER)
- .input("≤" + (int)(double)CoCoinUtil.INPUT_MAX_EXPENSE, "", new MaterialDialog.InputCallback() {
+ .input("≤" + (int) (double) CoCoinUtil.INPUT_MAX_EXPENSE, "", new MaterialDialog.InputCallback() {
@Override
public void onInput(MaterialDialog dialog, CharSequence input) {
try {
@@ -1019,8 +945,10 @@ public void onInput(MaterialDialog dialog, CharSequence input) {
} catch (NumberFormatException n) {
inputNumber = -1;
}
- if (inputNumber == -1) dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
- else dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
+ if (inputNumber == -1)
+ dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
+ else
+ dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
}
})
.onAny(new MaterialDialog.SingleButtonCallback() {
@@ -1041,7 +969,6 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
.show();
}
- private boolean isFrom = true;
private void setCalendar() {
Calendar now = Calendar.getInstance();
DatePickerDialog dpd = DatePickerDialog.newInstance(
@@ -1051,13 +978,10 @@ private void setCalendar() {
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(mContext.getResources().getString(R.string.set_left_calendar));
- dpd.show(((Activity)mContext).getFragmentManager(), "Datepickerdialog");
+ dpd.show(((Activity) mContext).getFragmentManager(), "Datepickerdialog");
isFrom = true;
}
- private int fromYear, fromMonth, fromDay;
- private Calendar to = Calendar.getInstance();
- private Calendar from = Calendar.getInstance();
@Override
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
if (isFrom) {
@@ -1072,7 +996,7 @@ public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayO
now.get(Calendar.DAY_OF_MONTH)
);
dpd.setTitle(mContext.getResources().getString(R.string.set_right_calendar));
- dpd.show(((Activity)mContext).getFragmentManager(), "Datepickerdialog");
+ dpd.show(((Activity) mContext).getFragmentManager(), "Datepickerdialog");
isFrom = false;
} else {
from.set(fromYear, fromMonth - 1, fromDay, 0, 0, 0);
@@ -1084,17 +1008,13 @@ public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayO
if (to.before(from)) {
CoCoinUtil.showToast(mContext, mContext.getResources().getString(R.string.from_invalid), SuperToast.Background.RED);
} else {
- LEFT_CALENDAR = (Calendar)from.clone();
- RIGHT_CALENDAR = (Calendar)to.clone();
+ LEFT_CALENDAR = (Calendar) from.clone();
+ RIGHT_CALENDAR = (Calendar) to.clone();
setConditions();
}
}
}
- private MyGridView myGridView;
- private DialogTagChooseGridViewAdapter dialogTagChooseGridViewAdapter;
- private MaterialDialog tagSelectDialog;
- private View tagSelectDialogView;
private void setTag() {
tagSelectDialog = new MaterialDialog.Builder(this)
.title(R.string.set_tag)
@@ -1102,7 +1022,7 @@ private void setTag() {
.negativeText(R.string.cancel)
.show();
tagSelectDialogView = tagSelectDialog.getCustomView();
- myGridView = (MyGridView)tagSelectDialogView.findViewById(R.id.grid_view);
+ myGridView = (MyGridView) tagSelectDialogView.findViewById(R.id.grid_view);
dialogTagChooseGridViewAdapter = new DialogTagChooseGridViewAdapter(mContext);
myGridView.setAdapter(dialogTagChooseGridViewAdapter);
@@ -1117,15 +1037,93 @@ public void onItemClick(AdapterView> parent, View view, final int position, lo
});
}
- private DoubleSliderClickListener doubleSliderClickListener = new DoubleSliderClickListener() {
+ public class SelectRecordsByRemark extends AsyncTask {
+
+ private String sub;
+
+ public SelectRecordsByRemark(String sub) {
+ this.sub = sub;
+ }
+
@Override
- public void onSingleClick(BaseSliderView v) {
+ protected String doInBackground(String... params) {
+ RecordManager.getInstance(mContext).SELECTED_SUM = 0d;
+ if (RecordManager.getInstance(mContext).SELECTED_RECORDS == null) {
+ RecordManager.getInstance(mContext).SELECTED_RECORDS = new LinkedList<>();
+ } else {
+ RecordManager.getInstance(mContext).SELECTED_RECORDS.clear();
+ }
+ int size = RecordManager.getInstance(mContext).RECORDS.size();
+ for (int i = 0; i < size; i++) {
+ CoCoinRecord record = new CoCoinRecord();
+ record.set(RecordManager.getInstance(mContext).RECORDS.get(i));
+ if (inRemark(record, sub)) {
+ RecordManager.getInstance(mContext).SELECTED_SUM += record.getMoney();
+ RecordManager.getInstance(mContext).SELECTED_RECORDS.add(record);
+ }
+ }
+ originalSum = RecordManager.getInstance(mContext).SELECTED_SUM;
+ return null;
}
@Override
- public void onDoubleClick(BaseSliderView v) {
- if (recyclerView != null) recyclerView.scrollToPosition(0);
+ protected void onPostExecute(String result) {
+ mAdapter.notifyDataSetChanged();
+
+ changeTitleSlider();
+
+ if (RecordManager.SELECTED_RECORDS.size() == 0) {
+ emptyTip.setVisibility(View.VISIBLE);
+ verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
+ } else {
+ emptyTip.setVisibility(View.GONE);
+ verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
+ }
+
+ if (progressDialog != null) progressDialog.cancel();
}
- };
+ }
+
+ public class SelectRecords extends AsyncTask {
+
+ @Override
+ protected String doInBackground(String... params) {
+ RecordManager.getInstance(mContext).SELECTED_SUM = 0d;
+ if (RecordManager.getInstance(mContext).SELECTED_RECORDS == null) {
+ RecordManager.getInstance(mContext).SELECTED_RECORDS = new LinkedList<>();
+ } else {
+ RecordManager.getInstance(mContext).SELECTED_RECORDS.clear();
+ }
+ int size = RecordManager.getInstance(mContext).RECORDS.size();
+ for (int i = 0; i < size; i++) {
+ CoCoinRecord record = new CoCoinRecord();
+ record.set(RecordManager.getInstance(mContext).RECORDS.get(i));
+ if (inMoney(record) && inTag(record) && inTime(record)) {
+ RecordManager.getInstance(mContext).SELECTED_SUM += record.getMoney();
+ RecordManager.getInstance(mContext).SELECTED_RECORDS.add(record);
+ }
+ }
+
+ originalSum = RecordManager.getInstance(mContext).SELECTED_SUM;
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(String result) {
+ mAdapter.notifyDataSetChanged();
+
+ changeTitleSlider();
+
+ if (RecordManager.SELECTED_RECORDS.size() == 0) {
+ emptyTip.setVisibility(View.VISIBLE);
+ verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
+ } else {
+ emptyTip.setVisibility(View.GONE);
+ verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
+ }
+
+ if (progressDialog != null) progressDialog.cancel();
+ }
+ }
}
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookMonthViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookMonthViewActivity.java
index dfcd56d..edfccb8 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookMonthViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookMonthViewActivity.java
@@ -6,15 +6,6 @@
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.DefaultItemAnimator;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -30,10 +21,10 @@
import com.koushikdutta.async.future.FutureCallback;
import com.koushikdutta.ion.Ion;
import com.nightonke.saver.BuildConfig;
+import com.nightonke.saver.R;
import com.nightonke.saver.adapter.DrawerMonthViewRecyclerViewAdapter;
import com.nightonke.saver.adapter.DrawerMonthViewRecyclerViewAdapter.OnItemClickListener;
import com.nightonke.saver.adapter.MonthViewFragmentAdapter;
-import com.nightonke.saver.R;
import com.nightonke.saver.model.Logo;
import com.nightonke.saver.model.RecordManager;
import com.nightonke.saver.model.SettingManager;
@@ -47,6 +38,15 @@
import java.util.HashMap;
import java.util.List;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.view.GravityCompat;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.FindListener;
@@ -80,8 +80,8 @@ protected void onCreate(Bundle savedInstanceState) {
mContext = this;
setContentView(R.layout.activity_account_book_month_view);
- userName = (TextView)findViewById(R.id.user_name);
- userEmail = (TextView)findViewById(R.id.user_email);
+ userName = (TextView) findViewById(R.id.user_name);
+ userEmail = (TextView) findViewById(R.id.user_email);
userName.setTypeface(CoCoinUtil.typefaceLatoRegular);
userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
@@ -94,7 +94,7 @@ protected void onCreate(Bundle savedInstanceState) {
mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
View view = mViewPager.getRootView();
- TextView title = (TextView)view.findViewById(R.id.logo_white);
+ TextView title = (TextView) view.findViewById(R.id.logo_white);
title.setTypeface(CoCoinUtil.typefaceLatoLight);
title.setText(SettingManager.getInstance().getAccountBookName());
@@ -149,7 +149,7 @@ public HeaderDesign getHeaderDesign(int page) {
}
});
- recyclerView = (RecyclerView)mDrawer.findViewById(R.id.recycler_view);
+ recyclerView = (RecyclerView) mDrawer.findViewById(R.id.recycler_view);
drawerMonthViewRecyclerViewAdapter = new DrawerMonthViewRecyclerViewAdapter(mContext);
recyclerView.setAdapter(drawerMonthViewRecyclerViewAdapter);
recyclerView.setHasFixedSize(true);
@@ -169,7 +169,7 @@ public void run() {
}
});
- profileImage= (CircleImageView)mDrawer.findViewById(R.id.profile_image);
+ profileImage = (CircleImageView) mDrawer.findViewById(R.id.profile_image);
profileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -181,11 +181,11 @@ public void onClick(View v) {
}
});
- mDemoSlider = (SliderLayout)findViewById(R.id.slider);
+ mDemoSlider = (SliderLayout) findViewById(R.id.slider);
HashMap urls = CoCoinUtil.GetDrawerTopUrl();
- for(String name : urls.keySet()){
+ for (String name : urls.keySet()) {
CustomSliderView customSliderView = new CustomSliderView(this);
// initialize a SliderLayout
customSliderView
@@ -265,7 +265,8 @@ private void loadLogo() {
public void onSuccess(List object) {
// there has been an old logo in the server/////////////////////////////////////////////////////////
String url = object.get(0).getFile().getFileUrl(CoCoinApplication.getAppContext());
- if (BuildConfig.DEBUG) Log.d("CoCoin", "Logo in server: " + url);
+ if (BuildConfig.DEBUG)
+ Log.d("CoCoin", "Logo in server: " + url);
Ion.with(CoCoinApplication.getAppContext()).load(url)
.write(new File(CoCoinApplication.getAppContext().getFilesDir()
+ CoCoinUtil.LOGO_NAME))
@@ -278,10 +279,12 @@ public void onCompleted(Exception e, File file) {
}
});
}
+
@Override
public void onError(int code, String msg) {
// the picture is lost
- if (BuildConfig.DEBUG) Log.d("CoCoin", "Can't find the old logo in server.");
+ if (BuildConfig.DEBUG)
+ Log.d("CoCoin", "Can't find the old logo in server.");
}
});
} else {
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookReportViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookReportViewActivity.java
index ceb074c..bb967c8 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookReportViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookReportViewActivity.java
@@ -4,11 +4,10 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
-import android.util.Log;
-import android.util.TypedValue;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
@@ -19,7 +18,6 @@
import com.github.florent37.materialviewpager.header.HeaderDesign;
import com.nightonke.saver.R;
import com.nightonke.saver.adapter.ReportViewFragmentAdapter;
-import com.nightonke.saver.fragment.CoCoinFragmentManager;
import com.nightonke.saver.fragment.ReportViewFragment;
import com.nightonke.saver.model.SettingManager;
import com.nightonke.saver.util.CoCoinUtil;
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookSettingActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookSettingActivity.java
index 07a64e0..9c02efc 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookSettingActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookSettingActivity.java
@@ -10,9 +10,9 @@
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.AppCompatActivity;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.AppCompatActivity;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookTagViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookTagViewActivity.java
index f23e1ea..2b5dc1d 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookTagViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookTagViewActivity.java
@@ -7,12 +7,12 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.core.view.GravityCompat;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/activity/AccountBookTodayViewActivity.java b/app/src/main/java/com/nightonke/saver/activity/AccountBookTodayViewActivity.java
index 0bebc42..0d37dc0 100644
--- a/app/src/main/java/com/nightonke/saver/activity/AccountBookTodayViewActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/AccountBookTodayViewActivity.java
@@ -7,13 +7,13 @@
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
-import android.support.annotation.NonNull;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.annotation.NonNull;
+import androidx.core.view.GravityCompat;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@@ -59,8 +59,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -70,7 +68,6 @@
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
-import cn.bmob.v3.listener.DeleteListener;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
diff --git a/app/src/main/java/com/nightonke/saver/activity/EditPasswordActivity.java b/app/src/main/java/com/nightonke/saver/activity/EditPasswordActivity.java
index 007aa84..89c958d 100644
--- a/app/src/main/java/com/nightonke/saver/activity/EditPasswordActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/EditPasswordActivity.java
@@ -5,10 +5,10 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.core.content.ContextCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -27,7 +27,6 @@
import com.nightonke.saver.adapter.PasswordChangeButtonGridViewAdapter;
import com.nightonke.saver.adapter.PasswordChangeFragmentAdapter;
import com.nightonke.saver.fragment.CoCoinFragmentManager;
-import com.nightonke.saver.fragment.PasswordChangeFragment;
import com.nightonke.saver.model.SettingManager;
import com.nightonke.saver.model.User;
import com.nightonke.saver.ui.FixedSpeedScroller;
diff --git a/app/src/main/java/com/nightonke/saver/activity/EditRecordActivity.java b/app/src/main/java/com/nightonke/saver/activity/EditRecordActivity.java
index aeeb15f..4c51577 100644
--- a/app/src/main/java/com/nightonke/saver/activity/EditRecordActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/EditRecordActivity.java
@@ -5,9 +5,9 @@
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -28,7 +28,6 @@
import com.nightonke.saver.model.CoCoinRecord;
import com.nightonke.saver.model.RecordManager;
import com.nightonke.saver.ui.CoCoinScrollableViewPager;
-import com.nightonke.saver.ui.CoCoinUnscrollableViewPager;
import com.nightonke.saver.ui.MyGridView;
import com.nightonke.saver.util.CoCoinUtil;
diff --git a/app/src/main/java/com/nightonke/saver/activity/FeedbackActivity.java b/app/src/main/java/com/nightonke/saver/activity/FeedbackActivity.java
index 4935344..f1510b7 100644
--- a/app/src/main/java/com/nightonke/saver/activity/FeedbackActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/FeedbackActivity.java
@@ -4,10 +4,10 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/activity/HelpActivity.java b/app/src/main/java/com/nightonke/saver/activity/HelpActivity.java
index d403084..9b9c550 100644
--- a/app/src/main/java/com/nightonke/saver/activity/HelpActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/HelpActivity.java
@@ -4,10 +4,10 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/activity/MainActivity.java b/app/src/main/java/com/nightonke/saver/activity/MainActivity.java
index 633cd02..eb816ed 100644
--- a/app/src/main/java/com/nightonke/saver/activity/MainActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/MainActivity.java
@@ -9,11 +9,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -56,87 +51,115 @@
import java.util.Calendar;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.viewpager.widget.ViewPager;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
import cn.bmob.v3.BmobUser;
public class MainActivity extends AppCompatActivity
implements
TagChooseFragment.OnTagItemSelectedListener {
+ private static final float SHAKE_ACCELERATED_SPEED = 15;
private final int SETTING_TAG = 0;
-
+ private final int NO_TAG_TOAST = 0;
+ private final int NO_MONEY_TOAST = 1;
+ private final int PASSWORD_WRONG_TOAST = 2;
+ private final int PASSWORD_CORRECT_TOAST = 3;
+ private final int SAVE_SUCCESSFULLY_TOAST = 4;
+ private final int SAVE_FAILED_TOAST = 5;
+ private final int PRESS_AGAIN_TO_EXIT = 6;
+ private final int WELCOME_BACK = 7;
+ boolean doubleBackToExitPressedOnce = false;
+ @BindView(R.id.toolbar)
+ Toolbar toolbar;
+ @BindView(R.id.root)
+ FrameLayout root;
+ @BindView(R.id.content_hamburger)
+ View contentHamburger;
private Context mContext;
-
private View guillotineBackground;
-
private TextView toolBarTitle;
private TextView menuToolBarTitle;
-
private TextView passwordTip;
-
private SuperToast superToast;
private SuperActivityToast superActivityToast;
-
private MyGridView myGridView;
private ButtonGridViewAdapter myGridViewAdapter;
-
private LinearLayout transparentLy;
private LinearLayout guillotineColorLy;
-
private boolean isPassword = false;
-
private long RIPPLE_DURATION = 250;
-
private GuillotineAnimation animation;
-
private String inputPassword = "";
-
private float x1, y1, x2, y2;
-
private RadioButton radioButton0;
private RadioButton radioButton1;
private RadioButton radioButton2;
private RadioButton radioButton3;
-
private MaterialMenuView statusButton;
-
private LinearLayout radioButtonLy;
-
private View guillotineMenu;
-
private ViewPager tagViewPager;
private CoCoinScrollableViewPager editViewPager;
private FragmentPagerAdapter tagAdapter;
private FragmentPagerAdapter editAdapter;
-
private boolean isLoading;
-
private DummyOperation dummyOperation;
-
- private final int NO_TAG_TOAST = 0;
- private final int NO_MONEY_TOAST = 1;
- private final int PASSWORD_WRONG_TOAST = 2;
- private final int PASSWORD_CORRECT_TOAST = 3;
- private final int SAVE_SUCCESSFULLY_TOAST = 4;
- private final int SAVE_FAILED_TOAST = 5;
- private final int PRESS_AGAIN_TO_EXIT = 6;
- private final int WELCOME_BACK = 7;
-
- boolean doubleBackToExitPressedOnce = false;
-
private Toolbar guillotineToolBar;
-
private AppUpdateManager appUpdateManager;
+ private SensorManager sensorManager;
+ private AdapterView.OnItemLongClickListener gridViewLongClickListener
+ = new AdapterView.OnItemLongClickListener() {
+ @Override
+ public boolean onItemLongClick(AdapterView> parent, View view, int position, long id) {
+ if (!isLoading) {
+ buttonClickOperation(true, position);
+ }
+ return true;
+ }
+ };
+ private View.OnClickListener statusButtonOnClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ animation.close();
+ }
+ };
+ private AdapterView.OnItemClickListener gridViewClickListener
+ = new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ if (!isLoading) {
+ buttonClickOperation(false, position);
+ }
+ }
+ };
+ private SensorEventListener listener = new SensorEventListener() {
- @InjectView(R.id.toolbar)
- Toolbar toolbar;
- @InjectView(R.id.root)
- FrameLayout root;
- @InjectView(R.id.content_hamburger)
- View contentHamburger;
+ @Override
+ public void onSensorChanged(SensorEvent event) {
+ if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
+ if ((Math.abs(event.values[0]) > SHAKE_ACCELERATED_SPEED
+ || Math.abs(event.values[1]) > SHAKE_ACCELERATED_SPEED
+ || Math.abs(event.values[2]) > SHAKE_ACCELERATED_SPEED)) {
+ if (!isPassword) {
+ animation.open();
+ } else {
+ animation.close();
+ }
+ }
+ }
+ }
- private SensorManager sensorManager;
+ @Override
+ public void onAccuracyChanged(Sensor sensor, int accuracy) {
+
+ }
+ };
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -146,15 +169,17 @@ protected void onCreate(Bundle savedInstanceState) {
mContext = this;
+
// Bmob.initialize(CoCoinApplication.getAppContext(), CoCoin.APPLICATION_ID);
-// CrashReport.initCrashReport(CoCoinApplication.getAppContext(), "900016815", false);
+// CrashReport.initCrashReport
+// (CoCoinApplication.getAppContext(), "900016815", false);
// RecordManager.getInstance(CoCoinApplication.getAppContext());
// CoCoinUtil.init(CoCoinApplication.getAppContext());
appUpdateManager = new AppUpdateManager(mContext);
appUpdateManager.checkUpdateInfo(false);
- sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
+ sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor magneticSensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
Sensor accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
@@ -175,7 +200,7 @@ protected void onCreate(Bundle savedInstanceState) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
- } else{
+ } else {
// do something for phones running an SDK before lollipop
}
@@ -193,14 +218,14 @@ protected void onCreate(Bundle savedInstanceState) {
guillotineBackground = findViewById(R.id.guillotine_background);
- toolBarTitle = (TextView)findViewById(R.id.guillotine_title);
+ toolBarTitle = (TextView) findViewById(R.id.guillotine_title);
toolBarTitle.setTypeface(CoCoinUtil.typefaceLatoLight);
toolBarTitle.setText(SettingManager.getInstance().getAccountBookName());
// edit viewpager///////////////////////////////////////////////////////////////////////////////////
editViewPager = (CoCoinScrollableViewPager) findViewById(R.id.edit_pager);
editAdapter = new EditMoneyRemarkFragmentAdapter(getSupportFragmentManager(), CoCoinFragmentManager.MAIN_ACTIVITY_FRAGMENT);
-
+
editViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
@@ -227,7 +252,7 @@ public void onPageScrollStateChanged(int state) {
editViewPager.setAdapter(editAdapter);
// tag viewpager////////////////////////////////////////////////////////////////////////////////////
- tagViewPager = (ViewPager)findViewById(R.id.viewpager);
+ tagViewPager = (ViewPager) findViewById(R.id.viewpager);
if (RecordManager.getInstance(mContext).TAGS.size() % 8 == 0)
tagAdapter = new TagChooseFragmentAdapter(getSupportFragmentManager(), RecordManager.TAGS.size() / 8);
@@ -236,7 +261,7 @@ public void onPageScrollStateChanged(int state) {
tagViewPager.setAdapter(tagAdapter);
// button grid view/////////////////////////////////////////////////////////////////////////////////
- myGridView = (MyGridView)findViewById(R.id.gridview);
+ myGridView = (MyGridView) findViewById(R.id.gridview);
myGridViewAdapter = new ButtonGridViewAdapter(this);
myGridView.setAdapter(myGridViewAdapter);
@@ -258,7 +283,7 @@ public void onGlobalLayout() {
}
});
- ButterKnife.inject(this);
+ ButterKnife.bind(this);
if (toolbar != null) {
setSupportActionBar(toolbar);
@@ -270,32 +295,32 @@ public void onGlobalLayout() {
guillotineMenu = LayoutInflater.from(this).inflate(R.layout.guillotine, null);
root.addView(guillotineMenu);
- transparentLy = (LinearLayout)guillotineMenu.findViewById(R.id.transparent_ly);
- guillotineColorLy = (LinearLayout)guillotineMenu.findViewById(R.id.guillotine_color_ly);
- guillotineToolBar = (Toolbar)guillotineMenu.findViewById(R.id.toolbar);
+ transparentLy = (LinearLayout) guillotineMenu.findViewById(R.id.transparent_ly);
+ guillotineColorLy = (LinearLayout) guillotineMenu.findViewById(R.id.guillotine_color_ly);
+ guillotineToolBar = (Toolbar) guillotineMenu.findViewById(R.id.toolbar);
- menuToolBarTitle = (TextView)guillotineMenu.findViewById(R.id.guillotine_title);
+ menuToolBarTitle = (TextView) guillotineMenu.findViewById(R.id.guillotine_title);
menuToolBarTitle.setTypeface(CoCoinUtil.typefaceLatoLight);
menuToolBarTitle.setText(SettingManager.getInstance().getAccountBookName());
- radioButton0 = (RadioButton)guillotineMenu.findViewById(R.id.radio_button_0);
- radioButton1 = (RadioButton)guillotineMenu.findViewById(R.id.radio_button_1);
- radioButton2 = (RadioButton)guillotineMenu.findViewById(R.id.radio_button_2);
- radioButton3 = (RadioButton)guillotineMenu.findViewById(R.id.radio_button_3);
+ radioButton0 = (RadioButton) guillotineMenu.findViewById(R.id.radio_button_0);
+ radioButton1 = (RadioButton) guillotineMenu.findViewById(R.id.radio_button_1);
+ radioButton2 = (RadioButton) guillotineMenu.findViewById(R.id.radio_button_2);
+ radioButton3 = (RadioButton) guillotineMenu.findViewById(R.id.radio_button_3);
- passwordTip = (TextView)guillotineMenu.findViewById(R.id.password_tip);
+ passwordTip = (TextView) guillotineMenu.findViewById(R.id.password_tip);
passwordTip.setText(mContext.getResources().getString(R.string.password_tip));
passwordTip.setTypeface(CoCoinUtil.typefaceLatoLight);
- radioButtonLy = (LinearLayout)guillotineMenu.findViewById(R.id.radio_button_ly);
+ radioButtonLy = (LinearLayout) guillotineMenu.findViewById(R.id.radio_button_ly);
- statusButton = (MaterialMenuView)guillotineMenu.findViewById(R.id.status_button);
+ statusButton = (MaterialMenuView) guillotineMenu.findViewById(R.id.status_button);
statusButton.setState(MaterialMenuDrawable.IconState.ARROW);
statusButton.setOnClickListener(statusButtonOnClickListener);
animation = new GuillotineAnimation.GuillotineBuilder(guillotineMenu,
- guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
+ guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
.setStartDelay(RIPPLE_DURATION)
.setActionBarViewForAnimation(toolbar)
.setClosedOnStart(true)
@@ -343,18 +368,6 @@ public void onClick(View v) {
}
}
- private AdapterView.OnItemLongClickListener gridViewLongClickListener
- = new AdapterView.OnItemLongClickListener() {
- @Override
- public boolean onItemLongClick(AdapterView> parent, View view, int position, long id) {
- if (!isLoading) {
- buttonClickOperation(true, position);
- }
- return true;
- }
- };
-
-
private void checkPassword() {
if (inputPassword.length() != 4) {
return;
@@ -411,23 +424,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}
- private View.OnClickListener statusButtonOnClickListener = new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- animation.close();
- }
- };
-
- private AdapterView.OnItemClickListener gridViewClickListener
- = new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- if (!isLoading) {
- buttonClickOperation(false, position);
- }
- }
- };
-
private void buttonClickOperation(boolean longClick, int position) {
if (editViewPager.getCurrentItem() == 1) return;
if (!isPassword) {
@@ -449,8 +445,8 @@ private void buttonClickOperation(boolean longClick, int position) {
} else {
CoCoinFragmentManager.mainActivityEditMoneyFragment.setNumberText(
CoCoinFragmentManager.mainActivityEditMoneyFragment.getNumberText().toString()
- .substring(0, CoCoinFragmentManager.mainActivityEditMoneyFragment
- .getNumberText().toString().length() - 1));
+ .substring(0, CoCoinFragmentManager.mainActivityEditMoneyFragment
+ .getNumberText().toString().length() - 1));
if (CoCoinFragmentManager.mainActivityEditMoneyFragment
.getNumberText().toString().length() == 0) {
CoCoinFragmentManager.mainActivityEditMoneyFragment.setNumberText("0");
@@ -499,6 +495,7 @@ private void buttonClickOperation(boolean longClick, int position) {
}
if (inputPassword.length() == 0) {
radioButton0.setChecked(true);
+
YoYo.with(Techniques.Bounce).delay(0).duration(1000).playOn(radioButton0);
} else if (inputPassword.length() == 1) {
radioButton1.setChecked(true);
@@ -522,7 +519,7 @@ private void commit() {
showToast(NO_TAG_TOAST);
} else if (CoCoinFragmentManager.mainActivityEditMoneyFragment.getNumberText().toString().equals("0")) {
showToast(NO_MONEY_TOAST);
- } else {
+ } else {
Calendar calendar = Calendar.getInstance();
CoCoinRecord coCoinRecord = new CoCoinRecord(
-1,
@@ -603,7 +600,7 @@ private void changeColor() {
window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
}
- } else{
+ } else {
// do something for phones running an SDK before lollipop
}
@@ -743,28 +740,4 @@ public void onAnimationStart(int id) {
// Todo add animation for changing tag
}
- private static final float SHAKE_ACCELERATED_SPEED = 15;
- private SensorEventListener listener = new SensorEventListener() {
-
- @Override
- public void onSensorChanged(SensorEvent event) {
- if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
- if ((Math.abs(event.values[0]) > SHAKE_ACCELERATED_SPEED
- || Math.abs(event.values[1]) > SHAKE_ACCELERATED_SPEED
- || Math.abs(event.values[2]) > SHAKE_ACCELERATED_SPEED)) {
- if (!isPassword) {
- animation.open();
- } else {
- animation.close();
- }
- }
- }
- }
-
- @Override
- public void onAccuracyChanged(Sensor sensor, int accuracy) {
-
- }
- };
-
}
diff --git a/app/src/main/java/com/nightonke/saver/activity/SetPasswordActivity.java b/app/src/main/java/com/nightonke/saver/activity/SetPasswordActivity.java
index f3b2577..5991195 100644
--- a/app/src/main/java/com/nightonke/saver/activity/SetPasswordActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/SetPasswordActivity.java
@@ -5,9 +5,9 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/activity/ShowActivity.java b/app/src/main/java/com/nightonke/saver/activity/ShowActivity.java
index 3f1d9db..829bc52 100644
--- a/app/src/main/java/com/nightonke/saver/activity/ShowActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/ShowActivity.java
@@ -5,12 +5,11 @@
import android.graphics.Point;
import android.os.Bundle;
import android.os.Handler;
-import android.support.v4.content.ContextCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.appcompat.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.util.Log;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
@@ -18,7 +17,6 @@
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -44,7 +42,6 @@
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.listener.UpdateListener;
import lecho.lib.hellocharts.gesture.ContainerScrollType;
-import lecho.lib.hellocharts.model.Axis;
import lecho.lib.hellocharts.model.Column;
import lecho.lib.hellocharts.model.ColumnChartData;
import lecho.lib.hellocharts.model.Line;
@@ -54,7 +51,6 @@
import lecho.lib.hellocharts.model.SliceValue;
import lecho.lib.hellocharts.model.SubcolumnValue;
import lecho.lib.hellocharts.model.ValueShape;
-import lecho.lib.hellocharts.util.ChartUtils;
import lecho.lib.hellocharts.view.ColumnChartView;
import lecho.lib.hellocharts.view.LineChartView;
import lecho.lib.hellocharts.view.PieChartView;
diff --git a/app/src/main/java/com/nightonke/saver/activity/SplashActivity.java b/app/src/main/java/com/nightonke/saver/activity/SplashActivity.java
index ea503cf..368c564 100644
--- a/app/src/main/java/com/nightonke/saver/activity/SplashActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/SplashActivity.java
@@ -34,23 +34,19 @@
public class SplashActivity extends Activity {
+ private final int NUMBER_OF_LINES = 1;
private Context mContext;
-
private LineChartView chart;
private LineChartData data;
-
private RevealFrameLayout reveal;
private LinearLayout ly;
-
private ImageView image;
private TextView appName;
private TextView loadingText;
-
private boolean loadDataCompleted = false;
private boolean showAnimationCompleted = false;
private boolean activityStarted = false;
-
- private final int NUMBER_OF_LINES = 1;
+ private boolean hasAnimationStarted;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -86,14 +82,14 @@ protected void onCreate(Bundle savedInstanceState) {
data.setBaseValue(Float.NEGATIVE_INFINITY);
chart.setLineChartData(data);
- image = (ImageView)findViewById(R.id.image);
- appName = (TextView)findViewById(R.id.app_name);
+ image = (ImageView) findViewById(R.id.image);
+ appName = (TextView) findViewById(R.id.app_name);
appName.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- loadingText = (TextView)findViewById(R.id.loading_text);
+ loadingText = (TextView) findViewById(R.id.loading_text);
loadingText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- reveal = (RevealFrameLayout)findViewById(R.id.reveal);
- ly = (LinearLayout)findViewById(R.id.ly);
+ reveal = (RevealFrameLayout) findViewById(R.id.reveal);
+ ly = (LinearLayout) findViewById(R.id.ly);
new InitData().execute();
}
@@ -145,7 +141,6 @@ public void onAnimationRepeat() {
hasAnimationStarted = true;
}
- private boolean hasAnimationStarted;
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
@@ -165,6 +160,7 @@ protected String doInBackground(String... params) {
CoCoinUtil.init(CoCoinApplication.getAppContext());
return null;
}
+
@Override
protected void onPostExecute(String result) {
Log.d("CoCoin", "Loading Data completed");
diff --git a/app/src/main/java/com/nightonke/saver/activity/TagSettingActivity.java b/app/src/main/java/com/nightonke/saver/activity/TagSettingActivity.java
index b0d5080..d26266c 100644
--- a/app/src/main/java/com/nightonke/saver/activity/TagSettingActivity.java
+++ b/app/src/main/java/com/nightonke/saver/activity/TagSettingActivity.java
@@ -6,11 +6,12 @@
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.RecyclerView;
+import androidx.annotation.NonNull;
+import androidx.core.content.ContextCompat;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/CustomViewFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/CustomViewFragmentAdapter.java
index 29fd303..26866e3 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/CustomViewFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/CustomViewFragmentAdapter.java
@@ -1,7 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.nightonke.saver.fragment.CustomViewFragment;
@@ -13,7 +14,7 @@
public class CustomViewFragmentAdapter extends FragmentStatePagerAdapter {
- public CustomViewFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public CustomViewFragmentAdapter(FragmentManager fm) {
super(fm);
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/DrawerMonthViewRecyclerViewAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/DrawerMonthViewRecyclerViewAdapter.java
index d4683e6..e765c69 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/DrawerMonthViewRecyclerViewAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/DrawerMonthViewRecyclerViewAdapter.java
@@ -1,7 +1,6 @@
package com.nightonke.saver.adapter;
import android.content.Context;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -15,10 +14,12 @@
import java.util.ArrayList;
import java.util.Calendar;
+import androidx.recyclerview.widget.RecyclerView;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
import butterknife.Optional;
+
/**
* Created by 伟平 on 2015/10/20.
*/
@@ -26,15 +27,13 @@
public class DrawerMonthViewRecyclerViewAdapter
extends RecyclerView.Adapter {
+ OnItemClickListener onItemClickListener;
private ArrayList expenses;
private ArrayList records;
private ArrayList months;
private ArrayList years;
-
private Context mContext;
- OnItemClickListener onItemClickListener;
-
public DrawerMonthViewRecyclerViewAdapter(Context context) {
mContext = context;
expenses = new ArrayList<>();
@@ -90,7 +89,7 @@ public int getItemCount() {
@Override
public DrawerMonthViewRecyclerViewAdapter.viewHolder
- onCreateViewHolder(ViewGroup parent, int viewType) {
+ onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_month_view_drawer, parent, false);
@@ -114,24 +113,31 @@ public void onBindViewHolder(final viewHolder holder, final int position) {
holder.money.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
}
+ public void SetOnItemClickListener(final OnItemClickListener mItemClickListener) {
+ this.onItemClickListener = mItemClickListener;
+ }
+
+ public interface OnItemClickListener {
+ public void onItemClick(View view, int position);
+ }
+
public class viewHolder extends RecyclerView.ViewHolder
- implements View.OnClickListener {
- @Optional
- @InjectView(R.id.month)
+ implements View.OnClickListener {
+ @BindView(R.id.month)
TextView month;
- @Optional
- @InjectView(R.id.year)
+
+ @BindView(R.id.year)
TextView year;
- @Optional
- @InjectView(R.id.money)
+
+ @BindView(R.id.money)
TextView money;
- @Optional
- @InjectView(R.id.sum)
+
+ @BindView(R.id.sum)
TextView sum;
viewHolder(View view) {
super(view);
- ButterKnife.inject(this, view);
+ ButterKnife.bind(this, view);
view.setOnClickListener(this);
}
@@ -143,12 +149,4 @@ public void onClick(View v) {
}
}
- public interface OnItemClickListener {
- public void onItemClick(View view, int position);
- }
-
- public void SetOnItemClickListener(final OnItemClickListener mItemClickListener) {
- this.onItemClickListener = mItemClickListener;
- }
-
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/EditMoneyRemarkFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/EditMoneyRemarkFragmentAdapter.java
index f7ba9d1..419b111 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/EditMoneyRemarkFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/EditMoneyRemarkFragmentAdapter.java
@@ -1,8 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
import com.nightonke.saver.fragment.EditMoneyFragment;
import com.nightonke.saver.fragment.EditRemarkFragment;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/HelpFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/HelpFragmentAdapter.java
index cc7a2d6..089913b 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/HelpFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/HelpFragmentAdapter.java
@@ -1,7 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.nightonke.saver.R;
import com.nightonke.saver.activity.CoCoinApplication;
@@ -17,11 +18,11 @@ public class HelpFragmentAdapter extends FragmentStatePagerAdapter {
private int position = 0;
- public HelpFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public HelpFragmentAdapter(FragmentManager fm) {
super(fm);
}
- public HelpFragmentAdapter(android.support.v4.app.FragmentManager fm, int position) {
+ public HelpFragmentAdapter(FragmentManager fm, int position) {
super(fm);
this.position = position;
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/MonthViewFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/MonthViewFragmentAdapter.java
index 0ee4d8e..bfcb295 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/MonthViewFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/MonthViewFragmentAdapter.java
@@ -1,7 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.nightonke.saver.fragment.MonthViewFragment;
import com.nightonke.saver.model.RecordManager;
@@ -30,7 +31,7 @@ public class MonthViewFragmentAdapter extends FragmentStatePagerAdapter {
public boolean IS_EMPTY = false;
- public MonthViewFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public MonthViewFragmentAdapter(FragmentManager fm) {
super(fm);
list = new ArrayList<>();
diff --git a/app/src/main/java/com/nightonke/saver/adapter/MonthViewRecyclerViewAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/MonthViewRecyclerViewAdapter.java
index 24b7da8..ec7635e 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/MonthViewRecyclerViewAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/MonthViewRecyclerViewAdapter.java
@@ -2,8 +2,6 @@
import android.content.Context;
import android.graphics.Color;
-import android.support.v4.app.FragmentActivity;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -30,9 +28,10 @@
import java.util.Map;
import java.util.TreeMap;
+import androidx.fragment.app.FragmentActivity;
+import androidx.recyclerview.widget.RecyclerView;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
-import butterknife.Optional;
import lecho.lib.hellocharts.listener.PieChartOnValueSelectListener;
import lecho.lib.hellocharts.model.PieChartData;
import lecho.lib.hellocharts.model.SelectedValue;
@@ -48,13 +47,10 @@
public class MonthViewRecyclerViewAdapter
extends RecyclerView.Adapter {
- private Context mContext;
-
- private List list;
-
static final int TYPE_HEADER = 0;
static final int TYPE_CELL = 1;
-
+ private Context mContext;
+ private List list;
private int fragmentPosition;
private ArrayList> sliceValuesList;
@@ -378,34 +374,34 @@ public void onClick(View v) {
}
public static class viewHolder extends RecyclerView.ViewHolder {
- @Optional
- @InjectView(R.id.date)
+
+ @BindView(R.id.date)
TextView date;
- @Optional
- @InjectView(R.id.expanse)
+
+ @BindView(R.id.expanse)
TextView expanseSum;
- @Optional
- @InjectView(R.id.tags)
+
+ @BindView(R.id.tags)
TextView tags;
- @Optional
- @InjectView(R.id.empty_tip)
+
+ @BindView(R.id.empty_tip)
TextView emptyTip;
- @Optional
- @InjectView(R.id.chart_pie)
+
+ @BindView(R.id.chart_pie)
PieChartView pie;
- @Optional
- @InjectView(R.id.icon_left)
+
+ @BindView(R.id.icon_left)
MaterialIconView iconLeft;
- @Optional
- @InjectView(R.id.icon_right)
+
+ @BindView(R.id.icon_right)
MaterialIconView iconRight;
- @Optional
- @InjectView(R.id.all)
+
+ @BindView(R.id.all)
MaterialIconView all;
viewHolder(View view) {
super(view);
- ButterKnife.inject(this, view);
+ ButterKnife.bind(this, view);
}
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/MySwipeableItemAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/MySwipeableItemAdapter.java
index 03cfcf5..69ab336 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/MySwipeableItemAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/MySwipeableItemAdapter.java
@@ -5,9 +5,6 @@
*/
import android.content.Context;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.widget.RecyclerView;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -33,55 +30,21 @@
import java.util.HashMap;
import java.util.List;
+import androidx.core.content.ContextCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
public class MySwipeableItemAdapter
extends RecyclerView.Adapter
implements SwipeableItemAdapter {
- // NOTE: Make accessible with short name
- private interface Swipeable extends SwipeableItemConstants {
- }
-
+ private static HashMap pinned;
private OnItemDeleteListener onItemDeleteListener;
private OnItemClickListener onItemClickListener;
private Context mContext;
private EventListener mEventListener;
- private static HashMap pinned;
-
private List records;
- public interface EventListener {
- void onItemRemoved(int position);
-
- void onItemPinned(int position);
-
- void onItemViewClicked(View v, boolean pinned);
- }
-
- public static class MyViewHolder extends AbstractSwipeableItemViewHolder {
- public FrameLayout mContainer;
- public TextView money;
- public TextView remark;
- public TextView date;
- public ImageView tagImage;
- public TextView index;
-
- public MyViewHolder(View v) {
- super(v);
- mContainer = (FrameLayout) v.findViewById(R.id.container);
- money = (TextView) v.findViewById(R.id.money);
- remark = (TextView) v.findViewById(R.id.remark);
- date = (TextView) v.findViewById(R.id.date);
- tagImage = (ImageView) v.findViewById(R.id.image_view);
- index = (TextView)v.findViewById(R.id.index);
- }
-
- @Override
- public View getSwipeableContainerView() {
- return mContainer;
- }
- }
-
public MySwipeableItemAdapter(Context inContext, List records, final OnItemDeleteListener onItemDeleteListener, OnItemClickListener onItemClickListener) {
mContext = inContext;
this.records = records;
@@ -90,7 +53,7 @@ public MySwipeableItemAdapter(Context inContext, List records, fin
// Todo optimize
pinned = new HashMap<>();
for (int i = records.size() - 1; i >= 0; i--) {
- pinned.put((int)records.get(i).getId(), false);
+ pinned.put((int) records.get(i).getId(), false);
}
setHasStableIds(true);
@@ -217,7 +180,7 @@ public SwipeResultAction onSwipeItem(MyViewHolder holder, final int position, in
switch (result) {
// swipe right
case Swipeable.RESULT_SWIPED_RIGHT:
- if (pinned.get((int)records.get(records.size() - 1 - position).getId())) {
+ if (pinned.get((int) records.get(records.size() - 1 - position).getId())) {
return new UnpinResultAction(this, position);
} else {
return new SwipeRightResultAction(this, position, onItemDeleteListener);
@@ -242,9 +205,59 @@ public void setEventListener(EventListener eventListener) {
mEventListener = eventListener;
}
+ public void setPinned(boolean inPinned, int position) {
+ pinned.put((int) RecordManager.SELECTED_RECORDS.get(
+ RecordManager.SELECTED_RECORDS.size() - 1 - position).getId(), inPinned);
+
+ }
+
+ // NOTE: Make accessible with short name
+ private interface Swipeable extends SwipeableItemConstants {
+ }
+
+ public interface EventListener {
+ void onItemRemoved(int position);
+
+ void onItemPinned(int position);
+
+ void onItemViewClicked(View v, boolean pinned);
+ }
+
+ public interface OnItemDeleteListener {
+ void onSelectSumChanged();
+ }
+
+ public interface OnItemClickListener {
+ void onItemClick(int position);
+ }
+
+ public static class MyViewHolder extends AbstractSwipeableItemViewHolder {
+ public FrameLayout mContainer;
+ public TextView money;
+ public TextView remark;
+ public TextView date;
+ public ImageView tagImage;
+ public TextView index;
+
+ public MyViewHolder(View v) {
+ super(v);
+ mContainer = (FrameLayout) v.findViewById(R.id.container);
+ money = (TextView) v.findViewById(R.id.money);
+ remark = (TextView) v.findViewById(R.id.remark);
+ date = (TextView) v.findViewById(R.id.date);
+ tagImage = (ImageView) v.findViewById(R.id.image_view);
+ index = (TextView) v.findViewById(R.id.index);
+ }
+
+ @Override
+ public View getSwipeableContainerView() {
+ return mContainer;
+ }
+ }
+
private static class SwipeLeftResultAction extends SwipeResultActionMoveToSwipedDirection {
- private MySwipeableItemAdapter mAdapter;
private final int mPosition;
+ private MySwipeableItemAdapter mAdapter;
private boolean mSetPinned;
SwipeLeftResultAction(MySwipeableItemAdapter adapter, int position) {
@@ -255,9 +268,9 @@ private static class SwipeLeftResultAction extends SwipeResultActionMoveToSwiped
@Override
protected void onPerformAction() {
super.onPerformAction();
- if (!pinned.get((int)RecordManager.SELECTED_RECORDS.get(
+ if (!pinned.get((int) RecordManager.SELECTED_RECORDS.get(
RecordManager.SELECTED_RECORDS.size() - 1 - mPosition).getId())) {
- pinned.put((int)RecordManager.SELECTED_RECORDS.get(
+ pinned.put((int) RecordManager.SELECTED_RECORDS.get(
RecordManager.SELECTED_RECORDS.size() - 1 - mPosition).getId(), true);
mSetPinned = true;
mAdapter.notifyItemChanged(mPosition);
@@ -281,9 +294,9 @@ protected void onCleanUp() {
public static class SwipeRightResultAction extends SwipeResultActionRemoveItem {
+ private final int mPosition;
private OnItemDeleteListener onItemDeleteListener;
private MySwipeableItemAdapter mAdapter;
- private final int mPosition;
SwipeRightResultAction(MySwipeableItemAdapter adapter, int position, OnItemDeleteListener onItemDeleteListener) {
mAdapter = adapter;
@@ -324,8 +337,8 @@ protected void onCleanUp() {
}
private static class UnpinResultAction extends SwipeResultActionDefault {
- private MySwipeableItemAdapter mAdapter;
private final int mPosition;
+ private MySwipeableItemAdapter mAdapter;
UnpinResultAction(MySwipeableItemAdapter adapter, int position) {
mAdapter = adapter;
@@ -350,18 +363,4 @@ protected void onCleanUp() {
mAdapter = null;
}
}
-
- public void setPinned(boolean inPinned, int position) {
- pinned.put((int)RecordManager.SELECTED_RECORDS.get(
- RecordManager.SELECTED_RECORDS.size() - 1 - position).getId(), inPinned);
-
- }
-
- public interface OnItemDeleteListener {
- void onSelectSumChanged();
- }
-
- public interface OnItemClickListener {
- void onItemClick(int position);
- }
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/PasswordChangeFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/PasswordChangeFragmentAdapter.java
index 1ccf880..f1d781e 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/PasswordChangeFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/PasswordChangeFragmentAdapter.java
@@ -1,8 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
import com.nightonke.saver.fragment.PasswordChangeFragment;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/RecordCheckDialogRecyclerViewAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/RecordCheckDialogRecyclerViewAdapter.java
index 1a5364d..3d299b3 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/RecordCheckDialogRecyclerViewAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/RecordCheckDialogRecyclerViewAdapter.java
@@ -1,7 +1,6 @@
package com.nightonke.saver.adapter;
import android.content.Context;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -17,18 +16,18 @@
import java.util.ArrayList;
import java.util.List;
+import androidx.recyclerview.widget.RecyclerView;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
/**
* Created by 伟平 on 2015/11/1.
*/
public class RecordCheckDialogRecyclerViewAdapter extends RecyclerView.Adapter {
- private OnItemClickListener onItemClickListener;
-
private final LayoutInflater mLayoutInflater;
private final Context mContext;
+ private OnItemClickListener onItemClickListener;
private List coCoinRecords;
public RecordCheckDialogRecyclerViewAdapter(Context context, List list) {
@@ -82,23 +81,33 @@ public int getItemCount() {
return coCoinRecords.size();
}
+ public interface OnItemClickListener {
+ void onItemClick(View view, int position);
+ }
+
public class viewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
- @InjectView(R.id.image_view)
+
+ @BindView(R.id.image_view)
ImageView imageView;
- @InjectView(R.id.date)
+
+ @BindView(R.id.date)
TextView date;
- @InjectView(R.id.remark)
+
+ @BindView(R.id.remark)
TextView remark;
- @InjectView(R.id.money)
+
+ @BindView(R.id.money)
TextView money;
- @InjectView(R.id.index)
+
+ @BindView(R.id.index)
TextView index;
- @InjectView(R.id.material_ripple_layout)
+
+ @BindView(R.id.material_ripple_layout)
MaterialRippleLayout layout;
viewHolder(View view) {
super(view);
- ButterKnife.inject(this, view);
+ ButterKnife.bind(this, view);
}
@Override
@@ -106,8 +115,4 @@ public void onClick(View v) {
// onItemClickListener.onItemClick(v, getPosition());
}
}
-
- public interface OnItemClickListener {
- void onItemClick(View view , int position);
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/nightonke/saver/adapter/RecordExpandableSwipeableItemAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/RecordExpandableSwipeableItemAdapter.java
index eafc521..66dadf1 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/RecordExpandableSwipeableItemAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/RecordExpandableSwipeableItemAdapter.java
@@ -4,8 +4,9 @@
* Created by 伟平 on 2015/11/12.
*/
-import android.support.v4.view.ViewCompat;
-import android.support.v7.widget.RecyclerView;
+import androidx.core.view.ViewCompat;
+import androidx.recyclerview.widget.RecyclerView;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/ReportViewFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/ReportViewFragmentAdapter.java
index 490e39f..45ace80 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/ReportViewFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/ReportViewFragmentAdapter.java
@@ -1,9 +1,9 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
-import com.nightonke.saver.fragment.CustomViewFragment;
import com.nightonke.saver.fragment.ReportViewFragment;
/**
@@ -14,7 +14,7 @@
public class ReportViewFragmentAdapter extends FragmentStatePagerAdapter {
- public ReportViewFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public ReportViewFragmentAdapter(FragmentManager fm) {
super(fm);
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TagChooseFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TagChooseFragmentAdapter.java
index ef80118..0c97d5c 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TagChooseFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TagChooseFragmentAdapter.java
@@ -1,8 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
import com.nightonke.saver.fragment.TagChooseFragment;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TagDraggableItemAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TagDraggableItemAdapter.java
index 8c078c6..36c6813 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TagDraggableItemAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TagDraggableItemAdapter.java
@@ -1,6 +1,7 @@
package com.nightonke.saver.adapter;
-import android.support.v7.widget.RecyclerView;
+import androidx.recyclerview.widget.RecyclerView;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TagViewFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TagViewFragmentAdapter.java
index cc66d62..76279f0 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TagViewFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TagViewFragmentAdapter.java
@@ -1,7 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.nightonke.saver.activity.CoCoinApplication;
import com.nightonke.saver.fragment.TagViewFragment;
@@ -13,7 +14,7 @@
*/
public class TagViewFragmentAdapter extends FragmentStatePagerAdapter {
- public TagViewFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public TagViewFragmentAdapter(FragmentManager fm) {
super(fm);
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TagViewRecyclerViewAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TagViewRecyclerViewAdapter.java
index c45c334..4c02024 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TagViewRecyclerViewAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TagViewRecyclerViewAdapter.java
@@ -2,8 +2,6 @@
import android.content.Context;
import android.graphics.Color;
-import android.support.v4.app.FragmentActivity;
-import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
@@ -12,7 +10,6 @@
import com.nightonke.saver.R;
import com.nightonke.saver.fragment.RecordCheckDialogFragment;
-import com.nightonke.saver.model.CoCoin;
import com.nightonke.saver.model.CoCoinRecord;
import com.nightonke.saver.model.RecordManager;
import com.nightonke.saver.model.SettingManager;
@@ -34,9 +31,10 @@
import java.util.Map;
import java.util.TreeMap;
+import androidx.fragment.app.FragmentActivity;
+import androidx.recyclerview.widget.RecyclerView;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
-import butterknife.Optional;
import lecho.lib.hellocharts.listener.ColumnChartOnValueSelectListener;
import lecho.lib.hellocharts.listener.PieChartOnValueSelectListener;
import lecho.lib.hellocharts.model.Axis;
@@ -275,8 +273,8 @@ public TagViewRecyclerViewAdapter.viewHolder onCreateViewHolder(
return new viewHolder(view) {
};
case SUM_HISTOGRAM:
- view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.tag_list_view_histogram_body, parent, false);
+ view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.tag_list_view_histogram_body, parent, false);
return new viewHolder(view) {
};
}
@@ -300,7 +298,7 @@ public void onBindViewHolder(final viewHolder holder, final int position) {
holder.from.setText(
mContext.getResources().getString(R.string.from) + " " +
startYear + " " + CoCoinUtil.GetMonthShort(startMonth));
- holder.sum.setText(CoCoinUtil.GetInMoney((int)Sum));
+ holder.sum.setText(CoCoinUtil.GetInMoney((int) Sum));
holder.to.setText(
mContext.getResources().getString(R.string.to) + " " +
endYear + " " + CoCoinUtil.GetMonthShort(endMonth));
@@ -326,7 +324,7 @@ public void onBindViewHolder(final viewHolder holder, final int position) {
AllTagExpanse.get(position - 1).entrySet()) {
if (entry.getValue() >= 1) {
SliceValue sliceValue = new SliceValue(
- (float)(double)entry.getValue(),
+ (float) (double) entry.getValue(),
mContext.getResources().
getColor(CoCoinUtil.GetTagColorResource(entry.getKey())));
sliceValue.setLabel(String.valueOf(entry.getKey()));
@@ -418,7 +416,7 @@ public void onClick(View v) {
new ValueTouchListener(position - 1));
holder.date.setText(year + "");
- holder.expanse.setText(CoCoinUtil.GetInMoney((int)(double)SumList.get(position - 1)));
+ holder.expanse.setText(CoCoinUtil.GetInMoney((int) (double) SumList.get(position - 1)));
}
if (type.get(position - 1).equals(SHOW_IN_MONTH)) {
Calendar tempCal = new GregorianCalendar(year, month - 1, 1);
@@ -458,7 +456,7 @@ public void onClick(View v) {
holder.chart.setOnValueTouchListener(new ValueTouchListener(position - 1));
holder.date.setText(year + " " + CoCoinUtil.GetMonthShort(month));
- holder.expanse.setText(CoCoinUtil.GetInMoney((int)(double)SumList.get(position - 1)));
+ holder.expanse.setText(CoCoinUtil.GetInMoney((int) (double) SumList.get(position - 1)));
}
holder.iconRight.setOnClickListener(new View.OnClickListener() {
@@ -468,11 +466,11 @@ public void onClick(View v) {
SelectedPosition[position]
= (SelectedPosition[position] + 1) % columns.size();
} while (holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().size() == 0 ||
- holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().get(0).getValue() == 0);
+ .get(SelectedPosition[position])
+ .getValues().size() == 0 ||
+ holder.chart.getChartData().getColumns()
+ .get(SelectedPosition[position])
+ .getValues().get(0).getValue() == 0);
SelectedValue selectedValue =
new SelectedValue(
SelectedPosition[position],
@@ -490,11 +488,11 @@ public void onClick(View v) {
= (SelectedPosition[position] - 1 + columns.size())
% columns.size();
} while (holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().size() == 0 ||
- holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().get(0).getValue() == 0);
+ .get(SelectedPosition[position])
+ .getValues().size() == 0 ||
+ holder.chart.getChartData().getColumns()
+ .get(SelectedPosition[position])
+ .getValues().get(0).getValue() == 0);
SelectedValue selectedValue =
new SelectedValue(
SelectedPosition[position],
@@ -542,7 +540,7 @@ public void onClick(View v) {
new ValueTouchListener(position - 1));
holder.date.setText(year + "");
- holder.expanse.setText(CoCoinUtil.GetInMoney((int)(double)SumList.get(position - 1)));
+ holder.expanse.setText(CoCoinUtil.GetInMoney((int) (double) SumList.get(position - 1)));
}
if (type.get(position - 1).equals(SHOW_IN_MONTH)) {
@@ -591,7 +589,7 @@ public void onClick(View v) {
holder.chart.setOnValueTouchListener(new ValueTouchListener(position - 1));
holder.date.setText(year + " " + CoCoinUtil.GetMonthShort(month));
- holder.expanse.setText(CoCoinUtil.GetInMoney((int)(double)SumList.get(position - 1)));
+ holder.expanse.setText(CoCoinUtil.GetInMoney((int) (double) SumList.get(position - 1)));
}
holder.iconRight.setOnClickListener(new View.OnClickListener() {
@@ -601,11 +599,11 @@ public void onClick(View v) {
SelectedPosition[position]
= (SelectedPosition[position] + 1) % columns.size();
} while (holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().size() == 0 ||
- holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().get(0).getValue() == 0);
+ .get(SelectedPosition[position])
+ .getValues().size() == 0 ||
+ holder.chart.getChartData().getColumns()
+ .get(SelectedPosition[position])
+ .getValues().get(0).getValue() == 0);
SelectedValue selectedValue =
new SelectedValue(
SelectedPosition[position],
@@ -624,10 +622,10 @@ public void onClick(View v) {
% columns.size();
} while (holder.chart.getChartData().getColumns()
.get(SelectedPosition[position])
- .getValues().size() == 0 ||
+ .getValues().size() == 0 ||
holder.chart.getChartData().getColumns()
- .get(SelectedPosition[position])
- .getValues().get(0).getValue() == 0);
+ .get(SelectedPosition[position])
+ .getValues().get(0).getValue() == 0);
SelectedValue selectedValue =
new SelectedValue(
SelectedPosition[position],
@@ -643,37 +641,37 @@ public void onClick(View v) {
}
public static class viewHolder extends RecyclerView.ViewHolder {
- @Optional
- @InjectView(R.id.from)
+
+ @BindView(R.id.from)
TextView from;
- @Optional
- @InjectView(R.id.sum)
+
+ @BindView(R.id.sum)
TextView sum;
- @Optional
- @InjectView(R.id.to)
+
+ @BindView(R.id.to)
TextView to;
- @Optional
- @InjectView(R.id.chart_pie)
+
+ @BindView(R.id.chart_pie)
PieChartView pie;
- @Optional
- @InjectView(R.id.chart)
+
+ @BindView(R.id.chart)
ColumnChartView chart;
- @Optional
- @InjectView(R.id.date)
+
+ @BindView(R.id.date)
TextView date;
- @Optional
- @InjectView(R.id.expanse)
+
+ @BindView(R.id.expanse)
TextView expanse;
- @Optional
- @InjectView(R.id.icon_left)
+
+ @BindView(R.id.icon_left)
MaterialIconView iconLeft;
- @Optional
- @InjectView(R.id.icon_right)
+
+ @BindView(R.id.icon_right)
MaterialIconView iconRight;
viewHolder(View view) {
super(view);
- ButterKnife.inject(this, view);
+ ButterKnife.bind(this, view);
}
}
@@ -734,7 +732,7 @@ public void onActionClicked(Snackbar snackbar) {
}
}
}
- ((FragmentActivity)mContext).getSupportFragmentManager()
+ ((FragmentActivity) mContext).getSupportFragmentManager()
.beginTransaction()
.add(new RecordCheckDialogFragment(
mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
@@ -776,7 +774,7 @@ public void onActionClicked(Snackbar snackbar) {
}
}
}
- ((FragmentActivity)mContext).getSupportFragmentManager()
+ ((FragmentActivity) mContext).getSupportFragmentManager()
.beginTransaction()
.add(new RecordCheckDialogFragment(
mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
@@ -826,7 +824,7 @@ public void onActionClicked(Snackbar snackbar) {
}
}
}
- ((FragmentActivity)mContext).getSupportFragmentManager()
+ ((FragmentActivity) mContext).getSupportFragmentManager()
.beginTransaction()
.add(new RecordCheckDialogFragment(
mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
@@ -872,7 +870,7 @@ public void onActionClicked(Snackbar snackbar) {
}
}
}
- ((FragmentActivity)mContext).getSupportFragmentManager()
+ ((FragmentActivity) mContext).getSupportFragmentManager()
.beginTransaction()
.add(new RecordCheckDialogFragment(
mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
@@ -917,9 +915,9 @@ public void onValueSelected(int i, SliceValue sliceValue) {
text = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) +
CoCoinUtil.GetPercentString(percent) + "\n" +
"于" + CoCoinUtil.GetTagName(tagId);
- dialogTitle = mContext.getResources().getString(R.string.in) + timeString +
- CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + "\n" +
- "于" + CoCoinUtil.GetTagName(tagId);
+ dialogTitle = mContext.getResources().getString(R.string.in) + timeString +
+ CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + "\n" +
+ "于" + CoCoinUtil.GetTagName(tagId);
} else {
text = CoCoinUtil.GetSpendString((int) sliceValue.getValue()) +
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TodayViewFragmentAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TodayViewFragmentAdapter.java
index 02caafc..d9b7f06 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TodayViewFragmentAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TodayViewFragmentAdapter.java
@@ -1,7 +1,8 @@
package com.nightonke.saver.adapter;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.nightonke.saver.fragment.TodayViewFragment;
import com.nightonke.saver.util.CoCoinUtil;
@@ -14,7 +15,7 @@ public class TodayViewFragmentAdapter extends FragmentStatePagerAdapter {
private static int TODAY_VIEW_FRAGMENT_NUMBER = 8;
- public TodayViewFragmentAdapter(android.support.v4.app.FragmentManager fm) {
+ public TodayViewFragmentAdapter(FragmentManager fm) {
super(fm);
}
diff --git a/app/src/main/java/com/nightonke/saver/adapter/TodayViewRecyclerViewAdapter.java b/app/src/main/java/com/nightonke/saver/adapter/TodayViewRecyclerViewAdapter.java
index d5e5f37..f8f1e20 100644
--- a/app/src/main/java/com/nightonke/saver/adapter/TodayViewRecyclerViewAdapter.java
+++ b/app/src/main/java/com/nightonke/saver/adapter/TodayViewRecyclerViewAdapter.java
@@ -2,8 +2,6 @@
import android.content.Context;
import android.graphics.Color;
-import android.support.v4.app.FragmentActivity;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -32,9 +30,11 @@
import java.util.Map;
import java.util.TreeMap;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.FragmentActivity;
+import androidx.recyclerview.widget.RecyclerView;
+import butterknife.BindView;
import butterknife.ButterKnife;
-import butterknife.InjectView;
-import butterknife.Optional;
import lecho.lib.hellocharts.listener.ColumnChartOnValueSelectListener;
import lecho.lib.hellocharts.listener.PieChartOnValueSelectListener;
import lecho.lib.hellocharts.model.Axis;
@@ -55,13 +55,8 @@
public class TodayViewRecyclerViewAdapter
extends RecyclerView.Adapter {
- private OnItemClickListener onItemClickListener;
-
- private Context mContext;
-
static final int TYPE_HEADER = 0;
static final int TYPE_BODY = 1;
-
static final int TODAY = 0;
static final int YESTERDAY = 1;
static final int THIS_WEEK = 2;
@@ -70,7 +65,8 @@ public class TodayViewRecyclerViewAdapter
static final int LAST_MONTH = 5;
static final int THIS_YEAR = 6;
static final int LAST_YEAR = 7;
-
+ private OnItemClickListener onItemClickListener;
+ private Context mContext;
private int fragmentPosition;
// the data of this fragment
@@ -172,7 +168,7 @@ public TodayViewRecyclerViewAdapter(int start, int end, Context context, int pos
originalTargets[coCoinRecord.getCalendar().get(axis_date) - 1]
+= coCoinRecord.getMoney();
else originalTargets[(coCoinRecord.getCalendar().get(axis_date) + 5) % 7]
- += coCoinRecord.getMoney();
+ += coCoinRecord.getMoney();
} else if (axis_date == Calendar.DAY_OF_MONTH) {
originalTargets[coCoinRecord.getCalendar().get(axis_date) - 1]
+= coCoinRecord.getMoney();
@@ -262,7 +258,7 @@ public void onBindViewHolder(final viewHolder holder, final int position) {
for (Map.Entry entry : TagExpanse.entrySet()) {
if (entry.getValue() >= 1) {
SliceValue sliceValue = new SliceValue(
- (float)(double)entry.getValue(),
+ (float) (double) entry.getValue(),
mContext.getApplicationContext().getResources().
getColor(CoCoinUtil.GetTagColorResource(entry.getKey())));
sliceValue.setLabel(String.valueOf(entry.getKey()));
@@ -420,7 +416,7 @@ public void onValueSelected(int p, SliceValue sliceValue) {
CoCoinUtil.GetPercentString(percent) + "\n" +
"于" + CoCoinUtil.GetTagName(tagId);
} else {
- text = "Spend " + (int)sliceValue.getValue()
+ text = "Spend " + (int) sliceValue.getValue()
+ " (takes " + String.format("%.2f", percent) + "%)\n"
+ "in " + CoCoinUtil.GetTagName(tagId);
}
@@ -429,7 +425,7 @@ public void onValueSelected(int p, SliceValue sliceValue) {
CoCoinUtil.GetSpendString((int) sliceValue.getValue()) + "\n" +
"于" + CoCoinUtil.GetTagName(tagId);
} else {
- dialogTitle = "Spend " + (int)sliceValue.getValue()
+ dialogTitle = "Spend " + (int) sliceValue.getValue()
+ dateShownString + "\n" +
"in " + CoCoinUtil.GetTagName(tagId);
}
@@ -506,58 +502,58 @@ public void onValueDeselected() {
// set value touch listener of histogram////////////////////////////////////////////////////////////
holder.histogram.setOnValueTouchListener(
new ColumnChartOnValueSelectListener() {
- @Override
- public void onValueSelected(int columnIndex,
- int subcolumnIndex, SubcolumnValue value) {
- lastHistogramSelectedPosition = columnIndex;
- timeIndex = columnIndex;
- // snack bar
- RecordManager recordManager
- = RecordManager.getInstance(mContext.getApplicationContext());
-
- String text = CoCoinUtil.GetSpendString((int) value.getValue());
- if (tagId != -1)
- // belongs a tag
- if ("zh".equals(CoCoinUtil.GetLanguage()))
- text = getSnackBarDateString() + text + "\n" +
- "于" + CoCoinUtil.GetTagName(tagId);
- else
- text += getSnackBarDateString() + "\n"
- + "in " + CoCoinUtil.GetTagName(tagId);
- else
- // don't belong to any tag
- if ("zh".equals(CoCoinUtil.GetLanguage()))
- text = getSnackBarDateString() + "\n" + text;
- else
- text += "\n" + getSnackBarDateString();
+ @Override
+ public void onValueSelected(int columnIndex,
+ int subcolumnIndex, SubcolumnValue value) {
+ lastHistogramSelectedPosition = columnIndex;
+ timeIndex = columnIndex;
+ // snack bar
+ RecordManager recordManager
+ = RecordManager.getInstance(mContext.getApplicationContext());
+
+ String text = CoCoinUtil.GetSpendString((int) value.getValue());
+ if (tagId != -1)
+ // belongs a tag
+ if ("zh".equals(CoCoinUtil.GetLanguage()))
+ text = getSnackBarDateString() + text + "\n" +
+ "于" + CoCoinUtil.GetTagName(tagId);
+ else
+ text += getSnackBarDateString() + "\n"
+ + "in " + CoCoinUtil.GetTagName(tagId);
+ else
+ // don't belong to any tag
+ if ("zh".equals(CoCoinUtil.GetLanguage()))
+ text = getSnackBarDateString() + "\n" + text;
+ else
+ text += "\n" + getSnackBarDateString();
// setting the snack bar and dialog title of histogram//////////////////////////////////////////////
- dialogTitle = text;
- Snackbar snackbar =
- Snackbar
- .with(mContext)
- .type(SnackbarType.MULTI_LINE)
- .duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
- .position(Snackbar.SnackbarPosition.BOTTOM)
- .margin(15, 15)
- .backgroundDrawable(CoCoinUtil.GetSnackBarBackground(
- fragmentPosition - 2))
- .text(text)
- .textTypeface(CoCoinUtil.GetTypeface())
- .textColor(Color.WHITE)
- .actionLabelTypeface(CoCoinUtil.GetTypeface())
- .actionLabel(mContext.getResources()
- .getString(R.string.check))
- .actionColor(Color.WHITE)
- .actionListener(new mActionClickListenerForHistogram());
- SnackbarManager.show(snackbar);
- }
+ dialogTitle = text;
+ Snackbar snackbar =
+ Snackbar
+ .with(mContext)
+ .type(SnackbarType.MULTI_LINE)
+ .duration(Snackbar.SnackbarDuration.LENGTH_SHORT)
+ .position(Snackbar.SnackbarPosition.BOTTOM)
+ .margin(15, 15)
+ .backgroundDrawable(CoCoinUtil.GetSnackBarBackground(
+ fragmentPosition - 2))
+ .text(text)
+ .textTypeface(CoCoinUtil.GetTypeface())
+ .textColor(Color.WHITE)
+ .actionLabelTypeface(CoCoinUtil.GetTypeface())
+ .actionLabel(mContext.getResources()
+ .getString(R.string.check))
+ .actionColor(Color.WHITE)
+ .actionListener(new mActionClickListenerForHistogram());
+ SnackbarManager.show(snackbar);
+ }
- @Override
- public void onValueDeselected() {
+ @Override
+ public void onValueDeselected() {
- }
- });
+ }
+ });
}
// set the listener of the reset button/////////////////////////////////////////////////////////////
@@ -586,7 +582,7 @@ public void onClick(View v) {
holder.all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- ((FragmentActivity)mContext).getSupportFragmentManager()
+ ((FragmentActivity) mContext).getSupportFragmentManager()
.beginTransaction()
.add(new RecordCheckDialogFragment(
mContext, allData, getAllDataDialogTitle()), "MyDialog")
@@ -617,10 +613,10 @@ public void onClick(View v) {
double spend = allData.get(position - 1).getMoney();
int tagId = allData.get(position - 1).getTag();
if ("zh".equals(CoCoinUtil.GetLanguage())) {
- subTitle = CoCoinUtil.GetSpendString((int)spend) +
+ subTitle = CoCoinUtil.GetSpendString((int) spend) +
"于" + CoCoinUtil.GetTagName(tagId);
} else {
- subTitle = "Spend " + (int)spend +
+ subTitle = "Spend " + (int) spend +
"in " + CoCoinUtil.GetTagName(tagId);
}
dialog = new MaterialDialog.Builder(mContext)
@@ -631,8 +627,8 @@ public void onClick(View v) {
.positiveText(R.string.get)
.show();
dialogView = dialog.getCustomView();
- TextView remark = (TextView)dialogView.findViewById(R.id.remark);
- TextView date = (TextView)dialogView.findViewById(R.id.date);
+ TextView remark = (TextView) dialogView.findViewById(R.id.remark);
+ TextView date = (TextView) dialogView.findViewById(R.id.date);
remark.setText(allData.get(position - 1).getRemark());
date.setText(allData.get(position - 1).getCalendarString());
}
@@ -642,117 +638,7 @@ public void onClick(View v) {
}
}
-// view holder class////////////////////////////////////////////////////////////////////////////////
- public static class viewHolder extends RecyclerView.ViewHolder {
- @Optional
- @InjectView(R.id.date)
- TextView date;
- @Optional
- @InjectView(R.id.date_bottom)
- TextView dateBottom;
- @Optional
- @InjectView(R.id.expanse)
- TextView expanseSum;
- @Optional
- @InjectView(R.id.empty_tip)
- TextView emptyTip;
- @Optional
- @InjectView(R.id.chart_pie)
- PieChartView pie;
- @Optional
- @InjectView(R.id.histogram)
- ColumnChartView histogram;
- @Optional
- @InjectView(R.id.icon_left)
- MaterialIconView iconLeft;
- @Optional
- @InjectView(R.id.icon_right)
- MaterialIconView iconRight;
- @Optional
- @InjectView(R.id.histogram_icon_left)
- MaterialIconView histogram_icon_left;
- @Optional
- @InjectView(R.id.histogram_icon_right)
- MaterialIconView histogram_icon_right;
- @Optional
- @InjectView(R.id.icon_reset)
- MaterialIconView reset;
- @Optional
- @InjectView(R.id.all)
- MaterialIconView all;
- @Optional
- @InjectView(R.id.tag_image)
- ImageView tagImage;
- @Optional
- @InjectView(R.id.money)
- TextView money;
- @Optional
- @InjectView(R.id.cell_date)
- TextView cell_date;
- @Optional
- @InjectView(R.id.remark)
- TextView remark;
- @Optional
- @InjectView(R.id.index)
- TextView index;
- @Optional
- @InjectView(R.id.material_ripple_layout)
- MaterialRippleLayout layout;
-
- viewHolder(View view) {
- super(view);
- ButterKnife.inject(this, view);
- }
- }
-
- public interface OnItemClickListener {
- void onItemClick(View view , int position);
- }
-
-// set the listener of the check button on the snack bar of pie/////////////////////////////////////
- private class mActionClickListenerForPie implements ActionClickListener {
- @Override
- public void onActionClicked(Snackbar snackbar) {
- List shownCoCoinRecords = Expanse.get(tagId);
- ((FragmentActivity)mContext).getSupportFragmentManager()
- .beginTransaction()
- .add(new RecordCheckDialogFragment(
- mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
- .commit();
- }
- }
-
-// set the listener of the check button on the snack bar of histogram///////////////////////////////
- private class mActionClickListenerForHistogram implements ActionClickListener {
- @Override
- public void onActionClicked(Snackbar snackbar) {
- ArrayList shownCoCoinRecords = new ArrayList<>();
- int index = timeIndex;
- if (axis_date == Calendar.DAY_OF_WEEK) {
- if (CoCoinUtil.WEEK_START_WITH_SUNDAY) index++;
- else
- if (index == 6) index = 1;
- else index += 2;
- }
- if (fragmentPosition == THIS_MONTH || fragmentPosition == LAST_MONTH) index++;
- if (tagId != -1) {
- for (int i = 0; i < Expanse.get(tagId).size(); i++)
- if (Expanse.get(tagId).get(i).getCalendar().get(axis_date) == index)
- shownCoCoinRecords.add(Expanse.get(tagId).get(i));
- } else {
- for (int i = 0; i < allData.size(); i++)
- if (allData.get(i).getCalendar().get(axis_date) == index)
- shownCoCoinRecords.add(allData.get(i));
- }
- ((FragmentActivity)mContext).getSupportFragmentManager()
- .beginTransaction()
- .add(new RecordCheckDialogFragment(
- mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
- .commit();
- }
- }
-
-// set the dateString shown in snack bar in this fragment///////////////////////////////////////////
+ // set the dateString shown in snack bar in this fragment///////////////////////////////////////////
private String getSnackBarDateString() {
switch (fragmentPosition) {
case TODAY:
@@ -831,7 +717,7 @@ private String getSnackBarDateString() {
}
}
-// set the dateString of this fragment//////////////////////////////////////////////////////////////
+ // set the dateString of this fragment//////////////////////////////////////////////////////////////
private void setDateString() {
String basicTodayDateString;
String basicYesterdayDateString;
@@ -917,9 +803,9 @@ private String getAllDataDialogTitle() {
String postfix;
if ("zh".equals(CoCoinUtil.GetLanguage())) {
prefix = mContext.getResources().getString(R.string.on);
- postfix = CoCoinUtil.GetSpendString((int)Sum);
+ postfix = CoCoinUtil.GetSpendString((int) Sum);
} else {
- prefix = CoCoinUtil.GetSpendString((int)Sum);
+ prefix = CoCoinUtil.GetSpendString((int) Sum);
postfix = "";
}
switch (fragmentPosition) {
@@ -952,4 +838,113 @@ private String getAllDataDialogTitle() {
}
}
+ public interface OnItemClickListener {
+ void onItemClick(View view, int position);
+ }
+
+ // view holder class////////////////////////////////////////////////////////////////////////////////
+ public static class viewHolder extends RecyclerView.ViewHolder {
+ @Nullable
+ @BindView(R.id.date)
+ TextView date;
+ @Nullable
+ @BindView(R.id.date_bottom)
+ TextView dateBottom;
+ @Nullable
+ @BindView(R.id.expanse)
+ TextView expanseSum;
+ @Nullable
+ @BindView(R.id.empty_tip)
+ TextView emptyTip;
+ @Nullable
+ @BindView(R.id.chart_pie)
+ PieChartView pie;
+ @Nullable
+ @BindView(R.id.histogram)
+ ColumnChartView histogram;
+ @Nullable
+ @BindView(R.id.icon_left)
+ MaterialIconView iconLeft;
+ @Nullable
+ @BindView(R.id.icon_right)
+ MaterialIconView iconRight;
+ @Nullable
+ @BindView(R.id.histogram_icon_left)
+ MaterialIconView histogram_icon_left;
+ @Nullable
+ @BindView(R.id.histogram_icon_right)
+ MaterialIconView histogram_icon_right;
+ @Nullable
+ @BindView(R.id.icon_reset)
+ MaterialIconView reset;
+ @Nullable
+ @BindView(R.id.all)
+ MaterialIconView all;
+ @Nullable
+ @BindView(R.id.tag_image)
+ ImageView tagImage;
+ @Nullable
+ @BindView(R.id.money)
+ TextView money;
+ @Nullable
+ @BindView(R.id.cell_date)
+ TextView cell_date;
+ @Nullable
+ @BindView(R.id.remark)
+ TextView remark;
+ @Nullable
+ @BindView(R.id.index)
+ TextView index;
+ @Nullable
+ @BindView(R.id.material_ripple_layout)
+ MaterialRippleLayout layout;
+
+ viewHolder(View view) {
+ super(view);
+ ButterKnife.bind(this, view);
+ }
+ }
+
+ // set the listener of the check button on the snack bar of pie/////////////////////////////////////
+ private class mActionClickListenerForPie implements ActionClickListener {
+ @Override
+ public void onActionClicked(Snackbar snackbar) {
+ List shownCoCoinRecords = Expanse.get(tagId);
+ ((FragmentActivity) mContext).getSupportFragmentManager()
+ .beginTransaction()
+ .add(new RecordCheckDialogFragment(
+ mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
+ .commit();
+ }
+ }
+
+ // set the listener of the check button on the snack bar of histogram///////////////////////////////
+ private class mActionClickListenerForHistogram implements ActionClickListener {
+ @Override
+ public void onActionClicked(Snackbar snackbar) {
+ ArrayList shownCoCoinRecords = new ArrayList<>();
+ int index = timeIndex;
+ if (axis_date == Calendar.DAY_OF_WEEK) {
+ if (CoCoinUtil.WEEK_START_WITH_SUNDAY) index++;
+ else if (index == 6) index = 1;
+ else index += 2;
+ }
+ if (fragmentPosition == THIS_MONTH || fragmentPosition == LAST_MONTH) index++;
+ if (tagId != -1) {
+ for (int i = 0; i < Expanse.get(tagId).size(); i++)
+ if (Expanse.get(tagId).get(i).getCalendar().get(axis_date) == index)
+ shownCoCoinRecords.add(Expanse.get(tagId).get(i));
+ } else {
+ for (int i = 0; i < allData.size(); i++)
+ if (allData.get(i).getCalendar().get(axis_date) == index)
+ shownCoCoinRecords.add(allData.get(i));
+ }
+ ((FragmentActivity) mContext).getSupportFragmentManager()
+ .beginTransaction()
+ .add(new RecordCheckDialogFragment(
+ mContext, shownCoCoinRecords, dialogTitle), "MyDialog")
+ .commit();
+ }
+ }
+
}
diff --git a/app/src/main/java/com/nightonke/saver/fragment/CustomViewFragment.java b/app/src/main/java/com/nightonke/saver/fragment/CustomViewFragment.java
index 83921d1..5757819 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/CustomViewFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/CustomViewFragment.java
@@ -4,9 +4,9 @@
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/EditMoneyFragment.java b/app/src/main/java/com/nightonke/saver/fragment/EditMoneyFragment.java
index d09151c..7e5cfa0 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/EditMoneyFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/EditMoneyFragment.java
@@ -3,10 +3,9 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/EditRecordFragment.java b/app/src/main/java/com/nightonke/saver/fragment/EditRecordFragment.java
index df8c3da..51a6c9d 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/EditRecordFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/EditRecordFragment.java
@@ -3,8 +3,8 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/EditRemarkFragment.java b/app/src/main/java/com/nightonke/saver/fragment/EditRemarkFragment.java
index 4c5a756..e1f5a96 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/EditRemarkFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/EditRemarkFragment.java
@@ -3,8 +3,8 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/HelpAboutFragment.java b/app/src/main/java/com/nightonke/saver/fragment/HelpAboutFragment.java
index 9b61602..fcd02bf 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/HelpAboutFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/HelpAboutFragment.java
@@ -5,8 +5,8 @@
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/HelpCoCoinFragment.java b/app/src/main/java/com/nightonke/saver/fragment/HelpCoCoinFragment.java
index 30cdabc..2dc2f47 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/HelpCoCoinFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/HelpCoCoinFragment.java
@@ -3,8 +3,8 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/HelpFeedbackFragment.java b/app/src/main/java/com/nightonke/saver/fragment/HelpFeedbackFragment.java
index b70d1cc..b4a7493 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/HelpFeedbackFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/HelpFeedbackFragment.java
@@ -3,15 +3,11 @@
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
@@ -23,6 +19,9 @@
import com.nightonke.saver.model.Feedback;
import com.nightonke.saver.util.CoCoinUtil;
+import androidx.annotation.Nullable;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
import cn.bmob.v3.listener.SaveListener;
/**
@@ -42,21 +41,20 @@ public class HelpFeedbackFragment extends Fragment {
private boolean exceed = false;
private ObservableScrollView mScrollView;
+ private Activity activity;
+ private Context mContext;
public static HelpFeedbackFragment newInstance() {
HelpFeedbackFragment fragment = new HelpFeedbackFragment();
return fragment;
}
- private Activity activity;
- private Context mContext;
-
@Override
public void onAttach(Context context) {
super.onAttach(context);
- if (context instanceof Activity){
- activity = (Activity)context;
+ if (context instanceof Activity) {
+ activity = (Activity) context;
}
}
@@ -78,15 +76,15 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mScrollView = (ObservableScrollView) view.findViewById(R.id.scrollView);
MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView, null);
- title = (TextView)view.findViewById(R.id.title);
+ title = (TextView) view.findViewById(R.id.title);
title.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- input = (EditText)view.findViewById(R.id.edittext);
+ input = (EditText) view.findViewById(R.id.edittext);
input.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- help = (TextView)view.findViewById(R.id.helper);
+ help = (TextView) view.findViewById(R.id.helper);
help.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- number = (TextView)view.findViewById(R.id.number);
+ number = (TextView) view.findViewById(R.id.number);
number.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
- send = (TextView)view.findViewById(R.id.send);
+ send = (TextView) view.findViewById(R.id.send);
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -125,9 +123,9 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
public void onTextChanged(CharSequence s, int start, int before, int count) {
setNumberText();
try {
- ((OnTextChangeListener)activity)
+ ((OnTextChangeListener) activity)
.onTextChange(input.getText().toString(), exceed);
- } catch (ClassCastException cce){
+ } catch (ClassCastException cce) {
cce.printStackTrace();
}
}
@@ -148,7 +146,7 @@ private void setNumberText() {
if (chineseIsDoubleCount) {
count = CoCoinUtil.getInstance().textCounter(input.getText().toString());
} else {
- count =input.getText().toString().length();
+ count = input.getText().toString().length();
}
number.setText(count + "/" + min + "-" + max);
if (min <= count && count <= max) {
diff --git a/app/src/main/java/com/nightonke/saver/fragment/MonthViewFragment.java b/app/src/main/java/com/nightonke/saver/fragment/MonthViewFragment.java
index 4c2bbf4..a00188e 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/MonthViewFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/MonthViewFragment.java
@@ -2,10 +2,6 @@
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -24,6 +20,11 @@
import java.util.Calendar;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* Created by 伟平 on 2015/10/20.
*/
diff --git a/app/src/main/java/com/nightonke/saver/fragment/PasswordChangeFragment.java b/app/src/main/java/com/nightonke/saver/fragment/PasswordChangeFragment.java
index 55680fe..23dde6c 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/PasswordChangeFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/PasswordChangeFragment.java
@@ -1,14 +1,13 @@
package com.nightonke.saver.fragment;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
+
import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.nightonke.saver.R;
@@ -17,6 +16,9 @@
import com.nightonke.saver.util.CoCoinUtil;
import com.rey.material.widget.RadioButton;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
/**
* Created by 伟平 on 2015/10/27.
@@ -48,14 +50,14 @@ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
View view = inflater.inflate(R.layout.password_state_fragment, container, false);
fragmentPosition = getArguments().getInt("position");
- CoCoinFragmentManager.passwordChangeFragment[fragmentPosition] = this ;
-
- button0 = (RadioButton)view.findViewById(R.id.button0);
- button1 = (RadioButton)view.findViewById(R.id.button1);
- button2 = (RadioButton)view.findViewById(R.id.button2);
- button3 = (RadioButton)view.findViewById(R.id.button3);
- ly = (LinearLayout)view.findViewById(R.id.buttonLy);
- passwordTip = (TextView)view.findViewById(R.id.password_tip);
+ CoCoinFragmentManager.passwordChangeFragment[fragmentPosition] = this;
+
+ button0 = (RadioButton) view.findViewById(R.id.button0);
+ button1 = (RadioButton) view.findViewById(R.id.button1);
+ button2 = (RadioButton) view.findViewById(R.id.button2);
+ button3 = (RadioButton) view.findViewById(R.id.button3);
+ ly = (LinearLayout) view.findViewById(R.id.buttonLy);
+ passwordTip = (TextView) view.findViewById(R.id.password_tip);
passwordTip.setTypeface(CoCoinUtil.GetTypeface());
switch (fragmentPosition) {
case 0:
diff --git a/app/src/main/java/com/nightonke/saver/fragment/RecordCheckDialogFragment.java b/app/src/main/java/com/nightonke/saver/fragment/RecordCheckDialogFragment.java
index a35acab..577e405 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/RecordCheckDialogFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/RecordCheckDialogFragment.java
@@ -5,14 +5,9 @@
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.app.DialogFragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
@@ -22,10 +17,13 @@
import com.nightonke.saver.model.CoCoinRecord;
import com.nightonke.saver.util.CoCoinUtil;
-import org.w3c.dom.Text;
-
import java.util.List;
+import androidx.annotation.NonNull;
+import androidx.fragment.app.DialogFragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* Created by 伟平 on 2015/10/31.
*/
@@ -35,6 +33,8 @@ public class RecordCheckDialogFragment extends DialogFragment implements RecordC
private List list;
private Context mContext;
private String title;
+ private MaterialDialog dialog;
+ private View dialogView;
public RecordCheckDialogFragment(Context context, List list, String title) {
this.list = list;
@@ -65,10 +65,10 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
builder.setView(view);
builder.setPositiveButton(mContext.getResources().getString(R.string.get),
new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- });
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ });
final AlertDialog alert = builder.create();
@@ -100,18 +100,16 @@ public void onDismiss(DialogInterface dialog) {
title = null;
}
- private MaterialDialog dialog;
- private View dialogView;
@Override
public void onItemClick(View view, int position) {
String subTitle;
double spend = list.get(position).getMoney();
int tagId = list.get(position).getTag();
if ("zh".equals(CoCoinUtil.GetLanguage())) {
- subTitle = CoCoinUtil.GetSpendString((int)spend) +
+ subTitle = CoCoinUtil.GetSpendString((int) spend) +
"于" + CoCoinUtil.GetTagName(tagId);
} else {
- subTitle = "Spend " + (int)spend +
+ subTitle = "Spend " + (int) spend +
"in " + CoCoinUtil.GetTagName(tagId);
}
dialog = new MaterialDialog.Builder(mContext)
@@ -122,8 +120,8 @@ public void onItemClick(View view, int position) {
.positiveText(R.string.get)
.show();
dialogView = dialog.getCustomView();
- TextView remark = (TextView)dialogView.findViewById(R.id.remark);
- TextView date = (TextView)dialogView.findViewById(R.id.date);
+ TextView remark = (TextView) dialogView.findViewById(R.id.remark);
+ TextView date = (TextView) dialogView.findViewById(R.id.date);
remark.setText(list.get(position).getRemark());
date.setText(CoCoinUtil.GetCalendarStringRecordCheckDialog(mContext, list.get(position).getCalendar()));
}
diff --git a/app/src/main/java/com/nightonke/saver/fragment/ReportViewFragment.java b/app/src/main/java/com/nightonke/saver/fragment/ReportViewFragment.java
index f200dd5..c111793 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/ReportViewFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/ReportViewFragment.java
@@ -5,10 +5,10 @@
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.content.ContextCompat;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+import androidx.core.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
diff --git a/app/src/main/java/com/nightonke/saver/fragment/TagChooseFragment.java b/app/src/main/java/com/nightonke/saver/fragment/TagChooseFragment.java
index 674e7e3..62bcb1d 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/TagChooseFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/TagChooseFragment.java
@@ -2,28 +2,20 @@
import android.app.Activity;
import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Color;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.util.TypedValue;
-import android.view.Gravity;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
import com.nightonke.saver.R;
import com.nightonke.saver.adapter.TagChooseGridViewAdapter;
-import com.nightonke.saver.model.CoCoin;
import com.nightonke.saver.model.RecordManager;
import com.nightonke.saver.ui.MyGridView;
-import com.nightonke.saver.util.CoCoinUtil;
/**
* Created by 伟平 on 2015/10/27.
diff --git a/app/src/main/java/com/nightonke/saver/fragment/TagViewFragment.java b/app/src/main/java/com/nightonke/saver/fragment/TagViewFragment.java
index a9e7d2b..f80070f 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/TagViewFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/TagViewFragment.java
@@ -2,10 +2,6 @@
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -22,6 +18,11 @@
import java.util.ArrayList;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* Created by 伟平 on 2015/10/20.
*/
@@ -70,7 +71,8 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
for (CoCoinRecord coCoinRecord : RecordManager.RECORDS) {
list.add(coCoinRecord);
}
- } if (position == 1) {
+ }
+ if (position == 1) {
for (CoCoinRecord coCoinRecord : RecordManager.RECORDS) {
list.add(coCoinRecord);
}
diff --git a/app/src/main/java/com/nightonke/saver/fragment/TodayViewFragment.java b/app/src/main/java/com/nightonke/saver/fragment/TodayViewFragment.java
index 0aa0140..6a9b84f 100644
--- a/app/src/main/java/com/nightonke/saver/fragment/TodayViewFragment.java
+++ b/app/src/main/java/com/nightonke/saver/fragment/TodayViewFragment.java
@@ -2,10 +2,6 @@
import android.content.Context;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -24,24 +20,17 @@
import java.util.Calendar;
import java.util.List;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* Created by 伟平 on 2015/10/20.
*/
public class TodayViewFragment extends Fragment {
- private int position;
-
- private List list = new ArrayList<>();
-
- private Context mContext;
-
- private RecyclerView mRecyclerView;
- private RecyclerViewMaterialAdapter mAdapter;
- private RecyclerView.Adapter adapter;
-
- private RecyclerView.LayoutManager layoutManager;
-
static final int TODAY = 0;
static final int YESTERDAY = 1;
static final int THIS_WEEK = 2;
@@ -50,6 +39,13 @@ public class TodayViewFragment extends Fragment {
static final int LAST_MONTH = 5;
static final int THIS_YEAR = 6;
static final int LAST_YEAR = 7;
+ private int position;
+ private List list = new ArrayList<>();
+ private Context mContext;
+ private RecyclerView mRecyclerView;
+ private RecyclerViewMaterialAdapter mAdapter;
+ private RecyclerView.Adapter adapter;
+ private RecyclerView.LayoutManager layoutManager;
public static TodayViewFragment newInstance(int position) {
TodayViewFragment fragment = new TodayViewFragment();
diff --git a/app/src/main/java/com/nightonke/saver/model/AppUpdateManager.java b/app/src/main/java/com/nightonke/saver/model/AppUpdateManager.java
index 61ac909..d6a78ad 100644
--- a/app/src/main/java/com/nightonke/saver/model/AppUpdateManager.java
+++ b/app/src/main/java/com/nightonke/saver/model/AppUpdateManager.java
@@ -7,7 +7,7 @@
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import android.widget.ProgressBar;
import com.afollestad.materialdialogs.DialogAction;
diff --git a/app/src/main/java/com/nightonke/saver/ui/CoCoinScrollableViewPager.java b/app/src/main/java/com/nightonke/saver/ui/CoCoinScrollableViewPager.java
index 39dd8fe..271ae13 100644
--- a/app/src/main/java/com/nightonke/saver/ui/CoCoinScrollableViewPager.java
+++ b/app/src/main/java/com/nightonke/saver/ui/CoCoinScrollableViewPager.java
@@ -1,9 +1,8 @@
package com.nightonke.saver.ui;
import android.content.Context;
-import android.support.v4.view.ViewPager;
+import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
-import android.view.MotionEvent;
import android.view.View;
/**
diff --git a/app/src/main/java/com/nightonke/saver/ui/CoCoinUnscrollableViewPager.java b/app/src/main/java/com/nightonke/saver/ui/CoCoinUnscrollableViewPager.java
index 09a8f15..d5241c1 100644
--- a/app/src/main/java/com/nightonke/saver/ui/CoCoinUnscrollableViewPager.java
+++ b/app/src/main/java/com/nightonke/saver/ui/CoCoinUnscrollableViewPager.java
@@ -1,7 +1,7 @@
package com.nightonke.saver.ui;
import android.content.Context;
-import android.support.v4.view.ViewPager;
+import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
diff --git a/app/src/main/java/com/nightonke/saver/ui/logoShowAnimation.java b/app/src/main/java/com/nightonke/saver/ui/logoShowAnimation.java
index 341cd5c..5866320 100644
--- a/app/src/main/java/com/nightonke/saver/ui/logoShowAnimation.java
+++ b/app/src/main/java/com/nightonke/saver/ui/logoShowAnimation.java
@@ -1,9 +1,11 @@
package com.nightonke.saver.ui;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.view.View;
import com.daimajia.androidanimations.library.BaseViewAnimator;
-import com.nineoldandroids.animation.ObjectAnimator;
+
/**
* Created by Weiping on 2016/1/21.
@@ -11,9 +13,11 @@
public class logoShowAnimation extends BaseViewAnimator {
@Override
protected void prepare(View target) {
- getAnimatorAgent().playTogether(
+ AnimatorSet animatorAgent = getAnimatorAgent();
+
+ animatorAgent.playTogether(
ObjectAnimator.ofFloat(target,"translationY",target.getMeasuredHeight(), -40,20,-10,5,0),
ObjectAnimator.ofFloat(target,"alpha",0,1,1,1)
);
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/nightonke/saver/util/CoCoinUtil.java b/app/src/main/java/com/nightonke/saver/util/CoCoinUtil.java
index a1fc0ec..88ca0ed 100644
--- a/app/src/main/java/com/nightonke/saver/util/CoCoinUtil.java
+++ b/app/src/main/java/com/nightonke/saver/util/CoCoinUtil.java
@@ -9,7 +9,7 @@
import android.graphics.Point;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
-import android.support.v4.content.ContextCompat;
+import androidx.core.content.ContextCompat;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import android.util.DisplayMetrics;
@@ -27,7 +27,8 @@
import com.nightonke.saver.db.DB;
import com.nightonke.saver.db.DBHelper;
import com.nightonke.saver.model.CoCoinRecord;
-import com.nineoldandroids.animation.ObjectAnimator;
+import android.animation.ObjectAnimator;
+
import com.rengwuxian.materialedittext.MaterialEditText;
import java.text.ParseException;
diff --git a/app/src/main/java/com/nightonke/saver/util/ViewUtil.java b/app/src/main/java/com/nightonke/saver/util/ViewUtil.java
index 0571d63..82bfe15 100644
--- a/app/src/main/java/com/nightonke/saver/util/ViewUtil.java
+++ b/app/src/main/java/com/nightonke/saver/util/ViewUtil.java
@@ -3,7 +3,7 @@
/**
* Created by 伟平 on 2015/11/13.
*/
-import android.support.v4.view.ViewCompat;
+import androidx.core.view.ViewCompat;
import android.view.View;
public class ViewUtil {
diff --git a/app/src/main/res/drawable/CoCoin_Splash_1.png b/app/src/main/res/drawable/cocoin_splash_1.png
similarity index 100%
rename from app/src/main/res/drawable/CoCoin_Splash_1.png
rename to app/src/main/res/drawable/cocoin_splash_1.png
diff --git a/app/src/main/res/drawable/CoCoin_Splash_2.png b/app/src/main/res/drawable/cocoin_splash_2.png
similarity index 100%
rename from app/src/main/res/drawable/CoCoin_Splash_2.png
rename to app/src/main/res/drawable/cocoin_splash_2.png
diff --git a/app/src/main/res/layout/account_book_fragment_recyclerview.xml b/app/src/main/res/layout/account_book_fragment_recyclerview.xml
index 1fd9f34..03c87de 100644
--- a/app/src/main/res/layout/account_book_fragment_recyclerview.xml
+++ b/app/src/main/res/layout/account_book_fragment_recyclerview.xml
@@ -1,5 +1,5 @@
-
-
-
-
+
-
-
+
diff --git a/app/src/main/res/layout/activity_account_book_month_view.xml b/app/src/main/res/layout/activity_account_book_month_view.xml
index da5c714..2bd14d1 100644
--- a/app/src/main/res/layout/activity_account_book_month_view.xml
+++ b/app/src/main/res/layout/activity_account_book_month_view.xml
@@ -1,5 +1,5 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_account_book_setting.xml b/app/src/main/res/layout/activity_account_book_setting.xml
index ad3bb3d..ad021ef 100644
--- a/app/src/main/res/layout/activity_account_book_setting.xml
+++ b/app/src/main/res/layout/activity_account_book_setting.xml
@@ -61,7 +61,7 @@
android:id="@+id/icon_left"
/>
-
-
+
-
-
+
-
-
+
-
-
+
+
+
-
+
-
-
+
-
-
+
-
-
+
-
-
+
diff --git a/app/src/main/res/layout/activity_account_book_tag_view.xml b/app/src/main/res/layout/activity_account_book_tag_view.xml
index 43c3edb..8a75928 100644
--- a/app/src/main/res/layout/activity_account_book_tag_view.xml
+++ b/app/src/main/res/layout/activity_account_book_tag_view.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/layout/activity_account_book_today_view.xml b/app/src/main/res/layout/activity_account_book_today_view.xml
index 8560bbc..3a1d361 100644
--- a/app/src/main/res/layout/activity_account_book_today_view.xml
+++ b/app/src/main/res/layout/activity_account_book_today_view.xml
@@ -1,5 +1,5 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_edit_password.xml b/app/src/main/res/layout/activity_edit_password.xml
index b7726dc..d29b882 100644
--- a/app/src/main/res/layout/activity_edit_password.xml
+++ b/app/src/main/res/layout/activity_edit_password.xml
@@ -24,12 +24,12 @@
android:layout_height="wrap_content"
>
-
-
+
-
-
-
+
-
-
@@ -40,7 +40,7 @@
android:textSize="25sp"
/>
-
+
-
-
-
+
-
-
+
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_dialog_list.xml b/app/src/main/res/layout/fragment_dialog_list.xml
index cb55cae..d2a89a2 100644
--- a/app/src/main/res/layout/fragment_dialog_list.xml
+++ b/app/src/main/res/layout/fragment_dialog_list.xml
@@ -5,7 +5,7 @@
android:background="@android:color/background_light"
android:gravity="bottom">
-
diff --git a/app/src/main/res/layout/guillotine.xml b/app/src/main/res/layout/guillotine.xml
index 6522155..36f0d23 100644
--- a/app/src/main/res/layout/guillotine.xml
+++ b/app/src/main/res/layout/guillotine.xml
@@ -8,7 +8,7 @@
android:background="#00ffffff"
android:orientation="vertical">
-
@@ -32,7 +32,7 @@
android:textSize="25sp"
/>
-
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_today_view_body.xml b/app/src/main/res/layout/item_today_view_body.xml
index faa5739..0160c07 100644
--- a/app/src/main/res/layout/item_today_view_body.xml
+++ b/app/src/main/res/layout/item_today_view_body.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_today_view_head.xml b/app/src/main/res/layout/item_today_view_head.xml
index 29288db..3c216c3 100644
--- a/app/src/main/res/layout/item_today_view_head.xml
+++ b/app/src/main/res/layout/item_today_view_head.xml
@@ -4,18 +4,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
+
+
+
-
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/month_fragment.xml b/app/src/main/res/layout/month_fragment.xml
index 1fd9f34..03c87de 100644
--- a/app/src/main/res/layout/month_fragment.xml
+++ b/app/src/main/res/layout/month_fragment.xml
@@ -1,5 +1,5 @@
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tag_list_view_head.xml b/app/src/main/res/layout/tag_list_view_head.xml
index 800f7ee..cd51f77 100644
--- a/app/src/main/res/layout/tag_list_view_head.xml
+++ b/app/src/main/res/layout/tag_list_view_head.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tag_list_view_histogram_body.xml b/app/src/main/res/layout/tag_list_view_histogram_body.xml
index 705756e..2f7f985 100644
--- a/app/src/main/res/layout/tag_list_view_histogram_body.xml
+++ b/app/src/main/res/layout/tag_list_view_histogram_body.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/tag_list_view_pie_body.xml b/app/src/main/res/layout/tag_list_view_pie_body.xml
index 528ce28..6432722 100644
--- a/app/src/main/res/layout/tag_list_view_pie_body.xml
+++ b/app/src/main/res/layout/tag_list_view_pie_body.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/today_fragment.xml b/app/src/main/res/layout/today_fragment.xml
index 1fd9f34..7475389 100644
--- a/app/src/main/res/layout/today_fragment.xml
+++ b/app/src/main/res/layout/today_fragment.xml
@@ -1,7 +1,18 @@
-
\ No newline at end of file
+ android:layout_height="match_parent">
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 9d3cfe4..bbf4dd7 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,7 +1,7 @@
-
+ Base application theme.
@@ -15,9 +15,6 @@