Java Code Examples for com.blankj.utilcode.util.ActivityUtils

The following examples show how to use com.blankj.utilcode.util.ActivityUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: DoraemonKit   Source File: LargePictureManager.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 保存在内部里的图片信息
 *
 * @param url
 * @param memorySize
 * @param width
 * @param height
 */
public void saveImageInfo(String url, double memorySize, int width, int height, String framework) {
    if (ActivityUtils.getTopActivity() instanceof UniversalActivity) {
        return;
    }
    LargeImageInfo largeImageInfo;
    if (LARGE_IMAGE_INFO_MAP.containsKey(url)) {
        largeImageInfo = LARGE_IMAGE_INFO_MAP.get(url);
    } else {
        largeImageInfo = new LargeImageInfo();
        LARGE_IMAGE_INFO_MAP.put(url, largeImageInfo);
        largeImageInfo.setUrl(url);
    }
    largeImageInfo.setMemorySize(memorySize);
    largeImageInfo.setWidth(width);
    largeImageInfo.setHeight(height);
    largeImageInfo.setFramework(framework);
}
 
Example 2
Source Project: DoraemonKit   Source File: ActivityCounter.java    License: Apache License 2.0 6 votes vote down vote up
public void render() {
    mRenderStartTime = System.currentTimeMillis();
    final Activity activity = ActivityUtils.getTopActivity();
    if (activity != null && activity.getWindow() != null) {
        mCurrentActivity = activity.getClass().getSimpleName();
        activity.getWindow().getDecorView().post(new Runnable() {
            @Override
            public void run() {
                activity.getWindow().getDecorView().post(new Runnable() {
                    @Override
                    public void run() {
                        renderEnd();
                    }
                });
            }
        });
    } else {
        renderEnd();
    }
}
 
Example 3
Source Project: DoraemonKit   Source File: ColorPickerInfoDokitView.java    License: Apache License 2.0 6 votes vote down vote up
private void initView() {
    mColor = findViewById(R.id.color);
    mColorHex = findViewById(R.id.color_hex);
    mClose = findViewById(R.id.close);
    mClose.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ColorPickManager.getInstance().setColorPickerDokitView(null);
            ColorPickConfig.setColorPickOpen(false);
            DokitViewManager.getInstance().detach(ColorPickerDokitView.class.getSimpleName());
            DokitViewManager.getInstance().detach(ColorPickerInfoDokitView.class.getSimpleName());
            //取色器kit是依赖在当前透明的Activity上的 所以关闭控件时需要finish
            if (ActivityUtils.getTopActivity() != null && ActivityUtils.getTopActivity() instanceof TranslucentActivity) {
                ActivityUtils.getTopActivity().finish();
            }

        }
    });
}
 
Example 4
Source Project: DoraemonKit   Source File: LeakCanaryManager.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 初始化跨进程框架
 * 接受leakcanary 进程泄漏传递过来的数据
 */
