mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
parse color in try/catch block
This commit is contained in:
parent
350d54f614
commit
9bdaf17b81
2 changed files with 6 additions and 4 deletions
|
@ -778,8 +778,10 @@ public class ExtendedListFragment extends Fragment
|
|||
getContext().getContentResolver());
|
||||
OCCapability capability = storageManager.getCapability(account.name);
|
||||
|
||||
if (capability != null && !capability.getServerColor().isEmpty()) {
|
||||
try {
|
||||
primaryColor = Color.parseColor(capability.getServerColor());
|
||||
} catch (Exception e) {
|
||||
primaryColor = getResources().getColor(R.color.primary);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -728,7 +728,7 @@ public class DisplayUtils {
|
|||
public static String getDefaultDisplayNameForRootFolder() {
|
||||
OCCapability capability = getCapability();
|
||||
|
||||
if (capability.getServerSlogan().isEmpty()) {
|
||||
if (capability.getServerSlogan() == null || capability.getServerSlogan().isEmpty()) {
|
||||
return MainApp.getAppContext().getResources().getString(R.string.default_display_name_for_root_folder);
|
||||
} else {
|
||||
return capability.getServerSlogan();
|
||||
|
@ -769,9 +769,9 @@ public class DisplayUtils {
|
|||
public static int primaryDarkColor() {
|
||||
OCCapability capability = getCapability();
|
||||
|
||||
if (!capability.getServerColor().isEmpty()) {
|
||||
try {
|
||||
return adjustLightness(-0.2f, Color.parseColor(capability.getServerColor()));
|
||||
} else {
|
||||
} catch (Exception e) {
|
||||
return MainApp.getAppContext().getResources().getColor(R.color.primary_dark);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue