From b106b5c01278f2acb524ec66805617b352590665 Mon Sep 17 00:00:00 2001 From: Mariotaku Lee Date: Thu, 21 Jan 2016 22:39:13 +0800 Subject: [PATCH] Fixed #287, finally! --- .../twidere/api/twitter/TwitterUpload.java | 19 +++++++++++ .../AbsContentRecyclerViewFragment.java | 16 ++++----- .../service/BackgroundOperationService.java | 32 ++++++++--------- .../util/MouseScrollDirectionDecider.java | 20 ++++++++--- .../util/io/ContentLengthInputStream.java | 4 +++ .../twidere/view/ExtendedRecyclerView.java | 14 +++++++- .../main/res/layout/activity_media_viewer.xml | 15 ++++---- .../res/layout/fragment_content_listview.xml | 11 +++--- .../layout/fragment_content_recyclerview.xml | 3 +- .../src/main/res/layout/fragment_drafts.xml | 24 ++++++------- .../res/layout/fragment_media_page_image.xml | 3 +- .../fragment_media_page_image_compat.xml | 10 +++--- .../res/layout/fragment_media_page_video.xml | 6 ++-- .../layout/fragment_user_profile_editor.xml | 34 +++++++++---------- .../layout/layout_content_fragment_common.xml | 8 ++--- .../layout_draggable_list_with_empty_view.xml | 3 +- 16 files changed, 131 insertions(+), 91 deletions(-) diff --git a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterUpload.java b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterUpload.java index a73469a2b..8afc085d4 100644 --- a/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterUpload.java +++ b/twidere.component.common/src/main/java/org/mariotaku/twidere/api/twitter/TwitterUpload.java @@ -20,10 +20,14 @@ package org.mariotaku.twidere.api.twitter; import org.mariotaku.restfu.annotation.method.POST; +import org.mariotaku.restfu.annotation.param.KeyValue; import org.mariotaku.restfu.annotation.param.Param; +import org.mariotaku.restfu.annotation.param.Params; import org.mariotaku.restfu.http.BodyType; +import org.mariotaku.restfu.http.mime.Body; import org.mariotaku.restfu.http.mime.FileBody; import org.mariotaku.twidere.api.twitter.model.MediaUploadResponse; +import org.mariotaku.twidere.api.twitter.model.ResponseCode; import java.io.File; @@ -38,4 +42,19 @@ public interface TwitterUpload { @BodyType(BodyType.MULTIPART) MediaUploadResponse uploadMedia(@Param("media") FileBody data) throws TwitterException; + + @POST("/media/upload.json") + @Params(@KeyValue(key = "command", value = "INIT")) + MediaUploadResponse initUploadMedia(@Param("media_type") String mediaType, + @Param("total_bytes") long totalBytes) throws TwitterException; + + @POST("/media/upload.json") + @Params(@KeyValue(key = "command", value = "APPEND")) + ResponseCode initUploadMedia(@Param("media_id") long mediaId, + @Param("segment_index") int segmentIndex, + @Param("media") Body media) throws TwitterException; + + @POST("/media/upload.json") + @Params(@KeyValue(key = "command", value = "FINALIZE")) + MediaUploadResponse initUploadMedia(@Param("media_id") long mediaId) throws TwitterException; } diff --git a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentRecyclerViewFragment.java b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentRecyclerViewFragment.java index e8d6ecd5f..5103602c0 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentRecyclerViewFragment.java +++ b/twidere/src/main/java/org/mariotaku/twidere/fragment/support/AbsContentRecyclerViewFragment.java @@ -59,8 +59,6 @@ public abstract class AbsContentRecyclerViewFragment + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:menu="menu_media_viewer_image_page"> + android:layout_height="match_parent"/> + android:background="@drawable/shadow_top"/> + android:background="#80000000"/> \ No newline at end of file diff --git a/twidere/src/main/res/layout/fragment_content_listview.xml b/twidere/src/main/res/layout/fragment_content_listview.xml index 549a2a273..fa306a7eb 100644 --- a/twidere/src/main/res/layout/fragment_content_listview.xml +++ b/twidere/src/main/res/layout/fragment_content_listview.xml @@ -17,18 +17,17 @@ ~ along with this program. If not, see . --> - + android:layout_height="match_parent"> - + + android:listSelector="?selectableItemBackground"/> \ No newline at end of file diff --git a/twidere/src/main/res/layout/fragment_content_recyclerview.xml b/twidere/src/main/res/layout/fragment_content_recyclerview.xml index 6de86ba9b..a6f532573 100644 --- a/twidere/src/main/res/layout/fragment_content_recyclerview.xml +++ b/twidere/src/main/res/layout/fragment_content_recyclerview.xml @@ -20,8 +20,7 @@ + android:layout_height="match_parent"> diff --git a/twidere/src/main/res/layout/fragment_drafts.xml b/twidere/src/main/res/layout/fragment_drafts.xml index 518036cca..6fe36b9f9 100644 --- a/twidere/src/main/res/layout/fragment_drafts.xml +++ b/twidere/src/main/res/layout/fragment_drafts.xml @@ -17,24 +17,24 @@ ~ along with this program. If not, see . --> - + android:layout_height="match_parent"> + android:layout_height="match_parent" + android:visibility="gone" + tools:visibility="visible"> + tools:visibility="gone"/> + android:color="?android:textColorSecondary"/> + android:textAppearance="?android:textAppearanceMedium"/> + tools:visibility="gone"> + android:layout_height="match_parent"> . --> - + android:layout_height="match_parent"> + android:layout_height="match_parent"/> + android:layout_height="match_parent"> + android:layout_alignParentBottom="true"> . --> - + android:scaleType="centerCrop"/> + android:textStyle="bold"/> @@ -89,7 +89,7 @@ android:layout_height="@dimen/element_size_mlarge" android:layout_gravity="center" android:foreground="?selectableItemBackground" - android:scaleType="centerCrop" /> + android:scaleType="centerCrop"/> + android:textStyle="bold"/> + android:layout_height="@dimen/element_spacing_normal"/> + app:met_maxCharacters="20"/> + app:met_maxCharacters="160"/> + app:met_maxCharacters="30"/> + app:met_maxCharacters="100"/> + android:layout_height="@dimen/element_spacing_normal"/> + android:layout_weight="0"/> + android:textStyle="bold"/> @@ -214,7 +214,7 @@ android:id="@+id/background_color" android:layout_width="@dimen/element_size_normal" android:layout_height="@dimen/element_size_normal" - android:layout_weight="0" /> + android:layout_weight="0"/> + android:textStyle="bold"/> diff --git a/twidere/src/main/res/layout/layout_content_fragment_common.xml b/twidere/src/main/res/layout/layout_content_fragment_common.xml index 58e35618a..6afd0afc0 100644 --- a/twidere/src/main/res/layout/layout_content_fragment_common.xml +++ b/twidere/src/main/res/layout/layout_content_fragment_common.xml @@ -18,10 +18,10 @@ --> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + android:src="@drawable/ic_info_error_generic"/> + android:textAppearance="?android:textAppearanceMedium"/> \ No newline at end of file diff --git a/twidere/src/main/res/layout/layout_draggable_list_with_empty_view.xml b/twidere/src/main/res/layout/layout_draggable_list_with_empty_view.xml index e3417c290..6cb7e561d 100644 --- a/twidere/src/main/res/layout/layout_draggable_list_with_empty_view.xml +++ b/twidere/src/main/res/layout/layout_draggable_list_with_empty_view.xml @@ -22,8 +22,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:animateLayoutChanges="true"> + android:layout_height="match_parent">