Example usage for android.app Activity getClass

List of usage examples for android.app Activity getClass

Introduction

In this page you can find the example usage for android.app Activity getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.owncloud.android.MainApp.java

@SuppressFBWarnings("ST")
public void onCreate() {
    super.onCreate();
    JobManager.create(this).addJobCreator(new NCJobCreator());
    MainApp.mContext = getApplicationContext();

    SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    MainApp.storagePath = appPrefs.getString(Preferences.PreferenceKeys.STORAGE_PATH,
            Environment.getExternalStorageDirectory().getAbsolutePath());

    boolean isSamlAuth = AUTH_ON.equals(getString(R.string.auth_method_saml_web_sso));

    OwnCloudClientManagerFactory.setUserAgent(getUserAgent());
    if (isSamlAuth) {
        OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
    } else {//from   w  w  w  .j a  va2  s . c om
        OwnCloudClientManagerFactory.setDefaultPolicy(Policy.ALWAYS_NEW_CLIENT);
    }

    // initialise thumbnails cache on background thread
    new ThumbnailsCacheManager.InitDiskCacheTask().execute();

    if (BuildConfig.DEBUG) {

        String dataFolder = getDataFolder();

        // Set folder for store logs
        Log_OC.setLogDataFolder(dataFolder);

        Log_OC.startLogging(MainApp.storagePath);
        Log_OC.d("Debug", "start logging");
    }

    cleanOldEntries();
    updateAutoUploadEntries();

    Log_OC.d("SyncedFolderObserverService", "Start service SyncedFolderObserverService");
    Intent i = new Intent(this, SyncedFolderObserverService.class);
    startService(i);
    bindService(i, syncedFolderObserverServiceConnection, Context.BIND_AUTO_CREATE);

    // register global protection with pass code
    registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {

        @Override
        public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
            Log_OC.d(activity.getClass().getSimpleName(), "onCreate(Bundle) starting");
            WhatsNewActivity.runIfNeeded(activity);
            PassCodeManager.getPassCodeManager().onActivityCreated(activity);
        }

        @Override
        public void onActivityStarted(Activity activity) {
            Log_OC.d(activity.getClass().getSimpleName(), "onStart() starting");
            PassCodeManager.getPassCodeManager().onActivityStarted(activity);
        }

        @Override
        public void onActivityResumed(Activity activity) {
            Log_OC.d(activity.getClass().getSimpleName(), "onResume() starting");
        }

        @Override
        public void onActivityPaused(Activity activity) {
            Log_OC.d(activity.getClass().getSimpleName(), "onPause() ending");
        }

        @Override
        public void onActivityStopped(Activity activity) {
            Log_OC.d(activity.getClass().getSimpleName(), "onStop() ending");
            PassCodeManager.getPassCodeManager().onActivityStopped(activity);
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
            Log_OC.d(activity.getClass().getSimpleName(), "onSaveInstanceState(Bundle) starting");
        }

        @Override
        public void onActivityDestroyed(Activity activity) {
            Log_OC.d(activity.getClass().getSimpleName(), "onDestroy() ending");
        }
    });
}

From source file:com.nick.scalpel.Scalpel.java

public void wire(Activity activity, Scope scope) {
    if (isInScope(scope, Scope.Class))
        wireClz(activity);/*from w  ww .  j a va 2  s.  c  om*/
    if (isInScope(scope, Scope.Field)) {
        Class clz = activity.getClass();
        for (Field field : clz.getDeclaredFields()) {
            for (FieldWirer wirer : mFieldWirers) {
                if (field.isAnnotationPresent(wirer.annotationClass())) {
                    wirer.wire(activity, field);
                }
            }
        }
    }
}

From source file:com.yahoo.mobile.client.android.yodel.ui.PostListFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (!(activity instanceof Callbacks)) {
        throw new IllegalStateException("Activity " + activity.getClass().getSimpleName()
                + " must implement PostListFragment.Callbacks");
    } else {//from  w w  w .  ja v a  2 s.co  m
        mCallbackHandler = (Callbacks) activity;
    }
}

