Skip to content

Commit

Permalink
Merge branch 'master' of github.com:guardianproject/haven into update…
Browse files Browse the repository at this point in the history
…_dependencies
  • Loading branch information
archie94 committed Jul 29, 2018
2 parents ddb7f9c + 9ff8b02 commit 7ce3ae3
Show file tree
Hide file tree
Showing 28 changed files with 1,695 additions and 834 deletions.
24 changes: 17 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath 'com.android.tools.build:gradle:3.3.0-alpha03'

}

Expand Down Expand Up @@ -69,7 +69,7 @@ android {

defaultConfig {
applicationId "org.havenapp.main"
versionCode 113
versionCode 116
versionName getVersionName()
archivesBaseName = "Haven-$versionName"
minSdkVersion 16
Expand All @@ -80,8 +80,15 @@ android {
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 16
renderscriptSupportModeEnabled true

ndk {
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}


buildTypes {
release {
minifyEnabled false
Expand All @@ -100,21 +107,20 @@ android {
}

dependencies {
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.github.guardianproject:signal-cli-android:-SNAPSHOT'
implementation 'com.github.guardianproject:signal-cli-android:v0.6.0-android-beta-1'
implementation 'com.github.satyan:sugar:1.5'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'net.the4thdimension:audio-wife:1.0.3'
implementation 'com.github.apl-devs:appintro:v4.2.3'
implementation 'info.guardianproject.netcipher:netcipher:2.0.0-alpha1'
implementation 'com.nanohttpd:nanohttpd-webserver:2.2.0'
implementation 'me.angrybyte.picker:picker:1.3.1'
implementation 'com.github.stfalcon:frescoimageviewer:0.5.0'
implementation 'com.facebook.fresco:fresco:1.8.1'
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.github.derlio.waveform:library:1.0.3@aar'
implementation 'org.firezenk:audiowaves:1.1@aar'
implementation 'com.maxproj.simplewaveform:app:1.0.0'
Expand All @@ -124,5 +130,9 @@ dependencies {
implementation('com.mikepenz:aboutlibraries:6.0.2@aar') {
transitive = true
}

implementation 'com.asksira.android:cameraviewplus:0.9.4'
implementation 'com.github.halilozercan:BetterVideoPlayer:1.1.0'
implementation 'io.github.silvaren:easyrs:0.5.3'
implementation 'org.jcodec:jcodec:0.2.3'
implementation 'org.jcodec:jcodec-android:0.2.3'
}
117 changes: 77 additions & 40 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.havenapp.main">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.SEND_SMS" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.microphone" android:required="false" />
<!-- Some Chromebooks don't support touch. Although not essential,
it's a good idea to explicitly include this declaration. -->
<uses-feature android:name="android.hardware.touchscreen"
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<!--
Some Chromebooks don't support touch. Although not essential,
it's a good idea to explicitly include this declaration.
-->
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

<application xmlns:tools="http://schemas.android.com/tools"
android:name="org.havenapp.main.HavenApp"
<application xmlns:tools="http://schemas.android.com/tools"
android:name=".HavenApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:largeHeap="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">
<activity
android:name="org.havenapp.main.ListActivity"
android:label="@string/title_activity_start"
android:name=".ListActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_start"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -43,21 +54,32 @@
</intent-filter>
</activity>
<activity
android:name="org.havenapp.main.SettingsActivity"
android:name=".SettingsActivity"
android:configChanges="orientation|screenSize"
android:label="@string/settings"
android:theme="@style/SettingsTheme"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="stateHidden" />
<activity android:name="org.havenapp.main.ui.PPAppIntro"
<activity
android:name=".ui.PPAppIntro"
android:screenOrientation="portrait" />
<activity
android:name=".MonitorActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
/>
<activity
android:name="org.havenapp.main.MonitorActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:launchMode="singleTop" />
android:name=".ui.VideoPlayerActivity"
android:configChanges="orientation|keyboardHidden|screenLayout|screenSize"
android:label="@string/title_activity_video_player"
android:theme="@style/AppTheme" />

<service android:name="org.havenapp.main.service.MonitorService"
<service
android:name=".service.MonitorService"
android:exported="false" />

<meta-data
Expand All @@ -74,23 +96,38 @@
android:value="org.havenapp.main.model" />

<activity
android:name="org.havenapp.main.ui.EventActivity"
android:label="@string/title_activity_event"
android:name=".ui.EventActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_event"
android:theme="@style/AppTheme" />
<activity android:name="org.havenapp.main.ui.MicrophoneConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="org.havenapp.main.ui.AccelConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity android:name="org.havenapp.main.ui.CameraConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden"/>
<activity
android:name=".ui.MicrophoneConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.AccelConfigureActivity"
android:configChanges="orientation|screenSize|keyboardHidden" />
<activity
android:name=".ui.CameraConfigureActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden" />

<receiver android:name="org.havenapp.main.sensors.PowerConnectionReceiver">
<receiver android:name=".sensors.PowerConnectionReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="org.havenapp.main.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>

</application>

</manifest>
</manifest>
25 changes: 18 additions & 7 deletions src/main/java/org/havenapp/main/HavenApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import android.util.Log;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig;
import com.orm.SugarContext;

import java.io.IOException;
Expand All @@ -44,26 +46,35 @@ public class HavenApp extends MultiDexApplication {
public void onCreate() {
super.onCreate();

SugarContext.init(this);

mPrefs = new PreferenceManager(this);

Fresco.initialize(this);
SugarContext.init(this);
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.setResizeAndRotateEnabledForNetwork(true)
.setDownsampleEnabled(true)
.build();

Fresco.initialize(this,config);

AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

if (mPrefs.getRemoteAccessActive())
startServer();

}


public void startServer ()
{
if (mOnionServer == null || (!mOnionServer.isAlive()))
{
try {
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
} catch (IOException ioe) {
Log.e("OnioNServer", "unable to start onion server", ioe);
if ( mPrefs.getRemoteAccessCredential() != null) {
try {
mOnionServer = new WebServer(this, mPrefs.getRemoteAccessCredential());
} catch (IOException ioe) {
Log.e("OnioNServer", "unable to start onion server", ioe);
}
}
}
}
Expand Down
44 changes: 15 additions & 29 deletions src/main/java/org/havenapp/main/ListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,30 +178,19 @@ public void onItemClick(View view, int position) {
private void deleteEvent (final Event event, final int position)
{

final Runnable runnableDelete = new Runnable ()
{
public void run ()
{
event.delete();
}
};

handler.postDelayed(runnableDelete,3000);
final Runnable runnableDelete = () -> event.delete();

handler.postDelayed(runnableDelete,5000);
events.remove(position);
adapter.notifyItemRemoved(position);

event.delete();

Snackbar.make(recyclerView, getString(R.string.event_deleted), Snackbar.LENGTH_SHORT)
.setAction(getString(R.string.undo), new View.OnClickListener() {
@Override
public void onClick(View v) {
handler.removeCallbacks(runnableDelete);
event.save();
events.add(position, event);
adapter.notifyItemInserted(position);
}
.setAction(getString(R.string.undo), v -> {
handler.removeCallbacks(runnableDelete);
event.save();
events.add(position, event);
adapter.notifyItemInserted(position);
recyclerView.scrollToPosition(position);
})
.show();
}
Expand Down Expand Up @@ -343,16 +332,13 @@ public void run ()
handler.postDelayed(runnableDelete, 3000);

Snackbar.make(recyclerView, getString(R.string.events_deleted), Snackbar.LENGTH_SHORT)
.setAction(getString(R.string.undo), new View.OnClickListener() {
@Override
public void onClick(View v) {
handler.removeCallbacks(runnableDelete);

for (Event event : removedEvents) {
event.save();
events.add(event);
adapter.notifyItemInserted(events.size() - 1);
}
.setAction(getString(R.string.undo), v -> {
handler.removeCallbacks(runnableDelete);

for (Event event : removedEvents) {
event.save();
events.add(event);
adapter.notifyItemInserted(events.size() - 1);
}
})
.show();
Expand Down
Loading

0 comments on commit 7ce3ae3

Please sign in to comment.