import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.util.TypedValue;
+import android.view.ContextMenu;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
+import android.widget.Toast;
import java.util.Date;
import java.util.regex.Matcher;
private static long account_list_last_updated;
private static boolean account_list_needs_update = true;
+ private TableRow clickedAccountRow;
+
public static void preferences_changed() {
account_list_needs_update = true;
}
return acc_name;
}
+ public void hideAccountClicked(MenuItem item) {
+ TextView textView = (TextView) clickedAccountRow.getChildAt(0);
+ Toast.makeText(this, textView.getText(), Toast.LENGTH_SHORT).show();
+ }
+
@SuppressLint("DefaultLocale")
private void update_account_table() {
LinearLayout root = findViewById(R.id.account_root);
root.removeAllViewsInLayout();
+ View.OnCreateContextMenuListener ccml = new View.OnCreateContextMenuListener() {
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
+ clickedAccountRow = (TableRow) v;
+ getMenuInflater().inflate(R.menu.account_summary_account_menu, menu);
+ }
+ };
try (Cursor cursor = db.rawQuery("SELECT name FROM accounts ORDER BY name;", null)) {
boolean even = false;
TableRow r = new TableRow(this);
r.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
r.setGravity(Gravity.CENTER_VERTICAL);
- r.setPadding(getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(2), getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(4));
+ r.setPadding(getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(3), getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(4));
if (even)
r.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg, getTheme()));
even = !even;
+ r.setContextClickable(true);
+ r.setOnCreateContextMenuListener(ccml);
+
TextView acc_tv = new TextView(this, null, R.style.account_summary_account_name);
acc_tv.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 9f));
<string name="progress_N_accounts_loaded">Заредени са %d сметки</string>
<string name="action_submit_transaction_title">Запазване</string>
<string name="account_summary_title">Сметките накратко</string>
+ <string name="menu_hide_acc_condensed_title">Скриване</string>
+ <string name="menu_hide_acc_title">Скриване на сметката</string>
+ <string name="menu_acc_summary_refresh_title">Обновяване</string>
+ <string name="err_net_error">Мрежова грешка</string>
+ <string name="menu_acc_summary_show_hidden_accounts_title">Показване на скритите сметки</string>
</resources>
\ No newline at end of file