final ui changes

This commit is contained in:
IvanaE 2018-11-09 23:32:40 -05:00
parent d5824827cf
commit 89985db38f
8 changed files with 21 additions and 8 deletions

View file

@ -61,7 +61,7 @@ public class EditServiceDialogFragment extends DialogFragment{
Bundle args = new Bundle();
args.putString("name", (String)getArguments().get("name"));
EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
if(rateInput.getText().toString().length()>0){
if(rateInput.getText().toString().length()>0 && !rateInput.getText().toString().equals(".")){
Double rate = Double.parseDouble(rateInput.getText().toString());
args.putDouble("rate", rate);

View file

@ -79,7 +79,7 @@ public class NewServiceDialogFragment extends DialogFragment {
EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
String name = nameInput.getText().toString();
DBHelper dbHelper = new DBHelper(getContext());
if (rateInput.getText().toString().length()>0 && name.length()>0 && name.matches("[a-zA-Z]*")&& dbHelper.findService(name)==null){
if (rateInput.getText().toString().length()>0 && !rateInput.getText().toString().equals(".") && name.length()>0 && name.matches("[a-zA-Z]*")&& dbHelper.findService(name)==null){
Double rate = Double.parseDouble(rateInput.getText().toString());
Bundle args = new Bundle();
args.putString("name", name);
@ -87,7 +87,7 @@ public class NewServiceDialogFragment extends DialogFragment {
NewServiceDialogFragment.this.setArguments(args);
mListener.onDialogNew(NewServiceDialogFragment.this);
}
else if(!(rateInput.getText().toString().length()>0) || !(name.length()>0)|| !name.matches("[a-zA-Z]*")){
else if(!(rateInput.getText().toString().length()>0) || !(name.length()>0)|| !name.matches("[a-zA-Z]*") || !rateInput.getText().toString().equals(".")){
Toast.makeText(getContext(), "Service must have an alphanumeric name and a rate", Toast.LENGTH_LONG).show();
}
else{

View file

@ -176,7 +176,7 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF
public void onBindViewHolder(ServicesHolder holder, int position) {
Service service = services[position];
holder.name.setText(service.getName());
holder.rate.setText(""+service.getRate());
holder.rate.setText(String.format("$%,.2f", service.getRate()));

View file

@ -23,6 +23,7 @@
android:id="@+id/Title1"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
@ -38,7 +39,9 @@
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="Hourly Rate($)"
android:text="Hourly Rate"
android:gravity="end"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white"
android:textSize="15sp" />

View file

@ -12,6 +12,13 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/background"
tools:context=".SignUp">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/Title"
@ -104,5 +111,7 @@
android:onClick="onClickSignUp"
android:text="@string/signup"
android:theme="@style/AppTheme.Button" />
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -23,6 +23,7 @@
<TextView
android:id="@+id/Rate"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:layout_width="wrap_content"
@ -31,5 +32,5 @@
android:text=""
android:textColor="@color/colorBlack"
android:textSize="15sp"
android:gravity="center"/>
android:gravity="end"/>
</LinearLayout>

View file

@ -1,7 +1,7 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light">
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>