Search in sources :

Example 16 with CallSuper

use of android.support.annotation.CallSuper in project Shuttle by timusus.

the class BaseActivity method onCreate.

@CallSuper
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Permiso.getInstance().setActivity(this);
    Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {

        @Override
        public void onPermissionResult(Permiso.ResultSet resultSet) {
            if (resultSet.areAllPermissionsGranted()) {
                bindService();
            } else {
                Toast.makeText(BaseActivity.this, "Permission check failed", Toast.LENGTH_LONG).show();
                finish();
            }
        }

        @Override
        public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String... permissions) {
            callback.onRationaleProvided();
        }
    }, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.WAKE_LOCK);
    billingManager = new BillingManager(this, new BillingManager.BillingUpdatesListener() {

        @Override
        public void onPurchasesUpdated(List<Purchase> purchases) {
            for (Purchase purchase : purchases) {
                if (purchase.getSku().equals(Config.SKU_PREMIUM)) {
                    ShuttleApplication.getInstance().setIsUpgraded(true);
                }
            }
        }

        @Override
        public void onPremiumPurchaseCompleted() {
            ShuttleApplication.getInstance().setIsUpgraded(true);
            UpgradeDialog.getUpgradeSuccessDialog(BaseActivity.this).show();
        }

        @Override
        public void onPremiumPurchaseRestored() {
            ShuttleApplication.getInstance().setIsUpgraded(true);
            Toast.makeText(BaseActivity.this, R.string.iab_purchase_restored, Toast.LENGTH_SHORT).show();
        }
    });
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
Also used : Permiso(com.greysonparrelli.permiso.Permiso) Purchase(com.android.billingclient.api.Purchase) BillingManager(com.simplecity.amp_library.billing.BillingManager) List(java.util.List) CallSuper(android.support.annotation.CallSuper)

Example 17 with CallSuper

use of android.support.annotation.CallSuper in project BottomNavigation by Ashok-Varma.

the class BottomNavigationTab method initialise.

@CallSuper
public void initialise(boolean setActiveColor) {
    iconView.setSelected(false);
    if (isInActiveIconSet) {
        StateListDrawable states = new StateListDrawable();
        states.addState(new int[] { android.R.attr.state_selected }, mCompactIcon);
        states.addState(new int[] { -android.R.attr.state_selected }, mCompactInActiveIcon);
        states.addState(new int[] {}, mCompactInActiveIcon);
        iconView.setImageDrawable(states);
    } else {
        if (setActiveColor) {
            DrawableCompat.setTintList(mCompactIcon, new ColorStateList(new int[][] { // 1
            new int[] { android.R.attr.state_selected }, // 2
            new int[] { -android.R.attr.state_selected }, new int[] {} }, new int[] { // 1
            mActiveColor, // 2
            mInActiveColor, // 3
            mInActiveColor }));
        } else {
            DrawableCompat.setTintList(mCompactIcon, new ColorStateList(new int[][] { // 1
            new int[] { android.R.attr.state_selected }, // 2
            new int[] { -android.R.attr.state_selected }, new int[] {} }, new int[] { // 1
            mBackgroundColor, // 2
            mInActiveColor, // 3
            mInActiveColor }));
        }
        iconView.setImageDrawable(mCompactIcon);
    }
    if (isNoTitleMode) {
        labelView.setVisibility(GONE);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) iconContainerView.getLayoutParams();
        layoutParams.gravity = Gravity.CENTER;
        setNoTitleIconContainerParams(layoutParams);
        iconContainerView.setLayoutParams(layoutParams);
        FrameLayout.LayoutParams iconLayoutParams = (FrameLayout.LayoutParams) iconView.getLayoutParams();
        setNoTitleIconParams(iconLayoutParams);
        iconView.setLayoutParams(iconLayoutParams);
    }
}
Also used : FrameLayout(android.widget.FrameLayout) ColorStateList(android.content.res.ColorStateList) StateListDrawable(android.graphics.drawable.StateListDrawable) CallSuper(android.support.annotation.CallSuper)

Example 18 with CallSuper

use of android.support.annotation.CallSuper in project android-oss by kickstarter.

the class KSApplication method onCreate.

@Override
@CallSuper
public void onCreate() {
    super.onCreate();
    // Send crash reports in release builds
    if (!BuildConfig.DEBUG && !isInUnitTests()) {
        checkForCrashes();
    }
    MultiDex.install(this);
    // Only log for internal builds
    if (BuildConfig.FLAVOR_AUDIENCE.equals("internal")) {
        Timber.plant(new Timber.DebugTree());
    }
    if (!isInUnitTests() && ApiCapabilities.canDetectMemoryLeaks()) {
        refWatcher = LeakCanary.install(this);
    }
    JodaTimeAndroid.init(this);
    component = DaggerApplicationComponent.builder().applicationModule(new ApplicationModule(this)).build();
    component().inject(this);
    CookieHandler.setDefault(cookieManager);
    FacebookSdk.sdkInitialize(this);
    pushNotifications.initialize();
    final ApplicationLifecycleUtil appUtil = new ApplicationLifecycleUtil(this);
    registerActivityLifecycleCallbacks(appUtil);
    registerComponentCallbacks(appUtil);
}
Also used : Timber(timber.log.Timber) ApplicationLifecycleUtil(com.kickstarter.libs.utils.ApplicationLifecycleUtil) CallSuper(android.support.annotation.CallSuper)

Example 19 with CallSuper

use of android.support.annotation.CallSuper in project android-oss by kickstarter.

the class BaseActivity method onSaveInstanceState.

@CallSuper
@Override
protected void onSaveInstanceState(@NonNull final Bundle outState) {
    super.onSaveInstanceState(outState);
    Timber.d("onSaveInstanceState %s", this.toString());
    final Bundle viewModelEnvelope = new Bundle();
    if (viewModel != null) {
        ActivityViewModelManager.getInstance().save(viewModel, viewModelEnvelope);
    }
    outState.putBundle(VIEW_MODEL_KEY, viewModelEnvelope);
}
Also used : Bundle(android.os.Bundle) CallSuper(android.support.annotation.CallSuper)

Example 20 with CallSuper

use of android.support.annotation.CallSuper in project nucleus by konmik.

the class RxPresenter method onSave.

/**
     * {@inheritDoc}
     */
@CallSuper
@Override
protected void onSave(Bundle state) {
    for (int i = requested.size() - 1; i >= 0; i--) {
        int restartableId = requested.get(i);
        Subscription subscription = restartableSubscriptions.get(restartableId);
        if (subscription != null && subscription.isUnsubscribed())
            requested.remove(i);
    }
    state.putIntegerArrayList(REQUESTED_KEY, requested);
}
Also used : CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription) CallSuper(android.support.annotation.CallSuper)

Aggregations

CallSuper (android.support.annotation.CallSuper)30 Intent (android.content.Intent)6 MenuItem (android.view.MenuItem)6 View (android.view.View)5 Spinner (android.widget.Spinner)5 Date (java.util.Date)5 Bundle (android.os.Bundle)2 TextView (android.widget.TextView)2 SharedPreferences (android.content.SharedPreferences)1 ColorStateList (android.content.res.ColorStateList)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1 StateListDrawable (android.graphics.drawable.StateListDrawable)1 ConnectivityManager (android.net.ConnectivityManager)1 NetworkInfo (android.net.NetworkInfo)1 PowerManager (android.os.PowerManager)1 RecognizerIntent (android.speech.RecognizerIntent)1 Nullable (android.support.annotation.Nullable)1 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 MotionEvent (android.view.MotionEvent)1