mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-02 17:56:56 +01:00
improved theme settings
moved some unused settings bug fixes
This commit is contained in:
parent
a65de0cdbc
commit
9d6a0e4558
@ -34,6 +34,7 @@ import org.mariotaku.twidere.api.twitter.model.IDs;
|
||||
import org.mariotaku.twidere.api.twitter.model.PageableResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
import org.mariotaku.twidere.api.twitter.model.ProfileUpdate;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseCode;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.SettingsUpdate;
|
||||
import org.mariotaku.twidere.api.twitter.model.User;
|
||||
@ -103,7 +104,7 @@ public interface UsersResources {
|
||||
|
||||
@POST("/account/remove_profile_banner.json")
|
||||
@Body(BodyType.FORM)
|
||||
void removeProfileBannerImage() throws TwitterException;
|
||||
ResponseCode removeProfileBannerImage() throws TwitterException;
|
||||
|
||||
@GET("/users/search.json")
|
||||
ResponseList<User> searchUsers(@Query("q") String query, @Query Paging paging) throws TwitterException;
|
||||
@ -132,14 +133,14 @@ public interface UsersResources {
|
||||
|
||||
@POST("/account/update_profile_banner.json")
|
||||
@Body(BodyType.MULTIPART)
|
||||
void updateProfileBannerImage(@Part("image") FileTypedData data, @Part("width") int width,
|
||||
ResponseCode updateProfileBannerImage(@Part("image") FileTypedData data, @Part("width") int width,
|
||||
@Part("height") int height, @Part("offset_left") int offsetLeft,
|
||||
@Part("offset_top") int offsetTop)
|
||||
throws TwitterException;
|
||||
|
||||
@POST("/account/update_profile_banner.json")
|
||||
@Body(BodyType.MULTIPART)
|
||||
void updateProfileBannerImage(@Part("image") FileTypedData data) throws TwitterException;
|
||||
ResponseCode updateProfileBannerImage(@Part("image") FileTypedData data) throws TwitterException;
|
||||
|
||||
@POST("/account/update_profile_image.json")
|
||||
@Body(BodyType.MULTIPART)
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.api.twitter.model;
|
||||
|
||||
import org.mariotaku.restfu.http.RestHttpResponse;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/6/15.
|
||||
*/
|
||||
public class ResponseCode {
|
||||
|
||||
private final int responseCode;
|
||||
|
||||
public ResponseCode(RestHttpResponse response) {
|
||||
responseCode = response.getStatus();
|
||||
}
|
||||
|
||||
public int getResponseCode() {
|
||||
return responseCode;
|
||||
}
|
||||
|
||||
public boolean isSuccessful() {
|
||||
return responseCode >= 200 && responseCode < 300;
|
||||
}
|
||||
|
||||
}
|
@ -48,6 +48,7 @@ import org.mariotaku.twidere.api.twitter.model.PageableResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.Place;
|
||||
import org.mariotaku.twidere.api.twitter.model.QueryResult;
|
||||
import org.mariotaku.twidere.api.twitter.model.Relationship;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseCode;
|
||||
import org.mariotaku.twidere.api.twitter.model.ResponseList;
|
||||
import org.mariotaku.twidere.api.twitter.model.SavedSearch;
|
||||
import org.mariotaku.twidere.api.twitter.model.Status;
|
||||
@ -194,6 +195,8 @@ public class TwitterConverter implements Converter {
|
||||
} catch (ParseException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
} else if (ResponseCode.class.isAssignableFrom(cls)) {
|
||||
return new ResponseCode(response);
|
||||
}
|
||||
final Object object = parseOrThrow(response, stream, cls);
|
||||
checkResponse(cls, object, response);
|
||||
@ -226,7 +229,11 @@ public class TwitterConverter implements Converter {
|
||||
|
||||
private static <T> T parseOrThrow(RestHttpResponse resp, InputStream stream, Class<T> cls) throws IOException, TwitterException {
|
||||
try {
|
||||
return LoganSquare.parse(stream, cls);
|
||||
final T parse = LoganSquare.parse(stream, cls);
|
||||
if (TwitterException.class.isAssignableFrom(cls) && parse == null) {
|
||||
throw new TwitterException();
|
||||
}
|
||||
return parse;
|
||||
} catch (JsonParseException e) {
|
||||
throw new TwitterException("Malformed JSON Data", resp);
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ public interface IntentConstants {
|
||||
String EXTRA_MY_FOLLOWING_ONLY = "my_following_only";
|
||||
String EXTRA_CHANGED = "changed";
|
||||
String EXTRA_NOTIFY_CHANGE = "notify_change";
|
||||
String EXTRA_RESTART_ACTIVITY = "restart_activity";
|
||||
String EXTRA_FROM_USER = "from_user";
|
||||
String EXTRA_SHOW_MEDIA_PREVIEW = "show_media_preview";
|
||||
String EXTRA_SHOW_EXTRA_TYPE = "show_extra_type";
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package org.mariotaku.twidere.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -95,8 +96,14 @@ public class SettingsDetailsFragment extends BasePreferenceFragment implements S
|
||||
final Preference preference = findPreference(key);
|
||||
if (preference == null) return;
|
||||
final Bundle extras = preference.getExtras();
|
||||
if (extras != null && extras.containsKey(EXTRA_NOTIFY_CHANGE)) {
|
||||
SettingsActivity.setShouldNotifyChange(getActivity());
|
||||
if (extras != null) {
|
||||
final Activity activity = getActivity();
|
||||
if (extras.containsKey(EXTRA_NOTIFY_CHANGE)) {
|
||||
SettingsActivity.setShouldNotifyChange(activity);
|
||||
}
|
||||
if (extras.containsKey(EXTRA_RESTART_ACTIVITY)) {
|
||||
Utils.restartActivity(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ public class BackgroundOperationService extends IntentService implements Constan
|
||||
status.possiblySensitive(statusUpdate.is_possibly_sensitive);
|
||||
|
||||
if (twitter == null) {
|
||||
results.add(new SingleResponse<ParcelableStatus>(null, new NullPointerException()));
|
||||
results.add(SingleResponse.<ParcelableStatus>getInstance(new NullPointerException()));
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@ -588,7 +588,7 @@ public class BackgroundOperationService extends IntentService implements Constan
|
||||
}
|
||||
}
|
||||
final ParcelableStatus result = new ParcelableStatus(resultStatus, account.account_id, false);
|
||||
results.add(new SingleResponse<>(result, null));
|
||||
results.add(SingleResponse.getInstance(result));
|
||||
} catch (final TwitterException e) {
|
||||
final SingleResponse<ParcelableStatus> response = SingleResponse.getInstance(e);
|
||||
results.add(response);
|
||||
|
@ -113,6 +113,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
|
||||
profileImageView.setImageResource(R.mipmap.ic_launcher);
|
||||
nameView.setName(TWIDERE_PREVIEW_NAME);
|
||||
nameView.setScreenName("@" + TWIDERE_PREVIEW_SCREEN_NAME);
|
||||
nameView.updateText();
|
||||
if (adapter.getLinkHighlightingStyle() == VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE) {
|
||||
textView.setText(Html.fromHtml(TWIDERE_PREVIEW_TEXT_HTML));
|
||||
adapter.getTwidereLinkify().applyAllLinks(textView, -1, -1, false, adapter.getLinkHighlightingStyle());
|
||||
|
@ -82,10 +82,6 @@
|
||||
android:summaryOff="@string/read_from_bottom_summary_off"
|
||||
android:summaryOn="@string/read_from_bottom_summary_on"
|
||||
android:title="@string/read_from_bottom"/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="sort_timeline_by_id"
|
||||
android:title="@string/sort_timeline_by_id"/>
|
||||
|
||||
<org.mariotaku.twidere.preference.TrendsLocationPreference
|
||||
android:key="trends_location"
|
||||
|
@ -94,4 +94,8 @@
|
||||
android:key="leftside_compose_button"
|
||||
android:summary="@string/leftside_compose_button_summary"
|
||||
android:title="@string/leftside_compose_button" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="sort_timeline_by_id"
|
||||
android:title="@string/sort_timeline_by_id"/>
|
||||
</PreferenceScreen>
|
@ -4,14 +4,6 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/theme">
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="cat_theme_preview"
|
||||
android:order="11"
|
||||
android:title="@string/preview">
|
||||
<org.mariotaku.twidere.preference.ThemePreviewPreference
|
||||
android:key="theme_preview"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<org.mariotaku.twidere.preference.DarkLightThemeTogglePreference
|
||||
android:key="theme"
|
||||
android:order="21"
|
||||
@ -19,6 +11,9 @@
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
<extra
|
||||
android:name="restart_activity"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.DarkLightThemeTogglePreference>
|
||||
|
||||
<org.mariotaku.twidere.preference.ThemeBackgroundPreference
|
||||
@ -28,6 +23,9 @@
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
<extra
|
||||
android:name="restart_activity"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.ThemeBackgroundPreference>
|
||||
|
||||
<org.mariotaku.twidere.preference.ColorPickerPreference
|
||||
@ -38,6 +36,9 @@
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
<extra
|
||||
android:name="restart_activity"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.ColorPickerPreference>
|
||||
|
||||
<org.mariotaku.twidere.preference.ThemeFontFamilyPreference
|
||||
@ -45,10 +46,13 @@
|
||||
android:enabled="@bool/has_font_family"
|
||||
android:key="theme_font_family"
|
||||
android:order="24"
|
||||
android:title="@string/style">
|
||||
android:title="@string/font_family">
|
||||
<extra
|
||||
android:name="notify_change"
|
||||
android:value="true"/>
|
||||
<extra
|
||||
android:name="restart_activity"
|
||||
android:value="true"/>
|
||||
</org.mariotaku.twidere.preference.ThemeFontFamilyPreference>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user