Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
Added Flash light feature
Browse files Browse the repository at this point in the history
Added Flash light feature

autofills ignored

removed empty line

Added the flash feature

added margin and made some changes

Fix crash on start

Also removes duplicate write permissions requests

Stop app crash on entering received forms (#237)

Improve UX for setting password (#230)

Removed unused changes

Removed unused changes

Introduced flashlight

made maifest changes

Checkstyle changed

Checkstyle changed

Checkstyle changed

Checkstyle changed

Checkstyle changed

Checkstyle changed

changed to QRcode

Fix crash on start

Also removes duplicate write permissions requests

Stop app crash on entering received forms (#237)

Improve UX for setting password (#230)

Made object name to camel case

Fix crash on start

Also removes duplicate write permissions requests

Stop app crash on entering received forms (#237)

Improve UX for setting password (#230)

Changes for #230

Changed QR code camel case

Changed QR code camel case
  • Loading branch information
ajay-prabhakar committed Aug 21, 2019
1 parent d1ff99e commit 82c7e2c
Show file tree
Hide file tree
Showing 124 changed files with 4,144 additions and 816 deletions.
2 changes: 1 addition & 1 deletion config/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ android {

//------------------------ ALL ------------------------//
task checkCode(type: GradleBuild) {
tasks = ['pmd', 'checkstyle', 'lint', 'findbugs']
tasks = ['pmd', 'checkstyle', 'lint', 'findbugs', 'testDebugUnitTest']
}
15 changes: 15 additions & 0 deletions skunkworks_crow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ android {
targetCompatibility 1.8
sourceCompatibility 1.8
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}

dependencies {
Expand All @@ -32,6 +37,12 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

// testing-only
testImplementation "junit:junit:4.12"
testImplementation "org.mockito:mockito-core:2.11.0"
testImplementation "org.robolectric:robolectric:4.3"
testImplementation "org.robolectric:shadows-multidex:4.3"

// butterknife
implementation "com.jakewharton:butterknife:${rootProject.butterknifeVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${rootProject.butterknifeVersion}"
Expand Down Expand Up @@ -59,4 +70,8 @@ dependencies {

//MPAndroidChart
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

// Permissions Dispatcher
implementation "org.permissionsdispatcher:permissionsdispatcher:4.5.0"
annotationProcessor "org.permissionsdispatcher:permissionsdispatcher-processor:4.5.0"
}
59 changes: 31 additions & 28 deletions skunkworks_crow/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<!-- Device with versions >= Oreo need location permission to start/stop the hotspot -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<application
android:name=".application.Share"
Expand All @@ -26,50 +28,51 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activities.MainActivity">
<activity android:name=".views.ui.bluetooth.BtReceiverActivity" />
<activity android:name=".views.ui.bluetooth.BtSenderActivity" />
<activity android:name=".views.ui.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".activities.WifiActivity"
android:parentActivityName=".activities.MainActivity">
<activity
android:name=".views.ui.hotspot.HpReceiverActivity"
android:parentActivityName=".views.ui.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.ui.main.MainActivity" />
</activity>
<activity android:name=".activities.InstancesList" />
<activity android:name=".preferences.SettingsPreference" />
<activity android:name=".activities.WebViewActivity" />

<activity android:name=".activities.AboutActivity"
android:parentActivityName=".activities.MainActivity">
<activity android:name=".views.ui.instance.InstancesList" />
<activity android:name=".views.ui.settings.SettingsActivity" />
<activity android:name=".views.ui.about.WebViewActivity" />
<activity
android:name=".views.ui.about.AboutActivity"
android:parentActivityName=".views.ui.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.ui.main.MainActivity" />
</activity>
<activity
android:name=".activities.SendActivity"
android:name=".views.ui.hotspot.HpSenderActivity"
android:configChanges="orientation|screenSize" />

<service android:name=".services.HotspotService" />

<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:name=".views.ui.receive.ScannerActivity"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
tools:replace="android:screenOrientation" />

<activity android:name=".activities.InstanceManagerTabs"
android:parentActivityName=".activities.MainActivity">
<activity
android:name=".views.ui.instance.InstanceManagerTabs"
android:parentActivityName=".views.ui.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.ui.main.MainActivity" />
</activity>

<activity android:name=".activities.ReviewFormActivity" />
<activity android:name=".views.ui.review.ReviewFormActivity" />

<provider
android:name=".provider.TransferProvider"
Expand All @@ -78,13 +81,13 @@
android:name=".provider.InstanceMapProvider"
android:authorities="org.odk.share.provider.odk.map" />

<activity android:name=".activities.SendFormsActivity"
android:parentActivityName=".activities.MainActivity">
<activity
android:name=".views.ui.send.SendFormsActivity"
android:parentActivityName=".views.ui.main.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MainActivity"/>
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.ui.main.MainActivity" />
</activity>

</application>

</manifest>
22 changes: 22 additions & 0 deletions skunkworks_crow/src/main/assets/open_source_licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ <h3>
Apache License Version 2.0, January 2004
</h3>
<ul>
<li>
<b>PermissionsDispatcher</b>
</li>
<li>
<b>Dagger 2</b>
</li>
Expand Down Expand Up @@ -85,5 +88,24 @@ <h3>
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
</pre>

<h3>
The MIT License (MIT)
</h3>
<ul>
<li>
<b>Mockito</b>
</li>
<li>
<b>Robolectric</b>
</li>
</ul>
<pre>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</pre>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ public List<Instance> getInstancesFromCursor(Cursor cursor) {
int jrVersionColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.JR_VERSION);
int statusColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.STATUS);
int lastStatusChangeDateColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.LAST_STATUS_CHANGE_DATE);
int displaySubtextColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_SUBTEXT);
int deletedDateColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DELETED_DATE);

int databaseIdIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns._ID);
Expand All @@ -326,7 +325,6 @@ public List<Instance> getInstancesFromCursor(Cursor cursor) {
.jrVersion(cursor.getString(jrVersionColumnIndex))
.status(cursor.getString(statusColumnIndex))
.lastStatusChangeDate(cursor.getLong(lastStatusChangeDateColumnIndex))
.displaySubtext(cursor.getString(displaySubtextColumnIndex))
.deletedDate(cursor.getLong(deletedDateColumnIndex))
.databaseId(cursor.getLong(databaseIdIndex))
.build();
Expand All @@ -353,7 +351,6 @@ public HashMap<Long, Instance> getMapFromCursor(Cursor cursor) {
int jrVersionColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.JR_VERSION);
int statusColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.STATUS);
int lastStatusChangeDateColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.LAST_STATUS_CHANGE_DATE);
int displaySubtextColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DISPLAY_SUBTEXT);
int deletedDateColumnIndex = cursor.getColumnIndex(InstanceProviderAPI.InstanceColumns.DELETED_DATE);

Instance instance = new Instance.Builder()
Expand All @@ -365,7 +362,6 @@ public HashMap<Long, Instance> getMapFromCursor(Cursor cursor) {
.jrVersion(cursor.getString(jrVersionColumnIndex))
.status(cursor.getString(statusColumnIndex))
.lastStatusChangeDate(cursor.getLong(lastStatusChangeDateColumnIndex))
.displaySubtext(cursor.getString(displaySubtextColumnIndex))
.deletedDate(cursor.getLong(deletedDateColumnIndex))
.build();

Expand All @@ -381,7 +377,7 @@ public HashMap<Long, Instance> getMapFromCursor(Cursor cursor) {
/**
* Returns the values of an instance as a ContentValues object for use with
* {@link #saveInstance(ContentValues)} or {@link #updateInstance(ContentValues, String, String[])}
* <p>
*
* Does NOT include the database ID.
*/
public ContentValues getValuesFromInstanceObject(Instance instance) {
Expand All @@ -394,7 +390,6 @@ public ContentValues getValuesFromInstanceObject(Instance instance) {
values.put(InstanceProviderAPI.InstanceColumns.JR_VERSION, instance.getJrVersion());
values.put(InstanceProviderAPI.InstanceColumns.STATUS, instance.getStatus());
values.put(InstanceProviderAPI.InstanceColumns.LAST_STATUS_CHANGE_DATE, instance.getLastStatusChangeDate());
values.put(InstanceProviderAPI.InstanceColumns.DISPLAY_SUBTEXT, instance.getDisplaySubtext());
values.put(InstanceProviderAPI.InstanceColumns.DELETED_DATE, instance.getDeletedDate());

return values;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package org.odk.collect.android.dto;

public class Instance {
public final class Instance {
private final String displayName;
private final String submissionUri;
private final String canEditWhenComplete;
Expand All @@ -25,7 +25,6 @@ public class Instance {
private final String jrVersion;
private final String status;
private final Long lastStatusChangeDate;
private final String displaySubtext;
private final Long deletedDate;

private final Long databaseId;
Expand All @@ -39,7 +38,6 @@ private Instance(Builder builder) {
jrVersion = builder.jrVersion;
status = builder.status;
lastStatusChangeDate = builder.lastStatusChangeDate;
displaySubtext = builder.displaySubtext;
deletedDate = builder.deletedDate;

databaseId = builder.databaseId;
Expand All @@ -54,7 +52,6 @@ public static class Builder {
private String jrVersion;
private String status;
private Long lastStatusChangeDate;
private String displaySubtext;
private Long deletedDate;

private Long databaseId;
Expand Down Expand Up @@ -99,11 +96,6 @@ public Builder lastStatusChangeDate(Long lastStatusChangeDate) {
return this;
}

public Builder displaySubtext(String displaySubtext) {
this.displaySubtext = displaySubtext;
return this;
}

public Builder deletedDate(Long deletedDate) {
this.deletedDate = deletedDate;
return this;
Expand Down Expand Up @@ -151,15 +143,22 @@ public Long getLastStatusChangeDate() {
return lastStatusChangeDate;
}

public String getDisplaySubtext() {
return displaySubtext;
}

public Long getDeletedDate() {
return deletedDate;
}

public Long getDatabaseId() {
return databaseId;
}
}

@Override
public boolean equals(Object other) {
return other == this || other instanceof Instance
&& this.instanceFilePath.equals(((Instance) other).instanceFilePath);
}

@Override
public int hashCode() {
return instanceFilePath.hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
import android.net.Uri;
import android.provider.BaseColumns;

/**
* Convenience definitions for NotePadProvider
*/
public final class InstanceProviderAPI {
public static final String AUTHORITY = "org.odk.collect.android.provider.odk.instances";

Expand All @@ -35,9 +32,6 @@ private InstanceProviderAPI() {
public static final String STATUS_SUBMITTED = "submitted";
public static final String STATUS_SUBMISSION_FAILED = "submissionFailed";

/**
* Notes table
*/
public static final class InstanceColumns implements BaseColumns {
// This class cannot be instantiated
private InstanceColumns() {
Expand All @@ -47,26 +41,15 @@ private InstanceColumns() {
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.odk.instance";
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.odk.instance";

// These are the only things needed for an insert
// instance column names
public static final String DISPLAY_NAME = "displayName";
public static final String SUBMISSION_URI = "submissionUri";
public static final String INSTANCE_FILE_PATH = "instanceFilePath";
public static final String JR_FORM_ID = "jrFormId";
public static final String JR_VERSION = "jrVersion";
//public static final String FORM_ID = "formId";

// these are generated for you (but you can insert something else if you want)
public static final String STATUS = "status";
public static final String CAN_EDIT_WHEN_COMPLETE = "canEditWhenComplete";
public static final String LAST_STATUS_CHANGE_DATE = "date";
public static final String DISPLAY_SUBTEXT = "displaySubtext";
public static final String DELETED_DATE = "deletedDate";
//public static final String DISPLAY_SUB_SUBTEXT = "displaySubSubtext";

// public static final String DEFAULT_SORT_ORDER = "modified DESC";
// public static final String TITLE = "title";
// public static final String NOTE = "note";
// public static final String CREATED_DATE = "created";
// public static final String MODIFIED_DATE = "modified";
}
}
}

This file was deleted.

12 changes: 12 additions & 0 deletions skunkworks_crow/src/main/java/org/odk/share/application/Share.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.content.Context;
import android.os.Environment;

import androidx.annotation.IntDef;

import com.evernote.android.job.JobManager;
import com.evernote.android.job.JobManagerCreateException;

Expand All @@ -12,6 +14,8 @@
import org.odk.share.tasks.ShareJobCreator;

import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;
Expand All @@ -23,6 +27,14 @@

public class Share extends DaggerApplication {

// define the different methods for data transferring.
@IntDef({TransferMethod.BLUETOOTH, TransferMethod.HOTSPOT})
@Retention(RetentionPolicy.SOURCE)
public @interface TransferMethod {
int BLUETOOTH = 0x101;
int HOTSPOT = 0x110;
}

public static final String ODK_ROOT = Environment.getExternalStorageDirectory() + File.separator + "share";
public static final String ODK_COLLECT_ROOT = Environment.getExternalStorageDirectory() + File.separator + "odk";
public static final String FORMS_DIR_NAME = "forms";
Expand Down
Loading

0 comments on commit 82c7e2c

Please sign in to comment.