added badges for profile
fixed icon not showing when just added a profile suppressed some annoying warnings
This commit is contained in:
@@ -52,7 +52,7 @@ android {
|
||||
applicationId "com.idlegandalf.ledd"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 23
|
||||
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 5
|
||||
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 50
|
||||
versionName "1.0.4-SNAPSHOT"
|
||||
archivesBaseName = "LedD-" + versionName + "-" + versionCode
|
||||
manifestPlaceholders = [HOCKEYAPP_APP_ID: "7febd1d2266a4f0c81667ca4e3d11fd3"]
|
||||
|
@@ -150,7 +150,12 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
|
||||
)
|
||||
.addDrawerItems(
|
||||
new DividerDrawerItem(),
|
||||
menuProfiles = new PrimaryDrawerItem().withName("Profiles").withIcon(R.drawable.ic_save_black_48dp).withSelectable(false).withIsExpanded(true)
|
||||
menuProfiles = new PrimaryDrawerItem()
|
||||
.withName("Profiles")
|
||||
.withIcon(R.drawable.ic_save_black_48dp)
|
||||
.withSelectable(false)
|
||||
.withIsExpanded(true)
|
||||
.withBadgeStyle(new BadgeStyle().withColor(Color.CYAN).withTextColor(Color.WHITE))
|
||||
)
|
||||
.build();
|
||||
|
||||
@@ -347,13 +352,14 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
|
||||
profiles.add(profile);
|
||||
|
||||
List<IDrawerItem> subProfiles = menuProfiles.getSubItems();
|
||||
subProfiles.add(0, new SecondaryDrawerItem().withName(profile.getName()).withSelectable(false).withTag(profile.getValues()));
|
||||
subProfiles.add(0, new SecondaryDrawerItem().withName(profile.getName()).withSelectable(false).withTag(profile.getValues()).withIcon(R.drawable.ic_save_black_48dp));
|
||||
|
||||
menuProfiles.withSubItems(subProfiles);
|
||||
menuProfiles.withSubItems(subProfiles).withIsExpanded(true).withBadge(String.valueOf(profiles.size()));
|
||||
mDrawer.updateItem(menuProfiles);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecated")
|
||||
public void refreshStripes() {
|
||||
if (isRefreshRunning)
|
||||
return;
|
||||
@@ -410,11 +416,13 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
|
||||
|
||||
nDaemonMenu.withSubItems(mStripes);
|
||||
nDaemonMenu.withBadge(String.valueOf(mStripes.size()));
|
||||
//noinspection deprecation
|
||||
nDaemonMenu.withBadgeStyle(new BadgeStyle().withColor(getResources().getColor(R.color.material_drawer_accent)).withTextColor(Color.WHITE));
|
||||
mDrawer.updateItem(nDaemonMenu);
|
||||
if (selectedItemId != -1)
|
||||
mDrawer.setSelection(selectedItemId);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
Snackbar.make(findViewById(android.R.id.content), R.string.snackbar_stripes_reloaded, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
@@ -456,6 +464,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
|
||||
|
||||
@Override
|
||||
public void onGetFailed(int code, String message) {
|
||||
//noinspection ConstantConditions
|
||||
Snackbar.make(findViewById(android.R.id.content), getString(R.string.snackbar_no_connection_stripes) + message, Snackbar
|
||||
.LENGTH_LONG).show();
|
||||
|
||||
@@ -463,6 +472,7 @@ public class ColorActivity extends AppCompatActivity implements Drawer.OnDrawerI
|
||||
|
||||
@Override
|
||||
public void onConnectionFailed(String message) {
|
||||
//noinspection ConstantConditions
|
||||
Snackbar.make(findViewById(android.R.id.content), getString(R.string.snackbar_connection_failed) + message, Snackbar
|
||||
.LENGTH_LONG).show();
|
||||
}
|
||||
|
Reference in New Issue
Block a user