improved card preview preference
This commit is contained in:
parent
76645a6ecd
commit
3998cb8e64
|
@ -215,7 +215,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.support.BrowserSignInActivity"
|
android:name=".activity.support.BrowserSignInActivity"
|
||||||
android:label="@string/browser_sign_in"
|
android:label="@string/browser_sign_in"
|
||||||
android:theme="@style/Theme.Twidere.Dark.Dialog"
|
android:theme="@style/Theme.Twidere.Dark"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="org.mariotaku.twidere.TWITTER_BROWSER_LOGIN"/>
|
<action android:name="org.mariotaku.twidere.TWITTER_BROWSER_LOGIN"/>
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package okhttp3;
|
|
||||||
|
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import okhttp3.internal.http.HttpEngine;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by mariotaku on 16/2/13.
|
|
||||||
*/
|
|
||||||
public class RealCallAccessor {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static HttpEngine getHttpEngine(Call call) {
|
|
||||||
if (call instanceof RealCall) {
|
|
||||||
return ((RealCall) call).engine;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -58,12 +58,10 @@ import static android.text.TextUtils.isEmpty;
|
||||||
import static org.mariotaku.twidere.util.Utils.getNonEmptyString;
|
import static org.mariotaku.twidere.util.Utils.getNonEmptyString;
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled")
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
public class BrowserSignInActivity extends BaseSupportDialogActivity {
|
public class BrowserSignInActivity extends BaseAppCompatActivity {
|
||||||
|
|
||||||
private static final String INJECT_CONTENT = "javascript:window.injector.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');";
|
private static final String INJECT_CONTENT = "javascript:window.injector.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');";
|
||||||
|
|
||||||
private SharedPreferences mPreferences;
|
|
||||||
|
|
||||||
private WebView mWebView;
|
private WebView mWebView;
|
||||||
private View mProgressContainer;
|
private View mProgressContainer;
|
||||||
|
|
||||||
|
@ -102,7 +100,6 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity {
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
||||||
setContentView(R.layout.activity_browser_sign_in);
|
setContentView(R.layout.activity_browser_sign_in);
|
||||||
mWebView.setWebViewClient(new AuthorizationWebViewClient(this));
|
mWebView.setWebViewClient(new AuthorizationWebViewClient(this));
|
||||||
mWebView.setVerticalScrollBarEnabled(false);
|
mWebView.setVerticalScrollBarEnabled(false);
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.mariotaku.twidere.adapter;
|
package org.mariotaku.twidere.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v7.widget.CardView;
|
|
||||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -42,13 +41,12 @@ public abstract class AbsUsersAdapter<D> extends LoadMoreSupportAdapter<ViewHold
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
|
|
||||||
private final int mCardBackgroundColor;
|
private final int mCardBackgroundColor;
|
||||||
private final boolean mCompactCards;
|
|
||||||
private final int mProfileImageStyle;
|
private final int mProfileImageStyle;
|
||||||
private final int mTextSize;
|
private final int mTextSize;
|
||||||
private final boolean mDisplayProfileImage;
|
private final boolean mDisplayProfileImage;
|
||||||
private final boolean mShowAbsoluteTime;
|
private final boolean mShowAbsoluteTime;
|
||||||
|
|
||||||
public AbsUsersAdapter(final Context context, final boolean compact) {
|
public AbsUsersAdapter(final Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
|
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
|
@ -56,7 +54,6 @@ public abstract class AbsUsersAdapter<D> extends LoadMoreSupportAdapter<ViewHold
|
||||||
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||||
mDisplayProfileImage = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE);
|
mDisplayProfileImage = mPreferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE);
|
||||||
mShowAbsoluteTime = mPreferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME);
|
mShowAbsoluteTime = mPreferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME);
|
||||||
mCompactCards = compact;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,15 +87,9 @@ public abstract class AbsUsersAdapter<D> extends LoadMoreSupportAdapter<ViewHold
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case ITEM_VIEW_TYPE_USER: {
|
case ITEM_VIEW_TYPE_USER: {
|
||||||
final View view;
|
final View view;
|
||||||
if (mCompactCards) {
|
view = mInflater.inflate(R.layout.card_item_user_compact, parent, false);
|
||||||
view = mInflater.inflate(R.layout.card_item_user_compact, parent, false);
|
final View itemContent = view.findViewById(R.id.item_content);
|
||||||
final View itemContent = view.findViewById(R.id.item_content);
|
itemContent.setBackgroundColor(mCardBackgroundColor);
|
||||||
itemContent.setBackgroundColor(mCardBackgroundColor);
|
|
||||||
} else {
|
|
||||||
view = mInflater.inflate(R.layout.card_item_user, parent, false);
|
|
||||||
final CardView cardView = (CardView) view.findViewById(R.id.card);
|
|
||||||
cardView.setCardBackgroundColor(mCardBackgroundColor);
|
|
||||||
}
|
|
||||||
final UserViewHolder holder = new UserViewHolder(this, view);
|
final UserViewHolder holder = new UserViewHolder(this, view);
|
||||||
holder.setOnClickListeners();
|
holder.setOnClickListeners();
|
||||||
holder.setupViewOptions();
|
holder.setupViewOptions();
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class ParcelableUsersAdapter extends AbsUsersAdapter<List<ParcelableUser>
|
||||||
private List<ParcelableUser> mData;
|
private List<ParcelableUser> mData;
|
||||||
|
|
||||||
|
|
||||||
public ParcelableUsersAdapter(Context context, boolean compact) {
|
public ParcelableUsersAdapter(Context context) {
|
||||||
super(context, compact);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -122,15 +122,16 @@ abstract class AbsUsersFragment<Data> extends AbsContentListRecyclerViewFragment
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ParcelableUser getSelectedUser() {
|
|
||||||
//TODO return selected
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract boolean hasMoreData(Data data);
|
protected abstract boolean hasMoreData(Data data);
|
||||||
|
|
||||||
protected abstract Loader<Data> onCreateUsersLoader(final Context context,
|
protected abstract Loader<Data> onCreateUsersLoader(final Context context,
|
||||||
@NonNull final Bundle args,
|
@NonNull final Bundle args,
|
||||||
final boolean fromUser);
|
final boolean fromUser);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupRecyclerView(Context context, boolean compact) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.adapter.AbsUsersAdapter;
|
||||||
import org.mariotaku.twidere.adapter.ParcelableUsersAdapter;
|
import org.mariotaku.twidere.adapter.ParcelableUsersAdapter;
|
||||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||||
import org.mariotaku.twidere.model.ParcelableUser;
|
import org.mariotaku.twidere.model.ParcelableUser;
|
||||||
|
@ -41,8 +42,8 @@ public abstract class ParcelableUsersFragment extends AbsUsersFragment<List<Parc
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
protected final ParcelableUsersAdapter onCreateAdapter(Context context, boolean compact) {
|
protected AbsUsersAdapter<List<ParcelableUser>> onCreateAdapter(Context context, boolean compact) {
|
||||||
return new ParcelableUsersAdapter(context, compact);
|
return new ParcelableUsersAdapter(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getAccountId() {
|
protected long getAccountId() {
|
||||||
|
|
|
@ -74,9 +74,9 @@ public class CardPreviewPreference extends Preference implements Constants, OnSh
|
||||||
|
|
||||||
protected void setLayoutResources(SharedPreferences preferences) {
|
protected void setLayoutResources(SharedPreferences preferences) {
|
||||||
if (preferences.getBoolean(KEY_COMPACT_CARDS, false)) {
|
if (preferences.getBoolean(KEY_COMPACT_CARDS, false)) {
|
||||||
setLayoutResource(R.layout.card_item_status_compact);
|
setLayoutResource(R.layout.layout_preferences_card_preview_compact);
|
||||||
} else {
|
} else {
|
||||||
setLayoutResource(R.layout.card_item_status);
|
setLayoutResource(R.layout.layout_preferences_card_preview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<include layout="@layout/card_item_status"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<include layout="@layout/card_item_status_compact"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
Loading…
Reference in New Issue