diff --git a/docs-android/app/app.iml b/docs-android/app/app.iml
index 55cf428a..46bcd543 100644
--- a/docs-android/app/app.iml
+++ b/docs-android/app/app.iml
@@ -98,13 +98,14 @@
-
+
+
diff --git a/docs-android/app/build.gradle b/docs-android/app/build.gradle
index 710b9bf4..31b88246 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.4'
+ classpath 'com.android.tools.build:gradle:1.0.0-rc1'
}
}
apply plugin: 'com.android.application'
@@ -36,5 +36,5 @@ dependencies {
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'it.sephiroth.android.library.imagezoom:imagezoom:1.0.5'
compile 'de.greenrobot:eventbus:2.4.0'
- compile 'com.shamanland:fab:0.0.5'
+ compile 'com.shamanland:fab:0.0.6'
}
diff --git a/docs-android/app/libs/tokenautocomplete-1.2.1.jar b/docs-android/app/libs/tokenautocomplete-1.2.1.jar
new file mode 100644
index 00000000..61424706
Binary files /dev/null and b/docs-android/app/libs/tokenautocomplete-1.2.1.jar differ
diff --git a/docs-android/app/src/main/AndroidManifest.xml b/docs-android/app/src/main/AndroidManifest.xml
index 6719ebd1..7f75291e 100644
--- a/docs-android/app/src/main/AndroidManifest.xml
+++ b/docs-android/app/src/main/AndroidManifest.xml
@@ -37,6 +37,11 @@
android:label=""
android:logo="@drawable/ic_launcher">
+
+
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 14af4c09..d6bda7e1 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
@@ -23,6 +23,8 @@ public class MainApplication extends Application {
// TODO Fullscreen preview
// TODO Caching preferences
// TODO Edit sharing
+ // TODO Documents adding/editing
+ // TODO Files adding/deleting
super.onCreate();
}
diff --git a/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java
new file mode 100644
index 00000000..24661bb2
--- /dev/null
+++ b/docs-android/app/src/main/java/com/sismics/docs/activity/DocumentEditActivity.java
@@ -0,0 +1,56 @@
+package com.sismics.docs.activity;
+
+import android.os.Bundle;
+import android.support.v7.app.ActionBarActivity;
+import android.view.MenuItem;
+import android.widget.ArrayAdapter;
+import android.widget.MultiAutoCompleteTextView;
+import android.widget.Spinner;
+
+import com.sismics.docs.R;
+
+/**
+ * Document edition activity.
+ *
+ * @author bgamard.
+ */
+public class DocumentEditActivity extends ActionBarActivity {
+ @Override
+ protected void onCreate(Bundle args) {
+ super.onCreate(args);
+
+ // Handle activity context
+ if (getIntent() == null) {
+ finish();
+ return;
+ }
+
+ // Setup the activity
+ setContentView(R.layout.document_edit_activity);
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
+
+ Spinner languageSpinner = (Spinner) findViewById(R.id.languageSpinner);
+ languageSpinner.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,
+ new String[] { "French", "English", "Japanese" }));
+
+ MultiAutoCompleteTextView tagsEditText = (MultiAutoCompleteTextView) findViewById(R.id.tagsEditText);
+ tagsEditText.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,
+ new String[] { "Caluire", "Appartement", "Banque", "Assurance" }));
+ tagsEditText.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ finish();
+ return true;
+
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/docs-android/app/src/main/java/com/sismics/docs/fragment/DocListFragment.java b/docs-android/app/src/main/java/com/sismics/docs/fragment/DocListFragment.java
index b43256c8..a862e9d6 100644
--- a/docs-android/app/src/main/java/com/sismics/docs/fragment/DocListFragment.java
+++ b/docs-android/app/src/main/java/com/sismics/docs/fragment/DocListFragment.java
@@ -9,11 +9,13 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
import com.sismics.docs.R;
import com.sismics.docs.activity.DocumentActivity;
+import com.sismics.docs.activity.DocumentEditActivity;
import com.sismics.docs.adapter.DocListAdapter;
import com.sismics.docs.event.SearchEvent;
import com.sismics.docs.listener.JsonHttpResponseHandler;
@@ -114,6 +116,16 @@ public class DocListFragment extends Fragment {
}
});
+ // Add document button
+ ImageButton addDocumentButton = (ImageButton) view.findViewById(R.id.addDocumentButton);
+ addDocumentButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(getActivity(), DocumentEditActivity.class);
+ startActivityForResult(intent, 1);
+ }
+ });
+
// Grab the documents
loadDocuments(view, true);
diff --git a/docs-android/app/src/main/java/com/sismics/docs/ui/view/DatePickerView.java b/docs-android/app/src/main/java/com/sismics/docs/ui/view/DatePickerView.java
new file mode 100644
index 00000000..974aa9e0
--- /dev/null
+++ b/docs-android/app/src/main/java/com/sismics/docs/ui/view/DatePickerView.java
@@ -0,0 +1,46 @@
+package com.sismics.docs.ui.view;
+
+import android.app.DatePickerDialog;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.DatePicker;
+import android.widget.TextView;
+
+import java.util.Calendar;
+
+public class DatePickerView extends TextView implements DatePickerDialog.OnDateSetListener{
+
+ public DatePickerView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ public DatePickerView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setAttributes();
+ }
+
+ public DatePickerView(Context context) {
+ super(context);
+ setAttributes();
+ }
+
+ private void setAttributes() {
+ setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final Calendar calendar = Calendar.getInstance();
+ new DatePickerDialog(
+ DatePickerView.this.getContext(), DatePickerView.this,
+ calendar.get(Calendar.YEAR),
+ calendar.get(Calendar.MONTH),
+ calendar.get(Calendar.DAY_OF_MONTH)).show();
+ }
+ });
+ }
+
+ @Override
+ public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
+ setText(String.format("%s/%s/%s", monthOfYear, dayOfMonth, year));
+ }
+}
\ No newline at end of file
diff --git a/docs-android/app/src/main/java/com/sismics/docs/ui/view/FloatingActionButton.java b/docs-android/app/src/main/java/com/sismics/docs/ui/view/FloatingActionButton.java
deleted file mode 100644
index 0fde5338..00000000
--- a/docs-android/app/src/main/java/com/sismics/docs/ui/view/FloatingActionButton.java
+++ /dev/null
@@ -1,268 +0,0 @@
-package com.sismics.docs.ui.view;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.LayerDrawable;
-import android.os.Build;
-import android.util.AttributeSet;
-import android.widget.ImageButton;
-import android.widget.ImageView;
-
-/**
- * A circular button made of paper that lifts and emits ink reactions on press.
- *
- * This widget supports two sizes: {@link #SIZE_NORMAL} and {@link #SIZE_MINI}
- * according to Promoted Actions pattern.
- *
- * Like an {@link ImageView} this widget require {@code android:src} attribute.
- * According to official documentation this drawable should be not more than {@code 24dp}.
- *
- * Use theme to customize all floating buttons in your app:
- *
- * Declare own style:
- *
- * <style name="AppTheme.Fab" parent="FloatingActionButton">
- * <item name="floatingActionButtonColor">@color/my_fab_color</item>
- * </style>
- *
- * Link this style in your theme:
- *
- * <style name="AppTheme" parent="android:Theme">
- * <item name="floatingActionButtonStyle">@style/AppTheme.Fab</item>
- * </style>
- *
- *
- * Customizing in layout.xml:
- *
- * <com.shamanland.fab.FloatingActionButton
- * android:layout_width="wrap_content"
- * android:layout_height="wrap_content"
- * android:src="@drawable/ic_action_my"
- * app:floatingActionButtonColor="@color/my_fab_color"
- * app:floatingActionButtonSize="mini"
- * />
- *
- *
- * Customizing in java-code:
- *
- * FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
- * fab.setSize(FloatingActionButton.SIZE_MINI);
- * fab.setColor(Color.RED);
- * // NOTE invoke this method after setting new values!
- * fab.initBackground();
- * // NOTE standard method of ImageView
- * fab.setImageResource(R.drawable.ic_action_my);
- *
- */
-public class FloatingActionButton extends ImageButton {
- /**
- * Constant representing normal size {@code 56dp}. Value: 0x0
- */
- public static final int SIZE_NORMAL = 0;
-
- /**
- * Constant representing mini size {@code 40dp}. Value: 0x1
- */
- public static final int SIZE_MINI = 1;
-
- private int mSize;
- private int mColor;
- private ColorStateList mColorStateList;
-
- private GradientDrawable mCircleDrawable;
-
- /**
- * Gets abstract size of this button.
- *
- * @return {@link #SIZE_NORMAL} or {@link #SIZE_MINI}
- */
- public int getSize() {
- return mSize;
- }
-
- /**
- * Sets abstract size for this button.
- *
- * Xml attribute: {@code app:floatingActionButtonSize}
- *
- * @param size {@link #SIZE_NORMAL} or {@link #SIZE_MINI}
- */
- public void setSize(int size) {
- mSize = size;
- }
-
- /**
- * Gets background color of this button.
- *
- * @return color
- */
- public int getColor() {
- return mColor;
- }
-
- /**
- * Sets background color for this button.
- *
- * Xml attribute: {@code app:floatingActionButtonColor}
- *
- * @param color color
- */
- public void setColor(int color) {
- mColor = color;
- }
-
- /**
- * Gets color state list used as background for this button.
- *
- * @return may be null
- */
- public ColorStateList getColorStateList() {
- return mColorStateList;
- }
-
- /**
- * Sets color state list as background for this button.
- *
- * Xml attribute: {@code app:floatingActionButtonColor}
- *
- * @param colorStateList color
- */
- public void setColorStateList(ColorStateList colorStateList) {
- mColorStateList = colorStateList;
- }
-
- public FloatingActionButton(Context context) {
- super(context);
- init(context, null, 0);
- }
-
- public FloatingActionButton(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context, attrs, com.shamanland.fab.R.attr.floatingActionButtonStyle);
- }
-
- public FloatingActionButton(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- init(context, attrs, defStyle);
- }
-
- private void init(Context context, AttributeSet attrs, int defStyle) {
- TypedArray a;
-
- try {
- if (isInEditMode()) {
- return;
- }
-
- if (attrs == null) {
- return;
- }
-
- Resources.Theme theme = context.getTheme();
- if (theme == null) {
- return;
- }
-
- a = theme.obtainStyledAttributes(attrs, com.shamanland.fab.R.styleable.FloatingActionButton, defStyle, com.shamanland.fab.R.style.FloatingActionButton_Dark);
- if (a == null) {
- return;
- }
- } finally {
- mSize = SIZE_NORMAL;
- mColor = Color.GRAY;
- mColorStateList = null;
- }
-
- try {
- initAttrs(a);
- } finally {
- a.recycle();
- }
-
- initBackground();
- }
-
- private void initAttrs(TypedArray a) {
- setSize(a.getInteger(com.shamanland.fab.R.styleable.FloatingActionButton_floatingActionButtonSize, SIZE_NORMAL));
- setColor(a.getColor(com.shamanland.fab.R.styleable.FloatingActionButton_floatingActionButtonColor, Color.GRAY));
- setColorStateList(a.getColorStateList(com.shamanland.fab.R.styleable.FloatingActionButton_floatingActionButtonColor));
- }
-
- /**
- * Inflate and initialize background drawable for this view with arguments
- * inflated from xml or specified using {@link #setSize(int)} or {@link #setColor(int)}
- *
- * Invoked from constructor, but it's allowed to invoke this method manually from code.
- */
- public void initBackground() {
- final int backgroundId;
-
- if (mSize == SIZE_MINI) {
- backgroundId = com.shamanland.fab.R.drawable.com_shamanland_fab_circle_mini;
- } else {
- backgroundId = com.shamanland.fab.R.drawable.com_shamanland_fab_circle_normal;
- }
-
- Drawable background = getResources().getDrawable(backgroundId);
-
- if (background instanceof LayerDrawable) {
- LayerDrawable layers = (LayerDrawable) background;
- if (layers.getNumberOfLayers() == 2) {
- Drawable shadow = layers.getDrawable(0);
- Drawable circle = layers.getDrawable(1);
-
- if (shadow instanceof GradientDrawable) {
- ((GradientDrawable) shadow.mutate()).setGradientRadius(getShadowRadius(shadow, circle));
- }
-
- if (circle instanceof GradientDrawable) {
- mCircleDrawable = (GradientDrawable) circle.mutate();
- mCircleDrawable.setColor(mColor);
- }
- }
- }
-
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
- //noinspection deprecation
- setBackgroundDrawable(background);
- } else {
- setBackground(background);
- }
- }
-
- @Override
- protected void drawableStateChanged() {
- super.drawableStateChanged();
-
- if (mCircleDrawable != null && mColorStateList != null) {
- mCircleDrawable.setColor(mColorStateList.getColorForState(getDrawableState(), mColor));
-
- // NOTE maybe this line is required only for Gingerbread
- invalidate();
- }
- }
-
- /**
- * Calculates required radius of shadow.
- *
- * @param shadow underlay drawable
- * @param circle overlay drawable
- * @return calculated radius, always >= 1
- */
- protected static int getShadowRadius(Drawable shadow, Drawable circle) {
- int radius = 0;
-
- if (shadow != null && circle != null) {
- Rect rect = new Rect();
- radius = (circle.getIntrinsicWidth() + (shadow.getPadding(rect) ? rect.left + rect.right : 0)) / 2;
- }
-
- return Math.max(1, radius);
- }
-}
\ No newline at end of file
diff --git a/docs-android/app/src/main/res/layout/doc_list_fragment.xml b/docs-android/app/src/main/res/layout/doc_list_fragment.xml
index 3b9104f2..3d781fde 100644
--- a/docs-android/app/src/main/res/layout/doc_list_fragment.xml
+++ b/docs-android/app/src/main/res/layout/doc_list_fragment.xml
@@ -37,7 +37,7 @@
android:textSize="16sp"
android:layout_centerInParent="true"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs-android/app/src/main/res/values/strings.xml b/docs-android/app/src/main/res/values/strings.xml
index 3c9ac83e..45a61499 100644
--- a/docs-android/app/src/main/res/values/strings.xml
+++ b/docs-android/app/src/main/res/values/strings.xml
@@ -41,5 +41,6 @@
Error loading documents
No files
Error loading files
+ New document
diff --git a/docs-android/gradle/wrapper/gradle-wrapper.properties b/docs-android/gradle/wrapper/gradle-wrapper.properties
index 5369550e..695bbdaa 100644
--- a/docs-android/gradle/wrapper/gradle-wrapper.properties
+++ b/docs-android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Nov 18 23:58:08 CET 2014
+#Wed Nov 26 21:58:48 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip