whatever
This commit is contained in:
		
							parent
							
								
									6d32b64e90
								
							
						
					
					
						commit
						b31edbb3df
					
				
					 4 changed files with 159 additions and 1 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								OlympusServices/.idea/caches/build_file_checksums.ser
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								OlympusServices/.idea/caches/build_file_checksums.ser
									
										
									
										generated
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -24,7 +24,7 @@ android {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dependencies {
 | 
					dependencies {
 | 
				
			||||||
    implementation fileTree(dir: 'libs', include: ['*.jar'])
 | 
					
 | 
				
			||||||
    implementation 'com.android.support:appcompat-v7:28.0.0'
 | 
					    implementation 'com.android.support:appcompat-v7:28.0.0'
 | 
				
			||||||
    implementation 'com.android.support:design:28.0.0'
 | 
					    implementation 'com.android.support:design:28.0.0'
 | 
				
			||||||
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 | 
					    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,69 @@
 | 
				
			||||||
 | 
					package com.uottawa.olympus.olympusservices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.app.AlertDialog;
 | 
				
			||||||
 | 
					import android.app.Dialog;
 | 
				
			||||||
 | 
					import android.content.Context;
 | 
				
			||||||
 | 
					import android.content.DialogInterface;
 | 
				
			||||||
 | 
					import android.os.Bundle;
 | 
				
			||||||
 | 
					import android.support.v4.app.DialogFragment;
 | 
				
			||||||
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
 | 
					import android.widget.EditText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class EditServiceDialogFragment extends DialogFragment{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface NoticeDialogListener {
 | 
				
			||||||
 | 
					    public void onDialogEdit(DialogFragment dialog);
 | 
				
			||||||
 | 
					    public void onDialogDelete(DialogFragment dialog);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    EditServiceDialogFragment.NoticeDialogListener mListener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onAttach(Context context) {
 | 
				
			||||||
 | 
					        super.onAttach(context);
 | 
				
			||||||
 | 
					        // Verify that the host activity implements the callback interface
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            // Instantiate the NoticeDialogListener so we can send events to the host
 | 
				
			||||||
 | 
					            mListener = (EditServiceDialogFragment.NoticeDialogListener) context;
 | 
				
			||||||
 | 
					        } catch (ClassCastException e) {
 | 
				
			||||||
 | 
					            // The activity doesn't implement the interface, throw exception
 | 
				
			||||||
 | 
					            throw new ClassCastException(this.toString()
 | 
				
			||||||
 | 
					                    + " must implement NoticeDialogListener");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Dialog onCreateDialog(Bundle savedInstanceState) {
 | 
				
			||||||
 | 
					        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
 | 
				
			||||||
 | 
					        // Get the layout inflater
 | 
				
			||||||
 | 
					        LayoutInflater inflater = getActivity().getLayoutInflater();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Inflate and set the layout for the dialog
 | 
				
			||||||
 | 
					        // Pass null as the parent view because its going in the dialog layout
 | 
				
			||||||
 | 
					        builder.setView(inflater.inflate(R.layout.dialog_service_edit, null))
 | 
				
			||||||
 | 
					                // Add action buttons
 | 
				
			||||||
 | 
					                .setPositiveButton(R.string.update, new DialogInterface.OnClickListener() {
 | 
				
			||||||
 | 
					                    @Override
 | 
				
			||||||
 | 
					                    public void onClick(DialogInterface dialog, int id) {
 | 
				
			||||||
 | 
					                        Bundle args = new Bundle();
 | 
				
			||||||
 | 
					                        //@anshu: get the name and rate to come from the dialog_service_new dialog
 | 
				
			||||||
 | 
					                        EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
 | 
				
			||||||
 | 
					                        double rate = Double.parseDouble(rateInput.getText().toString());
 | 
				
			||||||
 | 
					                        args.putDouble("rate", rate);
 | 
				
			||||||
 | 
					                        //EditServiceDialogFragment.this.setArguments(args);
 | 
				
			||||||
 | 
					                        mListener.onDialogEdit(EditServiceDialogFragment.this);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() {
 | 
				
			||||||
 | 
					                    public void onClick(DialogInterface dialog, int id) {
 | 
				
			||||||
 | 
					                        Bundle args = new Bundle();
 | 
				
			||||||
 | 
					                        //@anshu: get the name and rate to come from the dialog_service_new dialog
 | 
				
			||||||
 | 
					                        args.putString("name", (String)getArguments().get("name"));
 | 
				
			||||||
 | 
					                        //
 | 
				
			||||||
 | 
					                        EditServiceDialogFragment.this.setArguments(args);
 | 
				
			||||||
 | 
					                        mListener.onDialogDelete(EditServiceDialogFragment.this);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					        .setTitle((String)getArguments().get("name"));
 | 
				
			||||||
 | 
					        return builder.create();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,89 @@
 | 
				
			||||||
 | 
					package com.uottawa.olympus.olympusservices;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import android.app.AlertDialog;
 | 
				
			||||||
 | 
					import android.app.Dialog;
 | 
				
			||||||
 | 
					import android.content.Context;
 | 
				
			||||||
 | 
					import android.content.DialogInterface;
 | 
				
			||||||
 | 
					import android.content.res.Resources;
 | 
				
			||||||
 | 
					import android.os.Bundle;
 | 
				
			||||||
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
 | 
					import android.support.v4.app.DialogFragment;
 | 
				
			||||||
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
 | 
					import android.widget.EditText;
 | 
				
			||||||
 | 
					import android.view.View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.rengwuxian.materialedittext.MaterialEditText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class NewServiceDialogFragment extends DialogFragment {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public interface NoticeDialogListener {
 | 
				
			||||||
 | 
					        public void onDialogNew(DialogFragment dialog);
 | 
				
			||||||
 | 
					        public void onDialogNevermind(DialogFragment dialog);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    NoticeDialogListener mListener;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void onAttach(Context context) {
 | 
				
			||||||
 | 
					        super.onAttach(context);
 | 
				
			||||||
 | 
					        // Verify that the host activity implements the callback interface
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            // Instantiate the NoticeDialogListener so we can send events to the host
 | 
				
			||||||
 | 
					            mListener = (NoticeDialogListener) context;
 | 
				
			||||||
 | 
					        } catch (ClassCastException e) {
 | 
				
			||||||
 | 
					            // The activity doesn't implement the interface, throw exception
 | 
				
			||||||
 | 
					            throw new ClassCastException(this.toString()
 | 
				
			||||||
 | 
					                    + " must implement NoticeDialogListener");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //String name = ((EditText) view.findViewById(R.id.NameInput)).getText().toString();
 | 
				
			||||||
 | 
					    //int rate = Integer.parseInt(((EditText) view.findViewById(R.id.RateInput)).getText().toString())
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Dialog onCreateDialog(Bundle savedInstanceState) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
 | 
				
			||||||
 | 
					        // Get the layout inflater
 | 
				
			||||||
 | 
					        LayoutInflater inflater = getActivity().getLayoutInflater();
 | 
				
			||||||
 | 
					        View view = inflater.inflate(R.layout.dialog_service_new, null);
 | 
				
			||||||
 | 
					        builder.setView(view);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Inflate and set the layout for the dialog
 | 
				
			||||||
 | 
					        // Pass null as the parent view because its going in the dialog layout
 | 
				
			||||||
 | 
					        builder.setView(view)
 | 
				
			||||||
 | 
					                // Add action buttons
 | 
				
			||||||
 | 
					                .setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
 | 
				
			||||||
 | 
					                    @Override
 | 
				
			||||||
 | 
					                    public void onClick(DialogInterface dialog, int id) {
 | 
				
			||||||
 | 
					                        EditText nameInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.NameInput);
 | 
				
			||||||
 | 
					                        EditText rateInput = (EditText) ((AlertDialog) dialog).findViewById(R.id.RateInput);
 | 
				
			||||||
 | 
					                        String name = nameInput.getText().toString();
 | 
				
			||||||
 | 
					                        double rate = Double.parseDouble(rateInput.getText().toString());
 | 
				
			||||||
 | 
					                        Bundle args = new Bundle();
 | 
				
			||||||
 | 
					                        args.putString("name", name);
 | 
				
			||||||
 | 
					                        args.putDouble("rate", rate);
 | 
				
			||||||
 | 
					                        NewServiceDialogFragment.this.setArguments(args);
 | 
				
			||||||
 | 
					                        mListener.onDialogNew(NewServiceDialogFragment.this);
 | 
				
			||||||
 | 
					                        //@anshu: get the name and rate to come from the dialog_service_new dialog
 | 
				
			||||||
 | 
					                        dostuff();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
 | 
				
			||||||
 | 
					                    public void onClick(DialogInterface dialog, int id) {
 | 
				
			||||||
 | 
					                        NewServiceDialogFragment.this.getDialog().cancel();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					        return builder.create();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void dostuff(){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue