Android: file upload (in progress), title marquee

This commit is contained in:
jendib 2014-11-30 16:11:35 +01:00
parent e17abfe411
commit 551c10e7a3
7 changed files with 40 additions and 2 deletions

View File

@ -20,6 +20,7 @@ public class MainApplication extends Application {
JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON); JSONObject json = PreferenceUtil.getCachedJson(getApplicationContext(), PreferenceUtil.PREF_CACHED_USER_INFO_JSON);
ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json); ApplicationContext.getInstance().setUserInfo(getApplicationContext(), json);
// TODO Catch view intents pointing to a share and display it
// TODO Fullscreen preview // TODO Fullscreen preview
// TODO Caching preferences // TODO Caching preferences
// TODO Documents adding/editing // TODO Documents adding/editing

View File

@ -9,6 +9,8 @@ import android.os.Environment;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -115,8 +117,18 @@ public class DocumentActivity extends ActionBarActivity {
String language = document.optString("language"); String language = document.optString("language");
JSONArray tags = document.optJSONArray("tags"); JSONArray tags = document.optJSONArray("tags");
// Fill the layout // Setup the title
setTitle(title); setTitle(title);
Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar);
TextView titleTextView = (TextView) toolbar.getChildAt(1);
if (titleTextView != null) {
titleTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
titleTextView.setMarqueeRepeatLimit(-1);
titleTextView.setFocusable(true);
titleTextView.setFocusableInTouchMode(true);
}
// Fill the layout
TextView createdDateTextView = (TextView) findViewById(R.id.createdDateTextView); TextView createdDateTextView = (TextView) findViewById(R.id.createdDateTextView);
createdDateTextView.setText(date); createdDateTextView.setText(date);
@ -189,6 +201,13 @@ public class DocumentActivity extends ActionBarActivity {
dialog.show(getSupportFragmentManager(), "DocShareFragment"); dialog.show(getSupportFragmentManager(), "DocShareFragment");
return true; return true;
case R.id.upload_file:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT)
.setType("*/*")
.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
startActivityForResult(Intent.createChooser(intent, getText(R.string.upload_from)), 1);
return true;
case android.R.id.home: case android.R.id.home:
finish(); finish();
return true; return true;
@ -198,6 +217,10 @@ public class DocumentActivity extends ActionBarActivity {
} }
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
/** /**
* Download the current displayed file. * Download the current displayed file.
*/ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

View File

@ -10,6 +10,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:padding="16dp" android:padding="16dp"
android:textSize="24dp"
android:hint="Title"/> android:hint="Title"/>
<EditText <EditText
@ -20,6 +21,7 @@
android:layout_margin="8dp" android:layout_margin="8dp"
android:padding="16dp" android:padding="16dp"
android:hint="Description" android:hint="Description"
android:textSize="18sp"
android:lines="2"/> android:lines="2"/>
<LinearLayout <LinearLayout
@ -34,7 +36,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:textSize="16sp" android:textSize="18sp"
android:padding="16dp"/> android:padding="16dp"/>
<com.sismics.docs.ui.view.DatePickerView <com.sismics.docs.ui.view.DatePickerView
@ -43,6 +45,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_margin="8dp"
android:textSize="18sp"
android:text="15/11/2014" android:text="15/11/2014"
android:padding="16dp"/> android:padding="16dp"/>
@ -59,5 +62,7 @@
android:id="@+id/tagsEditText" android:id="@+id/tagsEditText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="18sp"
android:hint="Add tags"
android:layout_margin="8dp"/> android:layout_margin="8dp"/>
</LinearLayout> </LinearLayout>

View File

@ -2,6 +2,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/upload_file"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_file_upload_white_24dp"
android:title="@string/upload_file">
</item>
<item <item
android:id="@+id/share" android:id="@+id/share"
app:showAsAction="collapseActionView" app:showAsAction="collapseActionView"

View File

@ -54,5 +54,7 @@
<string name="share_default_name">Share link</string> <string name="share_default_name">Share link</string>
<string name="error_deleting_share">Error deleting the share</string> <string name="error_deleting_share">Error deleting the share</string>
<string name="send_share_to">Send share link to</string> <string name="send_share_to">Send share link to</string>
<string name="upload_file">Upload a file</string>
<string name="upload_from">Upload a file from</string>
</resources> </resources>