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
improve onboarding
n8fr825467c827b40
diff --git a/src/main/java/info/guardianproject/phoneypot/ListActivity.java b/src/main/java/info/guardianproject/phoneypot/ListActivity.javaindex a14cfbc..591bd9c 100644--- a/src/main/java/info/guardianproject/phoneypot/ListActivity.java+++ b/src/main/java/info/guardianproject/phoneypot/ListActivity.java@@ -127,9 +127,11 @@ public class ListActivity extends AppCompatActivity {initialCount = Event.count(Event.class);+ showOnboarding();+if (initialCount <= 0) {- showOnboarding();+ // showOnboarding();} else {recyclerView.setVisibility(View.VISIBLE);@@ -270,7 +272,7 @@ public class ListActivity extends AppCompatActivity {}- /**+@Overridepublic boolean onCreateOptionsMenu(Menu menu) {getMenuInflater().inflate(R.menu.menu_main, menu);@@ -280,11 +282,14 @@ public class ListActivity extends AppCompatActivity {@Overridepublic boolean onOptionsItemSelected (MenuItem item) {switch (item.getItemId()){- case R.id.menu_remote:- enableRemoteAccess();+ case R.id.menu_settings:+ startActivity(new Intent(this,SettingsActivity.class));+ break;+ case R.id.action_about:+ showOnboarding();break;}return true;- }**/+ }}\ No newline at end of filediff --git a/src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.java b/src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.javanew file mode 100644index 0000000..712d761--- /dev/null+++ b/src/main/java/info/guardianproject/phoneypot/ui/CustomIntroSlide.java@@ -0,0 +1,57 @@+package info.guardianproject.phoneypot.ui;++/**+ * Created by n8fr8 on 10/30/17.+ */+++import android.os.Bundle;+ import android.support.annotation.Nullable;+ import android.support.v4.app.Fragment;+ import android.view.LayoutInflater;+ import android.view.View;+ import android.view.ViewGroup;+import android.widget.TextView;++import info.guardianproject.phoneypot.R;++public class CustomIntroSlide extends Fragment {++ private static final String ARG_LAYOUT_RES_ID = "layoutResId";+ private int layoutResId;+ private String mTitle;++ public static CustomIntroSlide newInstance(int layoutResId) {+ CustomIntroSlide sampleSlide = new CustomIntroSlide();++ Bundle args = new Bundle();+ args.putInt(ARG_LAYOUT_RES_ID, layoutResId);+ sampleSlide.setArguments(args);++ return sampleSlide;+ }++ public void setTitle (String title)+ {+ mTitle = title;+ }++ @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);+ ((TextView)view.findViewById(R.id.custom_slide_big_text)).setText(mTitle);+ return view;++ }+}\ No newline at end of filediff --git a/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java b/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.javaindex 21fdcd4..5edfee8 100644--- a/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java+++ b/src/main/java/info/guardianproject/phoneypot/ui/PPAppIntro.java@@ -1,13 +1,15 @@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.os.Bundle;import android.support.annotation.Nullable;import android.support.v4.app.Fragment;+import android.widget.TextView;-import com.github.paolorotolo.appintro.AppIntro;-import com.github.paolorotolo.appintro.AppIntroFragment;import info.guardianproject.phoneypot.R;@@ -28,17 +30,26 @@ public class PPAppIntro extends AppIntro {addSlide(AppIntroFragment.newInstance(getString(R.string.intro1_title), getString(R.string.intro1_desc),R.drawable.web_hi_res_512, getResources().getColor(R.color.colorPrimaryDark)));- addSlide(AppIntroFragment.newInstance(getString(R.string.intro2_title), getString(R.string.intro2_desc),- R.drawable.intro2, getResources().getColor(R.color.colorPrimaryDark)));+ /**+ SliderPage sliderPage = new SliderPage();+ sliderPage.setTitle(getString(R.string.intro2_title));+ // 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);+ cs1.setTitle(getString(R.string.intro2_title));+ addSlide(cs1);- addSlide(AppIntroFragment.newInstance(getString(R.string.intro3_title), getString(R.string.intro3_desc),- R.drawable.intro4, getResources().getColor(R.color.colorPrimaryDark)));+ CustomIntroSlide cs2 = CustomIntroSlide.newInstance(R.layout.custom_slide_big_text);+ cs2.setTitle(getString(R.string.intro3_desc));+ addSlide(cs2);- addSlide(AppIntroFragment.newInstance(getString(R.string.intro4_title), getString(R.string.intro4_desc),- R.drawable.intro3, getResources().getColor(R.color.colorPrimaryDark)));+ CustomIntroSlide cs3 = CustomIntroSlide.newInstance(R.layout.custom_slide_big_text);+ cs3.setTitle(getString(R.string.intro4_desc));+ addSlide(cs3);addSlide(AppIntroFragment.newInstance(getString(R.string.intro5_title), getString(R.string.intro5_desc),- R.drawable.ic_play_arrow_white_24dp, getResources().getColor(R.color.colorPrimaryDark)));+ R.drawable.web_hi_res_512, getResources().getColor(R.color.colorPrimaryDark)));setDoneText(getString(R.string.onboarding_action_end));diff --git a/src/main/res/layout/custom_slide_big_text.xml b/src/main/res/layout/custom_slide_big_text.xmlnew file mode 100644index 0000000..78072fd--- /dev/null+++ b/src/main/res/layout/custom_slide_big_text.xml@@ -0,0 +1,22 @@+<?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="@string/intro2_title"+ android:textColor="@color/colorAccent"+ android:gravity="center"+ android:layout_margin="10dp"+ android:textStyle="bold"+ android:textSize="28sp"/>+++</LinearLayout>\ No newline at end of filediff --git a/src/main/res/menu/menu_main.xml b/src/main/res/menu/menu_main.xmlindex b887f12..eda4a0c 100644--- a/src/main/res/menu/menu_main.xml+++ b/src/main/res/menu/menu_main.xml@@ -1,7 +1,14 @@<menu xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto">- <item android:id="@+id/menu_remote"- android:title="@string/menu_save"+ <item+ android:id="@+id/action_settings"android:orderInCategory="100"- app:showAsAction="always|withText" />+ android:title="@string/action_settings"+ app:showAsAction="never" />+ <item+ android:id="@+id/action_about"+ android:orderInCategory="100"+ android:title="@string/menu_about"+ app:showAsAction="never" />+</menu>diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xmlindex 5c1395f..54a0387 100644--- a/src/main/res/values/strings.xml+++ b/src/main/res/values/strings.xml@@ -6,6 +6,7 @@<string name="menu_start">Start</string><string name="menu_save">Save</string><string name="menu_remote_access">Remote Access</string>+ <string name="menu_about">About</string><string name="title_activity_start">Haven</string>@@ -79,14 +80,14 @@<string name="action_settings">Settings</string>- <string name="intro1_title">Enter Your Haven</string>- <string name="intro1_desc">Protect your space against unexpected and unwanted intruders</string>+ <string name="intro1_title">Welcome to Haven</string>+ <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">Sensors for Defense</string>- <string name="intro2_desc">We use all the sensors in your device to detect movement, noise and light</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_title">Instant Notification</string>- <string name="intro3_desc">You will be notified via text message of any intrusion event</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="intro4_title">Evidence Captured</string><string name="intro4_desc">Any intrusion is logged for review upon your return for further investigation</string>