use of android.annotation.TargetApi in project FloatingActionButton by Clans.
the class FloatingActionButton method onActionDown.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionDown() {
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
} else if (Util.hasLollipop()) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] { android.R.attr.state_enabled, android.R.attr.state_pressed });
ripple.setHotspot(calculateCenterX(), calculateCenterY());
ripple.setVisible(true, true);
}
}
use of android.annotation.TargetApi in project FloatingActionButton by Clans.
the class FloatingActionButton method onActionUp.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionUp() {
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] { android.R.attr.state_enabled });
} else if (Util.hasLollipop()) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] { android.R.attr.state_enabled });
ripple.setHotspot(calculateCenterX(), calculateCenterY());
ripple.setVisible(true, true);
}
}
use of android.annotation.TargetApi in project FloatingActionButton by Clans.
the class Label method onActionUp.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void onActionUp() {
if (mUsingStyle) {
mBackgroundDrawable = getBackground();
}
if (mBackgroundDrawable instanceof StateListDrawable) {
StateListDrawable drawable = (StateListDrawable) mBackgroundDrawable;
drawable.setState(new int[] {});
} else if (Util.hasLollipop() && mBackgroundDrawable instanceof RippleDrawable) {
RippleDrawable ripple = (RippleDrawable) mBackgroundDrawable;
ripple.setState(new int[] {});
ripple.setHotspot(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
ripple.setVisible(true, true);
}
// setPressed(false);
}
use of android.annotation.TargetApi in project AndroidChromium by JackyAndroid.
the class NotificationBuilderBase method getActionBuilder.
// For Notification.Action.Builder
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
// For Builder(int, CharSequence, PendingIntent)
@SuppressWarnings("deprecation")
private static Notification.Action.Builder getActionBuilder(Action action) {
Notification.Action.Builder actionBuilder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && action.iconBitmap != null) {
// Icon was added in Android M.
Icon icon = Icon.createWithBitmap(action.iconBitmap);
actionBuilder = new Notification.Action.Builder(icon, action.title, action.intent);
} else {
actionBuilder = new Notification.Action.Builder(action.iconId, action.title, action.intent);
}
return actionBuilder;
}
use of android.annotation.TargetApi in project AndroidChromium by JackyAndroid.
the class IncognitoNotificationService method removeNonVisibleChromeTabbedRecentEntries.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void removeNonVisibleChromeTabbedRecentEntries() {
Set<Integer> visibleTaskIds = getTaskIdsForVisibleActivities();
Context context = ContextUtils.getApplicationContext();
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
PackageManager pm = getPackageManager();
for (AppTask task : manager.getAppTasks()) {
RecentTaskInfo info = DocumentUtils.getTaskInfoFromTask(task);
if (info == null)
continue;
String className = DocumentUtils.getTaskClassName(task, pm);
// close them to be on the cautious side of things.
if ((TextUtils.equals(className, ChromeTabbedActivity.class.getName()) || TextUtils.equals(className, ChromeLauncherActivity.class.getName())) && !visibleTaskIds.contains(info.id)) {
task.finishAndRemoveTask();
}
}
}
Aggregations