can no longer edit service name

This commit is contained in:
IvanaE 2018-11-01 20:30:03 -04:00
parent ea0e8bd7d1
commit 33611b8983
4 changed files with 12 additions and 21 deletions

View file

@ -45,7 +45,7 @@ public interface NoticeDialogListener {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
Bundle args = new Bundle(); Bundle args = new Bundle();
//@anshu: get the name and rate to come from the dialog_service_new dialog //@anshu: get the name and rate to come from the dialog_service_new dialog
args.putString("name", "hey"); args.putString("name", (String)getArguments().get("name"));
args.putDouble("rate", 2.5); args.putDouble("rate", 2.5);
// //
EditServiceDialogFragment.this.setArguments(args); EditServiceDialogFragment.this.setArguments(args);
@ -56,12 +56,13 @@ public interface NoticeDialogListener {
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
Bundle args = new Bundle(); Bundle args = new Bundle();
//@anshu: get the name and rate to come from the dialog_service_new dialog //@anshu: get the name and rate to come from the dialog_service_new dialog
args.putString("name", "hey"); args.putString("name", (String)getArguments().get("name"));
// //
EditServiceDialogFragment.this.setArguments(args); EditServiceDialogFragment.this.setArguments(args);
mListener.onDialogDelete(EditServiceDialogFragment.this); mListener.onDialogDelete(EditServiceDialogFragment.this);
} }
}); })
.setTitle((String)getArguments().get("name"));
return builder.create(); return builder.create();
} }
} }

View file

@ -53,9 +53,12 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF
DialogFragment newFragment = new NewServiceDialogFragment(); DialogFragment newFragment = new NewServiceDialogFragment();
newFragment.show(getSupportFragmentManager(), "addService"); newFragment.show(getSupportFragmentManager(), "addService");
} }
public void editService(View view) { public void editService(View view, String name) {
DialogFragment newFragment = new EditServiceDialogFragment(); DialogFragment newFragment = new EditServiceDialogFragment();
newFragment.show(getSupportFragmentManager(), "editService"); newFragment.show(getSupportFragmentManager(), "editService");
Bundle args = new Bundle();
args.putString("name", name);
newFragment.setArguments(args);
} }
//add new service //add new service
@Override @Override
@ -146,7 +149,9 @@ public class ServicesList extends AppCompatActivity implements NewServiceDialogF
} }
@Override @Override
public void onClick(View view) { public void onClick(View view) {
editService(view); TextView nameview = (TextView)view.findViewById(R.id.Name);
String name = nameview.getText().toString();
editService(view, name);
} }

View file

@ -50,7 +50,7 @@
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_weight="1" android:layout_weight="1"
android:text="Rate" android:text="Hourly Rate"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="15sp" /> android:textSize="15sp" />

View file

@ -5,21 +5,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
//component used from https://github.com/rengwuxian/MaterialEditText
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/NameInput"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="20dp"
android:hint="@string/servicename"
android:textCursorDrawable="@color/colorWhite"
android:textSize="15sp"
app:met_baseColor="@android:color/black"
app:met_floatingLabel="highlight"
app:met_primaryColor="@color/colorBlack"
app:met_singleLineEllipsis="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
//component used from https://github.com/rengwuxian/MaterialEditText //component used from https://github.com/rengwuxian/MaterialEditText
<com.rengwuxian.materialedittext.MaterialEditText <com.rengwuxian.materialedittext.MaterialEditText