import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
-import android.view.ContextMenu;
-import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
-import java.util.Observable;
-import java.util.Observer;
public class MainActivity extends AppCompatActivity {
public MobileLedgerListFragment currentFragment = null;
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
- Data.profile.addObserver(new Observer() {
- @Override
- public void update(Observable o, Object arg) {
- MobileLedgerProfile profile = Data.profile.get();
- runOnUiThread(() -> {
- if (profile == null) toolbar.setSubtitle("");
- else toolbar.setSubtitle(profile.getName());
- });
- }
+ Data.profile.addObserver((o, arg) -> {
+ MobileLedgerProfile profile = Data.profile.get();
+ runOnUiThread(() -> {
+ if (profile == null) toolbar.setSubtitle("");
+ else toolbar.setSubtitle(profile.getName());
+ });
});
setupProfile();
if (profile == null) throw new AssertionError("profile must have a value");
- Data.profile.set(profile);
- MLDB.set_option_value(MLDB.OPT_PROFILE_UUID, profile.getUuid());
+ Data.setCurrentProfile(profile);
if (profile.getUrl().isEmpty()) {
Intent intent = new Intent(this, ProfileListActivity.class);
public void nav_settings_clicked(View view) {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
+ drawer.closeDrawers();
}
public void markDrawerItemCurrent(int id) {
TextView item = drawer.findViewById(id);
}
}
}
- public void onOptionsMenuClicked(MenuItem menuItem) {
- ContextMenu.ContextMenuInfo info = menuItem.getMenuInfo();
- switch (menuItem.getItemId()) {
- case R.id.menu_acc_summary_cancel_selection:
- if (accountSummaryFragment != null)
- accountSummaryFragment.onCancelAccSelection(menuItem);
- break;
- case R.id.menu_acc_summary_confirm_selection:
- if (accountSummaryFragment != null)
- accountSummaryFragment.onConfirmAccSelection(menuItem);
- break;
- case R.id.menu_acc_summary_only_starred:
- if (accountSummaryFragment != null)
- accountSummaryFragment.onShowOnlyStarredClicked(menuItem);
- break;
- case R.id.menu_transaction_list_filter:
- if (transactionListFragment != null)
- transactionListFragment.onShowFilterClick(menuItem);
- break;
- default:
- Log.e("menu", String.format("Menu item %d not handled", menuItem.getItemId()));
- }
- }
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.clearAccountNameFilter: