Skip to content

Commit

Permalink
Resolve merge conflict with remote
Browse files Browse the repository at this point in the history
  • Loading branch information
mnipper committed May 4, 2015
2 parents 4d49bae + 1d50a52 commit f8cea01
Show file tree
Hide file tree
Showing 15 changed files with 268 additions and 56 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</receiver>
<receiver android:name="org.adaptlab.chpir.android.survey.Receivers.NotificationReceiver" />
<meta-data android:name="AA_DB_NAME" android:value="Survey.db" />
<meta-data android:name="AA_DB_VERSION" android:value="32" />
<meta-data android:name="AA_DB_VERSION" android:value="33" />
<meta-data android:name="SEED_DB" android:value="false" />
<meta-data android:name="com.crashlytics.ApiKey" android:value="@string/crashlytics_api_key"/>
</application>
Expand Down
22 changes: 22 additions & 0 deletions res/drawable/consent_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="14dp" />
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#80BF00"
android:startColor="#C9E97B"
android:endColor="#548C00"
android:type="linear"
/>
<padding
android:left="5dp"
android:top="0dp"
android:right="5dp"
android:bottom="0dp"
/>
<stroke
android:width="1dp"
android:color="#0085C3"
/>
</shape>
22 changes: 22 additions & 0 deletions res/drawable/disagree_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners android:radius="14dp" />
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#FF282F"
android:startColor="#FF7D80"
android:endColor="#C10000"
android:type="linear"
/>
<padding
android:left="5dp"
android:top="0dp"
android:right="5dp"
android:bottom="0dp"
/>
<stroke
android:width="1dp"
android:color="#0085C3"
/>
</shape>
20 changes: 0 additions & 20 deletions res/drawable/list_background_color_alternate.xml

This file was deleted.

86 changes: 73 additions & 13 deletions res/layout/fragment_consent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,35 @@
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/consent_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textStyle="bold"
android:text="@string/consent_title"/>

<TextView
android:id="@+id/consent_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/consent_text"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="40dp" />
android:layout_marginRight="16dp"
android:padding="5dp"
android:maxLines="10"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:background="@drawable/question_text_layout" />

<TextView
android:id="@+id/consent_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textStyle="bold"
android:text="@string/consent_name"/>

<EditText
android:id="@+id/consent_name_edit_text"
android:layout_width="match_parent"
Expand All @@ -23,29 +43,69 @@
android:ems="10" >
</EditText>

<TextView
android:id="@+id/consent_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textStyle="bold"
android:text="@string/consent_email"/>

<EditText
android:id="@+id/consent_email_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions"
android:inputType="textEmailAddress"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:ems="10" >
</EditText>

<CheckBox android:id="@+id/email_copy_of_consent_checkbox"
<CheckBox
android:id="@+id/email_copy_of_consent_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_email_copy_of_consent"
android:layout_marginTop="5dp" />
android:layout_margin="5dp" />

<Button
android:id="@+id/consent_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="18dp"
android:text="@string/consent_button"
android:width="200dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/consent_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_weight="1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:text="@string/consent_button"
android:background="@drawable/consent_button"
android:textColor="#000000"
android:textSize="30sp"
android:shadowColor="#A8A8A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5" />

<Button
android:id="@+id/disagree_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom|end"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:text="@string/dissent_button"
android:background="@drawable/disagree_button"
android:textColor="#000000"
android:textSize="30sp"
android:shadowColor="#A8A8A8"
android:shadowDx="0"
android:shadowDy="0"
android:shadowRadius="5" />

</LinearLayout>

</LinearLayout>
3 changes: 2 additions & 1 deletion res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<resources>
<color name="emphasis">#31b6e7</color>
<color name="bg_gray">#cecbce</color>
<color name="list_background_one">#C5D7F4</color>
<color name="list_background_two">#E1F0D2</color>
<color name="drawer_background">#C0CD2F</color>
<color name="list_background_one">#DDDFE1</color>
<color name="item_selected">#1C939D</color>
<color name="actionbar_tabs">#FFFFFF</color>
<color name="question_text_background">#E1F0D2</color>
Expand Down
4 changes: 4 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@
<string name="consent_text">You agree to all of this stuff.</string>
<string name="send_email_copy_of_consent">Send Email Copy of Consent</string>
<string name="consent_button">I agree</string>
<string name="dissent_button">I disagree</string>
<string name="consent_title">Carefully read the consent form below</string>
<string name="consent_name">Your Name</string>
<string name="consent_email">Your Email</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ public static String getEndPoint() {
}

public static void setConsentEndPoint(String endPoint) {
char lastChar = endPoint.charAt(endPoint.length() - 1);
if (lastChar != '/') endPoint = endPoint + "/";

mConsentEndPoint = endPoint;
if (endPoint != null) {
char lastChar = endPoint.charAt(endPoint.length() - 1);
if (lastChar != '/') endPoint = endPoint + "/";

mConsentEndPoint = endPoint;
}
}

public static String getConsentEndPoint() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ public void fetch() {
}

