X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FProfileDetailActivity.java;h=7daa3d315cbfbd479970efb26fcbc3121c285c61;hb=a2299fe8eddcbf5577a1576f899ddc28c8df00d5;hp=f14a5b5aaa7b7bf3f08b12e70e615a015047b277;hpb=1738aee062f23cc9a69ed11cade1cb048f083def;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java index f14a5b5a..7daa3d31 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java @@ -19,6 +19,7 @@ package net.ktnx.mobileledger.ui.activity; import android.os.Bundle; import android.view.Menu; +import android.view.MenuItem; import androidx.appcompat.app.ActionBar; import androidx.appcompat.widget.Toolbar; @@ -62,7 +63,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 +94,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() @@ -103,5 +111,12 @@ public class ProfileDetailActivity extends CrashReportingActivity { return true; } - + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } }