Skip to content

Commit 3b018d3

Browse files
committed
update build env and fix crash
1 parent 6f35769 commit 3b018d3

File tree

10 files changed

+90
-102
lines changed

10 files changed

+90
-102
lines changed

.idea/misc.xml

Lines changed: 1 addition & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

S2TDroid.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<content url="file://$MODULE_DIR$">
1414
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
1515
</content>
16-
<orderEntry type="inheritedJdk" />
16+
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
1717
<orderEntry type="sourceFolder" forTests="false" />
1818
</component>
1919
</module>

app/app.iml

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,40 @@
2222
</configuration>
2323
</facet>
2424
</component>
25-
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
25+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
2626
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
2727
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
2828
<exclude-output />
2929
<content url="file://$MODULE_DIR$">
30+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
3031
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
3132
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
3233
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
3334
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
34-
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" isTestSource="false" generated="true" />
3535
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
3636
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
37+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
3738
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
3839
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
3940
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
4041
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
41-
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" isTestSource="true" generated="true" />
4242
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
4343
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
44+
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" isTestSource="true" generated="true" />
4445
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
4546
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
4647
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
4748
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
4849
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
4950
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
5051
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
52+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
53+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
54+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
55+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
56+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
57+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
58+
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
5159
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
5260
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
5361
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
@@ -78,52 +86,53 @@
7886
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
7987
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
8088
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
89+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
90+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
91+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
8192
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
82-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
83-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/cn.pedant.sweetalert/library/1.3/jars" />
84-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/25.3.1/jars" />
85-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/25.3.1/jars" />
86-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-compat/25.3.1/jars" />
87-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-ui/25.3.1/jars" />
88-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-core-utils/25.3.1/jars" />
89-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-fragment/25.3.1/jars" />
90-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-media-compat/25.3.1/jars" />
91-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/25.3.1/jars" />
92-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/25.3.1/jars" />
93-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.medyo/android-about-page/1.2.1/jars" />
94-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.pnikosis/materialish-progress/1.0/jars" />
95-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.premnirmal.magnet/library/1.1.6/jars" />
96-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/filepicker-release/jars" />
9793
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
98-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
94+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
95+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
96+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
97+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
98+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
99+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
99100
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
101+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
100102
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
101-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
103+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
104+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
102105
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
103106
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
104107
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
108+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
109+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/splits-support" />
105110
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
111+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
106112
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
107113
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
108114
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
109115
</content>
110-
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
116+
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
111117
<orderEntry type="sourceFolder" forTests="false" />
112-
<orderEntry type="library" exported="" name="android-about-page-1.2.1" level="project" />
113-
<orderEntry type="library" exported="" name="filepicker-release-" level="project" />
114-
<orderEntry type="library" exported="" name="juniversalchardet-1.0.3" level="project" />
115-
<orderEntry type="library" exported="" name="materialish-progress-1.0" level="project" />
116-
<orderEntry type="library" exported="" name="support-core-ui-25.3.1" level="project" />
117-
<orderEntry type="library" exported="" name="library-1.3" level="project" />
118-
<orderEntry type="library" exported="" name="support-v4-25.3.1" level="project" />
119-
<orderEntry type="library" exported="" name="support-media-compat-25.3.1" level="project" />
120-
<orderEntry type="library" exported="" name="library-1.1.6" level="project" />
121-
<orderEntry type="library" exported="" name="support-annotations-25.3.1" level="project" />
122-
<orderEntry type="library" exported="" name="appcompat-v7-25.3.1" level="project" />
123-
<orderEntry type="library" exported="" name="support-vector-drawable-25.3.1" level="project" />
124-
<orderEntry type="library" exported="" name="support-compat-25.3.1" level="project" />
125-
<orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
126-
<orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />
127-
<orderEntry type="library" exported="" name="animated-vector-drawable-25.3.1" level="project" />
118+
<orderEntry type="library" name="com.github.medyo:android-about-page-1.2.1" level="project" />
119+
<orderEntry type="library" name="com.premnirmal.magnet:library-1.2.7" level="project" />
120+
<orderEntry type="library" name="com.android.support:animated-vector-drawable-27.0.2" level="project" />
121+
<orderEntry type="library" name="com.android.support:appcompat-v7-27.0.2" level="project" />
122+
<orderEntry type="library" name="__local_aars__:/Users/npes87184/Android/S2TDroid/app/libs/juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
123+
<orderEntry type="library" name="android.arch.lifecycle:common:1.0.3@jar" level="project" />
124+
<orderEntry type="library" name="com.android.support:support-annotations:27.0.2@jar" level="project" />
125+
<orderEntry type="library" name="com.github.f0ris.sweetalert:library-1.5.2" level="project" />
126+
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" />
127+
<orderEntry type="library" name="com.android.support:support-core-ui-27.0.2" level="project" />
128+
<orderEntry type="library" name="com.android.support:support-compat-27.0.2" level="project" />
129+
<orderEntry type="library" name="com.android.support:support-core-utils-27.0.2" level="project" />
130+
<orderEntry type="library" name="filepicker-release:@aar" level="project" />
131+
<orderEntry type="library" name="com.tumblr:backboard-0.1.2" level="project" />
132+
<orderEntry type="library" name="com.facebook.rebound:rebound:0.3.8@jar" level="project" />
133+
<orderEntry type="library" name="com.android.support:support-fragment-27.0.2" level="project" />
134+
<orderEntry type="library" name="com.pnikosis:materialish-progress-1.0" level="project" />
135+
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.3" level="project" />
136+
<orderEntry type="library" name="com.android.support:support-vector-drawable-27.0.2" level="project" />
128137
</component>
129138
</module>

