Search in sources :

Example 46 with AnimatedVectorDrawable

use of android.graphics.drawable.AnimatedVectorDrawable in project android_frameworks_base by ResurrectionRemix.

the class AnimatedVectorDrawableAttr method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animated_vector_drawable_attr);
    ImageView avdIv = (ImageView) findViewById(R.id.avd);
    AnimatedVectorDrawable avd = (AnimatedVectorDrawable) avdIv.getDrawable();
    avd.start();
}
Also used : ImageView(android.widget.ImageView) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Example 47 with AnimatedVectorDrawable

use of android.graphics.drawable.AnimatedVectorDrawable in project android_frameworks_base by ResurrectionRemix.

the class AnimatedVectorDrawableDupPerf method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    GridLayout container = new GridLayout(this);
    scrollView.addView(container);
    container.setColumnCount(5);
    Resources res = this.getResources();
    container.setBackgroundColor(0xFF888888);
    AnimatedVectorDrawable[] d = new AnimatedVectorDrawable[icon.length];
    long time = android.os.SystemClock.elapsedRealtimeNanos();
    for (int i = 0; i < icon.length; i++) {
        d[i] = create(res, icon[i]);
    }
    time = android.os.SystemClock.elapsedRealtimeNanos() - time;
    TextView t = new TextView(this);
    DecimalFormat df = new DecimalFormat("#.##");
    t.setText("avgL=" + df.format(time / (icon.length * 1000000.)) + " ms");
    container.addView(t);
    time = android.os.SystemClock.elapsedRealtimeNanos();
    for (int i = 0; i < icon.length; i++) {
        Button button = new Button(this);
        button.setWidth(200);
        button.setBackgroundResource(icon[i]);
        container.addView(button);
    }
    setContentView(scrollView);
    time = android.os.SystemClock.elapsedRealtimeNanos() - time;
    t = new TextView(this);
    t.setText("avgS=" + df.format(time / (icon.length * 1000000.)) + " ms");
    container.addView(t);
}
Also used : GridLayout(android.widget.GridLayout) ScrollView(android.widget.ScrollView) Button(android.widget.Button) DecimalFormat(java.text.DecimalFormat) TextView(android.widget.TextView) Resources(android.content.res.Resources) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Example 48 with AnimatedVectorDrawable

use of android.graphics.drawable.AnimatedVectorDrawable in project android_frameworks_base by ResurrectionRemix.

the class AnimatedVectorDrawableTest method onClick.

@Override
public void onClick(View v) {
    AnimatedVectorDrawable d = (AnimatedVectorDrawable) v.getBackground();
    d.start();
}
Also used : AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Example 49 with AnimatedVectorDrawable

use of android.graphics.drawable.AnimatedVectorDrawable in project android_frameworks_base by ResurrectionRemix.

the class RecentPanelView method setVisibility.

/**
     * Set correct visibility states for the listview and the empty recent icon.
     */
private void setVisibility() {
    mEmptyRecentView.setVisibility((mCardAdapter.getItemCount() == 0) ? View.VISIBLE : View.GONE);
    mCardRecyclerView.setVisibility((mCardAdapter.getItemCount() == 0) ? View.GONE : View.VISIBLE);
    if (mEmptyRecentView.getDrawable() instanceof AnimatedVectorDrawable) {
        AnimatedVectorDrawable vd = (AnimatedVectorDrawable) mEmptyRecentView.getDrawable();
        if (mCardAdapter.getItemCount() == 0) {
            vd.start();
        } else {
            vd.stop();
        }
    }
    mController.updateMemoryStatus();
}
Also used : AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Example 50 with AnimatedVectorDrawable

use of android.graphics.drawable.AnimatedVectorDrawable in project android_frameworks_base by ResurrectionRemix.

the class RecentPanelView method removeApplication.

/**
     * Remove requested application.
     */
private void removeApplication(TaskDescription td) {
    if (DEBUG)
        Log.v(TAG, "Jettison " + td.getLabel());
    // Kill the actual app and send accessibility event.
    final ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
    if (am != null) {
        am.removeTask(td.persistentTaskId);
        // Accessibility feedback
        mCardRecyclerView.setContentDescription(mContext.getString(R.string.accessibility_recents_item_dismissed, td.getLabel()));
        mCardRecyclerView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
        mCardRecyclerView.setContentDescription(null);
        // Remove app from task and expanded state list.
        removeExpandedTaskState(td.identifier);
    }
    // All apps were removed? Close recents panel.
    if (mCardAdapter.getItemCount() == 0) {
        if (!(mEmptyRecentView.getDrawable() instanceof AnimatedVectorDrawable)) {
            setVisibility();
        }
        exit();
    }
    mController.updateMemoryStatus();
}
Also used : ActivityManager(android.app.ActivityManager) AnimatedVectorDrawable(android.graphics.drawable.AnimatedVectorDrawable)

Aggregations

AnimatedVectorDrawable (android.graphics.drawable.AnimatedVectorDrawable)56 Drawable (android.graphics.drawable.Drawable)18 TextView (android.widget.TextView)9 Resources (android.content.res.Resources)8 Button (android.widget.Button)8 GridLayout (android.widget.GridLayout)8 ScrollView (android.widget.ScrollView)8 SuppressLint (android.annotation.SuppressLint)5 ColorDrawable (android.graphics.drawable.ColorDrawable)5 InsetDrawable (android.graphics.drawable.InsetDrawable)5 ImageView (android.widget.ImageView)5 Paint (android.graphics.Paint)4 Animatable2 (android.graphics.drawable.Animatable2)4 BitmapDrawable (android.graphics.drawable.BitmapDrawable)4 LayerDrawable (android.graphics.drawable.LayerDrawable)4 AttributeSet (android.util.AttributeSet)4 IOException (java.io.IOException)4 DecimalFormat (java.text.DecimalFormat)4 XmlPullParser (org.xmlpull.v1.XmlPullParser)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)4