Search in sources :

Example 51 with SuppressLint

use of android.annotation.SuppressLint in project superCleanMaster by joyoyao.

the class IconRoundCornerProgressBar method setHeaderColor.

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public void setHeaderColor(int color) {
    headerColor = color;
    int radius = this.radius - (padding / 2);
    GradientDrawable gradient = new GradientDrawable();
    gradient.setShape(GradientDrawable.RECTANGLE);
    gradient.setColor(headerColor);
    gradient.setCornerRadii(new float[] { radius, radius, 0, 0, 0, 0, radius, radius });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        layoutHeader.setBackgroundDrawable(gradient);
    } else {
        layoutHeader.setBackground(gradient);
    }
    if (!isProgressBarCreated) {
        isHeaderColorSetBeforeDraw = true;
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) GradientDrawable(android.graphics.drawable.GradientDrawable) SuppressLint(android.annotation.SuppressLint)

Example 52 with SuppressLint

use of android.annotation.SuppressLint in project android-app-common-tasks by multidots.

the class CropImage method onCreate.

@SuppressLint("InlinedApi")
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mContentResolver = getContentResolver();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.cropimage);
    mImageView = (CropImageView) findViewById(R.id.image);
    showStorageToast(this);
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        if (extras.getString(CIRCLE_CROP) != null) {
            if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
                mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            mCircleCrop = true;
            mAspectX = 1;
            mAspectY = 1;
        }
        mImagePath = extras.getString(IMAGE_PATH);
        assert mImagePath != null;
        String extension = mImagePath.substring(mImagePath.lastIndexOf(".") + 1).toLowerCase(Locale.getDefault());
        if (extension.equals("jpg") || extension.equals("jpeg")) {
            mOutputFormat = Bitmap.CompressFormat.JPEG;
        } else if (extension.equals("png")) {
            mOutputFormat = Bitmap.CompressFormat.PNG;
        }
        mSaveUri = getImageUri(mImagePath);
        mBitmap = getBitmap(mImagePath);
        if (extras.containsKey(ASPECT_X) && extras.get(ASPECT_X) instanceof Integer) {
            mAspectX = extras.getInt(ASPECT_X);
        } else {
            throw new IllegalArgumentException("aspect_x must be integer");
        }
        if (extras.containsKey(ASPECT_Y) && extras.get(ASPECT_Y) instanceof Integer) {
            mAspectY = extras.getInt(ASPECT_Y);
        } else {
            throw new IllegalArgumentException("aspect_y must be integer");
        }
        mOutputX = extras.getInt(OUTPUT_X);
        mOutputY = extras.getInt(OUTPUT_Y);
        mScale = extras.getBoolean(SCALE, true);
        mScaleUp = extras.getBoolean(SCALE_UP_IF_NEEDED, true);
    }
    if (mBitmap == null) {
        Log.d(TAG, "finish!!!");
        finish();
        return;
    }
    // Make UI fullscreen.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    findViewById(R.id.discard).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            setResult(RESULT_CANCELED);
            finish();
        }
    });
    findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            try {
                onSaveClicked();
            } catch (Exception e) {
                finish();
            }
        }
    });
    findViewById(R.id.rotateLeft).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            mBitmap = Util.rotateImage(mBitmap, -90);
            RotateBitmap rotateBitmap = new RotateBitmap(mBitmap);
            mImageView.setImageRotateBitmapResetBase(rotateBitmap, true);
            mRunFaceDetection.run();
        }
    });
    findViewById(R.id.rotateRight).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            mBitmap = Util.rotateImage(mBitmap, 90);
            RotateBitmap rotateBitmap = new RotateBitmap(mBitmap);
            mImageView.setImageRotateBitmapResetBase(rotateBitmap, true);
            mRunFaceDetection.run();
        }
    });
    startFaceDetection();
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) View(android.view.View) IOException(java.io.IOException) SuppressLint(android.annotation.SuppressLint)

Example 53 with SuppressLint

use of android.annotation.SuppressLint in project android-app-common-tasks by multidots.

the class CropImage method onCreate.

