bug fix
This commit is contained in:
@ -28,6 +28,7 @@ import android.os.Build;
|
|||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import com.arialyy.aria.core.scheduler.OnSchedulerListener;
|
import com.arialyy.aria.core.scheduler.OnSchedulerListener;
|
||||||
import com.arialyy.aria.core.task.Task;
|
import com.arialyy.aria.core.task.Task;
|
||||||
|
import com.arialyy.aria.util.CheckUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by lyy on 2016/12/1.
|
* Created by lyy on 2016/12/1.
|
||||||
@ -98,12 +99,12 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
private Aria() {
|
private Aria() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接受Activity、Service、Application
|
* 接受Activity、Service、Application
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(Context context) {
|
public static AMReceiver whit(Context context) {
|
||||||
//if (context == null) throw new IllegalArgumentException("context 不能为 null");
|
CheckUtil.checkNull(context);
|
||||||
checkNull(context);
|
|
||||||
if (context instanceof Activity
|
if (context instanceof Activity
|
||||||
|| context instanceof Service
|
|| context instanceof Service
|
||||||
|| context instanceof Application) {
|
|| context instanceof Application) {
|
||||||
@ -117,7 +118,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Fragment
|
* 处理Fragment
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(Fragment fragment) {
|
public static AMReceiver whit(Fragment fragment) {
|
||||||
checkNull(fragment);
|
CheckUtil.checkNull(fragment);
|
||||||
return AriaManager.getInstance(
|
return AriaManager.getInstance(
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
||||||
: fragment.getActivity()).get(fragment);
|
: fragment.getActivity()).get(fragment);
|
||||||
@ -127,7 +128,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Fragment
|
* 处理Fragment
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(android.support.v4.app.Fragment fragment) {
|
public static AMReceiver whit(android.support.v4.app.Fragment fragment) {
|
||||||
checkNull(fragment);
|
CheckUtil.checkNull(fragment);
|
||||||
return AriaManager.getInstance(
|
return AriaManager.getInstance(
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
||||||
: fragment.getActivity()).get(fragment);
|
: fragment.getActivity()).get(fragment);
|
||||||
@ -137,7 +138,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Fragment、或者DialogFragment
|
* 处理Fragment、或者DialogFragment
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(DialogFragment dialog) {
|
public static AMReceiver whit(DialogFragment dialog) {
|
||||||
checkNull(dialog);
|
CheckUtil.checkNull(dialog);
|
||||||
return AriaManager.getInstance(
|
return AriaManager.getInstance(
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? dialog.getContext() : dialog.getActivity())
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? dialog.getContext() : dialog.getActivity())
|
||||||
.get(dialog);
|
.get(dialog);
|
||||||
@ -147,7 +148,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理popupwindow
|
* 处理popupwindow
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(PopupWindow popupWindow) {
|
public static AMReceiver whit(PopupWindow popupWindow) {
|
||||||
checkNull(popupWindow);
|
CheckUtil.checkNull(popupWindow);
|
||||||
return AriaManager.getInstance(popupWindow.getContentView().getContext()).get(popupWindow);
|
return AriaManager.getInstance(popupWindow.getContentView().getContext()).get(popupWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +156,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Dialog
|
* 处理Dialog
|
||||||
*/
|
*/
|
||||||
public static AMReceiver whit(Dialog dialog) {
|
public static AMReceiver whit(Dialog dialog) {
|
||||||
checkNull(dialog);
|
CheckUtil.checkNull(dialog);
|
||||||
return AriaManager.getInstance(dialog.getContext()).get(dialog);
|
return AriaManager.getInstance(dialog.getContext()).get(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Dialog的通用任务
|
* 处理Dialog的通用任务
|
||||||
*/
|
*/
|
||||||
public static AriaManager get(Dialog dialog) {
|
public static AriaManager get(Dialog dialog) {
|
||||||
checkNull(dialog);
|
CheckUtil.checkNull(dialog);
|
||||||
return AriaManager.getInstance(dialog.getContext());
|
return AriaManager.getInstance(dialog.getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +186,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Dialog的通用任务
|
* 处理Dialog的通用任务
|
||||||
*/
|
*/
|
||||||
public static AriaManager get(PopupWindow popupWindow) {
|
public static AriaManager get(PopupWindow popupWindow) {
|
||||||
checkNull(popupWindow);
|
CheckUtil.checkNull(popupWindow);
|
||||||
return AriaManager.getInstance(popupWindow.getContentView().getContext());
|
return AriaManager.getInstance(popupWindow.getContentView().getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Fragment的通用任务
|
* 处理Fragment的通用任务
|
||||||
*/
|
*/
|
||||||
public static AriaManager get(Fragment fragment) {
|
public static AriaManager get(Fragment fragment) {
|
||||||
checkNull(fragment);
|
CheckUtil.checkNull(fragment);
|
||||||
return AriaManager.getInstance(
|
return AriaManager.getInstance(
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
||||||
: fragment.getActivity());
|
: fragment.getActivity());
|
||||||
@ -203,16 +204,12 @@ import com.arialyy.aria.core.task.Task;
|
|||||||
* 处理Fragment的通用任务
|
* 处理Fragment的通用任务
|
||||||
*/
|
*/
|
||||||
public static AriaManager get(android.support.v4.app.Fragment fragment) {
|
public static AriaManager get(android.support.v4.app.Fragment fragment) {
|
||||||
checkNull(fragment);
|
CheckUtil.checkNull(fragment);
|
||||||
return AriaManager.getInstance(
|
return AriaManager.getInstance(
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? fragment.getContext()
|
||||||
: fragment.getActivity());
|
: fragment.getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkNull(Object obj) {
|
|
||||||
if (obj == null) throw new IllegalArgumentException("不能传入空对象");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SimpleSchedulerListener implements OnSchedulerListener {
|
public static class SimpleSchedulerListener implements OnSchedulerListener {
|
||||||
|
|
||||||
@Override public void onTaskPre(Task task) {
|
@Override public void onTaskPre(Task task) {
|
||||||
|
@ -217,6 +217,10 @@ import java.util.Set;
|
|||||||
key = clsName;
|
key = clsName;
|
||||||
}
|
}
|
||||||
handlePopupWindowLift((PopupWindow) obj);
|
handlePopupWindowLift((PopupWindow) obj);
|
||||||
|
} else if (obj instanceof Service) {
|
||||||
|
key = clsName;
|
||||||
|
} else if (obj instanceof Application) {
|
||||||
|
key = clsName;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
key = clsName;
|
key = clsName;
|
||||||
|
@ -31,6 +31,10 @@ import java.util.regex.Pattern;
|
|||||||
public class CheckUtil {
|
public class CheckUtil {
|
||||||
private static final String TAG = "CheckUtil";
|
private static final String TAG = "CheckUtil";
|
||||||
|
|
||||||
|
public static void checkNull(Object obj) {
|
||||||
|
if (obj == null) throw new IllegalArgumentException("不能传入空对象");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查sql的expression是否合法
|
* 检查sql的expression是否合法
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user