Introduction to Bote for new users

This commit is contained in:
str4d
2014-06-19 01:00:22 +00:00
parent 32a24268ff
commit 82bbdea990
14 changed files with 453 additions and 19 deletions

View File

@@ -26,4 +26,5 @@ dependencies {
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
compile 'com.mcxiaoke.viewpagerindicator:library:2.4.1'
}

View File

@@ -27,6 +27,13 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".intro.IntroActivity"
android:parentActivityName=".EmailListActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="i2p.bote.android.EmailListActivity" />
</activity>
<activity
android:name=".ViewEmailActivity"
android:parentActivityName=".EmailListActivity" />

View File

@@ -1,23 +1,9 @@
package i2p.bote.android;
import net.i2p.android.router.service.IRouterState;
import i2p.bote.I2PBote;
import i2p.bote.android.addressbook.AddressBookActivity;
import i2p.bote.android.config.SettingsActivity;
import i2p.bote.android.service.BoteService;
import i2p.bote.android.service.Init;
import i2p.bote.android.service.Init.RouterChoice;
import i2p.bote.android.util.MoveToDialogFragment;
import i2p.bote.folder.EmailFolder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
@@ -26,6 +12,10 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.GravityCompat;
@@ -38,6 +28,19 @@ import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import net.i2p.android.router.service.IRouterState;
import i2p.bote.I2PBote;
import i2p.bote.android.addressbook.AddressBookActivity;
import i2p.bote.android.config.SettingsActivity;
import i2p.bote.android.intro.IntroActivity;
import i2p.bote.android.service.BoteService;
import i2p.bote.android.service.Init;
import i2p.bote.android.service.Init.RouterChoice;
import i2p.bote.android.util.MoveToDialogFragment;
import i2p.bote.folder.EmailFolder;
public class EmailListActivity extends ActionBarActivity implements
EmailListFragment.OnEmailSelectedListener,
@@ -60,9 +63,11 @@ public class EmailListActivity extends ActionBarActivity implements
private static final String SHARED_PREFS = "i2p.bote";
private static final String PREF_NAV_DRAWER_OPENED = "navDrawerOpened";
private static final String PREF_FIRST_START = "firstStart";
private static final String ACTIVE_FOLDER = "activeFolder";
private static final int REQUEST_START_I2P = 1;
private static final int RUN_SETUP_WIZARD = 1;
private static final int REQUEST_START_I2P = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -206,6 +211,14 @@ public class EmailListActivity extends ActionBarActivity implements
// Open nav drawer if the user has never opened it themselves
if (!mSharedPrefs.getBoolean(PREF_NAV_DRAWER_OPENED, false))
mDrawerLayout.openDrawer(mDrawerOuter);
// If first start, go to introduction and setup wizard
// TODO always show while testing, revert to preference when finished
if (true || mSharedPrefs.getBoolean(PREF_FIRST_START, true)) {
mSharedPrefs.edit().putBoolean(PREF_FIRST_START, false).apply();
Intent i = new Intent(EmailListActivity.this, IntroActivity.class);
startActivityForResult(i, RUN_SETUP_WIZARD);
}
}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@@ -353,8 +366,13 @@ public class EmailListActivity extends ActionBarActivity implements
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_START_I2P) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == RUN_SETUP_WIZARD) {
if (resultCode == RESULT_OK) {
// TODO remove (and implement a UI tutorial?)
Toast.makeText(this, "Setup wizard not yet implemented.", Toast.LENGTH_SHORT).show();
}
} else if (requestCode == REQUEST_START_I2P) {
if (resultCode == RESULT_OK) {
startBote();
}
} else {

View File

@@ -0,0 +1,144 @@
package i2p.bote.android.intro;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.viewpagerindicator.LinePageIndicator;
import i2p.bote.android.R;
public class IntroActivity extends ActionBarActivity {
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
SectionsPagerAdapter mSectionsPagerAdapter;
/**
* The {@link ViewPager} that will host the section contents.
*/
ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro);
// Take up the entire screen.
getSupportActionBar().hide();
// Create the sections adapter.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Bind the page indicator to the pager.
LinePageIndicator pageIndicator = (LinePageIndicator)findViewById(R.id.page_indicator);
pageIndicator.setViewPager(mViewPager);
findViewById(R.id.skip_intro).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setResult(Activity.RESULT_CANCELED);
finish();
}
});
}
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the intro sections.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position);
}
@Override
public int getCount() {
return 5;
}
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
switch (getArguments().getInt(ARG_SECTION_NUMBER)) {
case 1:
return inflater.inflate(R.layout.fragment_intro_1, container, false);
case 2:
return inflater.inflate(R.layout.fragment_intro_2, container, false);
case 3:
return inflater.inflate(R.layout.fragment_intro_3, container, false);
case 4:
View v4 = inflater.inflate(R.layout.fragment_intro_4, container, false);
Button b = (Button) v4.findViewById(R.id.start_setup_wizard);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// TODO start setup wizard
getActivity().setResult(Activity.RESULT_OK);
getActivity().finish();
}
});
return v4;
default:
View v0 = inflater.inflate(R.layout.fragment_intro_0, container, false);
TextView tv = (TextView) v0.findViewById(R.id.intro_app_name);
tv.append(".");
return v0;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,28 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:context="i2p.bote.android.intro.IntroActivity" />
<com.viewpagerindicator.LinePageIndicator
android:id="@+id/page_indicator"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
<TextView
android:id="@+id/skip_intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/i_know_what_to_do" />
</LinearLayout>