@SuppressLint("InlinedApi")
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mContentResolver = getContentResolver();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.cropimage);
    mImageView = (CropImageView) findViewById(R.id.image);
    showStorageToast(this);
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        if (extras.getString(CIRCLE_CROP) != null) {
            if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
                mImageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
            }
            mCircleCrop = true;
            mAspectX = 1;
            mAspectY = 1;
        }
        mImagePath = extras.getString(IMAGE_PATH);
        assert mImagePath != null;
        String extension = mImagePath.substring(mImagePath.lastIndexOf(".") + 1).toLowerCase(Locale.getDefault());
        if (extension.equals("jpg") || extension.equals("jpeg")) {
            mOutputFormat = Bitmap.CompressFormat.JPEG;
        } else if (extension.equals("png")) {
            mOutputFormat = Bitmap.CompressFormat.PNG;
        }
        mSaveUri = getImageUri(mImagePath);
        mBitmap = getBitmap(mImagePath);
        if (extras.containsKey(ASPECT_X) && extras.get(ASPECT_X) instanceof Integer) {
            mAspectX = extras.getInt(ASPECT_X);
        } else {
            throw new IllegalArgumentException("aspect_x must be integer");
        }
        if (extras.containsKey(ASPECT_Y) && extras.get(ASPECT_Y) instanceof Integer) {
            mAspectY = extras.getInt(ASPECT_Y);
        } else {
            throw new IllegalArgumentException("aspect_y must be integer");
        }
        mOutputX = extras.getInt(OUTPUT_X);
        mOutputY = extras.getInt(OUTPUT_Y);
        mScale = extras.getBoolean(SCALE, true);
        mScaleUp = extras.getBoolean(SCALE_UP_IF_NEEDED, true);
    }
    if (mBitmap == null) {
        Log.d(TAG, "finish!!!");
        finish();
        return;
    }
    // Make UI fullscreen.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    findViewById(R.id.discard).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            setResult(RESULT_CANCELED);
            finish();
        }
    });
    findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            try {
                onSaveClicked();
            } catch (Exception e) {
                finish();
            }
        }
    });
    findViewById(R.id.rotateLeft).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            mBitmap = Util.rotateImage(mBitmap, -90);
            RotateBitmap rotateBitmap = new RotateBitmap(mBitmap);
            mImageView.setImageRotateBitmapResetBase(rotateBitmap, true);
            mRunFaceDetection.run();
        }
    });
    findViewById(R.id.rotateRight).setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            mBitmap = Util.rotateImage(mBitmap, 90);
            RotateBitmap rotateBitmap = new RotateBitmap(mBitmap);
            mImageView.setImageRotateBitmapResetBase(rotateBitmap, true);
            mRunFaceDetection.run();
        }
    });
    startFaceDetection();
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) View(android.view.View) IOException(java.io.IOException) SuppressLint(android.annotation.SuppressLint)

Example 54 with SuppressLint

use of android.annotation.SuppressLint in project Rashr by DsLNeXuS.

the class FlashFragment method onCreateView.

@SuppressLint("PrivateResource")
@SuppressWarnings("ResourceAsColor")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_rashr, container, false);
    /** Check if device uses unified builds */
    if (Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_SHOW_UNIFIED) && RashrApp.DEVICE.isUnified() && (!RashrApp.DEVICE.isStockRecoverySupported() || !RashrApp.DEVICE.isCwmRecoverySupported() || !RashrApp.DEVICE.isTwrpRecoverySupported() || !RashrApp.DEVICE.isPhilzRecoverySupported())) {
        showUnifiedBuildsDialog();
    }
    optimizeLayout(root);
    if (Common.getBooleanPref(mContext, Const.PREF_NAME, Const.PREF_KEY_CHECK_UPDATES) && RashrActivity.FirstSession) {
        catchUpdates();
        RashrActivity.FirstSession = false;
    }
    return root;
}
Also used : View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint)

Example 55 with SuppressLint

use of android.annotation.SuppressLint in project Rashr by DsLNeXuS.

the class FlashFragment method optimizeLayout.

/**
     * optimizeLayout checks which cards need to be added to UI. So if you device doesn't support
     * kernel flashing optimizeLayout will not add it to UI.
     *
     * @param root RootView from Fragment
     * @throws NullPointerException layout can't be inflated
     */
@SuppressLint("PrivateResource")
public void optimizeLayout(View root) throws NullPointerException {
    CardUI RashrCards = (CardUI) root.findViewById(R.id.RashrCards);
    if (RashrApp.DEVICE.isRecoverySupported() || RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
        /** If device is supported start setting up layout */
        setupSwipeUpdater(root);
        /** Avoid overlapping scroll on CardUI and SwipeRefreshLayout */
        RashrCards.getListView().setOnScrollListener(new AbsListView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
                int topRowVerticalPosition = (view == null || view.getChildCount() == 0) ? 0 : view.getChildAt(0).getTop();
                if (mSwipeUpdater != null)
                    mSwipeUpdater.setEnabled((topRowVerticalPosition >= 0));
            }
        });
        if (RashrApp.DEVICE.isRecoverySupported() || BuildConfig.DEBUG) {
            addRecoveryCards(RashrCards);
        }
        if (RashrApp.DEVICE.isKernelSupported() || BuildConfig.DEBUG) {
            addKernelCards(RashrCards);
        }
        //Device has been flashed over Rashr so you can choose previously used images
        if (getHistoryFiles().size() > 0) {
            final IconCard HistoryCard = new IconCard(getString(R.string.history), R.drawable.ic_history, getString(R.string.history_description));
            HistoryCard.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    showFlashHistory();
                }
            });
            RashrCards.addCard(HistoryCard, true);
        }
    }
    addRebooterCards(RashrCards);
}
Also used : CardUI(com.fima.cardsui.views.CardUI) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) IconCard(com.fima.cardsui.views.IconCard) 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