fixed profile image background shape in lollipop

added unsupported message for send image to buffer
This commit is contained in:
Mariotaku Lee 2017-03-26 13:32:30 +08:00
parent 26bcfde9d2
commit 17418bebf8
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
10 changed files with 156 additions and 34 deletions

View File

@ -26,6 +26,7 @@ import org.mariotaku.microblog.library.twitter.api.FavoritesResources;
import org.mariotaku.microblog.library.twitter.api.FriendsFollowersResources; import org.mariotaku.microblog.library.twitter.api.FriendsFollowersResources;
import org.mariotaku.microblog.library.twitter.api.HelpResources; import org.mariotaku.microblog.library.twitter.api.HelpResources;
import org.mariotaku.microblog.library.twitter.api.ListResources; import org.mariotaku.microblog.library.twitter.api.ListResources;
import org.mariotaku.microblog.library.twitter.api.MutesResources;
import org.mariotaku.microblog.library.twitter.api.PlacesGeoResources; import org.mariotaku.microblog.library.twitter.api.PlacesGeoResources;
import org.mariotaku.microblog.library.twitter.api.SavedSearchesResources; import org.mariotaku.microblog.library.twitter.api.SavedSearchesResources;
import org.mariotaku.microblog.library.twitter.api.SearchResources; import org.mariotaku.microblog.library.twitter.api.SearchResources;
@ -41,5 +42,5 @@ import org.mariotaku.microblog.library.twitter.api.UsersResources;
public interface Twitter extends SearchResources, TimelineResources, TweetResources, UsersResources, public interface Twitter extends SearchResources, TimelineResources, TweetResources, UsersResources,
ListResources, DirectMessagesResources, FriendsFollowersResources, FavoritesResources, ListResources, DirectMessagesResources, FriendsFollowersResources, FavoritesResources,
SpamReportingResources, SavedSearchesResources, TrendsResources, PlacesGeoResources, SpamReportingResources, SavedSearchesResources, TrendsResources, PlacesGeoResources,
HelpResources, TwitterPrivate { HelpResources, MutesResources, TwitterPrivate {
} }

View File

@ -0,0 +1,59 @@
/*
* Twidere - Twitter client for Android
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.mariotaku.microblog.library.twitter.api;
import org.mariotaku.microblog.library.MicroBlogException;
import org.mariotaku.microblog.library.twitter.model.IDs;
import org.mariotaku.microblog.library.twitter.model.PageableResponseList;
import org.mariotaku.microblog.library.twitter.model.Paging;
import org.mariotaku.microblog.library.twitter.model.User;
import org.mariotaku.microblog.library.twitter.template.UserAnnotationTemplate;
import org.mariotaku.restfu.annotation.method.GET;
import org.mariotaku.restfu.annotation.method.POST;
import org.mariotaku.restfu.annotation.param.Param;
import org.mariotaku.restfu.annotation.param.Queries;
import org.mariotaku.restfu.annotation.param.Query;
/**
* Created by mariotaku on 2017/3/26.
*/
@Queries(template = UserAnnotationTemplate.class)
public interface MutesResources {
@POST("/mutes/users/create.json")
User createMute(@Param("user_id") String userId) throws MicroBlogException;
@POST("/mutes/users/create.json")
User createMuteByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@POST("/mutes/users/destroy.json")
User destroyMute(@Param("user_id") String userId) throws MicroBlogException;
@POST("/mutes/users/destroy.json")
User destroyMuteByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@GET("/mutes/users/ids.json")
IDs getMutesUsersIDs(Paging paging) throws MicroBlogException;
@GET("/mutes/users/list.json")
PageableResponseList<User> getMutesUsersList(@Query Paging paging) throws MicroBlogException;
}

View File

@ -0,0 +1,45 @@
/*
* Twidere - Twitter client for Android
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.mariotaku.microblog.library.twitter.api;
import org.mariotaku.microblog.library.MicroBlogException;
import org.mariotaku.microblog.library.twitter.model.IDs;
import org.mariotaku.microblog.library.twitter.model.MutedKeyword;
import org.mariotaku.microblog.library.twitter.model.PageableResponseList;
import org.mariotaku.microblog.library.twitter.model.Paging;
import org.mariotaku.microblog.library.twitter.template.UserAnnotationTemplate;
import org.mariotaku.restfu.annotation.method.GET;
import org.mariotaku.restfu.annotation.param.Queries;
import org.mariotaku.restfu.annotation.param.Query;
/**
* Created by mariotaku on 2017/3/26.
*/
@Queries(template = UserAnnotationTemplate.class)
public interface PrivateMutesResources {
@GET("/mutes/keywords/ids.json")
IDs getMutesKeywordsIDs(Paging paging) throws MicroBlogException;
@GET("/mutes/keywords/list.json")
PageableResponseList<MutedKeyword> getMutesKeywordsList(@Query Paging paging) throws MicroBlogException;
}

View File

@ -51,11 +51,6 @@ public interface UsersResources {
@POST("/blocks/create.json") @POST("/blocks/create.json")
User createBlockByScreenName(@Query("screen_name") String screenName) throws MicroBlogException; User createBlockByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@POST("/mutes/users/create.json")
User createMute(@Param("user_id") String userId) throws MicroBlogException;
@POST("/mutes/users/create.json")
User createMuteByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@POST("/blocks/destroy.json") @POST("/blocks/destroy.json")
User destroyBlock(@Param("user_id") String userId) throws MicroBlogException; User destroyBlock(@Param("user_id") String userId) throws MicroBlogException;
@ -63,11 +58,6 @@ public interface UsersResources {
@POST("/blocks/destroy.json") @POST("/blocks/destroy.json")
User destroyBlockByScreenName(@Query("screen_name") String screenName) throws MicroBlogException; User destroyBlockByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@POST("/mutes/users/destroy.json")
User destroyMute(@Param("user_id") String userId) throws MicroBlogException;
@POST("/mutes/users/destroy.json")
User destroyMuteByScreenName(@Query("screen_name") String screenName) throws MicroBlogException;
@GET("/account/settings.json") @GET("/account/settings.json")
AccountSettings getAccountSettings() throws MicroBlogException; AccountSettings getAccountSettings() throws MicroBlogException;
@ -80,11 +70,6 @@ public interface UsersResources {
ResponseList<User> getMemberSuggestions(String categorySlug) throws MicroBlogException; ResponseList<User> getMemberSuggestions(String categorySlug) throws MicroBlogException;
@GET("/mutes/users/ids.json")
IDs getMutesUsersIDs(Paging paging) throws MicroBlogException;
@GET("/mutes/users/list.json")
PageableResponseList<User> getMutesUsersList(@Query Paging paging) throws MicroBlogException;
ResponseList<Category> getSuggestedUserCategories() throws MicroBlogException; ResponseList<Category> getSuggestedUserCategories() throws MicroBlogException;

View File

@ -0,0 +1,31 @@
/*
* Twidere - Twitter client for Android
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.mariotaku.microblog.library.twitter.model;
import com.bluelinelabs.logansquare.annotation.JsonObject;
/**
* Created by mariotaku on 2017/3/26.
*/
@JsonObject
public class MutedKeyword {
}

View File

@ -119,12 +119,8 @@ public class ShapedImageView extends AppCompatImageView {
} }
public void setShapeBackground(final int color) { public void setShapeBackground(final int color) {
if (OUTLINE_DRAW) { mBackgroundPaint.setColor(color);
setBackgroundColor(color); invalidate();
} else {
mBackgroundPaint.setColor(color);
invalidate();
}
} }
public int[] getBorderColors() { public int[] getBorderColors() {
@ -193,15 +189,17 @@ public class ShapedImageView extends AppCompatImageView {
mDestination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(), mDestination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(),
getHeight() - getPaddingBottom()); getHeight() - getPaddingBottom());
final int contentLeft = getPaddingLeft(), contentTop = getPaddingTop(),
contentRight = getWidth() - getPaddingRight(),
contentBottom = getHeight() - getPaddingBottom();
final int contentWidth = contentRight - contentLeft,
contentHeight = contentBottom - contentTop;
final int size = Math.min(contentWidth, contentHeight);
if (OUTLINE_DRAW) { if (OUTLINE_DRAW) {
drawShape(canvas, mDestination, 0, mBackgroundPaint);
super.onDraw(canvas); super.onDraw(canvas);
} else { } else {
final int contentLeft = getPaddingLeft(), contentTop = getPaddingTop(),
contentRight = getWidth() - getPaddingRight(),
contentBottom = getHeight() - getPaddingBottom();
final int contentWidth = contentRight - contentLeft,
contentHeight = contentBottom - contentTop;
final int size = Math.min(contentWidth, contentHeight);
if (mShadowBitmap != null && mDrawShadow) { if (mShadowBitmap != null && mDrawShadow) {
canvas.drawBitmap(mShadowBitmap, contentLeft + (contentWidth - size) / 2 - mShadowRadius, canvas.drawBitmap(mShadowBitmap, contentLeft + (contentWidth - size) / 2 - mShadowRadius,
contentTop + (contentHeight - size) / 2 - mShadowRadius, null); contentTop + (contentHeight - size) / 2 - mShadowRadius, null);

View File

@ -262,7 +262,7 @@ class UpdateStatusTask(
throw SchedulerNotFoundException("No scheduler found") throw SchedulerNotFoundException("No scheduler found")
} }
controller.scheduleStatus(statusUpdate, pendingUpdate.overrideTexts, scheduleInfo) controller.scheduleStatus(statusUpdate, pendingUpdate, scheduleInfo)
return UpdateStatusResult(pendingUpdate.length, draftId) return UpdateStatusResult(pendingUpdate.length, draftId)
} }
@ -499,9 +499,9 @@ class UpdateStatusTask(
} }
} }
internal class PendingStatusUpdate(val length: Int, defaultText: String) { class PendingStatusUpdate internal constructor(val length: Int, defaultText: String) {
constructor(statusUpdate: ParcelableStatusUpdate) : this(statusUpdate.accounts.size, internal constructor(statusUpdate: ParcelableStatusUpdate) : this(statusUpdate.accounts.size,
statusUpdate.text) statusUpdate.text)
var sharedMediaIds: Array<String>? = null var sharedMediaIds: Array<String>? = null

View File

@ -25,6 +25,7 @@ import android.support.annotation.WorkerThread
import org.mariotaku.twidere.model.ParcelableStatusUpdate import org.mariotaku.twidere.model.ParcelableStatusUpdate
import org.mariotaku.twidere.model.schedule.ScheduleInfo import org.mariotaku.twidere.model.schedule.ScheduleInfo
import org.mariotaku.twidere.task.twitter.UpdateStatusTask import org.mariotaku.twidere.task.twitter.UpdateStatusTask
import org.mariotaku.twidere.task.twitter.UpdateStatusTask.PendingStatusUpdate
import java.util.* import java.util.*
/** /**
@ -35,7 +36,7 @@ interface StatusScheduleController {
@WorkerThread @WorkerThread
@Throws(UpdateStatusTask.ScheduleException::class) @Throws(UpdateStatusTask.ScheduleException::class)
fun scheduleStatus(statusUpdate: ParcelableStatusUpdate, overrideTexts: Array<String>, fun scheduleStatus(statusUpdate: ParcelableStatusUpdate, pendingUpdate: PendingStatusUpdate,
scheduleInfo: ScheduleInfo) scheduleInfo: ScheduleInfo)
fun createSetScheduleIntent(): Intent fun createSetScheduleIntent(): Intent

View File

@ -7,13 +7,13 @@
<item <item
android:id="@+id/add_media" android:id="@+id/add_media"
android:icon="@drawable/ic_action_gallery" android:icon="@drawable/ic_action_gallery"
android:title="@string/add_image" android:title="@string/action_add_media"
app:showAsAction="always" app:showAsAction="always"
tools:ignore="AlwaysShowAction"/> tools:ignore="AlwaysShowAction"/>
<item <item
android:id="@+id/media_menu" android:id="@+id/media_menu"
android:icon="@drawable/ic_action_gallery" android:icon="@drawable/ic_action_gallery"
android:title="@string/media" android:title="@string/label_media"
android:visible="false" android:visible="false"
app:showAsAction="always" app:showAsAction="always"
tools:ignore="AlwaysShowAction"> tools:ignore="AlwaysShowAction">

View File

@ -1258,4 +1258,6 @@
<string name="users_statuses">User\'s tweets</string> <string name="users_statuses">User\'s tweets</string>
<string name="vibration">Vibration</string> <string name="vibration">Vibration</string>
<string name="message_error_buffer_media_not_supported">Schedule media with Buffer is not yet supported</string>
<string name="title_buffer_set_schedule">Schedule with Buffer</string>
</resources> </resources>