Search in sources :

Example 1 with DebugLog

use of cn.cqautotest.sunnybeach.aop.DebugLog in project SunnyBeach by anjiemo.

the class ImageSelectActivity method start.

@DebugLog
@Permissions({ Permission.MANAGE_EXTERNAL_STORAGE })
public static void start(BaseActivity activity, int maxSelect, OnPhotoSelectListener listener) {
    if (maxSelect < 1) {
        // 最少要选择一个图片
        throw new IllegalArgumentException("are you ok?");
    }
    Intent intent = new Intent(activity, ImageSelectActivity.class);
    intent.putExtra(IntentKey.AMOUNT, maxSelect);
    activity.startActivityForResult(intent, (resultCode, data) -> {
        if (listener == null || data == null) {
            return;
        }
        ArrayList<String> list = data.getStringArrayListExtra(IntentKey.IMAGE);
        if (list == null || list.isEmpty()) {
            listener.onCancel();
            return;
        }
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            if (!new File(iterator.next()).isFile()) {
                iterator.remove();
            }
        }
        if (resultCode == RESULT_OK && !list.isEmpty()) {
            listener.onSelected(list);
            return;
        }
        listener.onCancel();
    });
}
Also used : Intent(android.content.Intent) File(java.io.File) DebugLog(cn.cqautotest.sunnybeach.aop.DebugLog) XXPermissions(com.hjq.permissions.XXPermissions) Permissions(cn.cqautotest.sunnybeach.aop.Permissions)

Example 2 with DebugLog

use of cn.cqautotest.sunnybeach.aop.DebugLog in project SunnyBeach by anjiemo.

the class LoginActivity method start.

@DebugLog
public static void start(Context context, String phone, String password) {
    Intent intent = new Intent(context, LoginActivity.class);
    intent.putExtra(IntentKey.PHONE, phone);
    intent.putExtra(IntentKey.PASSWORD, password);
    if (!(context instanceof Activity)) {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    context.startActivity(intent);
}
Also used : AppActivity(cn.cqautotest.sunnybeach.app.AppActivity) WXEntryActivity(cn.cqautotest.sunnybeach.wxapi.WXEntryActivity) Activity(android.app.Activity) Intent(android.content.Intent) DebugLog(cn.cqautotest.sunnybeach.aop.DebugLog)

Example 3 with DebugLog

use of cn.cqautotest.sunnybeach.aop.DebugLog in project SunnyBeach by anjiemo.

the class PasswordResetActivity method start.

@DebugLog
public static void start(Context context, String phone, String code) {
    Intent intent = new Intent(context, PasswordResetActivity.class);
    intent.putExtra(IntentKey.PHONE, phone);
    intent.putExtra(IntentKey.CODE, code);
    if (!(context instanceof Activity)) {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    context.startActivity(intent);
}
Also used : AppActivity(cn.cqautotest.sunnybeach.app.AppActivity) Activity(android.app.Activity) Intent(android.content.Intent) DebugLog(cn.cqautotest.sunnybeach.aop.DebugLog)

Example 4 with DebugLog

use of cn.cqautotest.sunnybeach.aop.DebugLog in project SunnyBeach by anjiemo.

the class VideoSelectActivity method start.

@DebugLog
@Permissions({ Permission.MANAGE_EXTERNAL_STORAGE })
public static void start(BaseActivity activity, int maxSelect, OnVideoSelectListener listener) {
    if (maxSelect < 1) {
        // 最少要选择一个视频
        throw new IllegalArgumentException("are you ok?");
    }
    Intent intent = new Intent(activity, VideoSelectActivity.class);
    intent.putExtra(IntentKey.AMOUNT, maxSelect);
    activity.startActivityForResult(intent, (resultCode, data) -> {
        if (listener == null || data == null) {
            return;
        }
        ArrayList<VideoBean> list = data.getParcelableArrayListExtra(IntentKey.VIDEO);
        if (list == null || list.isEmpty()) {
            listener.onCancel();
            return;
        }
        Iterator<VideoBean> iterator = list.iterator();
        while (iterator.hasNext()) {
            if (!new File(iterator.next().getVideoPath()).isFile()) {
                iterator.remove();
            }
        }
        if (resultCode == RESULT_OK && !list.isEmpty()) {
            listener.onSelected(list);
            return;
        }
        listener.onCancel();
    });
}
Also used : Intent(android.content.Intent) File(java.io.File) DebugLog(cn.cqautotest.sunnybeach.aop.DebugLog) XXPermissions(com.hjq.permissions.XXPermissions) Permissions(cn.cqautotest.sunnybeach.aop.Permissions)

Example 5 with DebugLog

use of cn.cqautotest.sunnybeach.aop.DebugLog in project SunnyBeach by anjiemo.

the class BrowserActivity method start.

@CheckNet
@DebugLog
public static void start(Context context, String url) {
    if (TextUtils.isEmpty(url)) {
        return;
    }
    Intent intent = new Intent(context, BrowserActivity.class);
    intent.putExtra(IntentKey.URL, url);
    // 加载非反馈界面
    intent.putExtra(IntentKey.OTHER, false);
    if (!(context instanceof Activity)) {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    context.startActivity(intent);
}
Also used : AppActivity(cn.cqautotest.sunnybeach.app.AppActivity) Activity(android.app.Activity) Intent(android.content.Intent) CheckNet(cn.cqautotest.sunnybeach.aop.CheckNet) DebugLog(cn.cqautotest.sunnybeach.aop.DebugLog)

Aggregations

DebugLog (cn.cqautotest.sunnybeach.aop.DebugLog)10 Intent (android.content.Intent)9 Activity (android.app.Activity)5 AppActivity (cn.cqautotest.sunnybeach.app.AppActivity)5 Permissions (cn.cqautotest.sunnybeach.aop.Permissions)3 XXPermissions (com.hjq.permissions.XXPermissions)3 File (java.io.File)3 CheckNet (cn.cqautotest.sunnybeach.aop.CheckNet)2 Bundle (android.os.Bundle)1 WXEntryActivity (cn.cqautotest.sunnybeach.wxapi.WXEntryActivity)1 ArrayList (java.util.ArrayList)1