Search in sources :

Example 61 with SuppressLint

use of android.annotation.SuppressLint in project UltimateAndroid by cymcsg.

the class AnimationAdapter method calculateAnimationDelay.

@SuppressLint("NewApi")
private long calculateAnimationDelay() {
    long delay;
    int lastVisiblePosition = getAbsListView().getLastVisiblePosition();
    int firstVisiblePosition = getAbsListView().getFirstVisiblePosition();
    int numberOfItemsOnScreen = lastVisiblePosition - firstVisiblePosition;
    int numberOfAnimatedItems = mLastAnimatedPosition - mFirstAnimatedPosition;
    if (numberOfItemsOnScreen + 1 < numberOfAnimatedItems) {
        delay = getAnimationDelayMillis();
        if (getAbsListView() instanceof GridView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            delay += getAnimationDelayMillis() * ((mLastAnimatedPosition + 1) % ((GridView) getAbsListView()).getNumColumns());
        }
    } else {
        long delaySinceStart = (mLastAnimatedPosition - mFirstAnimatedPosition + 1) * getAnimationDelayMillis();
        delay = mAnimationStartMillis + getInitialDelayMillis() + delaySinceStart - System.currentTimeMillis();
    }
    return Math.max(0, delay);
}
Also used : GridView(android.widget.GridView) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 62 with SuppressLint

use of android.annotation.SuppressLint in project MaterialProgressBar by DreaminginCodeZH.

the class HorizontalProgressDrawable method updateSecondaryProgressTint.

@SuppressLint("NewApi")
private void updateSecondaryProgressTint() {
    if (mHasSecondaryProgressTintColor) {
        int tintColor = mSecondaryProgressTintColor;
        if (!getShowBackground()) {
            // Alpha of tintColor may not be mBackgroundAlpha because we modulated it in
            // setTint().
            float backgroundAlpha = (float) Color.alpha(tintColor) / 0xFF;
            tintColor = ColorUtils.setAlphaComponent(tintColor, Math.round(0xFF * compositeAlpha(backgroundAlpha, backgroundAlpha)));
        }
        mSecondaryProgressDrawable.setTint(tintColor);
    } else if (mHasSecondaryProgressTint) {
        ColorStateList tint = mSecondaryProgressTint;
        if (!getShowBackground()) {
            // Composite alpha so that the secondary progress looks as before.
            tint = tint.withAlpha(Math.round(0xFF * compositeAlpha(mBackgroundAlpha, mBackgroundAlpha)));
        }
        mSecondaryProgressDrawable.setTintList(tint);
    }
}
Also used : ColorStateList(android.content.res.ColorStateList) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 63 with SuppressLint

use of android.annotation.SuppressLint in project MaterialProgressBar by DreaminginCodeZH.

the class HorizontalProgressDrawable method setTint.

/**
     * {@inheritDoc}
     */
@Override
@SuppressLint("NewApi")
public void setTint(@ColorInt int tintColor) {
    // Modulate alpha of tintColor against mBackgroundAlpha.
    int backgroundTintColor = ColorUtils.setAlphaComponent(tintColor, Math.round(Color.alpha(tintColor) * mBackgroundAlpha));
    mBackgroundDrawable.setTint(backgroundTintColor);
    setSecondaryProgressTint(backgroundTintColor);
    mProgressDrawable.setTint(tintColor);
}
Also used : SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 64 with SuppressLint

use of android.annotation.SuppressLint in project AndroidUtilCode by Blankj.

the class AppUtils method getAppSignature.

/**
     * 获取App签名
     *
     * @param context     上下文
     * @param packageName 包名
     * @return App签名
     */
@SuppressLint("PackageManagerGetSignatures")
public static Signature[] getAppSignature(Context context, String packageName) {
    if (StringUtils.isSpace(packageName))
        return null;
    try {
        PackageManager pm = context.getPackageManager();
        PackageInfo pi = pm.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
        return pi == null ? null : pi.signatures;
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) SuppressLint(android.annotation.SuppressLint)

Example 65 with SuppressLint

use of android.annotation.SuppressLint in project AndroidUtilCode by Blankj.

the class ConvertUtils method millis2FitTimeSpan.

/**
     * 毫秒时间戳转合适时间长度
     *
     * @param millis    毫秒时间戳
     *                  <p>小于等于0,返回null</p>
     * @param precision 精度
     *                  <ul>
     *                  <li>precision = 0,返回null</li>
     *                  <li>precision = 1,返回天</li>
     *                  <li>precision = 2,返回天和小时</li>
     *                  <li>precision = 3,返回天、小时和分钟</li>
     *                  <li>precision = 4,返回天、小时、分钟和秒</li>
     *                  <li>precision &gt;= 5,返回天、小时、分钟、秒和毫秒</li>
     *                  </ul>
     * @return 合适时间长度
     */
@SuppressLint("DefaultLocale")
public static String millis2FitTimeSpan(long millis, int precision) {
    if (millis <= 0 || precision <= 0)
        return null;
    StringBuilder sb = new StringBuilder();
    String[] units = { "天", "小时", "分钟", "秒", "毫秒" };
    int[] unitLen = { 86400000, 3600000, 60000, 1000, 1 };
    precision = Math.min(precision, 5);
    for (int i = 0; i < precision; i++) {
        if (millis >= unitLen[i]) {
            long mode = millis / unitLen[i];
            millis -= mode * unitLen[i];
            sb.append(mode).append(units[i]);
        }
    }
    return sb.toString();
}
Also used : SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1773 View (android.view.View)369 TextView (android.widget.TextView)243 Intent (android.content.Intent)232 ImageView (android.widget.ImageView)112 Paint (android.graphics.Paint)109 File (java.io.File)102 IOException (java.io.IOException)96 ArrayList (java.util.ArrayList)93 Context (android.content.Context)91 LayoutInflater (android.view.LayoutInflater)89 Uri (android.net.Uri)84 Bundle (android.os.Bundle)83 SharedPreferences (android.content.SharedPreferences)78 Bitmap (android.graphics.Bitmap)78 WebView (android.webkit.WebView)76 PendingIntent (android.app.PendingIntent)72 Method (java.lang.reflect.Method)72 SimpleDateFormat (java.text.SimpleDateFormat)69 ViewGroup (android.view.ViewGroup)66