Skip to content

Commit

Permalink
Fix gradle.
Browse files Browse the repository at this point in the history
  • Loading branch information
rome753 committed Feb 5, 2024
1 parent 665355c commit f6ae594
Show file tree
Hide file tree
Showing 30 changed files with 16 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

public class ActivityTaskHelper {

// If use WebTools only, set isSendBroadcast to false
public static boolean isSendBroadcast = true;

// Use AppStartUp, no need to call this method
public static void init(Application app) {
app.registerActivityLifecycleCallbacks(new ActivityTaskHelper().activityLifecycleImpl);
}
Expand All @@ -27,33 +31,36 @@ private void handleFragment(Fragment fragment) {
Log.e("ActivityTaskHelper", "handleFragment null");
return;
}
sendBroadcast(fragment.getActivity(), fragment);
notify(fragment.getActivity(), fragment);
}

private void handleFragment(Fragment fragment, Context context) {
if(fragment == null || !(context instanceof Activity)) {
Log.e("ActivityTaskHelper", "handleFragment null");
return;
}
sendBroadcast((Activity) context, fragment);
notify((Activity) context, fragment);
}

private void handleActivity(Activity activity) {
if(activity == null) {
Log.e("ActivityTaskHelper", "handleActivity null");
return;
}
sendBroadcast(activity, null);
notify(activity, null);
}

private void sendBroadcast(Activity activity, Fragment fragment) {
private void notify(Activity activity, Fragment fragment) {
ArrayList<String> fgs = getAllFragments(fragment);
String t = activity.getPackageName() + "@0x" + Integer.toHexString(activity.getTaskId());
String a = getSimpleName(activity);
String l = Thread.currentThread().getStackTrace()[5].getMethodName();
String fs = fgs == null ? "" : fgs.toString().replace(" ", "");
Log.d("ActivityTaskView.atv", t + " " + a + " " + l + " " + fs);

if (!isSendBroadcast) {
return;
}
String packageName = "cc.rome753.activitytask";
Intent intent = new Intent(packageName + ".ACTION_UPDATE_LIFECYCLE");
intent.setPackage(packageName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
import android.view.View;
import android.view.WindowManager;

import androidx.annotation.NonNull;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

import cc.rome753.activitytask.model.LifecycleInfo;
import cc.rome753.activitytask.view.ActivityTaskView;
import cc.rome753.activitytask.view.FragmentTaskView;

/**
* Created by [email protected] on 2017/4/16.
Expand Down Expand Up @@ -90,7 +91,7 @@ void send(LifecycleInfo info) {
}

@Override
public void handleMessage(Message msg) {
public void handleMessage(@NonNull Message msg) {
if (System.currentTimeMillis() - lastTime < interval) {
sendEmptyMessageDelayed(0, interval / 5);
} else {
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include ':app', ':activitytaskview', ':singleinstancedemo'
include ':app'
include ':activitytaskview'
include ':activitytasklib'
1 change: 0 additions & 1 deletion singleinstancedemo/.gitignore

This file was deleted.

30 changes: 0 additions & 30 deletions singleinstancedemo/build.gradle

This file was deleted.

21 changes: 0 additions & 21 deletions singleinstancedemo/proguard-rules.pro

This file was deleted.

32 changes: 0 additions & 32 deletions singleinstancedemo/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit f6ae594

Please sign in to comment.