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:zack.yovel.clear.controller.foreground.WeatherFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    WeatherReport weatherReport = getWeatherReport();
    if (weatherReport != null) {
        displayWeatherReport(weatherReport);
    }/*from  ww w  .jav  a  2  s.c  om*/

    Activity activity = getActivity();
    if (activity.getClass().equals(MainActivity.class)) {
        ((MainActivity) activity).addListener(this);
    }
    super.onActivityCreated(savedInstanceState);
}

From source file:net.reichholf.dreamdroid.fragment.helper.DreamDroidFragmentHelper.java

public void onAttach(Activity activity) {
    if (activity.getClass().equals(ActionBarActivity.class))
        ((ActionBarActivity) activity).setSupportProgressBarIndeterminateVisibility(false);
    else//  ww  w .  j  a  va  2s  .  c o  m
        activity.setProgressBarIndeterminateVisibility(false);
}

From source file:org.runnerup.view.SettingsActivity.java

private static boolean requestWriteStoragePermissions(final Activity activity) {
    boolean ret = true;
    if (ContextCompat.checkSelfPermission(activity,
            Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        ret = false;/*www .  j  av a  2  s .  com*/

        //noinspection StatementWithEmptyBody
        if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
                Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
            //The caller informs the user, no toast or SnackBar
        } else {
            //Request permission - not working from Settings.Activity
            //ActivityCompat.requestPermissions(activity,
            //        new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
            //        REQUEST_WRITE_EXTERNAL_STORAGE);
            String s = "Write permission is NOT granted";
            Log.i(activity.getClass().getSimpleName(), s);
        }
    }
    return ret;
}

From source file:zack.yovel.clear.controller.foreground.WeatherFragment.java

@Override
public void onPause() {
    Activity activity = getActivity();
    if (activity != null && activity.getClass().equals(MainActivity.class)) {
        ((MainActivity) activity).removeListener(this);
    }//from  w ww  .j a v  a  2  s.c  o m
    super.onPause();
}

From source file:com.dalaran.annotation.FieldMerge.java

public boolean merge(Activity a) {
    Field[] declaredFields = a.getClass().getDeclaredFields();
    boolean valid = false;
    for (Field field : declaredFields) {
        Annotation[] annotations = field.getAnnotations();
        for (Annotation annotation : annotations) {
            if (annotation.annotationType().equals(ViewById.class)) {
                boolean b = checkToMerge(a, field, (ViewById) annotation);
                if (b) {
                    valid = b;//from  ww w . j  a va 2 s  .co m
                }
            }
        }
        Click annotation = field.getAnnotation(Click.class);
        if (annotation != null) {
            clickAnnotation(annotation, field, a);

        }
    }
    return valid;
}

From source file:org.runnerup.view.SettingsActivity.java

@SuppressLint("InlinedApi")
public static boolean requestReadStoragePermissions(final Activity activity) {
    boolean ret = true;
    if (Build.VERSION.SDK_INT >= 16 && ContextCompat.checkSelfPermission(activity,
            Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
        ret = false;/*from   w w  w. j  a  va  2s.com*/

        //noinspection StatementWithEmptyBody
        if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
                Manifest.permission.READ_EXTERNAL_STORAGE)) {
            //The caller informs the user, no toast or SnackBar
        } else {
            //Request permission - not working from Settings.Activity
            //ActivityCompat.requestPermissions(activity,
            //        new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
            //        REQUEST_READ_EXTERNAL_STORAGE);
            String s = "Read permission is NOT granted";
            Log.i(activity.getClass().getSimpleName(), s);
        }
    }
    return ret;
}

From source file:uk.ac.horizon.ug.exploding.client.logging.ActivityLogger.java

public ActivityLogger(Activity activity) {
    activityClass = activity.getClass();
    activityHashCode = activity.hashCode();
}

From source file:com.mobicage.rogerthat.util.ui.UIUtils.java

public static void onActivityStart(final Activity activity, final MainService mainService) {
    if (T.getThreadType() != T.UI) {
        throw new RuntimeException("This method must be called from T.UI, got " + T.getThreadName());
    }//w ww  .  jav a2s  .co m
    sActivities.add(activity);
    L.d(activity.getClass().getSimpleName() + " starting. Visible activities: " + sActivities);
    connectToNewsChannel(mainService);
    checkAppDidEnterForeGround(mainService);
}

From source file:com.mobicage.rogerthat.util.ui.UIUtils.java

public static void onActivityStop(final Activity activity, final MainService mainService) {
    if (T.getThreadType() != T.UI) {
        throw new RuntimeException("This method must be called from T.UI, got " + T.getThreadName());
    }//from   www. ja v  a 2s .c om
    sActivities.remove(activity);
    L.d(activity.getClass().getSimpleName() + " stopping. Visible activities: " + sActivities);
    if (mainService != null && AppConstants.NEWS_ENABLED && sActivities.size() == 0) {
        NewsPlugin newsPlugin = mainService.getPlugin(NewsPlugin.class);
        if (newsPlugin != null) {
            newsPlugin.disconnectChannel();
        }
    }
}

From source file:es.usc.citius.servando.calendula.fragments.dosePickers.DosePickerFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    Log.d(getTag(),//  w  w w  .ja  va 2  s  .c  o m
            "Activity " + activity.getClass().getName() + ", " + (activity instanceof OnDoseSelectedListener));
    // If the container activity has implemented
    // the callback interface, set it as listener
    if (activity instanceof OnDoseSelectedListener) {
        mDoseSelectedListener = (OnDoseSelectedListener) activity;
    }
}