code refactor

This commit is contained in:
h4h13 2018-08-05 22:02:54 +05:30
parent 31467c9b5f
commit b046c85d78

View file

@ -12,21 +12,23 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import com.afollestad.materialdialogs.color.ColorChooserDialog;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.ui.fragments.settings.MainSettingsFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
import com.afollestad.materialdialogs.color.ColorChooserDialog;
public class SettingsActivity extends AbsBaseActivity implements ColorChooserDialog.ColorCallback {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
@ -34,7 +36,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
@BindView(R.id.detail_content_frame)
@Nullable
FrameLayout detailsFrame;
private FragmentManager fragmentManager = getSupportFragmentManager();
@Override
@ -77,17 +78,19 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
setupToolbar();
if (bundle == null) {
fragmentManager.beginTransaction().replace(R.id.content_frame, new MainSettingsFragment()).commit();
fragmentManager.beginTransaction().replace(R.id.content_frame, new MainSettingsFragment())
.commit();
} else {
restoreFragment();
}
}
private void setupToolbar() {
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
int primaryColor = ThemeStore.primaryColor(this);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(R.string.action_settings);
setTitle(R.string.app_name);
setSupportActionBar(toolbar);
}