From source file:vi.pdfscanner.fragment.CropFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (activity instanceof ScanListener) {
        scanListener = (ScanListener) activity;
    } else {//from www. j  a  v  a  2 s  .  co m
        throw new RuntimeException(
                activity.getClass().getName() + " must implement " + ScanListener.class.getName());
    }
}

From source file:reportsas.com.formulapp.Formulario.java

public static void reiniciarActivity(Activity actividad, String parametro) {
    Intent intent = new Intent();

    intent.setClass(actividad, actividad.getClass());
    intent.putExtra("formulario", parametro);
    //llamamos a la actividad
    actividad.startActivity(intent);/*  w w  w.ja va2  s . c om*/
    //finalizamos la actividad actual
    actividad.finish();
}

From source file:nl.eduvpn.app.service.VPNService.java

/**
 * Call this when your activity is starting up.
 *
 * @param activity The current activity to bind the service with.
 */// w  w  w  .j  av  a  2s .  c  o  m
public void onCreate(@NonNull Activity activity) {
    OpenVPNService.setNotificationActivityClass(activity.getClass());
    VpnStatus.addStateListener(this);
    Intent intent = new Intent(activity, OpenVPNService.class);
    intent.putExtra(OpenVPNService.ALWAYS_SHOW_NOTIFICATION, true);
    intent.setAction(OpenVPNService.START_SERVICE);
    activity.bindService(intent, _serviceConnection, Context.BIND_AUTO_CREATE);
}

From source file:cn.bingoogolapple.scaffolding.util.AppManager.java

/**
 * ? MainActivity ?//w w w. ja  v a2 s .  c  om
 *
 * @param activityClass
 */
public void popOthersActivity(Class<Activity> activityClass) {
    if (activityClass == null || mActivityStack.isEmpty()) {
        return;
    }

    Iterator<Activity> iterator = mActivityStack.iterator();
    while (iterator.hasNext()) {
        Activity activity = iterator.next();
        if (!activity.getClass().equals(activityClass)) {
            activity.finish();
            iterator.remove();
        }
    }
}

From source file:com.amazon.android.navigator.Navigator.java

/**
 * {@inheritDoc}// w w  w  . ja  v a2s .com
 */
@Override
public void onActivityResumed(Activity activity) {

    String activityName = getActivityName(activity);
    Log.d(TAG, activityName + " onActivityResumed " + activity.getClass().getName());

    mAppInBackground = true;
    String screenName = mScreenNameMap.get(activity.getClass().getName());
    mCurrentActivity = activity;
    if (screenName != null) {
        mINavigationListener.onScreenGotFocus(activity, screenName);
    }

    for (Runnable runnable : mRunOnUpcomingActivityList) {
        mCurrentActivity.runOnUiThread(runnable);
    }
    mRunOnUpcomingActivityList.clear();
}

From source file:com.readystatesoftware.android.geras.mqtt.GerasMqtt.java

public void startService(Activity activity) {
    if (!isServiceRunning()) {
        Intent intent = new Intent(activity, GerasMqttService.class);
        intent.putExtra(GerasMqttService.EXTRA_HOST, host);
        intent.putExtra(GerasMqttService.EXTRA_API_KEY, apiKey);
        intent.putExtra(GerasMqttService.EXTRA_SENSOR_MONITORS, mSensorMonitors);
        intent.putExtra(GerasMqttService.EXTRA_LOCATION_MONTITOR, mLocationMonitor);
        intent.putExtra(GerasMqttService.EXTRA_NOTIFICATION_TARGET_CLASS, activity.getClass());
        activity.startService(intent);// w  w  w.  j a  v a  2  s  . c o m
    }
}

From source file:com.amazon.android.navigator.Navigator.java

/**
 * {@inheritDoc}/* ww w. j  av  a2s .c om*/
 */
@Override
public void onActivityPaused(Activity activity) {

    String activityName = getActivityName(activity);
    Log.d(TAG, activityName + " onActivityPaused");

    String screenName = mScreenNameMap.get(activity.getClass().getName());
    if (screenName != null) {
        mINavigationListener.onScreenLostFocus(activity, screenName);
    }
}