View File

@@ -0,0 +1,53 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="i2p.bote.android.intro.IntroActivity$PlaceholderFragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/intro_private"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/intro_distributed"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/intro_secure"
android:layout_gravity="center_horizontal" />
<TextView
android:id="@+id/intro_app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/app_name"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:text="@string/swipe_to_start"
android:drawableLeft="@drawable/ic_navigation_back"
android:gravity="center_vertical"
android:layout_gravity="center_horizontal" />
</LinearLayout>

View File

@@ -0,0 +1,40 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="i2p.bote.android.intro.IntroActivity$PlaceholderFragment">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_1_1"
android:id="@+id/textView1"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_1_2"
android:id="@+id/textView2"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
</RelativeLayout>

View File

@@ -0,0 +1,40 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="i2p.bote.android.intro.IntroActivity$PlaceholderFragment">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_2_1"
android:id="@+id/textView1"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_2_2"
android:id="@+id/textView2"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
</RelativeLayout>

View File

@@ -0,0 +1,40 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="i2p.bote.android.intro.IntroActivity$PlaceholderFragment">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_3_1"
android:id="@+id/textView1"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_3_2"
android:id="@+id/textView2"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
</RelativeLayout>

View File

@@ -0,0 +1,49 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="i2p.bote.android.intro.IntroActivity$PlaceholderFragment">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_4_1"
android:id="@+id/textView1"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/intro_4_2"
android:id="@+id/textView2"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:gravity="center" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/lets_get_started"
android:id="@+id/start_setup_wizard"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/activity_vertical_margin" />
</RelativeLayout>

View File

@@ -1,7 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Bote</string>
<string name="app_name" translatable="false">Bote</string>
<string name="intro_private">Private.</string>
<string name="intro_distributed">Distributed.</string>
<string name="intro_secure">Secure.</string>
<string name="swipe_to_start">Swipe to start</string>
<string name="i_know_what_to_do">I know what to do</string>
<string name="intro_1_1">Traditional email is not secure.</string>
<string name="intro_1_2">Bote is a new kind of email.</string>
<string name="intro_2_1">When you send an email in Bote, everything is encrypted - including the email metadata. Only the recipient can download and read the email.</string>
<string name="intro_2_2">An outsider can only see that an email was sent, not who sent it. And if the recipient never publishes their address, the outsider can\'t even tell who the recipient is.</string>
<string name="intro_3_1">With traditional email, you need to trust a central server. And if it is blocked, you can\'t send or receive emails.</string>
<string name="intro_3_2">Bote uses a distributed peer-to-peer network, similar to BitTorrent. Encrypted emails are split up and stored with many other Bote users.</string>
<string name="intro_4_1">Because Bote is a little different to traditional email, there are a few things to set up before you can start using it.</string>
<string name="intro_4_2">The setup wizard will take a couple of minutes, and then everything will be ready.</string>
<string name="lets_get_started">Let\'s Get Started</string>
<string name="action_new_email">New email</string>
<string name="action_send_email">Send email</string>
<string name="action_start_bote">Connect to network</string>