Feat(main activity): Wireframing 2/2
This commit is contained in:
		@@ -0,0 +1,40 @@
 | 
			
		||||
package com.example.coen390_assignment2.Views;
 | 
			
		||||
 | 
			
		||||
import android.app.Dialog;
 | 
			
		||||
import android.content.DialogInterface;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.view.LayoutInflater;
 | 
			
		||||
 | 
			
		||||
import androidx.annotation.NonNull;
 | 
			
		||||
import androidx.appcompat.app.AlertDialog;
 | 
			
		||||
import androidx.fragment.app.DialogFragment;
 | 
			
		||||
 | 
			
		||||
import com.example.coen390_assignment2.R;
 | 
			
		||||
 | 
			
		||||
public class InsertProfileDialogFragment extends DialogFragment {
 | 
			
		||||
 | 
			
		||||
    @NonNull
 | 
			
		||||
    @Override
 | 
			
		||||
    public Dialog onCreateDialog(Bundle savedInstanceState) {
 | 
			
		||||
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
 | 
			
		||||
        // Get the layout inflater.
 | 
			
		||||
        LayoutInflater inflater = requireActivity().getLayoutInflater();
 | 
			
		||||
 | 
			
		||||
        // Inflate and set the layout for the dialog.
 | 
			
		||||
        // Pass null as the parent view because it's going in the dialog layout.
 | 
			
		||||
        builder.setView(inflater.inflate(R.layout.dialog_profile_create, null))
 | 
			
		||||
                // Add action buttons
 | 
			
		||||
                .setPositiveButton(R.string.save_text_dialog_fragment, new DialogInterface.OnClickListener() {
 | 
			
		||||
                    @Override
 | 
			
		||||
                    public void onClick(DialogInterface dialog, int id) {
 | 
			
		||||
                        // Sign in the user.
 | 
			
		||||
                    }
 | 
			
		||||
                })
 | 
			
		||||
                .setNegativeButton(R.string.cancel_text_dialog_fragment, new DialogInterface.OnClickListener() {
 | 
			
		||||
                    public void onClick(DialogInterface dialog, int id) {
 | 
			
		||||
                        InsertProfileDialogFragment.this.getDialog().cancel();
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
        return builder.create();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,12 @@
 | 
			
		||||
package com.example.coen390_assignment2.Views;
 | 
			
		||||
 | 
			
		||||
import androidx.appcompat.app.AppCompatActivity;
 | 
			
		||||
import androidx.appcompat.widget.Toolbar;
 | 
			
		||||
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.view.Menu;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.Button;
 | 
			
		||||
 | 
			
		||||
import androidx.appcompat.app.AppCompatActivity;
 | 
			
		||||
import androidx.appcompat.widget.Toolbar;
 | 
			
		||||
 | 
			
		||||
import com.example.coen390_assignment2.R;
 | 
			
		||||
 | 
			
		||||
@@ -14,11 +16,16 @@ public class MainActivity extends AppCompatActivity {
 | 
			
		||||
        super.onCreate(savedInstanceState);
 | 
			
		||||
        setContentView(R.layout.activity_main);
 | 
			
		||||
 | 
			
		||||
        // Initialize the ActionBar (Toolbar)
 | 
			
		||||
        Toolbar toolbar = findViewById(R.id.toolbar);
 | 
			
		||||
        Button showDialogButton = findViewById(R.id.add_profile_action_button);
 | 
			
		||||
 | 
			
		||||
        // Initialize the ActionBar (Toolbar)
 | 
			
		||||
        setSupportActionBar(toolbar);
 | 
			
		||||
 | 
			
		||||
        // TODO replace with actual database info
 | 
			
		||||
        toolbar.setSubtitle("New Subtitle Text !!!!!!!!!!!!!!");
 | 
			
		||||
 | 
			
		||||
        initAddProfileActionButton(showDialogButton);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -26,4 +33,15 @@ public class MainActivity extends AppCompatActivity {
 | 
			
		||||
        getMenuInflater().inflate(R.menu.settings_main_activity, menu);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void initAddProfileActionButton(Button button) {
 | 
			
		||||
        button.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
                // Show the DialogFragment
 | 
			
		||||
                InsertProfileDialogFragment dialogFragment = new InsertProfileDialogFragment();
 | 
			
		||||
                dialogFragment.show(getSupportFragmentManager(), "dialog_fragment_tag");
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -33,7 +33,7 @@
 | 
			
		||||
 | 
			
		||||
    <!-- Action Button at the bottom right -->
 | 
			
		||||
    <Button
 | 
			
		||||
        android:id="@+id/actionButton"
 | 
			
		||||
        android:id="@+id/add_profile_action_button"
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_alignParentEnd="true"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										56
									
								
								app/src/main/res/layout/dialog_profile_create.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								app/src/main/res/layout/dialog_profile_create.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
			
		||||
    android:layout_width="wrap_content"
 | 
			
		||||
    android:layout_height="wrap_content"
 | 
			
		||||
    android:orientation="vertical">
 | 
			
		||||
 | 
			
		||||
    <EditText
 | 
			
		||||
        android:id="@+id/profile_surname_edit_text"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginLeft="4dp"
 | 
			
		||||
        android:layout_marginTop="16dp"
 | 
			
		||||
        android:layout_marginRight="4dp"
 | 
			
		||||
        android:layout_marginBottom="4dp"
 | 
			
		||||
 | 
			
		||||
        android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
 | 
			
		||||
        android:hint="@string/surname_dialog_text"
 | 
			
		||||
        android:inputType="textPersonName" />
 | 
			
		||||
 | 
			
		||||
    <EditText
 | 
			
		||||
        android:id="@+id/profile_name_edit_text"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginLeft="4dp"
 | 
			
		||||
        android:layout_marginTop="4dp"
 | 
			
		||||
        android:layout_marginRight="4dp"
 | 
			
		||||
        android:layout_marginBottom="16dp"
 | 
			
		||||
        android:fontFamily="sans-serif"
 | 
			
		||||
 | 
			
		||||
        android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
 | 
			
		||||
        android:hint="@string/name_dialog_text"
 | 
			
		||||
        android:inputType="textPersonName" />
 | 
			
		||||
 | 
			
		||||
    <EditText
 | 
			
		||||
        android:id="@+id/profile_ID_edit_text"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginLeft="4dp"
 | 
			
		||||
        android:layout_marginTop="4dp"
 | 
			
		||||
        android:layout_marginRight="4dp"
 | 
			
		||||
        android:layout_marginBottom="16dp"
 | 
			
		||||
        android:fontFamily="sans-serif"
 | 
			
		||||
        android:hint="@string/ID_dialog_text"
 | 
			
		||||
        android:inputType="number" />
 | 
			
		||||
 | 
			
		||||
    <EditText
 | 
			
		||||
        android:id="@+id/profile_GPA_edit_text"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginLeft="4dp"
 | 
			
		||||
        android:layout_marginTop="4dp"
 | 
			
		||||
        android:layout_marginRight="4dp"
 | 
			
		||||
        android:layout_marginBottom="16dp"
 | 
			
		||||
        android:fontFamily="sans-serif"
 | 
			
		||||
        android:hint="@string/GPA_dialog_text"
 | 
			
		||||
        android:inputType="numberDecimal" />
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
@@ -2,4 +2,10 @@
 | 
			
		||||
    <string name="app_name">coen390_assignment2</string>
 | 
			
		||||
    <string name="add_profile_text_action_button">Add Profile</string>
 | 
			
		||||
    <string name="toggle_profiles_display_mode_text">By ID</string>
 | 
			
		||||
    <string name="save_text_dialog_fragment">Save</string>
 | 
			
		||||
    <string name="cancel_text_dialog_fragment">Cancel</string>
 | 
			
		||||
    <string name="surname_dialog_text">Student Surname</string>
 | 
			
		||||
    <string name="name_dialog_text">Student Name</string>
 | 
			
		||||
    <string name="ID_dialog_text">Student ID</string>
 | 
			
		||||
    <string name="GPA_dialog_text">Student GPA</string>
 | 
			
		||||
</resources>
 | 
			
		||||
@@ -5,10 +5,6 @@
 | 
			
		||||
-->
 | 
			
		||||
<data-extraction-rules>
 | 
			
		||||
    <cloud-backup>
 | 
			
		||||
        <!-- TODO: Use <include> and <exclude> to control what is backed up.
 | 
			
		||||
        <include .../>
 | 
			
		||||
        <exclude .../>
 | 
			
		||||
        -->
 | 
			
		||||
    </cloud-backup>
 | 
			
		||||
    <!--
 | 
			
		||||
    <device-transfer>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user