Skip to content

armgit / haven

Public Imported from GitHub
0

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

Major UI overhaul in line with #37 proposals

n8fr85c29260fb969
diff --git a/build.gradle b/build.gradle
index 3daebc8..8cd7c6b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -29,7 +29,7 @@ android {
defaultConfig {
applicationId "info.guardianproject.phoneypot"
- minSdkVersion 15
+ minSdkVersion 16
targetSdkVersion 25
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
@@ -68,4 +68,5 @@ dependencies {
compile 'com.facebook.fresco:fresco:1.4.0'
compile 'com.github.derlio.waveform:library:1.0.3@aar'
compile 'org.firezenk:audiowaves:1.1@aar'
+ compile 'com.maxproj.simplewaveform:app:1.0.0'
}
diff --git a/src/main/java/info/guardianproject/phoneypot/ListActivity.java b/src/main/java/info/guardianproject/phoneypot/ListActivity.java
index 591bd9c..69fe07b 100644
--- a/src/main/java/info/guardianproject/phoneypot/ListActivity.java
+++ b/src/main/java/info/guardianproject/phoneypot/ListActivity.java
@@ -11,6 +11,7 @@ import info.guardianproject.phoneypot.model.EventTrigger;
import info.guardianproject.phoneypot.service.WebServer;
import info.guardianproject.phoneypot.ui.EventActivity;
import info.guardianproject.phoneypot.ui.EventAdapter;
+import info.guardianproject.phoneypot.ui.MicrophoneConfigureActivity;
import info.guardianproject.phoneypot.ui.PPAppIntro;
@@ -25,6 +26,7 @@ import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.Toolbar;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.util.Log;
import android.view.Menu;
@@ -47,7 +49,7 @@ public class ListActivity extends AppCompatActivity {
RecyclerView recyclerView;
FloatingActionButton fab;
-
+ Toolbar toolbar;
EventAdapter adapter;
List<Event> events = new ArrayList<>();
@@ -68,6 +70,8 @@ public class ListActivity extends AppCompatActivity {
recyclerView = (RecyclerView) findViewById(R.id.main_list);
fab = (FloatingActionButton) findViewById(R.id.fab);
+ toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
LinearLayoutManager llm = new LinearLayoutManager(this);
recyclerView.setLayoutManager(llm);
@@ -127,11 +131,9 @@ public class ListActivity extends AppCompatActivity {
initialCount = Event.count(Event.class);
- showOnboarding();
-
if (initialCount <= 0) {
- // showOnboarding();
+ showOnboarding();
} else {
recyclerView.setVisibility(View.VISIBLE);
@@ -208,7 +210,6 @@ public class ListActivity extends AppCompatActivity {
if (requestCode == REQUEST_CODE_INTRO)
{
Intent i = new Intent(ListActivity.this, MonitorActivity.class);
- i.putExtra("firsttime",true);
startActivity(i);
}
}
@@ -282,7 +283,7 @@ public class ListActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()){
- case R.id.menu_settings:
+ case R.id.action_settings:
startActivity(new Intent(this,SettingsActivity.class));
break;
case R.id.action_about:
diff --git a/src/main/java/info/guardianproject/phoneypot/MonitorActivity.java b/src/main/java/info/guardianproject/phoneypot/MonitorActivity.java
index 975f838..fc7a7fe 100644
--- a/src/main/java/info/guardianproject/phoneypot/MonitorActivity.java
+++ b/src/main/java/info/guardianproject/phoneypot/MonitorActivity.java
@@ -12,6 +12,7 @@ import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
+import android.graphics.Camera;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Environment;
@@ -20,10 +21,16 @@ import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.FragmentActivity;
import android.text.InputType;
import android.util.Log;
+import android.view.DragEvent;
+import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.widget.Button;
import android.widget.EditText;
+import android.widget.FrameLayout;
+import android.widget.NumberPicker;
+import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
@@ -32,8 +39,12 @@ import org.w3c.dom.Text;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
import info.guardianproject.phoneypot.service.MonitorService;
+import info.guardianproject.phoneypot.ui.CameraFragment;
+import info.guardianproject.phoneypot.ui.MicrophoneConfigureActivity;
public class MonitorActivity extends FragmentActivity {
@@ -54,37 +65,103 @@ public class MonitorActivity extends FragmentActivity {
txtTimer = (TextView)findViewById(R.id.timer_text);
viewTimer = findViewById(R.id.timer_container);
- initTimer();
+ int timeM = preferences.getTimerDelay()*1000;
+ String timerText = String.format(Locale.getDefault(), "%02d:%02d",
+ TimeUnit.MILLISECONDS.toMinutes(timeM) % 60,
+ TimeUnit.MILLISECONDS.toSeconds(timeM) % 60);
- FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab_cancel);
- fab.setOnClickListener(new View.OnClickListener() {
+ txtTimer.setText(timerText);
+ txtTimer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (cTimer == null)
+ showNumberPicker();
- if (cTimer != null) {
- cTimer.cancel();
- cTimer = null;
- }
-
- close();
}
});
- fab = (FloatingActionButton)findViewById(R.id.fab_settings);
- fab.setOnClickListener(new View.OnClickListener() {
+ findViewById(R.id.btnStartLater).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ doCancel();
+ }
+ });
+
+ findViewById(R.id.btnStartNow).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ((Button)findViewById(R.id.btnStartLater)).setText(R.string.action_cancel);
+ findViewById(R.id.btnStartNow).setVisibility(View.INVISIBLE);
+ findViewById(R.id.timer_text_title).setVisibility(View.INVISIBLE);
+ initTimer();
+ }
+ });
+
+ findViewById(R.id.btnMicSettings).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(MonitorActivity.this, MicrophoneConfigureActivity.class));
+ }
+ });
+
+ findViewById(R.id.btnCameraSwitch).setOnClickListener(new View.OnClickListener() {
@Override
- public void onClick(View view) {
-
- showSettings();
+ public void onClick(View v) {
+ switchCamera();
}
});
- if (getIntent().getBooleanExtra("firsttime",false))
- {
- showSettings();
+ }
+
+ private void switchCamera ()
+ {
+
+ String camera = preferences.getCamera();
+ if (camera.equals(PreferenceManager.FRONT))
+ preferences.setCamera(PreferenceManager.BACK);
+ else if (camera.equals(PreferenceManager.BACK))
+ preferences.setCamera(PreferenceManager.FRONT);
+
+ ((CameraFragment)getSupportFragmentManager().findFragmentById(R.id.fragment_camera)).resetCamera();
+
+ }
+
+ private void updateTimerValue (int val)
+ {
+ preferences.setTimerDelay(val);
+ int valM = val * 1000;
+ String timerText = String.format(Locale.getDefault(), "%02d:%02d",
+ TimeUnit.MILLISECONDS.toMinutes(valM) % 60,
+ TimeUnit.MILLISECONDS.toSeconds(valM) % 60);
+
+ txtTimer.setText(timerText);
+ }
+
+ private void doCancel ()
+ {
+
+ if (cTimer != null) {
+ cTimer.cancel();
+ cTimer = null;
+ stopService(new Intent(this, MonitorService.class));
+
+ findViewById(R.id.btnStartNow).setVisibility(View.VISIBLE);
+ findViewById(R.id.timer_text_title).setVisibility(View.VISIBLE);
+
+ ((Button)findViewById(R.id.btnStartLater)).setText(R.string.start_later);
+
+ int timeM = preferences.getTimerDelay()*1000;
+ String timerText = String.format(Locale.getDefault(), "%02d:%02d",
+ TimeUnit.MILLISECONDS.toMinutes(timeM) % 60,
+ TimeUnit.MILLISECONDS.toSeconds(timeM) % 60);
+
+ txtTimer.setText(timerText);
}
+ else {
- }
+ close();
+ }
+ }
private void showSettings ()
{
@@ -110,13 +187,15 @@ public class MonitorActivity extends FragmentActivity {
private void initTimer ()
{
- cTimer = new CountDownTimer((preferences.getTimerDelay()+1)*1000, 1000) {
+ txtTimer.setTextColor(getResources().getColor(R.color.colorAccent));
+ cTimer = new CountDownTimer((preferences.getTimerDelay())*1000, 1000) {
public void onTick(long millisUntilFinished) {
- // mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
- //here you can have your logic to set text to edittext
+ String timerText = String.format(Locale.getDefault(), "%02d:%02d",
+ TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished) % 60,
+ TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) % 60);
- txtTimer.setText(""+millisUntilFinished/1000);
+ txtTimer.setText(timerText);
}
public void onFinish() {
@@ -160,7 +239,7 @@ public class MonitorActivity extends FragmentActivity {
preferences.unsetAccessToken();
preferences.unsetDelegatedAccessToken();
preferences.unsetPhoneId();
- finish();
+ finish();
}
@@ -171,6 +250,31 @@ public class MonitorActivity extends FragmentActivity {
public void onBackPressed() {
close();
}
-
+
+ private void showNumberPicker ()
+ {
+ final NumberPicker picker = new NumberPicker(this);
+ picker.setMinValue(1);
+ picker.setMaxValue(60*30);
+ picker.setValue(preferences.getTimerDelay());
+
+ final FrameLayout layout = new FrameLayout(this);
+ layout.addView(picker, new FrameLayout.LayoutParams(
+ FrameLayout.LayoutParams.WRAP_CONTENT,
+ FrameLayout.LayoutParams.WRAP_CONTENT,
+ Gravity.CENTER));
+
+ new AlertDialog.Builder(this)
+ .setView(layout)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ // do something with picker.getValue()
+ updateTimerValue (picker.getValue());
+ }
+ })
+ .setNegativeButton(android.R.string.cancel, null)
+ .show();
+ }
}
diff --git a/src/main/java/info/guardianproject/phoneypot/PreferenceManager.java b/src/main/java/info/guardianproject/phoneypot/PreferenceManager.java
index e3b48c8..ac25ada 100644
--- a/src/main/java/info/guardianproject/phoneypot/PreferenceManager.java
+++ b/src/main/java/info/guardianproject/phoneypot/PreferenceManager.java
@@ -171,6 +171,7 @@ public class PreferenceManager {
}
public void setSmsNumber(String number) {
+
prefsEditor.putString(SMS_NUMBER, number);
prefsEditor.commit();
}
diff --git a/src/main/java/info/guardianproject/phoneypot/sensors/media/MicSamplerTask.java b/src/main/java/info/guardianproject/phoneypot/sensors/media/MicSamplerTask.java
index 09600ca..c98a88a 100644
--- a/src/main/java/info/guardianproject/phoneypot/sensors/media/MicSamplerTask.java
+++ b/src/main/java/info/guardianproject/phoneypot/sensors/media/MicSamplerTask.java
@@ -56,7 +56,7 @@ public class MicSamplerTask extends AsyncTask<Void,Object,Void> {
publishProgress(volumeMeter.getAmplitude());
}
try {
- Thread.sleep(500);
+ Thread.sleep(250);
} catch (InterruptedException e) {
//Nothing to do we exit next line
@@ -70,7 +70,7 @@ public class MicSamplerTask extends AsyncTask<Void,Object,Void> {
}
while (paused) {
try {
- Thread.sleep(1000);
+ Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/src/main/java/info/guardianproject/phoneypot/sensors/motion/Preview.java b/src/main/java/info/guardianproject/phoneypot/sensors/motion/Preview.java
index 8754a21..33b308a 100644
--- a/src/main/java/info/guardianproject/phoneypot/sensors/motion/Preview.java
+++ b/src/main/java/info/guardianproject/phoneypot/sensors/motion/Preview.java
@@ -22,6 +22,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.YuvImage;
@@ -55,7 +56,7 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {
private PreferenceManager prefs;
private int cameraFacing = 0;
- private final static int PREVIEW_INTERVAL = 2000;
+ private final static int PREVIEW_INTERVAL = 500;
private List<MotionAsyncTask.MotionListener> listeners = new ArrayList<MotionAsyncTask.MotionListener>();
@@ -324,20 +325,44 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {
parameters.setPreviewFpsRange(PREVIEW_INTERVAL,PREVIEW_INTERVAL*2);
int degree = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
int displayOrientation = 0;
- switch (degree) {
- case Surface.ROTATION_0:
- displayOrientation = 90;
- break;
- case Surface.ROTATION_90:
- displayOrientation = 0;
- break;
- case Surface.ROTATION_180:
- displayOrientation = 0;
- break;
- case Surface.ROTATION_270:
- displayOrientation = 180;
- break;
+
+ if (prefs.getCamera().equals(PreferenceManager.FRONT)) {
+
+ switch (degree) {
+ case Surface.ROTATION_0:
+ displayOrientation = 90;
+ break;
+ case Surface.ROTATION_90:
+ displayOrientation = 0;
+ break;
+ case Surface.ROTATION_180:
+ displayOrientation = 0;
+ break;
+ case Surface.ROTATION_270:
+ displayOrientation = 180;
+ break;
+ }
+ }
+ else
+ {
+ boolean isLandscape = false;// degree == Configuration.ORIENTATION_LANDSCAPE;
+
+ switch (degree) {
+ case Surface.ROTATION_0:
+ displayOrientation = isLandscape? 0 : 90;
+ break;
+ case Surface.ROTATION_90:
+ displayOrientation = isLandscape? 0 :270;
+ break;
+ case Surface.ROTATION_180:
+ displayOrientation = isLandscape? 180 :270;
+ break;
+ case Surface.ROTATION_270:
+ displayOrientation = isLandscape? 180 :90;
+ break;
+ }
}
+
camera.setDisplayOrientation(displayOrientation);
//camera.setParameters(parameters);
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/CameraFragment.java b/src/main/java/info/guardianproject/phoneypot/ui/CameraFragment.java
index b3c82ae..a58fbb9 100644
--- a/src/main/java/info/guardianproject/phoneypot/ui/CameraFragment.java
+++ b/src/main/java/info/guardianproject/phoneypot/ui/CameraFragment.java
@@ -54,6 +54,18 @@ public final class CameraFragment extends Fragment {
public void onResume() {
super.onResume();
+ initCamera ();
+ }
+
+ public void resetCamera ()
+ {
+ ((FrameLayout) getActivity().findViewById(R.id.preview)).removeAllViews();
+ preview = null;
+ initCamera();
+ }
+
+ private void initCamera ()
+ {
if (preview == null) {
PreferenceManager prefs = new PreferenceManager(getActivity());
@@ -61,6 +73,7 @@ public final class CameraFragment extends Fragment {
if (prefs.getCameraSensitivity() != PreferenceManager.OFF) {
//Uncomment to see the camera
preview = new Preview(getActivity());
+
((FrameLayout) getActivity().findViewById(R.id.preview)).addView(preview);
// oldImage = (ImageView) getActivity().findViewById(R.id.old_image);
@@ -86,7 +99,6 @@ public final class CameraFragment extends Fragment {
}
}
}
-
public void onSensorChanged(SensorEvent event) {
}
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.java b/src/main/java/info/guardianproject/phoneypot/ui/CustomSlideBigText.java
similarity index 65%
rename from src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.java
rename to src/main/java/info/guardianproject/phoneypot/ui/CustomSlideBigText.java
index 712d761..328ef28 100644
--- a/src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.java
+++ b/src/main/java/info/guardianproject/phoneypot/ui/CustomSlideBigText.java
@@ -11,18 +11,21 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.TextView;
import info.guardianproject.phoneypot.R;
-public class CustomIntroSlide extends Fragment {
+public class CustomSlideBigText extends Fragment {
private static final String ARG_LAYOUT_RES_ID = "layoutResId";
private int layoutResId;
private String mTitle;
+ private String mButtonText;
+ private View.OnClickListener mButtonListener;
- public static CustomIntroSlide newInstance(int layoutResId) {
- CustomIntroSlide sampleSlide = new CustomIntroSlide();
+ public static CustomSlideBigText newInstance(int layoutResId) {
+ CustomSlideBigText sampleSlide = new CustomSlideBigText();
Bundle args = new Bundle();
args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
@@ -36,6 +39,12 @@ public class CustomIntroSlide extends Fragment {
mTitle = title;
}
+ public void showButton (String buttonText, View.OnClickListener buttonListener)
+ {
+ mButtonText = buttonText;
+ mButtonListener = buttonListener;
+ }
+
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -51,6 +60,14 @@ public class CustomIntroSlide extends Fragment {
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(layoutResId, container, false);
((TextView)view.findViewById(R.id.custom_slide_big_text)).setText(mTitle);
+
+ if (mButtonText != null)
+ {
+ Button button = (Button)view.findViewById(R.id.custom_slide_button);
+ button.setVisibility(View.VISIBLE);
+ button.setText(mButtonText);
+ button.setOnClickListener(mButtonListener);
+ }
return view;
}
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/CustomSlideNotify.java b/src/main/java/info/guardianproject/phoneypot/ui/CustomSlideNotify.java
new file mode 100644
index 0000000..082a1ee
--- /dev/null
+++ b/src/main/java/info/guardianproject/phoneypot/ui/CustomSlideNotify.java
@@ -0,0 +1,109 @@
+package info.guardianproject.phoneypot.ui;
+
+/**
+ * Created by n8fr8 on 10/30/17.
+ */
+
+
+import android.Manifest;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.ActivityCompat;
+import android.support.v4.app.Fragment;
+import android.support.v4.content.ContextCompat;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import info.guardianproject.phoneypot.PreferenceManager;
+import info.guardianproject.phoneypot.R;
+import info.guardianproject.phoneypot.SettingsActivity;
+
+public class CustomSlideNotify extends Fragment {
+
+ private static final String ARG_LAYOUT_RES_ID = "layoutResId";
+ private int layoutResId;
+ private EditText mEditNumber;
+
+ public static CustomSlideNotify newInstance(int layoutResId) {
+ CustomSlideNotify sampleSlide = new CustomSlideNotify();
+
+ Bundle args = new Bundle();
+ args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
+ sampleSlide.setArguments(args);
+
+ return sampleSlide;
+ }
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
+ layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
+ }
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ View view = inflater.inflate(layoutResId, container, false);
+
+ mEditNumber = (EditText)view.findViewById(R.id.editNumber);
+ mEditNumber.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ askForPermission(Manifest.permission.SEND_SMS,6);
+ askForPermission(Manifest.permission.READ_PHONE_STATE,6);
+
+ }
+ });
+ PreferenceManager pm = new PreferenceManager(getActivity());
+ if (!TextUtils.isEmpty(pm.getSmsNumber()))
+ mEditNumber.setText(pm.getSmsNumber());
+
+ Button button = (Button)view.findViewById(R.id.btnSaveNumber);
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ saveNumber();
+ }
+ });
+ return view;
+
+ }
+
+ private void saveNumber ()
+ {
+ PreferenceManager pm = new PreferenceManager(getActivity());
+ pm.activateSms(true);
+ pm.setSmsNumber(mEditNumber.getText().toString());
+ Toast.makeText(getActivity(),"Phone number saved!",Toast.LENGTH_SHORT).show();
+ }
+
+ private void askForPermission(String permission, Integer requestCode) {
+ if (ContextCompat.checkSelfPermission(getActivity(), permission) != PackageManager.PERMISSION_GRANTED) {
+
+ // Should we show an explanation?
+ if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(), permission)) {
+
+ //This is called if user has denied the permission before
+ //In this case I am just asking the permission again
+ ActivityCompat.requestPermissions(getActivity(), new String[]{permission}, requestCode);
+
+ } else {
+
+ ActivityCompat.requestPermissions(getActivity(), new String[]{permission}, requestCode);
+ }
+ } else {
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/EventTriggerAdapter.java b/src/main/java/info/guardianproject/phoneypot/ui/EventTriggerAdapter.java
index 322abaf..26c8fd2 100644
--- a/src/main/java/info/guardianproject/phoneypot/ui/EventTriggerAdapter.java
+++ b/src/main/java/info/guardianproject/phoneypot/ui/EventTriggerAdapter.java
@@ -22,13 +22,9 @@ import java.util.ArrayList;
import java.util.List;
import info.guardianproject.phoneypot.R;
-import info.guardianproject.phoneypot.model.Event;
import info.guardianproject.phoneypot.model.EventTrigger;
import nl.changer.audiowife.AudioWife;
-import static android.R.id.list;
-import static android.content.ContentValues.TAG;
-
/**
* Created by n8fr8 on 4/16/17.
*/
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/MicrophoneConfigureActivity.java b/src/main/java/info/guardianproject/phoneypot/ui/MicrophoneConfigureActivity.java
index 43702aa..92067ab 100644
--- a/src/main/java/info/guardianproject/phoneypot/ui/MicrophoneConfigureActivity.java
+++ b/src/main/java/info/guardianproject/phoneypot/ui/MicrophoneConfigureActivity.java
@@ -1,5 +1,9 @@
package info.guardianproject.phoneypot.ui;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
import android.os.Message;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
@@ -8,16 +12,22 @@ import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.MotionEvent;
import android.widget.NumberPicker;
import android.widget.TextView;
import android.widget.Toast;
+import com.maxproj.simplewaveform.SimpleWaveform;
+
+import java.util.LinkedList;
+
import info.guardianproject.phoneypot.PreferenceManager;
import info.guardianproject.phoneypot.R;
import info.guardianproject.phoneypot.model.EventTrigger;
import info.guardianproject.phoneypot.sensors.media.AudioRecorderTask;
import info.guardianproject.phoneypot.sensors.media.MicSamplerTask;
import info.guardianproject.phoneypot.sensors.media.MicrophoneTaskFactory;
+import me.angrybyte.numberpicker.listener.OnValueChangeListener;
import me.angrybyte.numberpicker.view.ActualNumberPicker;
import static info.guardianproject.phoneypot.R.id.microphone;
@@ -28,6 +38,10 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
private TextView mTextLevel;
private ActualNumberPicker mNumberTrigger;
private PreferenceManager mPrefManager;
+ private SimpleWaveformExtended mWaveform;
+ private LinkedList<Integer> mWaveAmpList;
+
+ private double maxAmp = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -37,16 +51,25 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
- setTitle("Sound Sensitivity");
+ setTitle("");
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mTextLevel = (TextView)findViewById(R.id.text_display_level);
mNumberTrigger = (ActualNumberPicker)findViewById(R.id.number_trigger_level);
+ mWaveform = (SimpleWaveformExtended)findViewById(R.id.simplewaveform);
mNumberTrigger.setMinValue(0);
mNumberTrigger.setMaxValue(120);
+ mNumberTrigger.setListener(new OnValueChangeListener() {
+ @Override
+ public void onValueChanged(int oldValue, int newValue) {
+ mWaveform.setThreshold(newValue);
+ }
+ });
mPrefManager = new PreferenceManager(this.getApplicationContext());
+ /**
if (mPrefManager.getMicrophoneSensitivity().equals("High")) {
mNumberTrigger.setValue(40);
} else if (mPrefManager.getMicrophoneSensitivity().equals("Medium")) {
@@ -59,11 +82,92 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
mNumberTrigger.setValue(Integer.parseInt(mPrefManager.getMicrophoneSensitivity()));
}
catch (Exception e){}
- }
+ }**/
+ initWave();
startMic();
}
+ private void initWave ()
+ {
+ mWaveform.init();
+
+ mWaveAmpList = new LinkedList<>();
+
+ mWaveform.setDataList(mWaveAmpList);
+
+ //define bar gap
+ mWaveform.barGap = 30;
+
+ //define x-axis direction
+ mWaveform.modeDirection = SimpleWaveform.MODE_DIRECTION_RIGHT_LEFT;
+
+ //define if draw opposite pole when show bars
+ mWaveform.modeAmp = SimpleWaveform.MODE_AMP_ABSOLUTE;
+ //define if the unit is px or percent of the view's height
+ mWaveform.modeHeight = SimpleWaveform.MODE_HEIGHT_PERCENT;
+ //define where is the x-axis in y-axis
+ mWaveform.modeZero = SimpleWaveform.MODE_ZERO_CENTER;
+ //if show bars?
+ mWaveform.showBar = true;
+
+ //define how to show peaks outline
+ mWaveform.modePeak = SimpleWaveform.MODE_PEAK_ORIGIN;
+ //if show peaks outline?
+ mWaveform.showPeak = true;
+
+ //show x-axis
+ mWaveform.showXAxis = true;
+ Paint xAxisPencil = new Paint();
+ xAxisPencil.setStrokeWidth(1);
+ xAxisPencil.setColor(0x88ffffff);
+ mWaveform.xAxisPencil = xAxisPencil;
+
+ //define pencil to draw bar
+ Paint barPencilFirst = new Paint();
+ Paint barPencilSecond = new Paint();
+ Paint peakPencilFirst = new Paint();
+ Paint peakPencilSecond = new Paint();
+
+ barPencilFirst.setStrokeWidth(15);
+ barPencilFirst.setColor(getResources().getColor(R.color.colorAccent));
+ mWaveform.barPencilFirst = barPencilFirst;
+
+ barPencilFirst.setStrokeWidth(15);
+
+ barPencilSecond.setStrokeWidth(15);
+ barPencilSecond.setColor(getResources().getColor(R.color.colorPrimaryDark));
+ mWaveform.barPencilSecond = barPencilSecond;
+
+ //define pencil to draw peaks outline
+ peakPencilFirst.setStrokeWidth(5);
+ peakPencilFirst.setColor(getResources().getColor(R.color.colorAccent));
+ mWaveform.peakPencilFirst = peakPencilFirst;
+ peakPencilSecond.setStrokeWidth(5);
+ peakPencilSecond.setColor(getResources().getColor(R.color.colorPrimaryDark));
+ mWaveform.peakPencilSecond = peakPencilSecond;
+ mWaveform.firstPartNum = 0;
+
+
+ //define how to clear screen
+ mWaveform.clearScreenListener = new SimpleWaveform.ClearScreenListener() {
+ @Override
+ public void clearScreen(Canvas canvas) {
+ canvas.drawColor(Color.WHITE, PorterDuff.Mode.CLEAR);
+ }
+ };
+ /**
+ mWaveform.progressTouch = new SimpleWaveform.ProgressTouch() {
+ @Override
+ public void progressTouch(int progress, MotionEvent event) {
+ Log.d("", "you touch at: " + progress);
+ mWaveform.firstPartNum = progress;
+ mWaveform.refresh();
+ }
+ };**/
+ //show...
+ mWaveform.refresh();
+ }
private void startMic ()
{
try {
@@ -80,11 +184,15 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
@Override
protected void onDestroy() {
super.onDestroy();
-
if (microphone != null)
microphone.cancel(true);
+ }
+
+ private void save ()
+ {
mPrefManager.setMicrophoneSensitivity(mNumberTrigger.getValue()+"");
+ finish();
}
@Override
@@ -112,12 +220,20 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
averageDB = 20 * Math.log10(Math.abs(average) / 1);
}
- mTextLevel.setText(((int)averageDB)+"");
+ if (averageDB > maxAmp) {
+ maxAmp = averageDB + 5d; //add 5db buffer
+ mNumberTrigger.setValue(new Integer((int)maxAmp));
+ mNumberTrigger.invalidate();
+ }
- if (averageDB > mNumberTrigger.getValue())
- {
- Toast.makeText(this,"Sound Threshold Crossed!",Toast.LENGTH_SHORT).show();
+ int perc = (int)((averageDB/140d)*100d);
+ mWaveAmpList.addFirst(new Integer((int)perc));
+ if (mWaveAmpList.size() > mWaveform.width / mWaveform.barGap + 2) {
+ mWaveAmpList.removeLast();
}
+ mWaveform.refresh();
+ mTextLevel.setText(getString(R.string.current_noise_base) + ' ' + ((int)averageDB)+"db");
+
}
@Override
@@ -135,6 +251,9 @@ public class MicrophoneConfigureActivity extends AppCompatActivity implements Mi
public boolean onOptionsItemSelected (MenuItem item) {
switch (item.getItemId()){
case R.id.menu_save:
+ save();
+ break;
+ case android.R.id.home:
finish();
break;
}
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java b/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java
index 5edfee8..cdc284c 100644
--- a/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java
+++ b/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java
@@ -2,13 +2,12 @@ package info.guardianproject.phoneypot.ui;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;
-import com.github.paolorotolo.appintro.model.SliderPage;
-import android.graphics.Color;
+import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import android.widget.TextView;
+import android.view.View;
import info.guardianproject.phoneypot.R;
@@ -36,18 +35,27 @@ public class PPAppIntro extends AppIntro {
// sliderPage.setDescription("This is a demo of the AppIntro library.");
sliderPage.setBgColor(getResources().getColor(R.color.colorPrimaryDark));
addSlide(AppIntroFragment.newInstance(sliderPage));**/
- CustomIntroSlide cs1 = CustomIntroSlide.newInstance(R.layout.custom_slide_big_text);
+ CustomSlideBigText cs1 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs1.setTitle(getString(R.string.intro2_title));
addSlide(cs1);
- CustomIntroSlide cs2 = CustomIntroSlide.newInstance(R.layout.custom_slide_big_text);
+ CustomSlideBigText cs2 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs2.setTitle(getString(R.string.intro3_desc));
+ cs2.showButton(getString(R.string.action_configure), new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(PPAppIntro.this,MicrophoneConfigureActivity.class));
+ }
+ });
addSlide(cs2);
- CustomIntroSlide cs3 = CustomIntroSlide.newInstance(R.layout.custom_slide_big_text);
+ CustomSlideBigText cs3 = CustomSlideBigText.newInstance(R.layout.custom_slide_big_text);
cs3.setTitle(getString(R.string.intro4_desc));
addSlide(cs3);
+ CustomSlideNotify cs4 = CustomSlideNotify.newInstance(R.layout.custom_slide_notify);
+ addSlide(cs4);
+
addSlide(AppIntroFragment.newInstance(getString(R.string.intro5_title), getString(R.string.intro5_desc),
R.drawable.web_hi_res_512, getResources().getColor(R.color.colorPrimaryDark)));
diff --git a/src/main/java/info/guardianproject/phoneypot/ui/SimpleWaveformExtended.java b/src/main/java/info/guardianproject/phoneypot/ui/SimpleWaveformExtended.java
new file mode 100644
index 0000000..e28f6df
--- /dev/null
+++ b/src/main/java/info/guardianproject/phoneypot/ui/SimpleWaveformExtended.java
@@ -0,0 +1,39 @@
+package info.guardianproject.phoneypot.ui;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+
+import com.maxproj.simplewaveform.SimpleWaveform;
+
+/**
+ * Created by n8fr8 on 10/30/17.
+ */
+
+public class SimpleWaveformExtended extends SimpleWaveform {
+
+
+ private int mThreshold = 0;
+
+ public SimpleWaveformExtended(Context context) {
+ super(context);
+ }
+
+ public SimpleWaveformExtended(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void setThreshold (int threshold)
+ {
+ mThreshold = threshold;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+
+ float percDb = (((float)mThreshold)/120f)*100f;
+ int lineY = getHeight()/2-(int)percDb*4;
+ canvas.drawLine(0,lineY,getWidth(),lineY,peakPencilFirst);
+ }
+}
diff --git a/src/main/res/drawable-hdpi/ic_camera_front_white_36dp.png b/src/main/res/drawable-hdpi/ic_camera_front_white_36dp.png
new file mode 100644
index 0000000..f8394dc
Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_camera_front_white_36dp.png differ
diff --git a/src/main/res/drawable-hdpi/ic_mic_white_36dp.png b/src/main/res/drawable-hdpi/ic_mic_white_36dp.png
new file mode 100644
index 0000000..670e806
Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_mic_white_36dp.png differ
diff --git a/src/main/res/drawable-mdpi/ic_camera_front_white_36dp.png b/src/main/res/drawable-mdpi/ic_camera_front_white_36dp.png
new file mode 100644
index 0000000..f36dcd4
Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_camera_front_white_36dp.png differ
diff --git a/src/main/res/drawable-mdpi/ic_mic_white_36dp.png b/src/main/res/drawable-mdpi/ic_mic_white_36dp.png
new file mode 100644
index 0000000..f316b84
Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_mic_white_36dp.png differ
diff --git a/src/main/res/drawable-xhdpi/ic_camera_front_white_36dp.png b/src/main/res/drawable-xhdpi/ic_camera_front_white_36dp.png
new file mode 100644
index 0000000..3eb24d1
Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_camera_front_white_36dp.png differ
diff --git a/src/main/res/drawable-xhdpi/ic_mic_white_36dp.png b/src/main/res/drawable-xhdpi/ic_mic_white_36dp.png
new file mode 100644
index 0000000..b038938
Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_mic_white_36dp.png differ
diff --git a/src/main/res/drawable-xxhdpi/ic_camera_front_white_36dp.png b/src/main/res/drawable-xxhdpi/ic_camera_front_white_36dp.png
new file mode 100644
index 0000000..115cdb7
Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_camera_front_white_36dp.png differ
diff --git a/src/main/res/drawable-xxhdpi/ic_mic_white_36dp.png b/src/main/res/drawable-xxhdpi/ic_mic_white_36dp.png
new file mode 100644
index 0000000..7066860
Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_mic_white_36dp.png differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_camera_front_white_36dp.png b/src/main/res/drawable-xxxhdpi/ic_camera_front_white_36dp.png
new file mode 100644
index 0000000..9f43e20
Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_camera_front_white_36dp.png differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_mic_white_36dp.png b/src/main/res/drawable-xxxhdpi/ic_mic_white_36dp.png
new file mode 100644
index 0000000..ad0460c
Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_mic_white_36dp.png differ
diff --git a/src/main/res/drawable/round_drawable.xml b/src/main/res/drawable/round_drawable.xml
new file mode 100644
index 0000000..134c36e
--- /dev/null
+++ b/src/main/res/drawable/round_drawable.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <stroke
+ android:width="3dp"
+ android:color="#ffffff" />
+
+ <padding
+ android:left="5dp"
+ android:right="5dp"/>
+
+ <corners
+ android:bottomLeftRadius="7dp"
+ android:bottomRightRadius="7dp"
+ android:topLeftRadius="7dp"
+ android:topRightRadius="7dp" />
+</shape>
\ No newline at end of file
diff --git a/src/main/res/drawable/round_drawable_accent.xml b/src/main/res/drawable/round_drawable_accent.xml
new file mode 100644
index 0000000..5ca6896
--- /dev/null
+++ b/src/main/res/drawable/round_drawable_accent.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <stroke
+ android:width="3dp"
+ android:color="@color/colorAccent" />
+
+ <padding
+ android:left="5dp"
+ android:right="5dp"/>
+
+ <corners
+ android:bottomLeftRadius="7dp"
+ android:bottomRightRadius="7dp"
+ android:topLeftRadius="7dp"
+ android:topRightRadius="7dp" />
+</shape>
\ No newline at end of file
diff --git a/src/main/res/layout/activity_microphone_configure.xml b/src/main/res/layout/activity_microphone_configure.xml
index b922974..f4577fb 100644
--- a/src/main/res/layout/activity_microphone_configure.xml
+++ b/src/main/res/layout/activity_microphone_configure.xml
@@ -4,7 +4,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:background="@color/colorPrimary"
+ >
+
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
@@ -12,34 +15,54 @@
android:background="?attr/colorPrimary"
android:theme="@style/AppTheme.AppBarOverlay"/>
app:popupTheme="@style/AppTheme.PopupOverlay" />
-<ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:orientation="vertical"
+ android:gravity="center_vertical"
>
+
+
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:text="Current Audio Level"
+ android:text="@string/tune_the_sound_detection"
+ android:textColor="@color/colorAccent"
+ android:textSize="28dp"
+ android:textStyle="bold"
+
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
/>
-<TextView
- android:id="@+id/text_display_level"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textSize="80dp"
- android:text="0"
-/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:text="Configure Trigger Level"
- android:layout_marginTop="15dp"
+ android:text="@string/set_your_phone_on_the_table_and_make_noises_in_the_room_to_find_the_right_level_to_detect"
+ android:textColor="@color/colorAccent"
+ android:textSize="14dp"
+ android:textStyle="bold"
+ android:layout_marginLeft="10dp"
+ android:layout_marginRight="10dp"
+
+
+ />
+
+ <info.guardianproject.phoneypot.ui.SimpleWaveformExtended
+ android:id="@+id/simplewaveform"
+ android:layout_width="match_parent"
+ android:layout_height="240dp"
+ android:layout_margin="10dp"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="@string/configure_trigger_level"
+ android:textColor="@color/colorAccent"
+
/>
<me.angrybyte.numberpicker.view.ActualNumberPicker
@@ -61,6 +84,16 @@
app:text_color="@android:color/darker_gray"
app:text_size="16sp" />
+ <TextView
+ android:id="@+id/text_display_level"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="24dp"
+ android:text="@string/current_noise_base"
+ android:textColor="@color/colorAccent"
+ android:textStyle="bold"
+ android:layout_margin="15dp"
+ />
</LinearLayout>
-</ScrollView>
</LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/custom_slide_big_text.xml b/src/main/res/layout/custom_slide_big_text.xml
index 78072fd..fe7e406 100644
--- a/src/main/res/layout/custom_slide_big_text.xml
+++ b/src/main/res/layout/custom_slide_big_text.xml
@@ -12,11 +12,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/intro2_title"
- android:textColor="@color/colorAccent"
+ android:textColor="@color/colorPrimaryLight"
android:gravity="center"
android:layout_margin="10dp"
android:textStyle="bold"
android:textSize="28sp"/>
+ <Button
+ android:id="@+id/custom_slide_button"
+ android:layout_width="120dp"
+ android:layout_height="40dp"
+ android:layout_margin="10dp"
+ android:background="@drawable/round_drawable"
+ android:textColor="@color/White"
+ android:visibility="gone"
+ />
</LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/custom_slide_notify.xml b/src/main/res/layout/custom_slide_notify.xml
new file mode 100644
index 0000000..d2ada23
--- /dev/null
+++ b/src/main/res/layout/custom_slide_notify.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:background="@color/colorPrimaryDark"
+ >
+
+ <TextView
+ android:id="@+id/custom_slide_big_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Know immediately when Haven detects something"
+ android:textColor="@color/colorPrimaryLight"
+ android:gravity="center"
+ android:layout_margin="10dp"
+ android:textStyle="bold"
+ android:textSize="28sp"/>
+
+ <EditText
+ android:layout_width="200dp"
+ android:layout_height="wrap_content"
+ android:textColor="@color/White"
+ android:backgroundTint="@color/colorPrimaryLight"
+ android:hint="212 555 1212"
+ android:gravity="center"
+ android:inputType="phone"
+ android:id="@+id/editNumber"
+ />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="You will receive a text when the app hears or sees something"
+ android:textColor="@color/colorPrimaryLight"
+ android:gravity="center"
+ android:layout_marginLeft="40dp"
+ android:layout_marginRight="40dp"
+
+ android:textStyle="bold"
+ android:textSize="16dp"/>
+
+ <Button
+ android:layout_width="120dp"
+ android:layout_height="40dp"
+ android:text="@string/save_number"
+ android:layout_margin="10dp"
+ android:id="@+id/btnSaveNumber"
+ android:background="@drawable/round_drawable"
+ android:textColor="@color/White"
+
+ />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/src/main/res/layout/event_item.xml b/src/main/res/layout/event_item.xml
index a7810bc..82e28ec 100644
--- a/src/main/res/layout/event_item.xml
+++ b/src/main/res/layout/event_item.xml
@@ -29,6 +29,7 @@
android:visibility="gone"
android:scaleType="centerCrop"
/>
+
<com.github.derlio.waveform.SimpleWaveformView
android:id="@+id/event_item_sound"
android:layout_width="match_parent"
diff --git a/src/main/res/layout/layout_running.xml b/src/main/res/layout/layout_running.xml
index d6dd358..57e4f57 100644
--- a/src/main/res/layout/layout_running.xml
+++ b/src/main/res/layout/layout_running.xml
@@ -4,7 +4,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:background="@color/DarkGray"
+ >
<FrameLayout
android:layout_width="match_parent"
@@ -23,44 +25,80 @@
android:id="@+id/timer_container"
android:orientation="vertical"
android:background="#aaffffff"
- android:gravity="center_vertical"
+ android:gravity="center_vertical|center_horizontal"
>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:textSize="28dp"
+ android:text="@string/set_a_countdown_time"
+ android:textStyle="bold"
+ android:textColor="@color/White"
+ android:id="@+id/timer_text_title"
+
+ />
+
<TextView
android:id="@+id/timer_text"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
- android:textSize="120dp"
- android:text="100"
+ android:textSize="78dp"
+ android:text="1:00"
+ android:textStyle="bold"
+ android:textColor="@color/White"
/>
- <TextView
+ <Button
+ android:layout_width="120dp"
+ android:layout_height="40dp"
+ android:text="@string/start_now"
+ android:textStyle="bold"
+ android:textColor="@color/colorAccent"
+ android:background="@drawable/round_drawable_accent"
+ android:id="@+id/btnStartNow"
+ android:layout_margin="10dp"
+ />
+ <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="The final countdown... Motion, sound and camera events will be logged once the timer is complete.\n\nTap the Settings icon to customize\nor (X) Cancel to stop."
- android:gravity="center"
- android:layout_margin="40dp"
+ android:text="@string/start_later"
+ android:textStyle="bold"
+ android:textColor="@color/White"
+ android:background="@color/transparent"
+ android:id="@+id/btnStartLater"
+
+ />
+
+
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal|bottom"
+ android:padding="10dp"
+ >
+ <ImageView
+ android:id="@+id/btnCameraSwitch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_camera_front_white_36dp"
+ android:layout_margin="20dp"
+ />
+ <ImageView
+ android:id="@+id/btnMicSettings"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/ic_mic_white_36dp"
+ android:layout_margin="20dp"
/>
</LinearLayout>
</FrameLayout>
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab_settings"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|left"
- android:layout_margin="@dimen/fab_margin"
- android:src="@drawable/ic_settings_white_24dp"/>
-
- <android.support.design.widget.FloatingActionButton
- android:id="@+id/fab_cancel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|right"
- android:layout_margin="@dimen/fab_margin"
- android:src="@drawable/ic_cancel_white_24dp"
- android:tint="@android:color/white" />
</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file
diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml
index fc3fa3c..4ce6dd8 100644
--- a/src/main/res/values/colors.xml
+++ b/src/main/res/values/colors.xml
@@ -3,8 +3,8 @@
<resources>
<color name="colorPrimary">#2196F3</color>
<color name="colorPrimaryDark">#1976D2</color>
-<color name="primary_light">#BBDEFB</color>
-<color name="colorAccent">#FFC107</color>
+<color name="colorPrimaryLight">#BBDEFB</color>
+<color name="colorAccent">#f5c229</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#757575</color>
<color name="icons">#FFFFFF</color>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 54a0387..dd96fae 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -84,18 +84,16 @@
<string name="intro1_desc">\"Now when the ark of human fate,\nLong baffled by the wayward wind,\nIs drifting with its peopled freight,\nSAFE HAVEN on the height find...\"\n-George Meredith</string>
<string name="intro2_title">Haven is for people who want to keep an eye out for intrusions into their home, office, hotel room or other private space</string>
- <string name="intro2_desc"></string>
+ <string name="intro3_desc">Turn an extra phone into a motion, sound, vibration and light detector, watching for unexpected guests and unwanted intruders</string>
- <string name="intro3_title"></string>
- <string name="intro3_desc">Position the camera to capture motion, or set your phone somewhere discreet to just listen for noises</string>
+ <string name="sensor_setup_info">Position the camera to capture motion, or set your phone somewhere discreet to just listen for noises</string>
- <string name="intro4_title">Evidence Captured</string>
- <string name="intro4_desc">Any intrusion is logged for review upon your return for further investigation</string>
+ <string name="intro4_desc">Get notified of intrusion events instantly and access the logs remotely or in-person later</string>
- <string name="intro5_title">Activate your Haven?</string>
- <string name="intro5_desc">Now we\'ll help you configure your device for detection...</string>
+ <string name="intro5_title">Your Haven is ready</string>
+ <string name="intro5_desc">Activate the app at anytime using the &gt; action button on the main screen</string>
- <string name="onboarding_action_end">Let\'s go!</string>
+ <string name="onboarding_action_end">Finish</string>
<string name="remote_access_label">Enable remote access via Tor Onion Service</string>
<string name="remote_access_hint">(onion service address will be displayed here)</string>
@@ -107,4 +105,15 @@
<string name="action_configure">Configure</string>
<string name="main_screen_title">Your Haven Log</string>
+
+ <string name="current_noise_base">Current noise level is</string>
+ <string name="configure_trigger_level">Slide wheel to change detection threshold</string>
+ <string name="tune_the_sound_detection">Make some noise!</string>
+ <string name="set_your_phone_on_the_table_and_make_noises_in_the_room_to_find_the_right_level_to_detect">Set your phone on the table, and make noises in the room to find the right level to detect</string>
+ <string name="set_a_countdown_time">Tap to change countdown</string>
+ <string name="start_now">Start Now</string>
+ <string name="start_later">Start Later</string>
+ <string name="save_number">Save Number</string>
+
+ <string name="action_cancel">Cancel</string>
</resources>
\ No newline at end of file