Skip to content

Commit 4d53255

Browse files
author
chao
committed
Extract activityTaskView to Application, use AndroidX.
1 parent 1cdbfdb commit 4d53255

21 files changed

Lines changed: 167 additions & 83 deletions

File tree

activitytaskview/build.gradle

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,32 @@
1-
apply plugin: 'com.android.library'
2-
apply plugin: 'com.novoda.bintray-release'
3-
buildscript {
4-
repositories {
5-
jcenter()
6-
}
7-
dependencies {
8-
classpath 'com.novoda:bintray-release:0.8.1'
9-
}
10-
}
11-
12-
// ./gradlew clean build bintrayUpload -PbintrayUser=rome713bc -PbintrayKey= -PdryRun=false
13-
14-
publish {
15-
userOrg = 'rome713bc'
16-
groupId = 'cc.rome753'
17-
artifactId = 'activitytaskview'
18-
publishVersion = '3.8.0'
19-
desc = 'fix crash bug'
20-
website = 'https://github.com/rome753/activitytaskview'
21-
}
1+
apply plugin: 'com.android.application'
222

233
android {
244
compileSdkVersion 28
255
buildToolsVersion "26.0.3"
26-
276
defaultConfig {
7+
applicationId "cc.rome753.activitytask"
288
minSdkVersion 15
29-
versionCode 10
30-
versionName "3.8.0"
31-
9+
targetSdkVersion 28
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
3219
}
33-
3420
lintOptions {
3521
abortOnError false
3622
}
37-
3823
}
3924

4025
dependencies {
41-
implementation 'com.android.support:appcompat-v7:28.0.0'
42-
}
26+
api fileTree(include: ['*.jar'], dir: 'libs')
27+
androidTestApi('com.android.support.test.espresso:espresso-core:2.2.2', {
28+
exclude group: 'com.android.support', module: 'support-annotations'
29+
})
30+
api 'com.android.support:appcompat-v7:28.0.0'
31+
testApi 'junit:junit:4.12'
32+
}

activitytaskview/src/main/AndroidManifest.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="cc.rome753.activitytask">
44

5+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
6+
57
<application
68
android:allowBackup="true"
9+
android:icon="@drawable/activity_task"
710
android:label="@string/app_name"
8-
android:supportsRtl="true">
9-
<activity android:name="cc.rome753.activitytask.RequestOverlayActivity"></activity>
11+
android:supportsRtl="true"
12+
android:theme="@style/AppTheme">
13+
<activity android:name="cc.rome753.activitytask.RequestOverlayActivity">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN" />
16+
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
<receiver android:name=".LifecycleReceiver" >
21+
<intent-filter>
22+
<action android:name="action_update_lifecycle" />
23+
</intent-filter>
24+
</receiver>
1025
</application>
1126

1227
</manifest>

activitytaskview/src/main/java/cc/rome753/activitytask/ActivityTask.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
import android.os.Looper;
1212
import android.os.Message;
1313
import android.provider.Settings;
14-
import android.support.v4.app.Fragment;
15-
import android.support.v4.app.FragmentActivity;
16-
import android.support.v4.app.FragmentManager;
1714
import android.util.Log;
1815
import android.view.Gravity;
1916
import android.view.View;
2017
import android.view.WindowManager;
2118

19+
import androidx.fragment.app.Fragment;
20+
import androidx.fragment.app.FragmentActivity;
21+
import androidx.fragment.app.FragmentManager;
22+
2223
import java.util.LinkedList;
2324
import java.util.Queue;
2425

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package cc.rome753.activitytask;
2+
3+
import android.content.BroadcastReceiver;
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.text.TextUtils;
7+
import android.util.Log;
8+
9+
import java.util.ArrayList;
10+
import java.util.Arrays;
11+
12+
public class LifecycleReceiver extends BroadcastReceiver {
13+
14+
@Override
15+
public void onReceive(Context context, Intent intent) {
16+
if(TextUtils.equals(intent.getAction(), "action_update_lifecycle")) {
17+
String lifecycle = intent.getStringExtra("lifecycle");
18+
int task = intent.getIntExtra("task", 0);
19+
String activity = intent.getStringExtra("activity");
20+
ArrayList<String> fragments = intent.getStringArrayListExtra("fragments");
21+
String s = fragments == null ? "" : Arrays.toString(fragments.toArray());
22+
Log.d("chao", lifecycle + " " + task + " " + activity + " " + s);
23+
}
24+
}
25+
}

activitytaskview/src/main/java/cc/rome753/activitytask/model/FragmentInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package cc.rome753.activitytask.model;
22

3-
import android.support.v4.app.Fragment;
3+
import androidx.fragment.app.Fragment;
44

55
import java.util.LinkedList;
66

activitytaskview/src/main/java/cc/rome753/activitytask/view/ObserverTextView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package cc.rome753.activitytask.view;
22

33
import android.content.Context;
4-
import android.support.v7.widget.AppCompatTextView;
54
import android.text.TextUtils;
65
import android.util.AttributeSet;
6+
import android.widget.TextView;
77

88
import java.util.Observable;
99
import java.util.Observer;
@@ -16,7 +16,7 @@
1616
* Created by rome753@163.com on 2017/4/3.
1717
*/
1818

19-
public class ObserverTextView extends AppCompatTextView implements Observer{
19+
public class ObserverTextView extends TextView implements Observer{
2020

2121

2222
public ObserverTextView(Context context) {
1.15 KB
Loading
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#3F51B5</color>
4+
<color name="colorPrimaryDark">#303F9F</color>
5+
<color name="colorAccent">#FF4081</color>
6+
</resources>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<resources>
2+
3+
<!-- Base application theme. -->
4+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5+
<!-- Customize your theme here. -->
6+
<item name="colorPrimary">@color/colorPrimary</item>
7+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8+
<item name="colorAccent">@color/colorAccent</item>
9+
</style>
10+
11+
<!---->
12+
<style name="dialogstyle" parent="Theme.AppCompat.Dialog">
13+
<item name="android:windowFullscreen">true</item>
14+
<item name="windowNoTitle">true</item>
15+
<item name="android:windowIsFloating">true</item>
16+
<item name="android:windowContentOverlay">@null</item>
17+
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
18+
</style>
19+
20+
</resources>

app/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android {
44
compileSdkVersion 28
55
buildToolsVersion "26.0.3"
66
defaultConfig {
7-
applicationId "cc.rome753.activitytask"
7+
applicationId "cc.rome753.activitytask.demo"
88
minSdkVersion 15
99
targetSdkVersion 28
1010
versionCode 1
@@ -29,6 +29,4 @@ dependencies {
2929
})
3030
api 'com.android.support:appcompat-v7:28.0.0'
3131
testApi 'junit:junit:4.12'
32-
api project(':activitytaskview')
33-
// api 'cc.rome753:activitytaskview:3.8.0'
3432
}

0 commit comments

Comments
 (0)