mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-12 09:40:50 +01:00
fixed account spinner
added hide possibility sensitive tweet improved favorite tab title
This commit is contained in:
parent
a8edf99d74
commit
4255891a35
@ -593,5 +593,9 @@ public class ParcelableStatus implements Parcelable, Comparable<ParcelableStatus
|
||||
* You were blocked by original author of a quote/retweet
|
||||
*/
|
||||
long BLOCKED_BY_USER = 0x4;
|
||||
/**
|
||||
* Status possibility sensitive (NSFW etc)
|
||||
*/
|
||||
long POSSIBILITY_SENSITIVE = 0x8;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.mariotaku.twidere.model.tab.impl;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -14,18 +15,41 @@ import org.mariotaku.twidere.model.tab.StringHolder;
|
||||
import org.mariotaku.twidere.model.tab.TabConfiguration;
|
||||
import org.mariotaku.twidere.model.tab.argument.UserArguments;
|
||||
import org.mariotaku.twidere.model.tab.conf.UserExtraConfiguration;
|
||||
import org.mariotaku.twidere.util.dagger.DependencyHolder;
|
||||
|
||||
import static org.mariotaku.twidere.constant.IntentConstants.EXTRA_USER;
|
||||
import static org.mariotaku.twidere.constant.SharedPreferenceConstants.KEY_I_WANT_MY_STARS_BACK;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2016/11/27.
|
||||
*/
|
||||
|
||||
public class FavoriteTimelineTabConfiguration extends TabConfiguration {
|
||||
final static StringHolder TAB_NAME = new StringHolder() {
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createString(Context context) {
|
||||
if (DependencyHolder.Companion.get(context).preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK)) {
|
||||
return context.getString(R.string.title_favorites);
|
||||
}
|
||||
return context.getString(R.string.title_likes);
|
||||
}
|
||||
};
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public StringHolder getName() {
|
||||
return StringHolder.resource(R.string.title_favorites);
|
||||
return TAB_NAME;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -22,8 +22,7 @@ package org.mariotaku.twidere.adapter
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import kotlinx.android.synthetic.main.list_item_simple_user.view.*
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
@ -70,9 +69,9 @@ class AccountsSpinnerAdapter(
|
||||
}
|
||||
|
||||
private fun bindView(view: View, item: AccountDetails) {
|
||||
val text1 = view.findViewById(android.R.id.text1) as TextView?
|
||||
val text2 = view.findViewById(android.R.id.text2) as TextView?
|
||||
val icon = view.findViewById(android.R.id.icon) as ImageView?
|
||||
val text1 = view.name
|
||||
val text2 = view.screenName
|
||||
val icon = view.profileImage
|
||||
if (!item.dummy) {
|
||||
if (text1 != null) {
|
||||
text1.visibility = View.VISIBLE
|
||||
|
@ -52,6 +52,7 @@ val fabVisibleKey = KBooleanKey(KEY_FAB_VISIBLE, true)
|
||||
val themeKey = KStringKey(KEY_THEME, VALUE_THEME_NAME_LIGHT)
|
||||
val themeColorKey = KIntKey(KEY_THEME_COLOR, 0)
|
||||
val filterUnavailableQuoteStatusesKey = KBooleanKey("filter_unavailable_quote_statuses", false)
|
||||
val filterPossibilitySensitiveStatusesKey = KBooleanKey("filter_possibility_sensitive_statuses", false)
|
||||
|
||||
object profileImageStyleKey : KSimpleKey<Int>(KEY_PROFILE_IMAGE_STYLE, ProfileImageView.SHAPE_CIRCLE) {
|
||||
override fun read(preferences: SharedPreferences): Int {
|
||||
|
@ -61,13 +61,19 @@ object ParcelableStatusUtils {
|
||||
result.extras.retweeted_external_url = retweetedStatus.inferExternalUrl()
|
||||
|
||||
if (retweetUser.isBlocking) {
|
||||
result.filter_flags = result.filter_flags or FilterFlags.BLOCKING_USER
|
||||
result.addFilterFlag(FilterFlags.BLOCKING_USER)
|
||||
}
|
||||
if (retweetUser.isBlockedBy) {
|
||||
result.filter_flags = result.filter_flags or FilterFlags.BLOCKED_BY_USER
|
||||
result.addFilterFlag(FilterFlags.BLOCKED_BY_USER)
|
||||
}
|
||||
if (retweetedStatus.isPossiblySensitive) {
|
||||
result.addFilterFlag(FilterFlags.POSSIBILITY_SENSITIVE)
|
||||
}
|
||||
} else {
|
||||
status = orig
|
||||
if (status.isPossiblySensitive) {
|
||||
result.addFilterFlag(FilterFlags.POSSIBILITY_SENSITIVE)
|
||||
}
|
||||
}
|
||||
|
||||
val quoted = status.quotedStatus
|
||||
@ -104,8 +110,12 @@ object ParcelableStatusUtils {
|
||||
result.quoted_user_profile_image = TwitterContentUtils.getProfileImageUrl(quotedUser)
|
||||
result.quoted_user_is_protected = quotedUser.isProtected
|
||||
result.quoted_user_is_verified = quotedUser.isVerified
|
||||
|
||||
if (quoted.isPossiblySensitive) {
|
||||
result.addFilterFlag(FilterFlags.POSSIBILITY_SENSITIVE)
|
||||
}
|
||||
} else if (status.isQuoteStatus) {
|
||||
result.filter_flags = result.filter_flags or FilterFlags.QUOTE_NOT_AVAILABLE
|
||||
result.addFilterFlag(FilterFlags.QUOTE_NOT_AVAILABLE)
|
||||
}
|
||||
|
||||
result.reply_count = status.replyCount
|
||||
@ -165,6 +175,10 @@ object ParcelableStatusUtils {
|
||||
return result
|
||||
}
|
||||
|
||||
private fun ParcelableStatus.addFilterFlag(@FilterFlags flags: Long) {
|
||||
filter_flags = filter_flags or flags
|
||||
}
|
||||
|
||||
private fun getSpanItems(html: CharSequence): Array<SpanItem>? {
|
||||
if (html !is Spanned) return null
|
||||
val spans = html.getSpans(0, html.length, URLSpan::class.java)
|
||||
|
@ -3,6 +3,7 @@ package org.mariotaku.twidere.util
|
||||
import android.content.SharedPreferences
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.sqliteqb.library.*
|
||||
import org.mariotaku.twidere.constant.filterPossibilitySensitiveStatusesKey
|
||||
import org.mariotaku.twidere.constant.filterUnavailableQuoteStatusesKey
|
||||
import org.mariotaku.twidere.model.ParcelableStatus.FilterFlags
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Filters
|
||||
@ -59,6 +60,9 @@ fun buildStatusFilterWhereClause(preferences: SharedPreferences,
|
||||
if (preferences[filterUnavailableQuoteStatusesKey]) {
|
||||
filterFlags = filterFlags or FilterFlags.QUOTE_NOT_AVAILABLE
|
||||
}
|
||||
if (preferences[filterPossibilitySensitiveStatusesKey]) {
|
||||
filterFlags = filterFlags or FilterFlags.POSSIBILITY_SENSITIVE
|
||||
}
|
||||
|
||||
val filterExpression = Expression.or(
|
||||
Expression.and(
|
||||
|
@ -868,4 +868,5 @@
|
||||
<string name="action_invert_selection">Invert selection</string>
|
||||
<string name="message_no_user_selected">No user selected</string>
|
||||
<string name="preference_title_advanced">Advanced</string>
|
||||
<string name="preference_filter_possibility_sensitive_statuses">Filter sensitive tweets</string>
|
||||
</resources>
|
@ -4,4 +4,8 @@
|
||||
android:defaultValue="false"
|
||||
android:key="filter_unavailable_quote_statuses"
|
||||
android:title="@string/preference_filter_unavailable_quote_statuses"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="filter_possibility_sensitive_statuses"
|
||||
android:title="@string/preference_filter_possibility_sensitive_statuses"/>
|
||||
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user