app/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "23.0.3"
4+
compileSdkVersion 27
5+
buildToolsVersion "27.0.3"
66

77
defaultConfig {
88
applicationId "com.npes87184.s2tdroid.donate"
99
minSdkVersion 15
10-
targetSdkVersion 25
10+
targetSdkVersion 27
1111
versionCode 21
1212
versionName "1.7.6"
1313
}
@@ -27,10 +27,12 @@ repositories {
2727

2828
dependencies {
2929
compile fileTree(dir: 'libs', include: ['*.jar'])
30-
compile 'com.android.support:appcompat-v7:25.3.1'
31-
compile 'cn.pedant.sweetalert:library:1.3'
30+
compile 'com.android.support:appcompat-v7:27.0.2'
31+
compile 'com.github.f0ris.sweetalert:library:1.5.2'
3232
compile(name: 'filepicker-release', ext: 'aar')
33-
compile 'com.premnirmal.magnet:library:1.1.6'
33+
compile 'com.premnirmal.magnet:library:1.2.7'
34+
compile 'com.facebook.rebound:rebound:0.3.8'
35+
compile 'com.tumblr:backboard:0.1.2'
3436
compile files('libs/juniversalchardet-1.0.3.jar')
3537
compile 'com.github.medyo:android-about-page:1.2.1'
3638
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<uses-sdk
1212
tools:node="merge"
1313
android:minSdkVersion="15"
14-
android:targetSdkVersion="23"/>
14+
android:targetSdkVersion="27"/>
1515

1616
<application
1717
tools:replace="android:icon"

app/src/main/java/com/npes87184/s2tdroid/donate/BubbleFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
8585
if(Build.VERSION.SDK_INT >= 23) {
8686
if (!Settings.canDrawOverlays(getActivity())) {
8787
// SYSTEM_ALERT_WINDOW permission not granted...
88+
/* there is a bug in android O, which is canDrawOverlays always return false.
8889
new SweetAlertDialog(getActivity(), SweetAlertDialog.ERROR_TYPE)
8990
.setTitleText(getString(R.string.oops))
9091
.setContentText(getString(R.string.floatingPermission))
9192
.show();
93+
*/
9294
} else {
9395
getActivity().startService(new Intent(getActivity(), BubbleService.class));
9496
}

app/src/main/java/com/npes87184/s2tdroid/donate/BubbleService.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import android.widget.EditText;
1919
import android.widget.ImageView;
2020

21+
import com.facebook.rebound.SpringConfig;
2122
import com.npes87184.s2tdroid.donate.model.Analysis;
2223
import com.npes87184.s2tdroid.donate.model.KeyCollection;
2324
import com.premnirmal.Magnet.IconCallback;
@@ -40,6 +41,7 @@ public IBinder onBind(Intent intent) {
4041
@Override
4142
public void onCreate() {
4243
super.onCreate();
44+
SpringConfig springConfig = SpringConfig.fromBouncinessAndSpeed(10, 50);
4345

4446
NotificationCompat.Builder mBuilder =
4547
new NotificationCompat.Builder(this)
@@ -50,14 +52,14 @@ public void onCreate() {
5052
// Creates an explicit intent for an Activity in your app
5153
Intent resultIntent = new Intent(this, MainActivity.class);
5254

53-
// The stack builder object will contain an artificial back stack for the
54-
// started Activity.
55-
// This ensures that navigating backward from the Activity leads out of
56-
// your application to the Home screen.
55+
// The stack builder object will contain an artificial back stack for the
56+
// started Activity.
57+
// This ensures that navigating backward from the Activity leads out of
58+
// your application to the Home screen.
5759
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
58-
// Adds the back stack for the Intent (but not the Intent itself)
60+
// Adds the back stack for the Intent (but not the Intent itself)
5961
stackBuilder.addParentStack(MainActivity.class);
60-
// Adds the Intent that starts the Activity to the top of the stack
62+
// Adds the Intent that starts the Activity to the top of the stack
6163
stackBuilder.addNextIntent(resultIntent);
6264
PendingIntent resultPendingIntent =
6365
stackBuilder.getPendingIntent(
@@ -68,29 +70,31 @@ public void onCreate() {
6870
startForeground(1, mBuilder.build());
6971

7072
scale = getResources().getDisplayMetrics().density;
71-
int size = (int)(60 * scale);
73+
int size = (int) (60 * scale);
7274
prefs = PreferenceManager.getDefaultSharedPreferences(this);
7375
ImageView iconView = new ImageView(this);
7476
iconView.setImageResource(R.drawable.telegram);
7577
iconView.setAdjustViewBounds(true);
7678
iconView.setMaxHeight(size);
7779
iconView.setMaxWidth(size);
7880
iconView.setScaleType(ImageView.ScaleType.FIT_CENTER);
79-
mMagnet = new Magnet.Builder(this)
81+
mMagnet = Magnet.newBuilder(this)
8082
.setIconView(iconView)
8183
.setIconCallback(this)
82-
.setRemoveIconResId(R.drawable.trash)
83-
.setRemoveIconShadow(R.drawable.bottom_shadow)
84-
.setShouldFlingAway(true)
84+
.setShouldShowRemoveView(true)
8585
.setShouldStickToWall(true)
8686
.setRemoveIconShouldBeResponsive(true)
87+
.setInitialPosition(300, 400)
88+
.setHideFactor(0.2f)
89+
.withSpringConfig(springConfig)
8790
.build();
8891
mMagnet.show();
8992
}
9093

9194
@Override
9295
public void onFlingAway() {
93-
96+
mMagnet.destroy();
97+
stopSelf();
9498
}
9599

96100
@Override
@@ -134,13 +138,13 @@ public void onClick(DialogInterface dialog, int which) {
134138
// in Lollipop the dialog will be covered by input...
135139
int size = (int)(150 * scale);
136140
alert.getWindow().getAttributes().y = -1*size;
137-
alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
141+
alert.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
138142
alert.show();
139143
}
140144

141145
@Override
142146
public void onIconDestroyed() {
143-
stopSelf();
147+
144148
}
145149

146150
private void copyToClipboard(String str) {

0 commit comments

Comments
 (0)