X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FProfileDetailActivity.java;h=a1bc5cf7014b159894764761b3b21b827d5a61f6;hp=ccdad2c7115504c1ce1b32cfb5c63818ee7aaee1;hb=e975cffd3885678f30f69d09fbc99905c3118588;hpb=aef5271787fb3b91b74a93efb48c569df0de6575 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 ccdad2c7..a1bc5cf7 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 @@ -17,23 +17,23 @@ package net.ktnx.mobileledger.ui.activity; -import android.content.Intent; import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.Snackbar; -import android.support.v7.app.ActionBar; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.snackbar.Snackbar; + import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.model.MobileLedgerProfile; -import net.ktnx.mobileledger.ui.activity.CrashReportingActivity; -import net.ktnx.mobileledger.ui.activity.ProfileListActivity; import net.ktnx.mobileledger.ui.profiles.ProfileDetailFragment; +import net.ktnx.mobileledger.utils.Colors; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.widget.Toolbar; /** * An activity representing a single Profile detail screen. This @@ -42,10 +42,22 @@ import net.ktnx.mobileledger.ui.profiles.ProfileDetailFragment; * in a {@link ProfileListActivity}. */ public class ProfileDetailActivity extends CrashReportingActivity { - private MobileLedgerProfile profile; + private MobileLedgerProfile profile = null; @Override protected void onCreate(Bundle savedInstanceState) { + final int index = getIntent().getIntExtra(ProfileDetailFragment.ARG_ITEM_ID, -1); + + if (index != -1) { + profile = Data.profiles.get(index); + if (profile == null) throw new AssertionError( + String.format("Can't get profile " + "(index:%d) from the global list", index)); + + Log.d("profiles", String.format("Editing profile %s (%s); hue=%d", profile.getName(), + profile.getUuid(), profile.getThemeId())); + } + super.onCreate(savedInstanceState); + Colors.setupTheme(this, profile); setContentView(R.layout.activity_profile_detail); Toolbar toolbar = findViewById(R.id.detail_toolbar); setSupportActionBar(toolbar); @@ -75,15 +87,6 @@ public class ProfileDetailActivity extends CrashReportingActivity { // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { - final int index = getIntent().getIntExtra(ProfileDetailFragment.ARG_ITEM_ID, -1); - - if (index != -1) { - profile = Data.profiles.get(index); - if (profile == null) throw new AssertionError( - String.format("Can't get profile " + "(index:%d) from the global list", - index)); - } - // Create the detail fragment and add it to the activity // using a fragment transaction. Bundle arguments = new Bundle(); @@ -117,19 +120,4 @@ public class ProfileDetailActivity extends CrashReportingActivity { return true; } - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); - if (id == android.R.id.home) { - // This ID represents the Home or Up button. In the case of this - // activity, the Up button is shown. For - // more details, see the Navigation pattern on Android Design: - // - // http://developer.android.com/design/patterns/navigation.html#up-vs-back - // - navigateUpTo(new Intent(this, ProfileListActivity.class)); - return true; - } - return super.onOptionsItemSelected(item); - } }