public static void preferences_changed() {
account_list_needs_update = true;
}
+ MenuItem mRefresh;
@Override
protected void onCreate(Bundle savedInstanceState) {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
- //getMenuInflater().inflate(R.menu.latest_transactions, menu);
+ getMenuInflater().inflate(R.menu.account_summary, menu);
+ mRefresh = (MenuItem) menu.findItem(R.id.menu_acc_summary_refresh);
+ assert mRefresh != null;
return true;
}
return super.onOptionsItemSelected(item);
}
+ public void onRefreshAccountSummaryClicked(MenuItem mi) {
+ update_accounts(true);
+ }
+
private void prepare_db() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
MobileLedgerDB.setDb_filename(this.getApplicationInfo().deviceProtectedDataDir + "/" + MobileLedgerDB.DATABASE_NAME);
}
private void update_accounts() {
+ mRefresh.setVisible(false);
Resources rm = getResources();
ProgressBar pb = findViewById(R.id.progressBar);
protected void onPostExecute(Void result) {
pb.setVisibility(GONE);
pt.setVisibility(GONE);
+ mRefresh.setVisible(true);
if (this.error != 0)
Snackbar.make(drawer, rm.getString(this.error), Snackbar.LENGTH_LONG );
else
--- /dev/null
+<vector android:height="24dp" android:tint="#EEEEEE"
+ android:viewportHeight="24.0" android:viewportWidth="24.0"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="#FF000000" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
+</vector>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/menu_acc_summary_refresh"
+ android:icon="@drawable/ic_refresh_white_24dp"
+ android:title="@string/menu_acc_summary_refresh_title"
+ android:onClick="onRefreshAccountSummaryClicked"
+ app:showAsAction="ifRoom" />
+</menu>
\ No newline at end of file
<string name="new_transaction_description_hint">Description</string>
<string name="action_submit_transaction_title">Save</string>
<string name="account_summary_title">Account Summary</string>
+ <string name="menu_acc_summary_refresh_title">Refresh</string>
</resources>