Merge branch 'lBranch'
# Conflicts: # OlympusServices/.idea/caches/build_file_checksums.ser # OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/EditServiceDialogFragment.java # OlympusServices/app/src/main/java/com/uottawa/olympus/olympusservices/NewServiceDialogFragment.java
This commit is contained in:
		
						commit
						4520816740
					
				
					 4 changed files with 32 additions and 11 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 {
 | 
			
		||||
    implementation fileTree(dir: 'libs', include: ['*.jar'])
 | 
			
		||||
 | 
			
		||||
    implementation 'com.android.support:appcompat-v7:28.0.0'
 | 
			
		||||
    implementation 'com.android.support:design:28.0.0'
 | 
			
		||||
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@ 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{
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,10 +45,11 @@ public interface NoticeDialogListener {
 | 
			
		|||
                    @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
 | 
			
		||||
                        args.putString("name", (String)getArguments().get("name"));
 | 
			
		||||
                        args.putDouble("rate", 2.5);
 | 
			
		||||
                        //
 | 
			
		||||
                        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);
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			@ -55,9 +57,8 @@ public interface NoticeDialogListener {
 | 
			
		|||
                .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);
 | 
			
		||||
                    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,8 +8,19 @@ import android.os.Bundle;
 | 
			
		|||
import android.support.v4.app.DialogFragment;
 | 
			
		||||
import android.view.LayoutInflater;
 | 
			
		||||
 | 
			
		||||
import android.content.res.Resources;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.support.annotation.NonNull;
 | 
			
		||||
import android.support.annotation.Nullable;
 | 
			
		||||
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);
 | 
			
		||||
| 
						 | 
				
			
			@ -30,26 +41,35 @@ public class NewServiceDialogFragment extends DialogFragment {
 | 
			
		|||
                    + " 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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        // 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_new, null))
 | 
			
		||||
        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();
 | 
			
		||||
                        //@anshu: get the name and rate to come from the dialog_service_new dialog
 | 
			
		||||
                        args.putString("name", "test2");
 | 
			
		||||
                        args.putDouble("rate", 2.5);
 | 
			
		||||
                        ///
 | 
			
		||||
                        args.putString("name", name);
 | 
			
		||||
                        args.putDouble("rate", rate);
 | 
			
		||||
                        NewServiceDialogFragment.this.setArguments(args);
 | 
			
		||||
                        mListener.onDialogNew(NewServiceDialogFragment.this);
 | 
			
		||||
            
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue