|
|
@ -3,6 +3,8 @@ package xyz.fycz.myreader; |
|
|
|
import androidx.appcompat.app.AppCompatActivity; |
|
|
|
import androidx.appcompat.app.AppCompatActivity; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import xyz.fycz.myreader.base.BaseActivity; |
|
|
|
|
|
|
|
|
|
|
|
public class ActivityManage { |
|
|
|
public class ActivityManage { |
|
|
|
|
|
|
|
|
|
|
|
private static ArrayList<AppCompatActivity> activities = new ArrayList<>(); |
|
|
|
private static ArrayList<AppCompatActivity> activities = new ArrayList<>(); |
|
|
@ -15,7 +17,7 @@ public class ActivityManage { |
|
|
|
activities.remove(activity); |
|
|
|
activities.remove(activity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void finishAllActivites() { |
|
|
|
public static void finishAllActivities() { |
|
|
|
for (AppCompatActivity activity : activities) { |
|
|
|
for (AppCompatActivity activity : activities) { |
|
|
|
if (!activity.isFinishing()) { |
|
|
|
if (!activity.isFinishing()) { |
|
|
|
activity.finish(); |
|
|
|
activity.finish(); |
|
|
@ -23,7 +25,7 @@ public class ActivityManage { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static AppCompatActivity getActivityByCurrenlyRun(){ |
|
|
|
public static AppCompatActivity getActivityByCurrentlyRun(){ |
|
|
|
if(activities.size() <= 0){ |
|
|
|
if(activities.size() <= 0){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -44,4 +46,12 @@ public class ActivityManage { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static AppCompatActivity getByClass(Class<?> activity){ |
|
|
|
|
|
|
|
for (AppCompatActivity item : activities) { |
|
|
|
|
|
|
|
if (null != item && item.getClass() == activity) { |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|