aboutsummaryrefslogtreecommitdiffhomepage
path: root/example/android/AndroidExample/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'example/android/AndroidExample/app/src/main')
-rw-r--r--example/android/AndroidExample/app/src/main/AndroidManifest.xml49
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java18
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java70
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java84
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java87
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java191
-rw-r--r--example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java34
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.pngbin0 -> 9397 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.pngbin0 -> 5237 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.pngbin0 -> 14383 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 19388 bytes
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml23
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml7
-rw-r--r--example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values-v21/styles.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/dimens.xml5
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/strings.xml8
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml15
-rw-r--r--example/android/AndroidExample/app/src/main/res/values/styles.xml8
20 files changed, 614 insertions, 0 deletions
diff --git a/example/android/AndroidExample/app/src/main/AndroidManifest.xml b/example/android/AndroidExample/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..58481ab8
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/AndroidManifest.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.libmailcore.androidexample" >
+
+ <!-- To access Google+ APIs: -->
+ <uses-permission android:name="android.permission.INTERNET" />
+ <!--
+ To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
+ option is required to comply with the Google+ Sign-In developer policies
+ -->
+ <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <!-- To retrieve the account name (email) as part of sign-in: -->
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- To auto-complete the email text field in the login form with the user's emails -->
+ <uses-permission android:name="android.permission.READ_PROFILE" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name=".MessageViewListActivity"
+ android:label="@string/title_messageview_list" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity
+ android:name=".MessageViewDetailActivity"
+ android:label="@string/title_messageview_detail"
+ android:parentActivityName=".MessageViewListActivity" >
+ <meta-data
+ android:name="android.support.PARENT_ACTIVITY"
+ android:value="com.libmailcore.androidexample.MessageViewListActivity" />
+ </activity>
+ <activity
+ android:name=".LoginActivity"
+ android:label="@string/title_activity_login"
+ android:windowSoftInputMode="adjustResize|stateHidden" >
+ </activity>
+
+ <meta-data
+ android:name="com.google.android.gms.version"
+ android:value="@integer/google_play_services_version" />
+ </application>
+
+</manifest>
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java
new file mode 100644
index 00000000..86781ce6
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageAdapter.java
@@ -0,0 +1,18 @@
+package com.libmailcore.androidexample;
+
+import com.libmailcore.IMAPMessage;
+
+/**
+ * Created by hoa on 1/9/15.
+ */
+public class MessageAdapter {
+ IMAPMessage message;
+
+ public MessageAdapter(IMAPMessage msg) {
+ message = msg;
+ }
+
+ public String toString() {
+ return message.header().from().displayName() + " " + message.header().extractedSubject();
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java
new file mode 100644
index 00000000..e12f71b1
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailActivity.java
@@ -0,0 +1,70 @@
+package com.libmailcore.androidexample;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.app.Activity;
+
+import android.view.MenuItem;
+
+
+/**
+ * An activity representing a single MessageView detail screen. This
+ * activity is only used on handset devices. On tablet-size devices,
+ * item details are presented side-by-side with a list of items
+ * in a {@link MessageViewListActivity}.
+ * <p/>
+ * This activity is mostly just a 'shell' activity containing nothing
+ * more than a {@link MessageViewDetailFragment}.
+ */
+public class MessageViewDetailActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_messageview_detail);
+
+ // Show the Up button in the action bar.
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+
+ // savedInstanceState is non-null when there is fragment state
+ // saved from previous configurations of this activity
+ // (e.g. when rotating the screen from portrait to landscape).
+ // In this case, the fragment will automatically be re-added
+ // to its container so we don't need to manually add it.
+ // For more information, see the Fragments API guide at:
+ //
+ // http://developer.android.com/guide/components/fragments.html
+ //
+ if (savedInstanceState == null) {
+ // Create the detail fragment and add it to the activity
+ // using a fragment transaction.
+ /*
+ Bundle arguments = new Bundle();
+ arguments.putString(MessageViewDetailFragment.ARG_ITEM_ID,
+ getIntent().getStringExtra(MessageViewDetailFragment.ARG_ITEM_ID));
+ */
+
+ MessageViewDetailFragment fragment = new MessageViewDetailFragment();
+ //fragment.setArguments(arguments);
+ getFragmentManager().beginTransaction()
+ .add(R.id.messageview_detail_container, fragment)
+ .commit();
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ int id = item.getItemId();
+ if (id == android.R.id.home) {
+ // This ID represents the Home or Up button. In the case of this
+ // activity, the Up button is shown. For
+ // more details, see the Navigation pattern on Android Design:
+ //
+ // http://developer.android.com/design/patterns/navigation.html#up-vs-back
+ //
+ navigateUpTo(new Intent(this, MessageViewListActivity.class));
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java
new file mode 100644
index 00000000..4fd80282
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewDetailFragment.java
@@ -0,0 +1,84 @@
+package com.libmailcore.androidexample;
+
+import android.os.Bundle;
+import android.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebView;
+import android.util.Log;
+
+
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+import com.libmailcore.IMAPMessage;
+import com.libmailcore.IMAPMessageRenderingOperation;
+
+/**
+ * A fragment representing a single MessageView detail screen.
+ * This fragment is either contained in a {@link MessageViewListActivity}
+ * in two-pane mode (on tablets) or a {@link MessageViewDetailActivity}
+ * on handsets.
+ */
+public class MessageViewDetailFragment extends Fragment implements OperationCallback {
+ /**
+ * The fragment argument representing the item ID that this fragment
+ * represents.
+ */
+ public static final String ARG_ITEM_ID = "item_id";
+
+ /**
+ * The dummy content this fragment is presenting.
+ */
+ //private DummyContent.DummyItem mItem;
+ private IMAPMessage message;
+
+ /**
+ * Mandatory empty constructor for the fragment manager to instantiate the
+ * fragment (e.g. upon screen orientation changes).
+ */
+ public MessageViewDetailFragment() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ /*
+ if (getArguments().containsKey(ARG_ITEM_ID)) {
+ // Load the dummy content specified by the fragment
+ // arguments. In a real-world scenario, use a Loader
+ // to load content from a content provider.
+ mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
+ }
+ */
+ message = MessagesSyncManager.singleton().currentMessage;
+ }
+
+ private IMAPMessageRenderingOperation renderingOp;
+ private WebView webView;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_messageview_detail, container, false);
+ webView = (WebView) rootView.findViewById(R.id.messageview_detail);
+
+ if (message != null) {
+ Log.d("detail", "message: " + message);
+ renderingOp = MessagesSyncManager.singleton().session.htmlRenderingOperation(message, "INBOX");
+ renderingOp.start(this);
+ }
+
+ return rootView;
+ }
+
+ public void succeeded() {
+ String html = renderingOp.result();
+ webView.loadData(html, "text/html", "utf-8");
+ }
+
+ public void failed(MailException exception) {
+
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java
new file mode 100644
index 00000000..e0115a69
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListActivity.java
@@ -0,0 +1,87 @@
+package com.libmailcore.androidexample;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.app.Activity;
+import com.libmailcore.IMAPSession;
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+import com.libmailcore.IMAPMessage;
+
+/**
+ * An activity representing a list of MessagesViews. This activity
+ * has different presentations for handset and tablet-size devices. On
+ * handsets, the activity presents a list of items, which when touched,
+ * lead to a {@link MessageViewDetailActivity} representing
+ * item details. On tablets, the activity presents the list of items and
+ * item details side-by-side using two vertical panes.
+ * <p/>
+ * The activity makes heavy use of fragments. The list of items is a
+ * {@link MessageViewListFragment} and the item details
+ * (if present) is a {@link MessageViewDetailFragment}.
+ * <p/>
+ * This activity also implements the required
+ * {@link MessageViewListFragment.Callbacks} interface
+ * to listen for item selections.
+ */
+public class MessageViewListActivity extends Activity
+ implements MessageViewListFragment.Callbacks {
+
+ /**
+ * Whether or not the activity is in two-pane mode, i.e. running on a tablet
+ * device.
+ */
+ private boolean mTwoPane;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_messageview_list);
+
+ if (findViewById(R.id.messageview_detail_container) != null) {
+ // The detail container view will be present only in the
+ // large-screen layouts (res/values-large and
+ // res/values-sw600dp). If this view is present, then the
+ // activity should be in two-pane mode.
+ mTwoPane = true;
+
+ // In two-pane mode, list items should be given the
+ // 'activated' state when touched.
+ ((MessageViewListFragment) getFragmentManager()
+ .findFragmentById(R.id.messageview_list))
+ .setActivateOnItemClick(true);
+ }
+
+ // TODO: If exposing deep links into your app, handle intents here.
+ }
+
+ /**
+ * Callback method from {@link MessageViewListFragment.Callbacks}
+ * indicating that the item with the given ID was selected.
+ */
+ @Override
+ public void onItemSelected(IMAPMessage msg) {
+ if (mTwoPane) {
+ // In two-pane mode, show the detail view in this activity by
+ // adding or replacing the detail fragment using a
+ // fragment transaction.
+ MessagesSyncManager.singleton().currentMessage = msg;
+
+ //Bundle arguments = new Bundle();
+ //arguments.putString(MessageViewDetailFragment.ARG_ITEM_ID, msg);
+ MessageViewDetailFragment fragment = new MessageViewDetailFragment();
+ //fragment.setArguments(arguments);
+ getFragmentManager().beginTransaction()
+ .replace(R.id.messageview_detail_container, fragment)
+ .commit();
+
+ } else {
+ // In single-pane mode, simply start the detail activity
+ // for the selected item ID.
+ MessagesSyncManager.singleton().currentMessage = msg;
+ Intent detailIntent = new Intent(this, MessageViewDetailActivity.class);
+ //detailIntent.putExtra(MessageViewDetailFragment.ARG_ITEM_ID, id);
+ startActivity(detailIntent);
+ }
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java
new file mode 100644
index 00000000..b39c51ac
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessageViewListFragment.java
@@ -0,0 +1,191 @@
+package com.libmailcore.androidexample;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.app.ListFragment;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.util.Log;
+
+import java.util.ArrayList;
+
+import com.libmailcore.IMAPFetchMessagesOperation;
+import com.libmailcore.IMAPMessage;
+import com.libmailcore.MailException;
+import com.libmailcore.OperationCallback;
+//import com.libmailcore.androidexample.dummy.DummyContent;
+import com.libmailcore.IndexSet;
+import com.libmailcore.IMAPMessagesRequestKind;
+import com.libmailcore.Range;
+
+/**
+ * A list fragment representing a list of MessagesViews. This fragment
+ * also supports tablet devices by allowing list items to be given an
+ * 'activated' state upon selection. This helps indicate which item is
+ * currently being viewed in a {@link MessageViewDetailFragment}.
+ * <p/>
+ * Activities containing this fragment MUST implement the {@link Callbacks}
+ * interface.
+ */
+public class MessageViewListFragment extends ListFragment implements OperationCallback {
+
+ /**
+ * The serialization (saved instance state) Bundle key representing the
+ * activated item position. Only used on tablets.
+ */
+ private static final String STATE_ACTIVATED_POSITION = "activated_position";
+
+ /**
+ * The fragment's current callback object, which is notified of list item
+ * clicks.
+ */
+ private Callbacks mCallbacks = sDummyCallbacks;
+
+ /**
+ * The current activated item position. Only used on tablets.
+ */
+ private int mActivatedPosition = ListView.INVALID_POSITION;
+
+ /**
+ * A callback interface that all activities containing this fragment must
+ * implement. This mechanism allows activities to be notified of item
+ * selections.
+ */
+ public interface Callbacks {
+ /**
+ * Callback for when an item has been selected.
+ */
+ public void onItemSelected(IMAPMessage msg);
+ }
+
+ /**
+ * A dummy implementation of the {@link Callbacks} interface that does
+ * nothing. Used only when this fragment is not attached to an activity.
+ */
+ private static Callbacks sDummyCallbacks = new Callbacks() {
+ @Override
+ public void onItemSelected(IMAPMessage msg) {
+ }
+ };
+
+ /**
+ * Mandatory empty constructor for the fragment manager to instantiate the
+ * fragment (e.g. upon screen orientation changes).
+ */
+ public MessageViewListFragment() {
+ }
+
+ private IMAPFetchMessagesOperation fetchMessagesOp;
+ private ArrayAdapter<MessageAdapter> adapter;
+ private java.util.List<IMAPMessage> messages;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ fetchMessagesOp = MessagesSyncManager.singleton().session.fetchMessagesByNumberOperation("INBOX", IMAPMessagesRequestKind.IMAPMessagesRequestKindHeaders | IMAPMessagesRequestKind.IMAPMessagesRequestKindStructure, IndexSet.indexSetWithRange(new Range(1, Range.RangeMax)));
+ fetchMessagesOp.start(this);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ // Restore the previously serialized activated item position.
+ if (savedInstanceState != null
+ && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
+ setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+
+ // Activities containing this fragment must implement its callbacks.
+ if (!(activity instanceof Callbacks)) {
+ throw new IllegalStateException("Activity must implement fragment's callbacks.");
+ }
+
+ mCallbacks = (Callbacks) activity;
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+
+ // Reset the active callbacks interface to the dummy implementation.
+ mCallbacks = sDummyCallbacks;
+ }
+
+ @Override
+ public void onListItemClick(ListView listView, View view, int position, long id) {
+ super.onListItemClick(listView, view, position, id);
+
+ // Notify the active callbacks interface (the activity, if the
+ // fragment is attached to one) that an item has been selected.
+// mCallbacks.onItemSelected(DummyContent.ITEMS.get(position).id);
+ Log.d("msglist", "row clicked: " + id);
+ mCallbacks.onItemSelected(messages.get((int) id));
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ if (mActivatedPosition != ListView.INVALID_POSITION) {
+ // Serialize and persist the activated item position.
+ outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
+ }
+ }
+
+ /**
+ * Turns on activate-on-click mode. When this mode is on, list items will be
+ * given the 'activated' state when touched.
+ */
+ public void setActivateOnItemClick(boolean activateOnItemClick) {
+ // When setting CHOICE_MODE_SINGLE, ListView will automatically
+ // give items the 'activated' state when touched.
+ getListView().setChoiceMode(activateOnItemClick
+ ? ListView.CHOICE_MODE_SINGLE
+ : ListView.CHOICE_MODE_NONE);
+ }
+
+ private void setActivatedPosition(int position) {
+ if (position == ListView.INVALID_POSITION) {
+ getListView().setItemChecked(mActivatedPosition, false);
+ } else {
+ getListView().setItemChecked(position, true);
+ }
+
+ mActivatedPosition = position;
+ }
+
+ public void succeeded() {
+ messages = fetchMessagesOp.messages();
+ updateResult();
+ }
+
+ public void failed(MailException exception) {
+
+ }
+
+ private void updateResult() {
+
+ Log.d("msglist", "update result");
+ ArrayList<MessageAdapter> array = new ArrayList();
+ for(IMAPMessage msg : messages) {
+ MessageAdapter msgAdapter = new MessageAdapter(msg);
+ array.add(msgAdapter);
+ }
+ adapter = new ArrayAdapter<MessageAdapter>(
+ getActivity(),
+ android.R.layout.simple_list_item_activated_1,
+ android.R.id.text1,
+ array);
+
+ // TODO: replace with a real list adapter.
+ setListAdapter(adapter);
+
+ }
+}
diff --git a/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java
new file mode 100644
index 00000000..3c25e2bf
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/java/com/libmailcore/androidexample/MessagesSyncManager.java
@@ -0,0 +1,34 @@
+package com.libmailcore.androidexample;
+
+import com.libmailcore.ConnectionType;
+import com.libmailcore.IMAPFetchMessagesOperation;
+import com.libmailcore.IMAPSession;
+import com.libmailcore.IMAPMessage;
+
+/**
+ * Created by hoa on 1/8/15.
+ */
+public class MessagesSyncManager {
+ public IMAPSession session;
+ public IMAPMessage currentMessage;
+
+ static private MessagesSyncManager theSingleton;
+
+ public static MessagesSyncManager singleton() {
+ if (theSingleton == null) {
+ theSingleton = new MessagesSyncManager();
+ }
+ return theSingleton;
+ }
+
+ private MessagesSyncManager() {
+ session = new IMAPSession();
+ session.setUsername("login@gmail.com");
+ session.setPassword("password");
+ session.setHostname("imap.gmail.com");
+ session.setPort(993);
+ session.setConnectionType(ConnectionType.ConnectionTypeTLS);
+ }
+
+
+}
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 00000000..96a442e5
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 00000000..359047df
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..71c6d760
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..4df18946
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml b/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml
new file mode 100644
index 00000000..9b211bda
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout-sw600dp/activity_messageview_list.xml
@@ -0,0 +1,23 @@
+<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:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp" android:baselineAligned="false"
+ android:divider="?android:attr/dividerHorizontal" android:orientation="horizontal"
+ android:showDividers="middle"
+ tools:context="com.libmailcore.androidexample.MessageViewListActivity">
+
+ <!--
+ This layout is a two-pane layout for the MessagesViews
+ master/detail flow.
+
+ -->
+
+ <fragment android:id="@+id/messageview_list"
+ android:name="com.libmailcore.androidexample.MessageViewListFragment"
+ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"
+ tools:layout="@android:layout/list_content" />
+
+ <FrameLayout android:id="@+id/messageview_detail_container" android:layout_width="0dp"
+ android:layout_height="match_parent" android:layout_weight="3" />
+
+</LinearLayout>
diff --git a/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml
new file mode 100644
index 00000000..fa100d0b
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_detail.xml
@@ -0,0 +1,5 @@
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_detail_container"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ tools:context="com.libmailcore.androidexample.MessageViewDetailActivity"
+ tools:ignore="MergeRootFrame" />
diff --git a/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml
new file mode 100644
index 00000000..039f69b1
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/activity_messageview_list.xml
@@ -0,0 +1,7 @@
+<fragment xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_list"
+ android:name="com.libmailcore.androidexample.MessageViewListFragment"
+ android:layout_width="match_parent" android:layout_height="match_parent"
+ android:layout_marginLeft="16dp" android:layout_marginRight="16dp"
+ tools:context="com.libmailcore.androidexample.MessageViewListActivity"
+ tools:layout="@android:layout/list_content" />
diff --git a/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml b/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml
new file mode 100644
index 00000000..d1ecbf75
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/layout/fragment_messageview_detail.xml
@@ -0,0 +1,5 @@
+<WebView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/messageview_detail"
+ style="?android:attr/textAppearanceLarge" android:layout_width="match_parent"
+ android:layout_height="match_parent" android:padding="16dp" android:textIsSelectable="true"
+ tools:context="com.libmailcore.androidexample.MessageViewDetailFragment" />
diff --git a/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml b/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 00000000..dba3c417
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="AppTheme" parent="android:Theme.Material.Light">
+ </style>
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/dimens.xml b/example/android/AndroidExample/app/src/main/res/values/dimens.xml
new file mode 100644
index 00000000..47c82246
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/strings.xml b/example/android/AndroidExample/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..986a9ee4
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">AndroidExample</string>
+ <string name="title_messageview_list">MessagesViews</string>
+ <string name="title_messageview_detail">MessageView Detail</string>
+
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml b/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml
new file mode 100644
index 00000000..9f1a810f
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/strings_activity_login.xml
@@ -0,0 +1,15 @@
+<resources>
+ <string name="title_activity_login">Sign in</string>
+
+ <!-- Strings related to login -->
+ <string name="prompt_email">Email</string>
+ <string name="prompt_password">Password (optional)</string>
+ <string name="action_sign_in">Sign in or register</string>
+ <string name="action_sign_in_short">Sign in</string>
+ <string name="plus_sign_out">Switch Google+ account</string>
+ <string name="plus_disconnect">Disconnect from Google+</string>
+ <string name="error_invalid_email">This email address is invalid</string>
+ <string name="error_invalid_password">This password is too short</string>
+ <string name="error_incorrect_password">This password is incorrect</string>
+ <string name="error_field_required">This field is required</string>
+</resources>
diff --git a/example/android/AndroidExample/app/src/main/res/values/styles.xml b/example/android/AndroidExample/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..ff6c9d2c
--- /dev/null
+++ b/example/android/AndroidExample/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>