Search in sources :

Example 16 with SuppressLint

use of android.annotation.SuppressLint in project AnimeTaste by daimajia.

the class PlayActivity method setMaxSize.

@SuppressLint("InlinedApi")
private void setMaxSize() {
    if (Build.VERSION.SDK_INT >= 9) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    if (Build.MODEL.equals("M040")) {
        if (!mSharedPreferences.getBoolean("Meizu", false)) {
            SuperToast superToast = new SuperToast(this);
            superToast.setDuration(12000);
            superToast.setText("魅族某些版本固件可能存在兼容性问题,建议您升级到最新固件");
            superToast.setIcon(SuperToast.Icon.Dark.INFO, SuperToast.IconPosition.LEFT);
            superToast.show();
            mSharedPreferences.edit().putBoolean("Meizu", true).apply();
        }
    }
    getSupportActionBar().hide();
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(Screen.getScreenWidth(getWindowManager()), Screen.getScreenHeight(getWindowManager()));
    mHeaderWrapper.setLayoutParams(param);
    mVV.setLayoutParams(param);
    mZoomButton.setBackgroundResource(R.drawable.screensize_zoomin_button);
    mCurrentScape = OrientationHelper.LANDSCAPE;
}
Also used : SuperToast(com.github.johnpersano.supertoasts.SuperToast) RelativeLayout(android.widget.RelativeLayout) SuppressLint(android.annotation.SuppressLint)

Example 17 with SuppressLint

use of android.annotation.SuppressLint in project AnimeTaste by daimajia.

the class GifMovieView method setViewAttributes.

@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {
    /**
		 * Starting from HONEYCOMB have to turn off HW acceleration to draw
		 * Movie on Canvas.
		 */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.GifMoviewView, defStyle, R.style.Widget_GifMoviewView);
    mMovieResourceId = array.getResourceId(R.styleable.GifMoviewView_gif, -1);
    mPaused = array.getBoolean(R.styleable.GifMoviewView_paused, false);
    array.recycle();
    if (mMovieResourceId != -1) {
        mMovie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    }
}
Also used : TypedArray(android.content.res.TypedArray) SuppressLint(android.annotation.SuppressLint)

Example 18 with SuppressLint

use of android.annotation.SuppressLint in project AppRater by delight-im.

the class AppRater method show.

/**
     * Checks if the rating dialog should be shown to the user and displays it if needed
     *
     * @return the AlertDialog that has been shown or null
     */
@SuppressLint("CommitPrefEdits")
public AlertDialog show() {
    createTargetIntent();
    if (mContext.getPackageManager().queryIntentActivities(mTargetIntent, 0).size() <= 0) {
        // no app available to handle the intent
        return null;
    }
    final SharedPreferences prefs = mContext.getSharedPreferences(mPrefGroup, 0);
    final SharedPreferences.Editor editor = prefs.edit();
    if (prefs.getBoolean(mPreference_dontShow, false)) {
        // do not show anything
        return null;
    }
    // get launch counter
    long launch_count = prefs.getLong(mPreference_launchCount, 0);
    // increase number of launches by one
    launch_count++;
    // write new counter back to preference
    editor.putLong(mPreference_launchCount, launch_count);
    // get date of first launch
    long firstLaunchTime = prefs.getLong(mPreference_firstLaunch, 0);
    if (firstLaunchTime == 0) {
        // if not set yet
        // set to current time
        firstLaunchTime = System.currentTimeMillis();
        editor.putLong(mPreference_firstLaunch, firstLaunchTime);
    }
    savePreferences(editor);
    if (launch_count >= mLaunchesBeforePrompt) {
        // wait at least x app launches
        if (System.currentTimeMillis() >= (firstLaunchTime + (mDaysBeforePrompt * DateUtils.DAY_IN_MILLIS))) {
            // wait at least x days
            try {
                return showDialog(mContext, editor, firstLaunchTime);
            } catch (Exception e) {
                return null;
            }
        } else {
            return null;
        }
    } else {
        return null;
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) SuppressLint(android.annotation.SuppressLint)

Example 19 with SuppressLint

use of android.annotation.SuppressLint in project android-process-button by dmytrodanylyk.

the class FlatButton method setBackgroundCompat.

/**
     * Set the View's background. Masks the API changes made in Jelly Bean.
     *
     * @param drawable
     */
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public void setBackgroundCompat(Drawable drawable) {
    int pL = getPaddingLeft();
    int pT = getPaddingTop();
    int pR = getPaddingRight();
    int pB = getPaddingBottom();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        setBackground(drawable);
    } else {
        setBackgroundDrawable(drawable);
    }
    setPadding(pL, pT, pR, pB);
}
Also used : SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 20 with SuppressLint

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

the class BaseAdapterHelper method setAlpha.

/**
     * Add an action to set the alpha of a view. Can be called multiple times.
     * Alpha between 0-1.
     *
     * @param viewId na
     * @param value  na
     * @return na
     */
@SuppressLint("NewApi")
public BaseAdapterHelper setAlpha(int viewId, float value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        retrieveView(viewId).setAlpha(value);
    } else {
        // Pre-honeycomb hack to set Alpha value
        AlphaAnimation alpha = new AlphaAnimation(value, value);
        alpha.setDuration(0);
        alpha.setFillAfter(true);
        retrieveView(viewId).startAnimation(alpha);
    }
    return this;
}
Also used : AlphaAnimation(android.view.animation.AlphaAnimation) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)671 View (android.view.View)141 TextView (android.widget.TextView)89 Intent (android.content.Intent)71 Paint (android.graphics.Paint)61 ImageView (android.widget.ImageView)42 WebView (android.webkit.WebView)33 Bitmap (android.graphics.Bitmap)30 ListView (android.widget.ListView)30 File (java.io.File)28 ViewGroup (android.view.ViewGroup)26 AdapterView (android.widget.AdapterView)25 AlertDialog (android.app.AlertDialog)23 DialogInterface (android.content.DialogInterface)22 TypedArray (android.content.res.TypedArray)22 Uri (android.net.Uri)22 OnClickListener (android.view.View.OnClickListener)22 LayoutInflater (android.view.LayoutInflater)21 Point (android.graphics.Point)20 ArrayList (java.util.ArrayList)20