diff --git a/docs-android/app/app.iml b/docs-android/app/app.iml
index 02513694..3aac58b8 100644
--- a/docs-android/app/app.iml
+++ b/docs-android/app/app.iml
@@ -98,7 +98,9 @@
+
+
diff --git a/docs-android/app/build.gradle b/docs-android/app/build.gradle
index 501a9dda..c48d012a 100644
--- a/docs-android/app/build.gradle
+++ b/docs-android/app/build.gradle
@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.14.2'
+ classpath 'com.android.tools.build:gradle:0.14.4'
}
}
apply plugin: 'com.android.application'
@@ -14,7 +14,7 @@ repositories {
android {
compileSdkVersion 21
- buildToolsVersion "21.1"
+ buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 14
@@ -27,12 +27,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
}
dependencies {
@@ -40,4 +34,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.loopj.android:android-async-http:1.4.6'
+ compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
}
diff --git a/docs-android/app/src/main/AndroidManifest.xml b/docs-android/app/src/main/AndroidManifest.xml
index 62370917..2f0116b7 100644
--- a/docs-android/app/src/main/AndroidManifest.xml
+++ b/docs-android/app/src/main/AndroidManifest.xml
@@ -28,6 +28,11 @@
android:logo="@drawable/ic_launcher"
android:launchMode="singleTop">
+
+
diff --git a/docs-android/app/src/main/java/com/sismics/docs/MainApplication.java b/docs-android/app/src/main/java/com/sismics/docs/MainApplication.java
index 1bef21f3..c7becb64 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/MainApplication.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/MainApplication.java
@@ -20,9 +20,19 @@ public class MainApplication extends Application {
JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON);
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
+ // TODO Fullscreen preview
+ // TODO Downloading
+ // TODO Sharing
+ // TODO Shared status
+ // TODO Tags on document
+ // TODO Error feedback
+ // TODO Infinite scrolling on documents
+ // TODO Searching
+ // TODO Printing
+
super.onCreate();
}
-
+
@Override
public void onLowMemory() {
BitmapAjaxCallback.clearCache();
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentActivity.java
new file mode 100644
index 00000000..fa0abe29
--- /dev/null
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentActivity.java
@@ -0,0 +1,121 @@
+package com.sismics.docs.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.view.ViewPager;
+import android.support.v7.app.ActionBarActivity;
+import android.text.format.DateFormat;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.TextView;
+
+import com.loopj.android.http.JsonHttpResponseHandler;
+import com.sismics.docs.R;
+import com.sismics.docs.adapter.FilePagerAdapter;
+import com.sismics.docs.model.application.ApplicationContext;
+import com.sismics.docs.resource.FileResource;
+
+import org.apache.http.Header;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Date;
+
+/**
+ * Document activity.
+ *
+ * @author bgamard
+ */
+public class DocumentActivity extends ActionBarActivity {
+
+ @Override
+ protected void onCreate(final Bundle args) {
+ super.onCreate(args);
+
+ // Check if logged in
+ if (!ApplicationContext.getInstance().isLoggedIn()) {
+ startActivity(new Intent(this, LoginActivity.class));
+ finish();
+ return;
+ }
+
+ // Handle activity context
+ if (getIntent() == null) {
+ finish();
+ return;
+ }
+
+ // Parse input document
+ String documentJson = getIntent().getStringExtra("document");
+ if (documentJson == null) {
+ finish();
+ return;
+ }
+
+ JSONObject document;
+ try {
+ document = new JSONObject(documentJson);
+ } catch (JSONException e) {
+ finish();
+ return;
+ }
+
+ // Setup the activity
+ setContentView(R.layout.document_activity);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
+
+ // Grab the document
+ refreshDocument(document);
+ }
+
+ /**
+ * Refresh the displayed document.
+ *
+ * @param document Document in JSON format
+ */
+ private void refreshDocument(JSONObject document) {
+ String id = document.optString("id");
+ String title = document.optString("title");
+ String date = DateFormat.getDateFormat(this).format(new Date(document.optLong("create_date")));
+ String description = document.optString("description");
+
+ // Fill the layout
+ setTitle(title);
+ TextView createdDateTextView = (TextView) findViewById(R.id.createdDateTextView);
+ createdDateTextView.setText(date);
+ TextView languageTextView = (TextView) findViewById(R.id.languageTextView);
+ languageTextView.setText(document.optString("language"));
+ TextView descriptionTextView = (TextView) findViewById(R.id.descriptionTextView);
+ if (description == null || description.isEmpty()) {
+ descriptionTextView.setVisibility(View.GONE);
+ } else {
+ descriptionTextView.setText(description);
+ }
+
+ // Grab the attached files
+ FileResource.list(this, id, new JsonHttpResponseHandler() {
+ @Override
+ public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
+ ViewPager fileViewPager = (ViewPager) findViewById(R.id.fileViewPager);
+ fileViewPager.setOffscreenPageLimit(1);
+ fileViewPager.setAdapter(new FilePagerAdapter(DocumentActivity.this, response.optJSONArray("files")));
+ findViewById(R.id.progressBar).setVisibility(View.GONE);
+ }
+ });
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
\ No newline at end of file
diff --git a/docs-android/app/src/main/java/com/sismics/docs/adapter/DocListAdapter.java b/docs-android/app/src/main/java/com/sismics/docs/adapter/DocListAdapter.java
index 3f2101ae..102686f6 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/adapter/DocListAdapter.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/adapter/DocListAdapter.java
@@ -88,7 +88,21 @@ public class DocListAdapter extends RecyclerView.Adapter
-
+ android:layout_height="match_parent">
-
\ No newline at end of file
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs-android/app/src/main/res/layout/document_activity.xml b/docs-android/app/src/main/res/layout/document_activity.xml
new file mode 100644
index 00000000..5a5336f3
--- /dev/null
+++ b/docs-android/app/src/main/res/layout/document_activity.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs-android/app/src/main/res/layout/file_viewpager_item.xml b/docs-android/app/src/main/res/layout/file_viewpager_item.xml
new file mode 100644
index 00000000..fc1e6846
--- /dev/null
+++ b/docs-android/app/src/main/res/layout/file_viewpager_item.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/docs-android/app/src/main/res/values/strings.xml b/docs-android/app/src/main/res/values/strings.xml
index 3a0a3ca3..afcb8596 100644
--- a/docs-android/app/src/main/res/values/strings.xml
+++ b/docs-android/app/src/main/res/values/strings.xml
@@ -18,6 +18,8 @@
Invalid URL
Please check the server URL and try again
A crash occurred, a report has been sent to resolve this problem
+ Created date
+ Language
Invalid email