Search in sources :

Example 56 with IconCompat

use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiSlice method getLoadingRow.

private ListBuilder.RowBuilder getLoadingRow(CharSequence placeholder) {
    final CharSequence title = mContext.getText(R.string.wifi_empty_list_wifi_on);
    // for aligning to the Wi-Fi AP's name
    final IconCompat emptyIcon = Utils.createIconWithDrawable(new ColorDrawable(Color.TRANSPARENT));
    return new ListBuilder.RowBuilder().setTitleItem(emptyIcon, ListBuilder.ICON_IMAGE).setTitle(placeholder).setSubtitle(title);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) IconCompat(androidx.core.graphics.drawable.IconCompat) ListBuilder(androidx.slice.builders.ListBuilder)

Example 57 with IconCompat

use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiSlice method getAccessPointRow.

private ListBuilder.RowBuilder getAccessPointRow(AccessPoint accessPoint) {
    final boolean isCaptivePortal = accessPoint.isActive() && isCaptivePortal();
    final CharSequence title = accessPoint.getTitle();
    final CharSequence summary = getAccessPointSummary(accessPoint, isCaptivePortal);
    final IconCompat levelIcon = getAccessPointLevelIcon(accessPoint);
    final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder().setTitleItem(levelIcon, ListBuilder.ICON_IMAGE).setTitle(title).setSubtitle(summary).setPrimaryAction(getAccessPointAction(accessPoint, isCaptivePortal, levelIcon, title));
    if (isCaptivePortal) {
        rowBuilder.addEndItem(getCaptivePortalEndAction(accessPoint, title));
    } else {
        final IconCompat endIcon = getEndIcon(accessPoint);
        if (endIcon != null) {
            rowBuilder.addEndItem(endIcon, ListBuilder.ICON_IMAGE);
        }
    }
    return rowBuilder;
}
Also used : IconCompat(androidx.core.graphics.drawable.IconCompat) ListBuilder(androidx.slice.builders.ListBuilder)

Example 58 with IconCompat

use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UtilsTest method createIconWithDrawable_VectorDrawable.

@Test
public void createIconWithDrawable_VectorDrawable() {
    final VectorDrawable drawable = VectorDrawable.create(mContext.getResources(), R.drawable.ic_settings_accent);
    final IconCompat icon = Utils.createIconWithDrawable(drawable);
    assertThat(icon.getBitmap()).isNotNull();
}
Also used : IconCompat(androidx.core.graphics.drawable.IconCompat) VectorDrawable(android.graphics.drawable.VectorDrawable) Test(org.junit.Test)

Example 59 with IconCompat

use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UtilsTest method createIconWithDrawable_BitmapDrawable.

@Test
public void createIconWithDrawable_BitmapDrawable() {
    final Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
    final BitmapDrawable drawable = new BitmapDrawable(mContext.getResources(), bitmap);
    final IconCompat icon = Utils.createIconWithDrawable(drawable);
    assertThat(icon.getBitmap()).isNotNull();
}
Also used : Bitmap(android.graphics.Bitmap) IconCompat(androidx.core.graphics.drawable.IconCompat) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Test(org.junit.Test)

Example 60 with IconCompat

use of androidx.core.graphics.drawable.IconCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UtilsTest method createIconWithDrawable_ColorDrawable.

@Test
public void createIconWithDrawable_ColorDrawable() {
    final ColorDrawable drawable = new ColorDrawable(Color.BLACK);
    final IconCompat icon = Utils.createIconWithDrawable(drawable);
    assertThat(icon.getBitmap()).isNotNull();
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) IconCompat(androidx.core.graphics.drawable.IconCompat) Test(org.junit.Test)

Aggregations

IconCompat (androidx.core.graphics.drawable.IconCompat)103 ListBuilder (androidx.slice.builders.ListBuilder)55 PendingIntent (android.app.PendingIntent)42 SliceAction (androidx.slice.builders.SliceAction)39 Test (org.junit.Test)25 ColorInt (android.annotation.ColorInt)22 RowBuilder (androidx.slice.builders.ListBuilder.RowBuilder)21 SliceMetadata (androidx.slice.SliceMetadata)18 SliceAction (androidx.slice.core.SliceAction)18 Intent (android.content.Intent)15 Slice (androidx.slice.Slice)14 Drawable (android.graphics.drawable.Drawable)7 ShortcutInfoCompat (androidx.core.content.pm.ShortcutInfoCompat)7 SliceItem (androidx.slice.SliceItem)6 ColorDrawable (android.graphics.drawable.ColorDrawable)5 Bitmap (android.graphics.Bitmap)4 SpannableString (android.text.SpannableString)4 PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)4 Resources (android.content.res.Resources)3 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)3