Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
Android 10 (day/night themes, etc.) + Update build to newest stuff
fattired50b33cbc7dc
diff --git a/build.gradle b/build.gradleindex fc16d5f..d78beb0 100644--- a/build.gradle+++ b/build.gradle@@ -1,11 +1,11 @@buildscript {- ext.kotlin_version = '1.3.21'+ ext.kotlin_version = '1.3.50'repositories {google()jcenter()}dependencies {- classpath 'com.android.tools.build:gradle:3.3.2'+ classpath 'com.android.tools.build:gradle:3.6.0-beta01'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"}@@ -43,9 +43,9 @@ allprojects {// these are common variables used in */build.gradleversion_number = getVersionName()group_info = "haven"- buildToolsVersion = "28.0.3"+ buildToolsVersion = "29.0.2"minSdkVersion = 16- targetSdkVersion = 28+ targetSdkVersion = 29}/**@@ -54,13 +54,12 @@ allprojects {options.compilerArgs << "-Xlint:unchecked"}}**/-}android {- compileSdkVersion 28- buildToolsVersion = '28.0.3'+ compileSdkVersion 29+ buildToolsVersion = '29.0.2'packagingOptions {exclude 'META-INF/LICENSE.txt'@@ -84,7 +83,7 @@ android {versionName getVersionName()archivesBaseName = "Haven-$versionName"minSdkVersion 16- targetSdkVersion 28+ targetSdkVersion 29compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8@@ -109,6 +108,7 @@ android {arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]}}+}@@ -138,54 +138,53 @@ configurations {}dependencies {- implementation 'androidx.appcompat:appcompat:1.0.2'- implementation 'androidx.cardview:cardview:1.0.0'- implementation 'androidx.constraintlayout:constraintlayout:1.1.3'- implementation 'androidx.preference:preference:1.1.0-alpha03'+ implementation 'androidx.appcompat:appcompat:1.1.0'+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'+ implementation 'androidx.preference:preference:1.1.0'implementation 'androidx.multidex:multidex:2.0.1'- implementation 'androidx.annotation:annotation:1.0.1'- implementation 'com.google.android.material:material:1.0.0'- implementation 'com.wdullaer:materialdatetimepicker:4.1.1'+ implementation 'androidx.annotation:annotation:1.1.0'+ implementation 'com.google.android.material:material:1.1.0-beta01'+ implementation 'com.google.code.gson:gson:2.8.6'+ implementation 'com.wdullaer:materialdatetimepicker:4.2.3'implementation 'com.github.guardianproject:signal-cli-android:v0.6.0-android-beta-1'implementation 'net.the4thdimension:audio-wife:1.0.3'implementation 'com.github.AppIntro:AppIntro:v5.1.0'- implementation 'info.guardianproject.netcipher:netcipher:2.0.0-beta1'+ implementation 'info.guardianproject.netcipher:netcipher:2.1.0'implementation 'org.nanohttpd:nanohttpd-webserver:2.3.1'implementation 'me.angrybyte.picker:picker:1.3.1'implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'- implementation 'com.facebook.fresco:fresco:1.10.0'+ implementation 'com.facebook.fresco:fresco:2.0.0'implementation 'com.github.derlio:audio-waveform:v1.0.1'- implementation 'org.firezenk:audiowaves:1.1@aar'implementation 'com.maxproj.simplewaveform:app:1.0.0'- implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.4'- implementation('com.mikepenz:aboutlibraries:6.1.1@aar') {+ implementation 'com.googlecode.libphonenumber:libphonenumber:8.10.18'+ implementation('com.mikepenz:aboutlibraries:7.0.3@aar') {transitive = true}implementation 'com.github.halilozercan:BetterVideoPlayer:1.1.0'- implementation 'com.github.ybq:Android-SpinKit:1.2.0'+ implementation 'com.github.ybq:Android-SpinKit:1.4.0'implementation 'io.github.silvaren:easyrs:0.5.3'- implementation 'org.jcodec:jcodec:0.2.3'- implementation 'org.jcodec:jcodec-android:0.2.3'+ implementation 'org.jcodec:jcodec:0.2.5'+ implementation 'org.jcodec:jcodec-android:0.2.5'implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"// Room- implementation "android.arch.persistence.room:runtime:1.1.1"- kapt "android.arch.persistence.room:compiler:1.1.1"- implementation "android.arch.lifecycle:runtime:1.1.1"- implementation "android.arch.lifecycle:extensions:1.1.1"+ implementation "android.arch.persistence.room:runtime:2.1.0"+ kapt "android.arch.persistence.room:compiler:2.1.0"+ implementation "android.arch.lifecycle:runtime:2.1.0"+ implementation "android.arch.lifecycle:extensions:2.1.0"testImplementation "junit:junit:4.12"- androidTestImplementation 'androidx.test:runner:1.1.1'- androidTestImplementation 'androidx.test:core:1.1.0'- androidTestImplementation 'androidx.test:rules:1.1.1'- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'- androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'- androidTestImplementation "android.arch.persistence.room:testing:1.1.1"+ androidTestImplementation 'androidx.test:runner:1.2.0'+ androidTestImplementation 'androidx.test:core:1.2.0'+ androidTestImplementation 'androidx.test:rules:1.2.0'+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'+ androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'+ androidTestImplementation "android.arch.persistence.room:testing:2.1.0"// android-job- implementation 'com.evernote:android-job:1.2.6'+ implementation 'com.evernote:android-job:1.4.1'// new camera view: https://github.com/natario1/CameraView- implementation 'com.otaliastudios:cameraview:2.0.0-beta04'+ implementation 'com.otaliastudios:cameraview:2.3.0'}diff --git a/gradle.properties b/gradle.propertiesindex 65f8789..a622ad0 100644--- a/gradle.properties+++ b/gradle.properties@@ -1,5 +1,4 @@org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8android.enableJetifier=trueandroid.useAndroidX=true-android.enableR8=trueandroid.enableD8=truediff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.propertiesindex 9aae1af..497114b 100644--- a/gradle/wrapper/gradle-wrapper.properties+++ b/gradle/wrapper/gradle-wrapper.properties@@ -2,7 +2,8 @@distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOME-android.enableR8=true+android.enableD8=true+android.useAndroidX=truezipStorePath=wrapper/dists-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip-distributionSha256Sum=53b71812f18cdb2777e9f1b2a0f2038683907c90bdc406bc64d8b400e1fb2c3b+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip+distributionSha256Sum=027fdd265d277bae65a0d349b6b8da02135b0b8e14ba891e26281fa877fe37a2diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xmlindex c1c5bf3..945966b 100644--- a/src/main/AndroidManifest.xml+++ b/src/main/AndroidManifest.xml@@ -34,7 +34,7 @@<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />- <application xmlns:tools="http://schemas.android.com/tools"+ <applicationandroid:name=".HavenApp"android:allowBackup="false"android:icon="@mipmap/ic_launcher"@@ -64,11 +64,11 @@android:windowSoftInputMode="stateHidden" /><activityandroid:name=".ui.PPAppIntro"- android:screenOrientation="portrait" />+ android:screenOrientation="fullSensor" /><activityandroid:name=".MonitorActivity"android:label="@string/app_name"- android:screenOrientation="portrait"+ android:screenOrientation="fullSensor"android:launchMode="singleTop"android:resizeableActivity="true"android:supportsPictureInPicture="true"@@ -114,7 +114,7 @@android:configChanges="orientation|screenSize|keyboardHidden" /><activityandroid:name=".ui.CameraConfigureActivity"- android:screenOrientation="portrait"+ android:screenOrientation="fullSensor"android:configChanges="orientation|screenSize|keyboardHidden" /><receiver android:name=".sensors.PowerConnectionReceiver">diff --git a/src/main/java/org/havenapp/main/ListActivity.java b/src/main/java/org/havenapp/main/ListActivity.javaindex 8df8623..cc6b5cf 100644--- a/src/main/java/org/havenapp/main/ListActivity.java+++ b/src/main/java/org/havenapp/main/ListActivity.java@@ -28,13 +28,24 @@ import android.graphics.PorterDuff;import android.graphics.drawable.Drawable;import android.os.Build;import android.os.Bundle;-import android.text.TextUtils;import android.util.Log;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.widget.Toast;+import androidx.annotation.NonNull;+import androidx.appcompat.app.AppCompatActivity;+import androidx.appcompat.widget.Toolbar;+import androidx.core.content.ContextCompat;+import androidx.core.graphics.drawable.DrawableCompat;+import androidx.lifecycle.LiveData;+import androidx.lifecycle.Observer;+import androidx.localbroadcastmanager.content.LocalBroadcastManager;+import androidx.recyclerview.widget.ItemTouchHelper;+import androidx.recyclerview.widget.LinearLayoutManager;+import androidx.recyclerview.widget.RecyclerView;+import com.google.android.material.floatingactionbutton.FloatingActionButton;import com.google.android.material.snackbar.Snackbar;import com.mikepenz.aboutlibraries.Libs;@@ -57,17 +68,6 @@ import org.havenapp.main.ui.PPAppIntro;import java.util.ArrayList;import java.util.List;-import androidx.annotation.NonNull;-import androidx.appcompat.app.AppCompatActivity;-import androidx.appcompat.widget.Toolbar;-import androidx.core.content.ContextCompat;-import androidx.core.graphics.drawable.DrawableCompat;-import androidx.lifecycle.LiveData;-import androidx.lifecycle.Observer;-import androidx.localbroadcastmanager.content.LocalBroadcastManager;-import androidx.recyclerview.widget.ItemTouchHelper;-import androidx.recyclerview.widget.LinearLayoutManager;-import androidx.recyclerview.widget.RecyclerView;import kotlin.Pair;import static org.havenapp.main.database.DbConstantsKt.DB_INIT_END;@@ -146,6 +146,9 @@ public class ListActivity extends AppCompatActivity {recyclerView = findViewById(R.id.main_list);FloatingActionButton fab = findViewById(R.id.fab);Toolbar toolbar = findViewById(R.id.toolbar);+ final Drawable overflowIcon = toolbar.getOverflowIcon();+ overflowIcon.setColorFilter(ContextCompat.getColor(this, android.R.color.white), PorterDuff.Mode.SRC_ATOP);+ toolbar.setOverflowIcon(overflowIcon);setSupportActionBar(toolbar);LocalBroadcastManager.getInstance(this).registerReceiver(dbBroadcastReceiver,new IntentFilter(DB_INIT_STATUS));diff --git a/src/main/java/org/havenapp/main/PreferenceManager.java b/src/main/java/org/havenapp/main/PreferenceManager.javaindex 33e4f13..cd1a3ad 100644--- a/src/main/java/org/havenapp/main/PreferenceManager.java+++ b/src/main/java/org/havenapp/main/PreferenceManager.java@@ -30,8 +30,6 @@ import java.io.File;import java.util.Date;import java.util.Objects;-import javax.annotation.Nullable;-import androidx.annotation.NonNull;import androidx.appcompat.app.AppCompatActivity;@@ -152,7 +150,6 @@ public class PreferenceManager {** @return the verified Signal username; null when no Signal username is verified even though registered.*/- @Nullablepublic String getVerifiedSignalUsername() {return appSharedPrefs.getString(SIGNAL_VERIFIED_USERNAME, null);}diff --git a/src/main/java/org/havenapp/main/ui/CameraFragment.java b/src/main/java/org/havenapp/main/ui/CameraFragment.javaindex ed82c8a..39bed74 100644--- a/src/main/java/org/havenapp/main/ui/CameraFragment.java+++ b/src/main/java/org/havenapp/main/ui/CameraFragment.java@@ -8,31 +8,24 @@*/package org.havenapp.main.ui;-import android.content.BroadcastReceiver;-import android.content.Context;import android.content.Intent;-import android.content.IntentFilter;-import android.graphics.Bitmap;import android.hardware.SensorEvent;import android.os.Bundle;-import android.os.Handler;-import android.os.Message;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.ImageView;-import android.widget.TextView;-import com.otaliastudios.cameraview.Audio;+import androidx.fragment.app.Fragment;+import androidx.localbroadcastmanager.content.LocalBroadcastManager;+import com.otaliastudios.cameraview.CameraView;+import com.otaliastudios.cameraview.controls.Audio;import org.havenapp.main.PreferenceManager;import org.havenapp.main.R;import org.havenapp.main.model.EventTrigger;-import androidx.fragment.app.Fragment;-import androidx.localbroadcastmanager.content.LocalBroadcastManager;-public final class CameraFragment extends Fragment {private CameraViewHolder cameraViewHolder;diff --git a/src/main/java/org/havenapp/main/ui/CameraViewHolder.java b/src/main/java/org/havenapp/main/ui/CameraViewHolder.javaindex 0fb396c..2421075 100644--- a/src/main/java/org/havenapp/main/ui/CameraViewHolder.java+++ b/src/main/java/org/havenapp/main/ui/CameraViewHolder.java@@ -25,12 +25,14 @@ import android.os.RemoteException;import android.util.Log;import android.view.Surface;+import androidx.annotation.NonNull;+import com.otaliastudios.cameraview.CameraView;-import com.otaliastudios.cameraview.Facing;-import com.otaliastudios.cameraview.Frame;-import com.otaliastudios.cameraview.FrameProcessor;-import com.otaliastudios.cameraview.Size;-import com.otaliastudios.cameraview.SizeSelector;+import com.otaliastudios.cameraview.controls.Facing;+import com.otaliastudios.cameraview.frame.Frame;+import com.otaliastudios.cameraview.frame.FrameProcessor;+import com.otaliastudios.cameraview.size.Size;+import com.otaliastudios.cameraview.size.SizeSelector;import org.havenapp.main.PreferenceManager;import org.havenapp.main.Utils;@@ -53,8 +55,6 @@ import java.util.concurrent.LinkedBlockingQueue;import java.util.concurrent.ThreadPoolExecutor;import java.util.concurrent.TimeUnit;-import androidx.annotation.NonNull;-public class CameraViewHolder {/**@@ -160,7 +160,7 @@ public class CameraViewHolder {try {- File fileImageDir = new File(Environment.getExternalStorageDirectory(), prefs.getDefaultMediaStoragePath());+ File fileImageDir = new File(this.context.getExternalFilesDir(null), prefs.getDefaultMediaStoragePath());fileImageDir.mkdirs();String ts = new SimpleDateFormat(Utils.DATE_TIME_PATTERN,@@ -234,21 +234,19 @@ public class CameraViewHolder {cameraView.addFrameProcessor(new FrameProcessor() {@Overridepublic void process(@NonNull Frame frame) {-long now = System.currentTimeMillis();if (now < CameraViewHolder.this.lastTimestamp + DETECTION_INTERVAL_MS)return;CameraViewHolder.this.lastTimestamp = now;-- if (frame.getData() != null && frame.getSize() != null) {+ byte[] data = frame.getData();+ Size size = frame.getSize();if (!doingVideoProcessing) {- mDecodeThreadPool.execute(() -> processNewFrame(frame));+ mDecodeThreadPool.execute(() -> processNewFrame(data, size));} else {- mEncodeVideoThreadPool.execute(() -> recordNewFrame(frame));+ mEncodeVideoThreadPool.execute(() -> recordNewFrame(data, size));}- }}});@@ -295,17 +293,12 @@ public class CameraViewHolder {private Matrix mtxVideoRotate;- private void recordNewFrame (Frame frame)+ private void recordNewFrame (byte[] data, Size size){-- byte[] data = frame.getData();- Size size = frame.getSize();-if (data != null && size != null) {int width = size.getWidth();int height = size.getHeight();- Bitmap bitmap = MotionDetector.convertImage(data, width, height);- bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, mtxVideoRotate, true);+ Bitmap bitmap = Bitmap.createBitmap(MotionDetector.convertImage(data, width, height), 0, 0, width, height, mtxVideoRotate, true);try {if (encoder != null)@@ -316,7 +309,6 @@ public class CameraViewHolder {} catch (Exception e) {e.printStackTrace();}-}}@@ -342,12 +334,8 @@ public class CameraViewHolder {}- private void processNewFrame (Frame frame)+ private void processNewFrame (byte[] data, Size size){-- byte[] data = frame.getData();- Size size = frame.getSize();-if (data != null && size != null) {int width = size.getWidth();int height = size.getHeight();diff --git a/src/main/res/layout/activity_event.xml b/src/main/res/layout/activity_event.xmlindex 7530620..d7ba61d 100644--- a/src/main/res/layout/activity_event.xml+++ b/src/main/res/layout/activity_event.xml@@ -50,6 +50,9 @@app:layout_anchor="@id/app_bar"app:layout_anchorGravity="bottom|end"app:fabSize="normal"+ android:tint="@android:color/white"+ app:tint="@android:color/white"+ app:backgroundTint="@color/colorPrimary"app:srcCompat="@drawable/ic_share" /></androidx.coordinatorlayout.widget.CoordinatorLayout>diff --git a/src/main/res/layout/activity_list.xml b/src/main/res/layout/activity_list.xmlindex 27fed6d..7c75db3 100644--- a/src/main/res/layout/activity_list.xml+++ b/src/main/res/layout/activity_list.xml@@ -55,6 +55,8 @@android:layout_height="wrap_content"android:layout_gravity="bottom|end"android:layout_margin="@dimen/fab_margin"+ app:backgroundTint="@color/colorPrimary"+ app:tint="@android:color/white"android:tint="@android:color/white"app:fabSize="normal"app:srcCompat="@drawable/ic_play_arrow" />diff --git a/src/main/res/layout/item_audio.xml b/src/main/res/layout/item_audio.xmlindex df2957a..b266b39 100644--- a/src/main/res/layout/item_audio.xml+++ b/src/main/res/layout/item_audio.xml@@ -43,7 +43,7 @@android:ellipsize="end"android:maxLines="6"android:paddingBottom="@dimen/activity_margin_half"- android:textColor="@android:color/black"+ android:textColor="@color/secondary_text"tools:text="Description" /></LinearLayout>diff --git a/src/main/res/layout/item_event.xml b/src/main/res/layout/item_event.xmlindex 1c48ea3..27189f7 100644--- a/src/main/res/layout/item_event.xml+++ b/src/main/res/layout/item_event.xml@@ -34,7 +34,7 @@android:ellipsize="end"android:maxLines="6"android:paddingBottom="@dimen/activity_margin_half"- android:textColor="@android:color/black"+ android:textColor="@color/secondary_text"tools:text="Description" /><ImageViewdiff --git a/src/main/res/layout/item_header.xml b/src/main/res/layout/item_header.xmlindex ef22261..1db63fa 100644--- a/src/main/res/layout/item_header.xml+++ b/src/main/res/layout/item_header.xml@@ -20,7 +20,7 @@android:layout_height="wrap_content"android:layout_marginStart="4dp"android:layout_marginLeft="4dp"- android:textColor="#808080"+ android:textColor="@color/secondary_text"android:textSize="12sp"tools:text="#123" />diff --git a/src/main/res/layout/item_photo.xml b/src/main/res/layout/item_photo.xmlindex 5696fd2..eb25444 100644--- a/src/main/res/layout/item_photo.xml+++ b/src/main/res/layout/item_photo.xml@@ -32,7 +32,7 @@android:ellipsize="end"android:maxLines="6"android:paddingBottom="@dimen/activity_margin_half"- android:textColor="@android:color/black"+ android:textColor="@color/secondary_text"tools:text="Description" /></LinearLayout>diff --git a/src/main/res/layout/item_video.xml b/src/main/res/layout/item_video.xmlindex 788097f..fc574fc 100644--- a/src/main/res/layout/item_video.xml+++ b/src/main/res/layout/item_video.xml@@ -32,7 +32,7 @@android:ellipsize="end"android:maxLines="6"android:paddingBottom="@dimen/activity_margin_half"- android:textColor="@android:color/black"+ android:textColor="@color/secondary_text"tools:text="Description" /></LinearLayout>diff --git a/src/main/res/values-night/colors.xml b/src/main/res/values-night/colors.xmlnew file mode 100644index 0000000..e2ed644--- /dev/null+++ b/src/main/res/values-night/colors.xml@@ -0,0 +1,12 @@+<?xml version="1.0" encoding="utf-8"?><!-- Palette generated by Material Palette - materialpalette.com/blue/amber -->+<resources>+ <color name="colorPrimary">#09304f</color>+ <color name="colorPrimaryDark">#06213d</color>+ <color name="colorPrimaryLight">#8099ad</color>+ <color name="colorAccent">#f5c229</color>+ <color name="primary_text">#EEEEEE</color>+ <color name="secondary_text">#DDDDDD</color>++ <!-- 25% black -->+ <color name="translucentOverlay25">#40000000</color>+</resources>diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xmlindex ed6db01..aed1a2a 100644--- a/src/main/res/values/styles.xml+++ b/src/main/res/values/styles.xml@@ -1,7 +1,7 @@<?xml version="1.0" encoding="utf-8"?><resources xmlns:android="http://schemas.android.com/apk/res/android"><!-- Base application theme. -->- <style name="AppTheme" parent="Theme.MaterialComponents.Light">+ <style name="AppTheme" parent="Theme.MaterialComponents.DayNight"><!-- Customize your theme here. --><item name="colorPrimary">@color/colorPrimary</item><item name="colorPrimaryDark">@color/colorPrimaryDark</item>@@ -10,9 +10,9 @@<item name="android:textColorSecondary">@color/secondary_text</item><item name="windowActionBar">false</item><item name="windowNoTitle">true</item>- </style>+</style>- <style name="SettingsTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">+ <style name="SettingsTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar"><!-- Customize your theme here. --><item name="colorPrimary">@color/colorPrimary</item><item name="colorPrimaryDark">@color/colorPrimaryDark</item>@@ -47,8 +47,7 @@<item name="negativeButtonText">@android:string/cancel</item></style>- <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />-- <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />+ <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.ActionBar" />+ <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.ActionBar" /></resources>\ No newline at end of file