Search in sources :

Example 46 with TargetApi

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);
    }
}
Also used : StateListDrawable(android.graphics.drawable.StateListDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) TargetApi(android.annotation.TargetApi)

Example 47 with TargetApi

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);
    }
}
Also used : StateListDrawable(android.graphics.drawable.StateListDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) TargetApi(android.annotation.TargetApi)

Example 48 with TargetApi

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);
}
Also used : StateListDrawable(android.graphics.drawable.StateListDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) TargetApi(android.annotation.TargetApi)

Example 49 with TargetApi

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;
}
Also used : Icon(android.graphics.drawable.Icon) TargetApi(android.annotation.TargetApi)

Example 50 with TargetApi

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();
        }
    }
}
Also used : Context(android.content.Context) AppTask(android.app.ActivityManager.AppTask) RecentTaskInfo(android.app.ActivityManager.RecentTaskInfo) PackageManager(android.content.pm.PackageManager) ActivityManager(android.app.ActivityManager) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1365 Intent (android.content.Intent)153 View (android.view.View)147 Test (org.junit.Test)119 SuppressLint (android.annotation.SuppressLint)115 Uri (android.net.Uri)70 ArrayList (java.util.ArrayList)68 Animator (android.animation.Animator)67 Point (android.graphics.Point)64 Window (android.view.Window)56 TextView (android.widget.TextView)56 IOException (java.io.IOException)56 ViewGroup (android.view.ViewGroup)53 Matchers.anyString (org.mockito.Matchers.anyString)53 SharedPreferences (android.content.SharedPreferences)44 File (java.io.File)44 Field (java.lang.reflect.Field)44 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)43 Bitmap (android.graphics.Bitmap)42 ImageView (android.widget.ImageView)40