]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java
profile editor: offer a suitable color for new profiles
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / ProfileDetailActivity.java
index f14a5b5aaa7b7bf3f08b12e70e615a015047b277..323568b4ea9cdac4a339fe6b0512485f281ba413 100644 (file)
@@ -62,7 +62,13 @@ public class ProfileDetailActivity extends CrashReportingActivity {
         }
 
         super.onCreate(savedInstanceState);
-        Colors.setupTheme(this, profile);
+        int themeHue;
+        if (profile != null)
+            themeHue = profile.getThemeHue();
+        else {
+            themeHue = Colors.getNewProfileThemeHue(Data.profiles.getValue());
+        }
+        Colors.setupTheme(this, themeHue);
         setContentView(R.layout.activity_profile_detail);
         Toolbar toolbar = findViewById(R.id.detail_toolbar);
         setSupportActionBar(toolbar);
@@ -87,6 +93,7 @@ public class ProfileDetailActivity extends CrashReportingActivity {
             // using a fragment transaction.
             Bundle arguments = new Bundle();
             arguments.putInt(ProfileDetailFragment.ARG_ITEM_ID, index);
+            arguments.putInt(ProfileDetailFragment.ARG_HUE, themeHue);
             mFragment = new ProfileDetailFragment();
             mFragment.setArguments(arguments);
             getSupportFragmentManager().beginTransaction()