import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
-import android.support.design.widget.FloatingActionButton;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.view.GravityCompat;
-import android.support.v4.view.ViewPager;
-import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarDrawerToggle;
-import android.support.v7.widget.Toolbar;
+import com.google.android.material.floatingactionbutton.FloatingActionButton;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
+import androidx.core.view.GravityCompat;
+import androidx.viewpager.widget.ViewPager;
+import androidx.drawerlayout.widget.DrawerLayout;
+import androidx.appcompat.app.ActionBarDrawerToggle;
+import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setSubtitle(R.string.profile_subitlte_read_only);
fab.hide();
}
+
+ int newProfileTheme = profile.getThemeId();
+ if (newProfileTheme != Colors.profileThemeId) {
+ Log.d("profiles", String.format("profile theme %d → %d", Colors.profileThemeId,
+ newProfileTheme));
+ profileThemeChanged();
+ Colors.profileThemeId = newProfileTheme;
+ }
});
});
findViewById(R.id.btn_add_transaction).setOnClickListener(this::fabNewTransactionClicked);
}
+ private void profileThemeChanged() {
+ setupProfileColors();
+
+ // restart activity to reflect theme change
+ finish();
+ Intent intent = new Intent(this, this.getClass());
+ startActivity(intent);
+ }
@Override
protected void onResume() {
super.onResume();
Intent intent = new Intent(this, ProfileListActivity.class);
startActivity(intent);
}
+ public void fabShouldShow() {
+ MobileLedgerProfile profile = Data.profile.get();
+ if ((profile != null) && profile.isPostingPermitted()) fab.show();
+ }
+
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
return 2;
}
}
- public void fabShouldShow() {
- MobileLedgerProfile profile = Data.profile.get();
- if ((profile != null) && profile.isPostingPermitted()) fab.show();
- }
}