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;
}
}
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();
}
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();
}
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;
}
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);
}
Aggregations