Search in sources :

Example 16 with UiThread

use of androidx.annotation.UiThread in project EhViewer by seven332.

the class SpiderQueen method obtainSpiderQueen.

@UiThread
public static SpiderQueen obtainSpiderQueen(@NonNull Context context, @NonNull GalleryInfo galleryInfo, @Mode int mode) {
    OSUtils.checkMainLoop();
    SpiderQueen queen = sQueenMap.get(galleryInfo.gid);
    if (queen == null) {
        EhApplication application = (EhApplication) context.getApplicationContext();
        queen = new SpiderQueen(application, galleryInfo);
        sQueenMap.put(galleryInfo.gid, queen);
        // Set mode
        queen.setMode(mode);
        queen.start();
    } else {
        // Set mode
        queen.setMode(mode);
    }
    return queen;
}
Also used : EhApplication(com.hippo.ehviewer.EhApplication) UiThread(androidx.annotation.UiThread)

Example 17 with UiThread

use of androidx.annotation.UiThread in project BigImageViewer by Piasy.

the class BigImageView method doOnFinish.

@UiThread
private void doOnFinish() {
    if (mOptimizeDisplay) {
        AnimationSet set = new AnimationSet(true);
        AlphaAnimation animation = new AlphaAnimation(1, 0);
        animation.setDuration(500);
        animation.setFillAfter(true);
        set.addAnimation(animation);
        if (mThumbnailView != null) {
            mThumbnailView.setAnimation(set);
        }
        if (mProgressIndicatorView != null) {
            mProgressIndicatorView.setAnimation(set);
        }
        if (mProgressIndicator != null) {
            mProgressIndicator.onFinish();
        }
        animation.setAnimationListener(new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                if (mThumbnailView != null) {
                    mThumbnailView.setVisibility(GONE);
                }
                if (mProgressIndicatorView != null) {
                    mProgressIndicatorView.setVisibility(GONE);
                }
                // ref: https://stackoverflow.com/q/33242776/3077508
                if (mThumbnailView != null || mProgressIndicatorView != null) {
                    post(new Runnable() {

                        @Override
                        public void run() {
                            clearThumbnailAndProgressIndicator();
                        }
                    });
                }
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    } else {
        if (mProgressIndicator != null) {
            mProgressIndicator.onFinish();
        }
        clearThumbnailAndProgressIndicator();
    }
}
Also used : Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) UiThread(androidx.annotation.UiThread)

Example 18 with UiThread

use of androidx.annotation.UiThread in project android_packages_apps_Settings by omnirom.

the class InternetResetHelper method suspendPreferences.

@UiThread
protected void suspendPreferences() {
    Log.d(TAG, "Suspend the subsystem preferences");
    if (mMobileNetworkController != null) {
        mMobileNetworkController.hidePreference(true, /* hide */
        true);
    }
    if (mWifiTogglePreferences != null) {
        mWifiTogglePreferences.setVisible(false);
    }
    for (PreferenceCategory pref : mWifiNetworkPreferences) {
        pref.removeAll();
        pref.setVisible(false);
    }
    if (mResettingPreference != null) {
        mResettingPreference.setVisible(true);
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) UiThread(androidx.annotation.UiThread)

Example 19 with UiThread

use of androidx.annotation.UiThread in project android_packages_apps_Settings by omnirom.

the class InternetResetHelper method resumePreferences.

@UiThread
protected void resumePreferences() {
    if (mIsRecoveryReady && mMobileNetworkController != null) {
        Log.d(TAG, "Resume the Mobile Network controller");
        mMobileNetworkController.hidePreference(false, /* hide */
        false);
    }
    if (mIsWifiReady && mWifiTogglePreferences != null) {
        Log.d(TAG, "Resume the Wi-Fi preferences");
        mWifiTogglePreferences.setVisible(true);
        for (PreferenceCategory pref : mWifiNetworkPreferences) {
            pref.setVisible(true);
        }
    }
    if (mIsRecoveryReady && mIsWifiReady) {
        mHandlerInjector.removeCallbacks(mTimeoutRunnable);
        if (mResettingPreference != null) {
            Log.d(TAG, "Resume the Resetting preference");
            mResettingPreference.setVisible(false);
        }
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) UiThread(androidx.annotation.UiThread)

Example 20 with UiThread

use of androidx.annotation.UiThread in project mapbox-plugins-android by mapbox.

the class CircleManager method create.

/**
 * Create a list of circles on the map.
 * <p>
 * Circles are going to be created only for features with a matching geometry.
 * <p>
 * All supported properties are:<br>
 * CircleOptions.PROPERTY_CIRCLE_RADIUS - Float<br>
 * CircleOptions.PROPERTY_CIRCLE_COLOR - String<br>
 * CircleOptions.PROPERTY_CIRCLE_BLUR - Float<br>
 * CircleOptions.PROPERTY_CIRCLE_OPACITY - Float<br>
 * CircleOptions.PROPERTY_CIRCLE_STROKE_WIDTH - Float<br>
 * CircleOptions.PROPERTY_CIRCLE_STROKE_COLOR - String<br>
 * CircleOptions.PROPERTY_CIRCLE_STROKE_OPACITY - Float<br>
 * Learn more about above properties in the <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/">Style specification</a>.
 * <p>
 * Out of spec properties:<br>
 * "is-draggable" - Boolean, true if the circle should be draggable, false otherwise
 *
 * @param featureCollection the featureCollection defining the list of circles to build
 * @return the list of built circles
 */
@UiThread
public List<Circle> create(@NonNull FeatureCollection featureCollection) {
    List<Feature> features = featureCollection.features();
    List<CircleOptions> options = new ArrayList<>();
    if (features != null) {
        for (Feature feature : features) {
            CircleOptions option = CircleOptions.fromFeature(feature);
            if (option != null) {
                options.add(option);
            }
        }
    }
    return create(options);
}
Also used : ArrayList(java.util.ArrayList) Feature(com.mapbox.geojson.Feature) UiThread(androidx.annotation.UiThread)

Aggregations

UiThread (androidx.annotation.UiThread)22 ArrayList (java.util.ArrayList)5 Feature (com.mapbox.geojson.Feature)4 SuppressLint (android.annotation.SuppressLint)2 PreferenceCategory (androidx.preference.PreferenceCategory)2 Attachment (org.thoughtcrime.securesms.attachments.Attachment)2 BlurHash (org.thoughtcrime.securesms.blurhash.BlurHash)2 Slide (org.thoughtcrime.securesms.mms.Slide)2 SettableFuture (org.thoughtcrime.securesms.util.concurrent.SettableFuture)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 Notification (android.app.Notification)1 NotificationChannel (android.app.NotificationChannel)1 NotificationManager (android.app.NotificationManager)1 JobInfo (android.app.job.JobInfo)1 JobScheduler (android.app.job.JobScheduler)1 ComponentName (android.content.ComponentName)1 Drawable (android.graphics.drawable.Drawable)1