try {
String url = ActiveRecordCloudSync.getEndPoint() + mRemoteTableName
String url = "";
if (mRemoteTableName == "consent_texts" ) {
url = ActiveRecordCloudSync.getConsentEndPoint() + mRemoteTableName
+ ActiveRecordCloudSync.getParams();
} else {
url = ActiveRecordCloudSync.getEndPoint() + mRemoteTableName
+ ActiveRecordCloudSync.getParams();
}
if (AppUtil.DEBUG) Log.i(TAG, "Attempting to access " + url);
String jsonString = getUrl(url);
if (AppUtil.DEBUG) Log.i(TAG, "Got JSON String: " + jsonString);
Expand Down
12 changes: 10 additions & 2 deletions src/org/adaptlab/chpir/android/survey/AdminFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void onClick(View v) {
AdminSettings.getInstance().setApiVersion(mApiVersionEditText.getText().toString());
AdminSettings.getInstance().setProjectId(mProjectIdEditText.getText().toString());
AdminSettings.getInstance().setApiKey(mApiKeyEditText.getText().toString());
AdminSettings.getInstance().setConsentApiUrl(mConsentApiUrlEditText.getText().toString());
AdminSettings.getInstance().setConsentApiUrl(getAdminSettingsInstanceConsentApiUrl());

// If this code is set, it will override the language selection on the device
// for all instrument translations.
Expand All @@ -122,7 +122,7 @@ public void onClick(View v) {
PollService.setPollInterval(AdminSettings.getInstance().getSyncInterval());
ActiveRecordCloudSync.setAccessToken(getAdminSettingsInstanceApiKey());
ActiveRecordCloudSync.setEndPoint(getAdminSettingsInstanceApiUrl());
ActiveRecordCloudSync.setConsentEndPoint(AdminSettings.getInstance().getConsentApiUrl());
ActiveRecordCloudSync.setConsentEndPoint(getAdminSettingsInstanceConsentApiUrl());
new ApkUpdateTask(getActivity()).execute();

AdminSettings.getInstance().setShowSurveys(mShowSurveysCheckBox.isChecked());
Expand Down Expand Up @@ -162,6 +162,14 @@ public String getAdminSettingsInstanceApiUrl() {
return domainName + "api/" + AdminSettings.getInstance().getApiVersion() + "/" +
"projects/" + AdminSettings.getInstance().getProjectId() + "/";
}

public String getAdminSettingsInstanceConsentApiUrl() {
String consentApiUrl = mConsentApiUrlEditText.getText().toString();
char lastChar = consentApiUrl.charAt(consentApiUrl.length() - 1);
if (lastChar != '/') consentApiUrl = consentApiUrl + "/";

return consentApiUrl + "api/v1/";
}

public String getAdminSettingsInstanceSyncInterval() {
return String.valueOf(AdminSettings.getInstance().getSyncIntervalInMinutes());
Expand Down
7 changes: 4 additions & 3 deletions src/org/adaptlab/chpir/android/survey/AppUtil.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.adaptlab.chpir.android.survey;

import java.util.Date;
import java.util.UUID;

import org.adaptlab.chpir.android.activerecordcloudsync.ActiveRecordCloudSync;
import org.adaptlab.chpir.android.survey.Models.AdminSettings;
import org.adaptlab.chpir.android.survey.Models.ConsentForm;
import org.adaptlab.chpir.android.survey.Models.ConsentText;
import org.adaptlab.chpir.android.survey.Models.DefaultAdminSettings;
import org.adaptlab.chpir.android.survey.Models.DeviceSyncEntry;
import org.adaptlab.chpir.android.survey.Models.DeviceUser;
Expand Down Expand Up @@ -38,7 +38,7 @@ public class AppUtil {
public final static boolean PRODUCTION = false;
public final static boolean REQUIRE_SECURITY_CHECKS = PRODUCTION;
public static boolean DEBUG = !PRODUCTION;
public static boolean REQUIRE_CONSENT = PRODUCTION;
public static boolean REQUIRE_CONSENT = true;

public static String ADMIN_PASSWORD_HASH;
public static String ACCESS_TOKEN;
Expand Down Expand Up @@ -97,6 +97,7 @@ public static final void appInit(Context context) {
ActiveRecordCloudSync.addReceiveTable("device_users", DeviceUser.class);
ActiveRecordCloudSync.addReceiveTable("skips", Skip.class);
ActiveRecordCloudSync.addReceiveTable("rules", Rule.class);
ActiveRecordCloudSync.addReceiveTable("consent_texts", ConsentText.class);
ActiveRecordCloudSync.addSendTable("surveys", Survey.class);
ActiveRecordCloudSync.addSendTable("responses", Response.class);
ActiveRecordCloudSync.addSendTable("response_images", ResponsePhoto.class);
Expand Down Expand Up @@ -159,7 +160,7 @@ public static Context getContext() {

public static AdminSettings getAdminSettingsInstance() {
if (adminSettingsInstance == null) {
setAdminSettingsInstance();
AppUtil.setAdminSettingsInstance();
}
return adminSettingsInstance;
}
Expand Down
Loading

0 comments on commit f8cea01

Please sign in to comment.