public static void initAidlBridge(Application application) {
    if (!DokitConstant.APP_HEALTH_RUNNING) {
        return;
    }
    IBridge.init(application, application.getPackageName(), IBridge.AbridgeType.AIDL);
    IBridge.registerAIDLCallBack(new AbridgeCallBack() {
        @Override
        public void receiveMessage(String message) {
            try {
                Log.i(TAG, "====aidl=====>" + message);
                if (DokitConstant.APP_HEALTH_RUNNING) {
                    AppHealthInfo.DataBean.LeakBean leakBean = new AppHealthInfo.DataBean.LeakBean();
                    leakBean.setPage(ActivityUtils.getTopActivity().getClass().getCanonicalName());
                    leakBean.setDetail(message);
                    AppHealthInfoUtil.getInstance().addLeakInfo(leakBean);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    });

}
 
Example 5
Source Project: DanDanPlayForAndroid   Source File: ChangePasswordActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void changeSuccess() {
    ToLoginDialog dialog = new ToLoginDialog(this, R.style.Dialog, 2, () -> {
        AppConfig.getInstance().setLogin(false);
        AppConfig.getInstance().saveUserName("");
        AppConfig.getInstance().saveUserScreenName("");
        AppConfig.getInstance().saveUserImage("");
        AppConfig.getInstance().saveToken("");
        EventBus.getDefault().post(UpdateFragmentEvent.updatePersonal());
        if (ActivityUtils.isActivityExistsInStack(PersonalInfoActivity.class))
            ActivityUtils.finishActivity(PersonalInfoActivity.class);
        launchActivity(LoginActivity.class);
        ChangePasswordActivity.this.finish();
    });
    dialog.show();
}
 
Example 6
Source Project: AndroidUtilCode   Source File: BaseDialogFragment.java    License: Apache License 2.0 6 votes vote down vote up
public void show(final String tag) {
    ThreadUtils.runOnUiThread(new Runnable() {
        @SuppressLint("CommitTransaction")
        @Override
        public void run() {
            if (ActivityUtils.isActivityAlive(mActivity)) {
                FragmentManager fm = mActivity.getSupportFragmentManager();
                Fragment prev = fm.findFragmentByTag(tag);
                if (prev != null) {
                    fm.beginTransaction().remove(prev);
                }
                BaseDialogFragment.super.show(fm, tag);
            }
        }
    });
}
 
Example 7
Source Project: AndroidUtilCode   Source File: DeviceInfoItem.java    License: Apache License 2.0 6 votes vote down vote up
public static List<DeviceInfoItem> getAppInfoItems() {
    List<DeviceInfoItem> appInfoItems = new ArrayList<>();
    appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_name, Build.MANUFACTURER + " " + Build.MODEL));
    appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_android_version, DeviceUtils.getSDKVersionName() + " (" + DeviceUtils.getSDKVersionCode() + ")"));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_adb_enabled, String.valueOf(DeviceUtils.isAdbEnabled())));
    }
    appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_support_abis, ArrayUtils.toString(DeviceUtils.getABIs())));
    appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_screen_info, getScreenInfo()));
    appInfoItems.add(new DeviceInfoItem(R.string.du_device_info_open_development_settings_page, "", new OnClickListener() {
        @Override
        public void onClick(View v) {
            ActivityUtils.startActivity(new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS));
        }
    }));
    return appInfoItems;
}
 
Example 8
Source Project: YCAudioPlayer   Source File: SplashPagerActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void initView() {
    if(SPUtils.getInstance(Constant.SP_NAME).getBoolean(Constant.KEY_FIRST_SPLASH,true)){
        initGetImage();
        initBanner();
    } else {
        ActivityUtils.startActivity(GuideActivity.class);
        finish();
    }
}
 
Example 9
Source Project: YCAudioPlayer   Source File: SplashPagerActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void initListener() {
    btnGo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ActivityUtils.startActivity(GuideActivity.class);
            finish();
            SPUtils.getInstance(Constant.SP_NAME).put(Constant.KEY_FIRST_SPLASH,false);
        }
    });
}
 
Example 10
Source Project: YCAudioPlayer   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.fl_search:
            ActivityUtils.startActivity(SearchMusicActivity.class);
            break;
        case R.id.fl_play_bar:
            showPlayingFragment();
            break;
        case R.id.iv_play_bar_list:
            showListDialog();
            break;
        case R.id.iv_play_bar_play:
            if(getPlayService().isDefault()){
                if(BaseAppHelper.get().getMusicList().size()>0){
                    int mPlayPosition;
                    if (getPlayService().getPlayingMusic() != null &&
                            getPlayService().getPlayingMusic().getType() == AudioBean.Type.LOCAL) {
                        mPlayPosition = getPlayService().getPlayingPosition();
                    } else {
                        mPlayPosition = 0;
                    }
                    getPlayService().play(BaseAppHelper.get().getMusicList().get(mPlayPosition));
                }else {
                    ToastUtils.showToast("请检查是否有音乐");
                }
            }else {
                getPlayService().playPause();
            }
            break;
        case R.id.iv_play_bar_next:
            getPlayService().next();
            break;
        default:
            break;
    }
}
 
Example 11
Source Project: YCAudioPlayer   Source File: MeFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.rl_me_collect:
            ShareDetailBean shareDetailBean = new ShareDetailBean();
            shareDetailBean.setShareType(ShareComment.ShareType.SHARE_GOODS);
            shareDetailBean.setContent("商品详情页分享");
            shareDetailBean.setTitle("分享");
            shareDetailBean.setImage("https://upload-images.jianshu.io/upload_images/4432347-fb25131b5629346a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240");
            ShareDialog shareDialog = new ShareDialog(activity,shareDetailBean);
            shareDialog.show(getChildFragmentManager());
            break;
        case R.id.rl_me_question:

            break;
        case R.id.rl_me_setting:
            ActivityUtils.startActivity(MeSettingActivity.class);
            break;
        case R.id.ll_timer:
            timerDialog(activity);
            break;
        case R.id.rl_me_feed_back:

            break;
        case R.id.rl_me_phone:

            break;
        case R.id.btn_exit:
            exit();
            break;
        default:
            break;
    }
}
 
Example 12
Source Project: YCAudioPlayer   Source File: ButtonViewHolder.java    License: Apache License 2.0 5 votes vote down vote up
public void bindData(List<String> mButtonList, Context mContext) {
    if(mButtonList!=null && mButtonList.size()>0){
        tv_home_first.setText(mButtonList.get(0));
        tv_home_second.setText(mButtonList.get(1));
        tv_home_third.setText(mButtonList.get(2));
        tv_home_four.setText(mButtonList.get(3));
        tv_home_five.setText(mButtonList.get(4));


        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.tv_home_first:
                        ActivityUtils.startActivity(AndroidActivity.class);
                        break;
                }
            }
        };

        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
        tv_home_first.setOnClickListener(listener);
    }
}
 
Example 13
Source Project: DoraemonKit   Source File: LargePictureManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param url
 * @param size
 */
public void process(String url, int size) {
    if (ActivityUtils.getTopActivity() instanceof UniversalActivity) {
        return;
    }
    if (PerformanceSpInfoConfig.isLargeImgOpen()) {
        //转化成kb
        double fileSize = (double) (size / 1024.0);
        saveImageInfo(url, fileSize);
    }

}
 
Example 14
Source Project: DoraemonKit   Source File: LargePictureManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 保存网络图片信息
 *
 * @param url
 * @param fileSize
 */
private void saveImageInfo(String url, double fileSize) {
    if (ActivityUtils.getTopActivity() instanceof UniversalActivity) {
        return;
    }
    LargeImageInfo largeImageInfo;
    if (LARGE_IMAGE_INFO_MAP.containsKey(url)) {
        largeImageInfo = LARGE_IMAGE_INFO_MAP.get(url);
    } else {
        largeImageInfo = new LargeImageInfo();
        LARGE_IMAGE_INFO_MAP.put(url, largeImageInfo);
        largeImageInfo.setUrl(url);
    }
    largeImageInfo.setFileSize(fileSize);
}
 
Example 15
Source Project: DoraemonKit   Source File: ActivityCounter.java    License: Apache License 2.0 5 votes vote down vote up
public void pause() {
    mStartTime = System.currentTimeMillis();
    mPauseCostTime = 0;
    mRenderCostTime = 0;
    mOtherCostTime = 0;
    mLaunchCostTime = 0;
    mLaunchStartTime = 0;
    mTotalCostTime = 0;
    mPreviousActivity = null;
    Activity activity = ActivityUtils.getTopActivity();
    if (activity != null) {
        mPreviousActivity = activity.getClass().getSimpleName();
    }
}
 
Example 16
Source Project: DoraemonKit   Source File: ActivityCounter.java    License: Apache License 2.0 5 votes vote down vote up
private void print() {
    CounterInfo counterInfo = new CounterInfo();
    counterInfo.time = System.currentTimeMillis();
    counterInfo.type = CounterInfo.TYPE_ACTIVITY;
    counterInfo.title = mPreviousActivity + " -> " + mCurrentActivity;
    counterInfo.launchCost = mLaunchCostTime;
    counterInfo.pauseCost = mPauseCostTime;
    counterInfo.renderCost = mRenderCostTime;
    counterInfo.totalCost = mTotalCostTime;
    counterInfo.otherCost = mOtherCostTime;
    try {
        //将Activity 打开耗时 添加到AppHealth 中
        if (DokitConstant.APP_HEALTH_RUNNING) {
            if (!ActivityUtils.getTopActivity().getClass().getCanonicalName().equals("com.didichuxing.doraemonkit.kit.base.UniversalActivity")) {
                AppHealthInfo.DataBean.PageLoadBean pageLoadBean = new AppHealthInfo.DataBean.PageLoadBean();
                pageLoadBean.setPage(ActivityUtils.getTopActivity().getClass().getCanonicalName());
                pageLoadBean.setTime("" + counterInfo.totalCost);
                pageLoadBean.setTrace(counterInfo.title);
                AppHealthInfoUtil.getInstance().addPageLoadInfo(pageLoadBean);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    mCounterInfos.add(counterInfo);

    TimeCounterDokitView dokitView = (TimeCounterDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), TimeCounterDokitView.class.getSimpleName());
    if (dokitView != null) {
        dokitView.showInfo(counterInfo);
    }


}
 
Example 17
Source Project: DoraemonKit   Source File: ViewCheckDrawDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    ViewCheckDokitView page = (ViewCheckDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), ViewCheckDokitView.class.getSimpleName());
    if (page != null) {
        page.removeViewSelectListener(this);
    }
}
 
