import android.support.v4.app.DialogFragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
+import android.text.InputType;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.widget.AutoCompleteTextView;
+import android.widget.EditText;
+import android.widget.TableLayout;
+import android.widget.TableRow;
import java.util.Objects;
}
public void addTransactionAccountFromMenu(MenuItem item) {
- Snackbar.make(getCurrentFocus(), "Not implemented yet", Snackbar.LENGTH_LONG)
- .setAction("Action", null).show();
+ final AutoCompleteTextView acc = new AutoCompleteTextView(this);
+ acc.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 9f));
+ acc.setHint(R.string.new_transaction_account_hint);
+ acc.setWidth(0);
+
+ final EditText amt = new EditText(this);
+ amt.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, 1f));
+ amt.setHint(R.string.new_transaction_amount_hint);
+ amt.setWidth(0);
+ amt.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL );
+ amt.setMinWidth(64);
+ amt.setTextAlignment(EditText.TEXT_ALIGNMENT_VIEW_END);
+
+ final TableLayout table = findViewById(R.id.new_transaction_accounts_table);
+ final TableRow row = new TableRow(this);
+ row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
+ row.addView(acc);
+ row.addView(amt);
+ table.addView(row);
}
}
android:textAlignment="center" />
<TableLayout
+ android:id="@+id/new_transaction_accounts_table"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="end"
android:layout_weight="1"
android:width="0dp"
- android:minWidth="36pt"
- android:ems="10"
- android:gravity="end"
android:hint="@string/new_transaction_amount_hint"
android:inputType="numberDecimal|numberSigned"
+ android:minWidth="24pt"
android:textAlignment="viewEnd" />
</TableRow>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="end"
android:layout_weight="1"
android:width="0dp"
- android:minWidth="36pt"
- android:ems="10"
- android:gravity="end"
android:hint="@string/new_transaction_amount_hint"
android:inputType="numberDecimal|numberSigned"
+ android:minWidth="24pt"
android:textAlignment="viewEnd" />
</TableRow>