Java Code Examples for android.app.Activity#getLocalClassName()

The following examples show how to use android.app.Activity#getLocalClassName() . 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 File: FirebaseInAppMessagingDisplay.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
private void bindFiamToActivity(Activity activity) {
  // If we have no currently bound activity or are currently bound to a different activity then
  // bind to this new activity.
  if (currentlyBoundActivityName == null
      || !currentlyBoundActivityName.equals(activity.getLocalClassName())) {
    Logging.logi("Binding to activity: " + activity.getLocalClassName());
    headlessInAppMessaging.setMessageDisplayComponent(
        (iam, cb) -> {
          // When we are in the middle of showing a message, we ignore other notifications these
          // messages will be fired when the corresponding events happen the next time.
          if (inAppMessage != null || headlessInAppMessaging.areMessagesSuppressed()) {
            Logging.logd("Active FIAM exists. Skipping trigger");
            return;
          }
          inAppMessage = iam;
          callbacks = cb;
          showActiveFiam(activity);
        });
    // set the current activity to be the one passed in so that we know not to bind again to the
    // same activity
    currentlyBoundActivityName = activity.getLocalClassName();
  }
  if (inAppMessage != null) {
    showActiveFiam(activity);
  }
}
 
Example 2
Source File: ActivityArchitector.java    From Mortar-architect with MIT License 6 votes vote down vote up
public static MortarScope onCreateScope(Activity activity, Bundle savedInstanceState, Architected architected) {
    String scopeName = activity.getLocalClassName() + "-task-" + activity.getTaskId();
    MortarScope scope = MortarScope.findChild(activity.getApplicationContext(), scopeName);
    if (scope == null) {
        MortarScope parentScope = MortarScope.getScope(activity.getApplicationContext());

        MortarScope.Builder builder = parentScope.buildChild()
                .withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner());
        architected.configureScope(builder, parentScope);
        scope = builder.build(scopeName);

        architected.createNavigator(scope);
    }

    BundleServiceRunner.getBundleServiceRunner(scope).onCreate(savedInstanceState);

    return scope;
}
 
Example 3
Source File: ShortCutHelper.java    From Utils with Apache License 2.0 6 votes vote down vote up
/**
 * 删除程序的快捷方式
 *
 * @param activity Activity
 */
public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent(
            "com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
            activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "."
            + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(),
            appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
            Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
}
 
Example 4
Source File: FloatLifecycleReceiver.java    From FloatWindow with Apache License 2.0 5 votes vote down vote up
/**
 * 页面展示时检查是否页面旋转。逻辑: 和上个页面对比
 *
 * @param activity
 */
private void checkConfigChangeWhenResume(Activity activity) {
    if (mActivityAndLandscape.size() > 0) {
        mActivityAndLandscape.clear();
    }
    if (FwContent.isDebug) {
        L.i("------checkConfigChangeWhenResume----mActivityAndLandscape: " + mActivityAndLandscape.size());
    }
    RotateUtil.getInstance().start(activity);
    String activityName = activity.getPackageName() + "." + activity.getLocalClassName();
    if (mActivityAndLandscape.size() < 1) {
        // 有悬浮窗后的,首次切换页面
        mActivityAndLandscape.put(activityName, ViewUtils.isActivityLandscape(activity));
        if (mConfigChange != null) {
            mConfigChange.onActivityConfigChanged();
        }
    } else {
        if (mActivityAndLandscape.containsKey(activityName)) {
            boolean isLandscape = ViewUtils.isActivityLandscape(activity);
            if (mActivityAndLandscape.get(activityName) != isLandscape) {
                mActivityAndLandscape.put(activityName, isLandscape);
                if (mConfigChange != null) {
                    mConfigChange.onActivityConfigChanged();
                }
            } else {
                // 页面方向未变
            }
        } else {
            mActivityAndLandscape.clear();
            // 有悬浮窗后的,首次切换页面
            mActivityAndLandscape.put(activityName, ViewUtils.isActivityLandscape(activity));
            if (mConfigChange != null) {
                mConfigChange.onActivityConfigChanged();
            }
        }
    }
}
 
Example 5
Source File: FloatLifecycleReceiver.java    From FloatWindow with Apache License 2.0 5 votes vote down vote up
/**
 * 页面关闭时检查页面监听监视
 *
 * @param activity
 */
private void checkConfigChangeWhenPause(Activity activity) {
    RotateUtil.getInstance().start(activity);

    if (mActivityAndLandscape.size() < 1) {
        // 有悬浮窗后的,首次关闭页面-(兼容页面打开,才展示悬浮窗,此时map无此页面信息)
        String activityName = activity.getPackageName() + "." + activity.getLocalClassName();
        mActivityAndLandscape.put(activityName, ViewUtils.isActivityLandscape(activity));
    }
}
 
Example 6
Source File: ShortCutUtil.java    From styT with Apache License 2.0 5 votes vote down vote up
/**
 * 删除程序的快捷方式
 *
 * @param activity Activity
 */
public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "." + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(), appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
}
 
Example 7
Source File: ShortCutUtils.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
/**
 * 删除程序的快捷方式
 *
 * @param activity Activity
 */
public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "." + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(), appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
}
 
Example 8
Source File: ShortCutUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 删除程序的快捷方式
 *
 * @param activity Activity
 */
public static void delShortcut(Activity activity) {
    Intent shortcut = new Intent(
            "com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
            activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "."
            + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(),
            appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
            Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
}
 
Example 9
Source File: DialogFragments.java    From ScreenShift with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if(!(activity instanceof DialogListener)){
        throw new ClassCastException(activity.getLocalClassName() + " must implement DialogListener");
    }
}
 
Example 10
Source File: ScreenView.java    From snowplow-android-tracker with Apache License 2.0 5 votes vote down vote up
public static ScreenView buildWithActivity(Activity activity) {
    String activityClassName = activity.getLocalClassName();
    String activityTag = getSnowplowScreenId(activity);
    String name = getValidName(activityClassName, activityTag);
    return ScreenView.builder()
            .activityClassName(activityClassName)
            .activityTag(activityTag)
            .fragmentClassName(null)
            .fragmentTag(null)
            .name(name)
            .type(activityClassName)
            .transitionType(null)
            .build();
}
 
Example 11
Source File: GoogleBillingUtil.java    From GoogleBilling with Apache License 2.0 4 votes vote down vote up
private String getTag(Activity activity){
    return activity.getLocalClassName();
}
 
Example 12
Source File: GuardaApp.java    From guarda-android-wallets with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void onActivityPaused(Activity activity) {
        currentActivity = activity.getLocalClassName();
//        Log.d("psd", "GuardaApp - onActivityPaused: " + activity.getLocalClassName());
    }
 
Example 13
Source File: HostDeviceApplication.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public void onActivityStarted(@NonNull Activity activity) {
    mNowTopActivityClassName = activity.getLocalClassName();
}
 
Example 14
Source File: HostDeviceApplication.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
@Override
public void onActivityResumed(@NonNull Activity activity) {
    mNowTopActivityClassName = activity.getLocalClassName();
}