Example 18
Source Project: DoraemonKit   Source File: ViewCheckDrawDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(FrameLayout view) {
    mLayoutBorderView = findViewById(R.id.rect_view);
    setDokitViewNotResponseTouchEvent(getRootView());
    postDelayed(new Runnable() {
        @Override
        public void run() {
            ViewCheckDokitView dokitView = (ViewCheckDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), ViewCheckDokitView.class.getSimpleName());
            if (dokitView != null) {
                dokitView.setViewSelectListener(ViewCheckDrawDokitView.this);
            }
        }
    }, 200);

}
 
Example 19
Source Project: DoraemonKit   Source File: ViewCheckInfoDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewSelected(@Nullable View current, @NonNull List<View> checkViewList) {

    mNext.setVisibility(checkViewList.size() > 1 ? View.VISIBLE : View.GONE);
    mPre.setVisibility(checkViewList.size() > 1 ? View.VISIBLE : View.GONE);

    if (current == null) {
        mName.setText("");
        mId.setText("");
        mPosition.setText("");
        mDesc.setText("");
    } else {
        mName.setText(getResources().getString(R.string.dk_view_check_info_class, current.getClass().getSimpleName()));
        String idText = getResources().getString(R.string.dk_view_check_info_id, UIUtils.getIdText(current));
        mId.setText(idText);
        String positionText = getResources().getString(R.string.dk_view_check_info_size, current.getWidth(), current.getHeight());
        mPosition.setText(positionText);
        String descText = getViewExtraInfo(current);
        if (TextUtils.isEmpty(descText)) {
            mDesc.setVisibility(View.GONE);
        } else {
            mDesc.setText(descText);
            mDesc.setVisibility(View.VISIBLE);
        }
        Activity activity = ActivityUtils.getTopActivity();
        if (activity != null) {
            String activityText = activity.getClass().getSimpleName();
            setTextAndVisible(mActivityInfo, getResources().getString(R.string.dk_view_check_info_activity, activityText));
            String fragmentText = getVisibleFragment(activity);
            if (!TextUtils.isEmpty(fragmentText)) {
                setTextAndVisible(mFragmentInfo, getResources().getString(R.string.dk_view_check_info_fragment, fragmentText));
            } else {
                setTextAndVisible(mFragmentInfo, "");
            }
        } else {
            setTextAndVisible(mActivityInfo, "");
            setTextAndVisible(mFragmentInfo, "");
        }
    }
}
 
Example 20
Source Project: DoraemonKit   Source File: ViewCheckDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Context context) {
    mTraverHandlerThread = new HandlerThread(TAG);
    mTraverHandlerThread.start();
    mTraverHandler = new Handler(mTraverHandlerThread.getLooper());
    mFindCheckViewRunnable = new FindCheckViewRunnable();
    mResumedActivity = ActivityUtils.getTopActivity();
    LifecycleListenerUtil.registerListener(this);
}
 
Example 21
Source Project: DoraemonKit   Source File: PerformanceDokitView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 系统模式下显示单独的关闭按钮
 */
private void showSystemPerfoemanceCloseDokitView() {

    DokitIntent dokitIntent = new DokitIntent(PerformanceCloseDokitView.class);
    DokitViewManager.getInstance().attach(dokitIntent);
    mPerformanceCloseDokitView = (PerformanceCloseDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), PerformanceCloseDokitView.class.getSimpleName());
    if (mPerformanceCloseDokitView != null) {
        mPerformanceCloseDokitView.setPerformanceCloseListener(PerformanceDokitView.this);
    }
}
 
Example 22
Source Project: DoraemonKit   Source File: PerformanceDokitViewManager.java    License: Apache License 2.0 5 votes vote down vote up
public static void open(int performanceType, String title, int interval, PerformanceFragmentCloseListener listener) {
    PerformanceDokitView performanceDokitView = (PerformanceDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), PerformanceDokitView.class.getSimpleName());
    if (performanceDokitView == null) {
        DokitIntent dokitIntent = new DokitIntent(PerformanceDokitView.class);
        dokitIntent.mode = DokitIntent.MODE_SINGLE_INSTANCE;
        DokitViewManager.getInstance().attach(dokitIntent);
        performanceDokitView = (PerformanceDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), PerformanceDokitView.class.getSimpleName());
        performanceDokitView.addItem(performanceType, title, interval);
    } else {
        performanceDokitView.addItem(performanceType, title, interval);
    }
    performanceDokitView.addPerformanceFragmentCloseListener(listener);
    singleperformanceViewInfos.put(title, new performanceViewInfo(performanceType, title, interval));
}
 
Example 23
Source Project: DoraemonKit   Source File: PerformanceDokitViewManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 性能检测设置页面关闭时调用
 *
 * @param listener
 */
public static void onPerformanceSettingFragmentDestroy(PerformanceFragmentCloseListener listener) {
    PerformanceDokitView performanceDokitView = (PerformanceDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), PerformanceDokitView.class.getSimpleName());
    if (performanceDokitView != null) {
        performanceDokitView.removePerformanceFragmentCloseListener(listener);
    }
}
 
Example 24
Source Project: DoraemonKit   Source File: PerformanceDokitViewManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param performanceType 参考 DataSourceFactory
 */
public static void close(int performanceType, String title) {
    PerformanceDokitView performanceDokitView = (PerformanceDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), PerformanceDokitView.class.getSimpleName());
    if (performanceDokitView != null) {
        performanceDokitView.removeItem(performanceType);
    }

    singleperformanceViewInfos.remove(title);
}
 
Example 25
Source Project: DoraemonKit   Source File: AlignRulerInfoDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(FrameLayout view) {
    postDelayed(new Runnable() {
        @Override
        public void run() {
            mMarker = (AlignRulerMarkerDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), AlignRulerMarkerDokitView.class.getSimpleName());
            if (mMarker != null) {
                mMarker.addPositionChangeListener(AlignRulerInfoDokitView.this);
            }
        }
    }, 100);
    initView();
}
 
Example 26
Source Project: DoraemonKit   Source File: AlignRulerLineDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(FrameLayout view) {
    postDelayed(new Runnable() {
        @Override
        public void run() {
            mMarker = (AlignRulerMarkerDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), AlignRulerMarkerDokitView.class.getSimpleName());
            if (mMarker != null) {
                mMarker.addPositionChangeListener(AlignRulerLineDokitView.this);
            }
        }
    }, 100);
    setDokitViewNotResponseTouchEvent(getRootView());
    mAlignInfoView = findViewById(R.id.info_view);
}
 
Example 27
Source Project: DoraemonKit   Source File: BlockMonitorManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 动态添加卡顿信息到appHealth
 *
 * @param blockInfo
 */
private void addBlockInfoInAppHealth(@NonNull BlockInfo blockInfo) {
    try {
        String activityName = ActivityUtils.getTopActivity().getClass().getCanonicalName();
        AppHealthInfo.DataBean.BlockBean blockBean = new AppHealthInfo.DataBean.BlockBean();
        blockBean.setPage(activityName);
        blockBean.setBlockTime(blockInfo.timeCost);
        blockBean.setDetail(blockInfo.toString());
        AppHealthInfoUtil.getInstance().addBlockInfo(blockBean);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
Example 28
Source Project: DoraemonKit   Source File: ColorPickerDokitView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Context context) {
    ColorPickManager.getInstance().setColorPickerDokitView(this);
    mInfoDokitView = (ColorPickerInfoDokitView) DokitViewManager.getInstance().getDokitView(ActivityUtils.getTopActivity(), ColorPickerInfoDokitView.class.getSimpleName());
    mImageCapture = new ImageCapture();
    try {
        mImageCapture.init(context, getBundle(), this);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 29
Source Project: QPM   Source File: QPMGetActivityStackExecutor.java    License: Apache License 2.0 5 votes vote down vote up
private List<String> getRunningActivityNames() {
    List<Activity> activityList = ActivityUtils.getActivityList();
    List<String> activitiNames = new ArrayList<>();
    for (Activity activity : activityList) {
        activitiNames.add(activity.getLocalClassName());
    }
    return activitiNames;
}
 
Example 30
Source Project: QPM   Source File: QPMGetTopActivityExecutor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void exec() throws QPMException {
    Activity topActivity = ActivityUtils.getTopActivity();
    if (topActivity != null) {
        analysys.onCollectTopActivityInfo(topActivity.getLocalClassName());
    }
}