Skip to content
Snippets Groups Projects
Commit 909ccb80 authored by ect1u17's avatar ect1u17
Browse files

Daily Commit

Changes:
- Created the "template" for all the experiment details that can be manipulated
- Have defined a plan for the differences between the layout types and how to move forward
parent 56ffb6c2
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="12">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="7" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
......
...@@ -90,6 +90,154 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity { ...@@ -90,6 +90,154 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity {
scrollLayout.addView(newHR(4)); scrollLayout.addView(newHR(4));
scrollLayout.addView(notificationLayout()); scrollLayout.addView(notificationLayout());
scrollLayout.addView(newHR(4)); scrollLayout.addView(newHR(4));
scrollLayout.addView(imageProcessingLayout());
scrollLayout.addView(newHR(4));
scrollLayout.addView(artefactImplementationLayout());
scrollLayout.addView(newHR(4));
scrollLayout.addView(audioProcessingLayout());
scrollLayout.addView(newHR(4));
scrollLayout.addView(videoProcessingLayout());
scrollLayout.addView(newHR(4));
}
private View artefactImplementationLayout() {
final RelativeLayout artefactLayout = new RelativeLayout(this);
TextView surveyTitle = new TextView(this);
surveyTitle.setText("Artefacts");
surveyTitle.setId(uniqueID++);
Switch surveyToggleSlider = new Switch(this);
surveyToggleSlider.setChecked(false);
RelativeLayout.LayoutParams sliderAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
RelativeLayout.LayoutParams titleAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
artefactLayout.addView(surveyToggleSlider, sliderAlignment);
artefactLayout.addView(surveyTitle, titleAlignment);
surveyToggleSlider.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// Set global variables
} else {
}
}
});
return artefactLayout;
}
private View videoProcessingLayout() {
final RelativeLayout videoLayout = new RelativeLayout(this);
TextView surveyTitle = new TextView(this);
surveyTitle.setText("Video Upload");
surveyTitle.setId(uniqueID++);
Switch surveyToggleSlider = new Switch(this);
surveyToggleSlider.setChecked(false);
RelativeLayout.LayoutParams sliderAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
RelativeLayout.LayoutParams titleAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
videoLayout.addView(surveyToggleSlider, sliderAlignment);
videoLayout.addView(surveyTitle, titleAlignment);
surveyToggleSlider.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// Set global variables
} else {
}
}
});
return videoLayout;
}
private View audioProcessingLayout() {
final RelativeLayout audioLayout = new RelativeLayout(this);
TextView surveyTitle = new TextView(this);
surveyTitle.setText("Audio Upload");
surveyTitle.setId(uniqueID++);
Switch surveyToggleSlider = new Switch(this);
surveyToggleSlider.setChecked(false);
RelativeLayout.LayoutParams sliderAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
RelativeLayout.LayoutParams titleAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
audioLayout.addView(surveyToggleSlider, sliderAlignment);
audioLayout.addView(surveyTitle, titleAlignment);
surveyToggleSlider.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// Set global variables
} else {
}
}
});
return audioLayout;
}
private View imageProcessingLayout() {
final RelativeLayout imageLayout = new RelativeLayout(this);
TextView surveyTitle = new TextView(this);
surveyTitle.setText("Image Upload");
surveyTitle.setId(uniqueID++);
Switch surveyToggleSlider = new Switch(this);
surveyToggleSlider.setChecked(false);
RelativeLayout.LayoutParams sliderAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
RelativeLayout.LayoutParams titleAlignment = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
sliderAlignment.addRule(RelativeLayout.ALIGN_PARENT_TOP);
imageLayout.addView(surveyToggleSlider, sliderAlignment);
imageLayout.addView(surveyTitle, titleAlignment);
surveyToggleSlider.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
// Set global variables
} else {
}
}
});
return imageLayout;
} }
private View notificationLayout() { private View notificationLayout() {
...@@ -104,7 +252,7 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity { ...@@ -104,7 +252,7 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity {
surveyTitle.setId(uniqueID++); surveyTitle.setId(uniqueID++);
Switch surveyToggleSlider = new Switch(this); Switch surveyToggleSlider = new Switch(this);
surveyToggleSlider.setChecked(true); surveyToggleSlider.setChecked(false);
notificationLabels.add(surveyTitle); notificationLabels.add(surveyTitle);
...@@ -137,6 +285,8 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity { ...@@ -137,6 +285,8 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity {
} }
}); });
notificationLayout.removeView(buttonLayout);
return notificationLayout; return notificationLayout;
} }
...@@ -386,7 +536,10 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity { ...@@ -386,7 +536,10 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity {
// test for git commit // test for git commit
if(getIntent().getIntExtra("ExperimentIndex", 0)+1 >= experimentJSON.length()){ d("experimentLength", String.valueOf(experimentJSON.length()));
d("experimentIndex", String.valueOf(getIntent().getIntExtra("ExperimentIndex", 0)));
if(getIntent().getIntExtra("ExperimentIndex", 0)+1 >= experimentJSON.length()){ // Check if moving out of group
openPage.putExtra("ExperimentIndex", 0); openPage.putExtra("ExperimentIndex", 0);
if(getIntent().getIntExtra("GroupIndex", 0)+1 >= boxInfo.getJSONArray("Experiments").length()){ if(getIntent().getIntExtra("GroupIndex", 0)+1 >= boxInfo.getJSONArray("Experiments").length()){
d("sub", "end of json check 1"); d("sub", "end of json check 1");
...@@ -397,9 +550,15 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity { ...@@ -397,9 +550,15 @@ public class ExperimentSurveyCreatorActivity extends AppCompatActivity {
startActivity(openPage); startActivity(openPage);
} }
} else if (getIntent().getIntExtra("GroupIndex", 0)+1 >= boxInfo.getJSONArray("Experiments").length()) { } else if (getIntent().getIntExtra("GroupIndex", 0)+1 >= boxInfo.getJSONArray("Experiments").length()) {
// Should never enter this check, but edge case just incase of bug, so run function just the same if(getIntent().getIntExtra("ExperimentIndex", 0) < experimentJSON.length()){
d("sub", "remain in the same group");
openPage.putExtra("ExperimentIndex", getIntent().getIntExtra("ExperimentIndex", 0) + 1);
openPage.putExtra("GroupIndex", getIntent().getIntExtra("GroupIndex", 0));
startActivity(openPage);
} else{
d("sub", "end of json check 2"); d("sub", "end of json check 2");
allSurveyCompleted(boxInfo); allSurveyCompleted(boxInfo);
}
} else { } else {
d("sub", "remain in the same group"); d("sub", "remain in the same group");
openPage.putExtra("ExperimentIndex", getIntent().getIntExtra("ExperimentIndex", 0) + 1); openPage.putExtra("ExperimentIndex", getIntent().getIntExtra("ExperimentIndex", 0) + 1);
......
...@@ -6,6 +6,7 @@ import android.content.Intent; ...@@ -6,6 +6,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.text.InputType; import android.text.InputType;
...@@ -23,7 +24,9 @@ import android.widget.Spinner; ...@@ -23,7 +24,9 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
...@@ -39,6 +42,7 @@ import org.json.JSONObject; ...@@ -39,6 +42,7 @@ import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import static android.util.Log.d; import static android.util.Log.d;
...@@ -48,28 +52,27 @@ import static android.util.Log.d; ...@@ -48,28 +52,27 @@ import static android.util.Log.d;
public class NewBox extends AppCompatActivity { public class NewBox extends AppCompatActivity {
private Toolbar toolbar;
private Uri imageUploadResultUri; private Uri imageUploadResultUri;
private List<EditText> groupTitlesArray = new ArrayList(); private List<EditText> groupTitlesArray = new ArrayList<>();
private List<List<EditText>> experimentTitlesArray = new ArrayList(); private List<List<EditText>> experimentTitlesArray = new ArrayList<>();
private List<List<EditText>> experimentDescriptionsArray = new ArrayList(); private List<List<EditText>> experimentDescriptionsArray = new ArrayList<>();
private List<List<EditText>> experimentInstructionsArray = new ArrayList(); private List<List<EditText>> experimentInstructionsArray = new ArrayList<>();
private ImageView uploadImageButton; private ImageView uploadImageButton;
private int globalGroupIndex = 1; private int globalGroupIndex = 1;
private String inFiveValue = "Select a MEECS..."; private String inFiveValue = "Select a MEECS...";
private boolean imageUploaded = false; private boolean imageUploaded = false;
private Toast submitToast; private Toast submitToast;
// OnCreate (Main thread) @RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_box); setContentView(R.layout.activity_new_box);
toolbar = findViewById(R.id.toolbar); Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true); Objects.requireNonNull(getSupportActionBar()).setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.mipmap.ic_launcher); getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true);
...@@ -142,7 +145,7 @@ public class NewBox extends AppCompatActivity { ...@@ -142,7 +145,7 @@ public class NewBox extends AppCompatActivity {
// Submit function // Submit function
private void submitNewBoxFunction() { private void submitNewBoxFunction() {
Boolean completedInfo = true; boolean completedInfo = true;
String toastText = "Need to fill out all the information to be able to submit box for review"; String toastText = "Need to fill out all the information to be able to submit box for review";
// Checks for completed data // Checks for completed data
...@@ -251,9 +254,7 @@ public class NewBox extends AppCompatActivity { ...@@ -251,9 +254,7 @@ public class NewBox extends AppCompatActivity {
} }
} else { } else {
try { try {
if (submitToast.getView().isShown()) { if (!submitToast.getView().isShown()) {
// Do nothing
} else {
// Update when should be shown // Update when should be shown
submitToast = Toast.makeText(getApplicationContext(), toastText, Toast.LENGTH_SHORT); submitToast = Toast.makeText(getApplicationContext(), toastText, Toast.LENGTH_SHORT);
submitToast.show(); submitToast.show();
...@@ -267,6 +268,7 @@ public class NewBox extends AppCompatActivity { ...@@ -267,6 +268,7 @@ public class NewBox extends AppCompatActivity {
} }
// Image permission check // Image permission check
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
private void imagePermissionCheckFunction() { private void imagePermissionCheckFunction() {
if (ContextCompat.checkSelfPermission(NewBox.this, if (ContextCompat.checkSelfPermission(NewBox.this,
Manifest.permission.READ_EXTERNAL_STORAGE) Manifest.permission.READ_EXTERNAL_STORAGE)
...@@ -457,21 +459,21 @@ public class NewBox extends AppCompatActivity { ...@@ -457,21 +459,21 @@ public class NewBox extends AppCompatActivity {
experimentTitleEditText.setHint("Title"); experimentTitleEditText.setHint("Title");
experimentTitleEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); experimentTitleEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
experimentTitlesArray.add(new ArrayList()); experimentTitlesArray.add(new ArrayList<EditText>());
experimentTitlesArray.get(localGroupIndex).add(experimentTitleEditText); experimentTitlesArray.get(localGroupIndex).add(experimentTitleEditText);
EditText experimentDescriptionEditText = new EditText(NewBox.this); EditText experimentDescriptionEditText = new EditText(NewBox.this);
experimentDescriptionEditText.setHint("Description"); experimentDescriptionEditText.setHint("Description");
experimentDescriptionEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); experimentDescriptionEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
experimentDescriptionsArray.add(new ArrayList()); experimentDescriptionsArray.add(new ArrayList<EditText>());
experimentDescriptionsArray.get(localGroupIndex).add(experimentDescriptionEditText); experimentDescriptionsArray.get(localGroupIndex).add(experimentDescriptionEditText);
EditText experimentInstructionsEditText = new EditText(NewBox.this); EditText experimentInstructionsEditText = new EditText(NewBox.this);
experimentInstructionsEditText.setHint("Instructions"); experimentInstructionsEditText.setHint("Instructions");
experimentInstructionsEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); experimentInstructionsEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
experimentInstructionsArray.add(new ArrayList()); experimentInstructionsArray.add(new ArrayList<EditText>());
experimentInstructionsArray.get(localGroupIndex).add(experimentInstructionsEditText); experimentInstructionsArray.get(localGroupIndex).add(experimentInstructionsEditText);
experimentSettingsEditTextLayout.addView(experimentTitleEditText); experimentSettingsEditTextLayout.addView(experimentTitleEditText);
...@@ -533,10 +535,8 @@ public class NewBox extends AppCompatActivity { ...@@ -533,10 +535,8 @@ public class NewBox extends AppCompatActivity {
// Permission processing // Permission processing
@Override @Override
public void onRequestPermissionsResult(int requestCode, public void onRequestPermissionsResult(int requestCode,
String[] permissions, int[] grantResults) { @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) { if (requestCode == 1) {// If request is cancelled, the result arrays are empty.
case 1: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) { && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
d("Perm", "granted"); d("Perm", "granted");
...@@ -555,8 +555,6 @@ public class NewBox extends AppCompatActivity { ...@@ -555,8 +555,6 @@ public class NewBox extends AppCompatActivity {
} }
}).setNegativeButton("Cancel", null).show(); }).setNegativeButton("Cancel", null).show();
} }
return;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment