improving user profile ui

improved api editor
This commit is contained in:
Mariotaku Lee 2015-04-02 04:13:42 +08:00
parent fe5a6eb6c6
commit 5eb10fb836
17 changed files with 168 additions and 115 deletions

View File

@ -168,6 +168,7 @@ public interface IntentConstants {
public static final String EXTRA_ICON = "icon";
public static final String EXTRA_ID = "id";
public static final String EXTRA_RESID = "resid";
public static final String EXTRA_SETTINGS_INTENT_ACTION = "settings_intent_action";
public static final String EXTRA_IMAGE_URI = "image_uri";
public static final String EXTRA_ATTACHED_IMAGE_TYPE = "attached_image_type";
public static final String EXTRA_ACTIVATED_ONLY = "activated_only";

View File

@ -595,18 +595,10 @@
<service
android:name=".service.RefreshService"
android:label="@string/label_refresh_service"
android:settingsActivity=".activity.SettingsActivity"/>
android:label="@string/label_refresh_service"/>
<service
android:name=".service.BackgroundOperationService"
android:label="@string/label_background_operation_service"/>
<service
android:name="edu.ucdavis.earlybird.UCDService"
android:settingsActivity=".activity.support.UsageStatisticsActivity"/>
<!-- SPICE -->
<service
android:name="edu.tsinghua.spice.SpiceService"
android:settingsActivity=".activity.support.UsageStatisticsActivity"/>
<service
android:name=".service.DashClockHomeUnreadCountService"
android:icon="@drawable/ic_extension_twidere"
@ -722,6 +714,11 @@
android:scheme="android_secret_code"/>
</intent-filter>
</receiver>
<!-- Begin third Party components -->
<service
android:name="edu.ucdavis.earlybird.UCDService"/>
<receiver
android:name="edu.ucdavis.earlybird.UploadReceiver"
android:exported="false">
@ -732,7 +729,10 @@
<action android:name="edu.ucdavis.earlybird.UPLOAD_PROFILE"/>
</intent-filter>
</receiver>
<!-- SPICE -->
<service
android:name="edu.tsinghua.spice.SpiceService"/>
<receiver
android:name="edu.tsinghua.spice.SpiceUploadReceiver"
android:exported="false">
@ -744,6 +744,8 @@
</intent-filter>
</receiver>
<!-- Begin third Party components -->
</application>
</manifest>

View File

@ -19,11 +19,7 @@
package org.mariotaku.twidere.activity.support;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
@ -31,6 +27,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -38,9 +35,7 @@ import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.Toast;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.fragment.BaseDialogFragment;
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
import org.mariotaku.twidere.util.ThemeUtils;
import twitter4j.TwitterConstants;
@ -49,7 +44,7 @@ import static org.mariotaku.twidere.util.Utils.getNonEmptyString;
import static org.mariotaku.twidere.util.Utils.trim;
public class APIEditorActivity extends BaseSupportDialogActivity implements TwitterConstants, OnCheckedChangeListener,
OnClickListener {
OnClickListener, CompoundButton.OnCheckedChangeListener {
private EditText mEditAPIUrlFormat;
private CheckBox mEditSameOAuthSigningUrl, mEditNoVersionSuffix;
@ -58,6 +53,7 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
private RadioButton mButtonOAuth, mButtonxAuth, mButtonBasic, mButtonTwipOMode;
private Button mSaveButton;
private View mAPIFormatHelpButton;
private boolean mEditNoVersionSuffixChanged;
@Override
public void onCheckedChanged(final RadioGroup group, final int checkedId) {
@ -66,6 +62,14 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
mEditSameOAuthSigningUrl.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerKey.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerSecret.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
if (!mEditNoVersionSuffixChanged) {
mEditNoVersionSuffix.setChecked(authType == Accounts.AUTH_TYPE_TWIP_O_MODE);
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditNoVersionSuffixChanged = true;
}
@Override
@ -73,12 +77,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
switch (v.getId()) {
case R.id.save: {
if (checkUrlErrors()) return;
final String apiUrlFormat = parseString(mEditAPIUrlFormat.getText());
final int authType = getCheckedAuthType(mEditAuthType.getCheckedRadioButtonId());
if (authType == Accounts.AUTH_TYPE_TWIP_O_MODE && !apiUrlFormat.endsWith("/1.1/")) {
new TWIPNoticeDialogFragment().show(getFragmentManager(), "twip_o_mode_bug_notice");
return;
}
saveAndFinish();
break;
}
@ -179,6 +177,7 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
}
mEditAuthType.setOnCheckedChangeListener(this);
mEditNoVersionSuffix.setOnCheckedChangeListener(this);
mSaveButton.setOnClickListener(this);
mAPIFormatHelpButton.setOnClickListener(this);
@ -218,33 +217,4 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
}
}
}
public static class TWIPNoticeDialogFragment extends BaseDialogFragment implements DialogInterface.OnClickListener {
@Override
public void onClick(final DialogInterface dialog, final int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE: {
final Activity a = getActivity();
if (a instanceof APIEditorActivity) {
((APIEditorActivity) a).saveAndFinish();
}
break;
}
}
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Context wrapped = ThemeUtils.getThemedContext(getActivity());
final AlertDialog.Builder builder = new AlertDialog.Builder(wrapped);
builder.setTitle(android.R.string.dialog_alert_title);
builder.setMessage(R.string.twip_api_version_notice_message);
builder.setPositiveButton(R.string.save, this);
builder.setNegativeButton(android.R.string.cancel, this);
return builder.create();
}
}
}

View File

@ -43,6 +43,7 @@ import org.mariotaku.twidere.fragment.iface.IBaseFragment.SystemWindowsInsetsCal
import org.mariotaku.twidere.fragment.iface.IBasePullToRefreshFragment;
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface;
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback;
import org.mariotaku.twidere.fragment.support.SearchFragment;
import org.mariotaku.twidere.util.MultiSelectEventHandler;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
@ -394,6 +395,8 @@ public class LinkHandlerActivity extends BaseActionBarActivity implements OnClic
@Override
public void setControlBarVisibleAnimate(boolean visible) {
// Currently only search page needs this pattern, so we only enable this feature for it.
if (!(getCurrentVisibleFragment() instanceof SearchFragment)) return;
mControlBarShowHideHelper.setControlBarVisibleAnimate(visible);
}

View File

@ -33,6 +33,9 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.ActionBar;
import android.text.Editable;
import android.text.TextWatcher;
@ -50,6 +53,7 @@ import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.app.TwidereApplication;
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
import org.mariotaku.twidere.fragment.support.SupportProgressDialogFragment;
import org.mariotaku.twidere.provider.TwidereDataStore.Accounts;
import org.mariotaku.twidere.util.AsyncTaskUtils;
import org.mariotaku.twidere.util.ContentValuesCreator;
@ -90,6 +94,7 @@ public class SignInActivity extends BaseActionBarActivity implements TwitterCons
private static final String TWITTER_SIGNUP_URL = "https://twitter.com/signup";
private static final String EXTRA_API_LAST_CHANGE = "api_last_change";
public static final String FRAGMENT_TAG_SIGN_IN_PROGRESS = "sign_in_progress";
private String mAPIUrlFormat;
private int mAuthType;
@ -436,6 +441,11 @@ public class SignInActivity extends BaseActionBarActivity implements TwitterCons
}
void onSignInResult(final SignInResponse result) {
final FragmentManager fm = getSupportFragmentManager();
final Fragment f = fm.findFragmentByTag(FRAGMENT_TAG_SIGN_IN_PROGRESS);
if (f instanceof DialogFragment) {
((DialogFragment) f).dismiss();
}
if (result != null) {
if (result.succeed) {
final ContentValues values;
@ -487,20 +497,12 @@ public class SignInActivity extends BaseActionBarActivity implements TwitterCons
}
}
}
setSupportProgressBarIndeterminateVisibility(false);
mEditPassword.setEnabled(true);
mEditUsername.setEnabled(true);
mSignInButton.setEnabled(true);
mSignUpButton.setEnabled(true);
setSignInButton();
}
void onSignInStart() {
setSupportProgressBarIndeterminateVisibility(true);
mEditPassword.setEnabled(false);
mEditUsername.setEnabled(false);
mSignInButton.setEnabled(false);
mSignUpButton.setEnabled(false);
final SupportProgressDialogFragment fragment = SupportProgressDialogFragment.show(this, FRAGMENT_TAG_SIGN_IN_PROGRESS);
fragment.setCancelable(false);
}
public static abstract class AbstractSignInTask extends AsyncTask<Void, Void, SignInResponse> {

View File

@ -57,16 +57,18 @@ public class SettingsDetailsFragment extends BasePreferenceFragment {
addPreferencesFromResource(resId);
}
final Context context = preferenceScreen.getContext();
final Intent hiddenEntryIntent = new Intent(INTENT_ACTION_HIDDEN_SETTINGS_ENTRY);
final PackageManager pm = context.getPackageManager();
for (ResolveInfo info : pm.queryIntentActivities(hiddenEntryIntent, PackageManager.MATCH_DEFAULT_ONLY)) {
final Preference preference = new Preference(context);
final Intent intent = new Intent(INTENT_ACTION_HIDDEN_SETTINGS_ENTRY);
intent.setPackage(info.resolvePackageName);
intent.setClassName(info.activityInfo.packageName, info.activityInfo.name);
preference.setIntent(intent);
preference.setTitle(info.loadLabel(pm));
preferenceScreen.addPreference(preference);
if (args.containsKey(EXTRA_SETTINGS_INTENT_ACTION)) {
final Intent hiddenEntryIntent = new Intent(args.getString(EXTRA_SETTINGS_INTENT_ACTION));
final PackageManager pm = context.getPackageManager();
for (ResolveInfo info : pm.queryIntentActivities(hiddenEntryIntent, PackageManager.MATCH_DEFAULT_ONLY)) {
final Preference preference = new Preference(context);
final Intent intent = new Intent(hiddenEntryIntent);
intent.setPackage(info.resolvePackageName);
intent.setClassName(info.activityInfo.packageName, info.activityInfo.name);
preference.setIntent(intent);
preference.setTitle(info.loadLabel(pm));
preferenceScreen.addPreference(preference);
}
}
}

View File

@ -107,6 +107,7 @@ import org.mariotaku.twidere.provider.TwidereDataStore.CachedUsers;
import org.mariotaku.twidere.provider.TwidereDataStore.Filters;
import org.mariotaku.twidere.text.TextAlphaSpan;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.ColorUtils;
import org.mariotaku.twidere.util.ContentValuesCreator;
import org.mariotaku.twidere.util.LinkCreator;
import org.mariotaku.twidere.util.MathUtils;
@ -117,17 +118,18 @@ import org.mariotaku.twidere.util.TwidereLinkify;
import org.mariotaku.twidere.util.TwidereLinkify.OnLinkClickListener;
import org.mariotaku.twidere.util.UserColorNameUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.accessor.ViewAccessor;
import org.mariotaku.twidere.util.menu.TwidereMenuInfo;
import org.mariotaku.twidere.util.message.FriendshipUpdatedEvent;
import org.mariotaku.twidere.util.message.ProfileUpdatedEvent;
import org.mariotaku.twidere.util.message.TaskStateChangedEvent;
import org.mariotaku.twidere.view.ColorLabelRelativeLayout;
import org.mariotaku.twidere.view.HeaderDrawerLayout;
import org.mariotaku.twidere.view.HeaderDrawerLayout.DrawerCallback;
import org.mariotaku.twidere.view.ProfileBannerImageView;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.TabPagerIndicator;
import org.mariotaku.twidere.view.TintedStatusFrameLayout;
import org.mariotaku.twidere.view.iface.IColorLabelView;
import org.mariotaku.twidere.view.iface.IExtendedView.OnSizeChangedListener;
import java.util.List;
@ -185,7 +187,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private View mDescriptionContainer, mLocationContainer, mURLContainer, mListedContainer, mFollowersContainer,
mFriendsContainer;
private Button mRetryButton;
private IColorLabelView mProfileNameContainer;
private ColorLabelRelativeLayout mProfileNameContainer;
private View mProgressContainer, mErrorRetryContainer;
private View mCardContent;
private View mProfileBannerSpace;
@ -201,6 +203,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private View mPagesContent, mPagesErrorContainer;
private ImageView mPagesErrorIcon;
private TextView mPagesErrorText;
private View mProfileNameBackground;
private View mProfileDetailsContainer;
private SupportTabsAdapter mPagerAdapter;
@ -725,10 +729,13 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mProfileBannerSpace.setOnTouchListener(this);
mCardView.setCardBackgroundColor(ThemeUtils.getCardBackgroundColor(getActivity()));
mCardView.setCardBackgroundColor(ThemeUtils.getCardBackgroundColor(activity));
getUserInfo(accountId, userId, screenName, false);
final float actionBarElevation = ThemeUtils.getActionBarElevation(activity);
ViewCompat.setElevation(mPagerIndicator, actionBarElevation);
setupBaseActionBar();
setupUserPages();
@ -1135,7 +1142,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mFollowersCount = (TextView) headerView.findViewById(R.id.followers_count);
mFriendsContainer = headerView.findViewById(R.id.friends_container);
mFriendsCount = (TextView) headerView.findViewById(R.id.friends_count);
mProfileNameContainer = (IColorLabelView) headerView.findViewById(R.id.profile_name_container);
mProfileNameContainer = (ColorLabelRelativeLayout) headerView.findViewById(R.id.profile_name_container);
mProfileImageView = (ShapedImageView) headerView.findViewById(R.id.profile_image);
mProfileTypeView = (ImageView) headerView.findViewById(R.id.profile_type);
mDescriptionContainer = headerView.findViewById(R.id.description_container);
@ -1151,6 +1158,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mPagesErrorContainer = view.findViewById(R.id.pages_error_container);
mPagesErrorIcon = (ImageView) view.findViewById(R.id.pages_error_icon);
mPagesErrorText = (TextView) view.findViewById(R.id.pages_error_text);
mProfileNameBackground = view.findViewById(R.id.profile_name_background);
mProfileDetailsContainer = view.findViewById(R.id.profile_details_container);
}
@Override
@ -1255,11 +1264,23 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
setupBaseActionBar();
}
mActionBarBackground.setColor(color);
mTintedStatusContent.setColor(color, ThemeUtils.getThemeAlpha(getActivity()));
mPagerIndicator.setStripColor(color);
final FragmentActivity activity = getActivity();
mTintedStatusContent.setColor(color, ThemeUtils.getThemeAlpha(activity));
mDescriptionView.setLinkTextColor(color);
mProfileBannerView.setBackgroundColor(color);
mLocationView.setLinkTextColor(color);
mURLView.setLinkTextColor(color);
if (activity instanceof IThemedActivity) {
final int themeRes = ((IThemedActivity) activity).getCurrentThemeResourceId();
if (ThemeUtils.isDarkTheme(themeRes)) {
ViewAccessor.setBackground(mPagerIndicator, ThemeUtils.getActionBarBackground(activity, themeRes));
mPagerIndicator.setStripColor(color);
} else {
mPagerIndicator.setBackgroundColor(color);
}
} else {
mPagerIndicator.setBackgroundColor(color);
}
}
private void setupUserPages() {
@ -1300,6 +1321,24 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
if (mActionBarBackground != null && mTintedStatusContent != null) {
mActionBarBackground.setFactor(factor);
mTintedStatusContent.setFactor(factor);
final float profileContentHeight = mProfileNameContainer.getHeight() + mProfileDetailsContainer.getHeight();
final float outlineAlphaFactor;
if ((offset - spaceHeight) > 0) {
outlineAlphaFactor = 1f - MathUtils.clamp((offset - spaceHeight) / profileContentHeight, 0, 1);
} else {
outlineAlphaFactor = 1f;
}
mActionBarBackground.setOutlineAlphaFactor(outlineAlphaFactor);
final Drawable drawable = mPagerIndicator.getBackground();
if (drawable != null) {
drawable.setAlpha(Math.round(255 * (1 - outlineAlphaFactor)));
}
final int color = mActionBarBackground.getColor();
final int contrastColor = ColorUtils.getContrastYIQ(color, 192);
mPagerIndicator.setIconColor(contrastColor);
mPagerIndicator.setLabelColor(contrastColor);
mPagerIndicator.setStripColor(contrastColor);
}
updateTitleColor();
}
@ -1369,24 +1408,29 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private final Drawable mShadowDrawable;
private final Drawable mBackgroundDrawable;
private final LineBackgroundDrawable mLineDrawable;
// private final LineBackgroundDrawable mLineDrawable;
private final ColorDrawable mColorDrawable;
private final boolean mColorLineOnly;
private float mFactor;
private int mColor;
private int mAlpha;
private float mOutlineAlphaFactor;
public ActionBarDrawable(Resources resources, Drawable shadow, Drawable background,
boolean colorLineOnly) {
super(new Drawable[]{shadow, background, new LineBackgroundDrawable(resources, 2.0f),
new ActionBarColorDrawable(true)});
super(new Drawable[]{shadow, background, new ActionBarColorDrawable(true)});
mShadowDrawable = getDrawable(0);
mBackgroundDrawable = getDrawable(1);
mLineDrawable = (LineBackgroundDrawable) getDrawable(2);
mColorDrawable = (ColorDrawable) getDrawable(3);
// mLineDrawable = (LineBackgroundDrawable) getDrawable(2);
mColorDrawable = (ColorDrawable) getDrawable(2);
mColorLineOnly = colorLineOnly;
setAlpha(0xFF);
setOutlineAlphaFactor(1);
}
public int getColor() {
return mColor;
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@ -1398,7 +1442,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
} else {
mBackgroundDrawable.getOutline(outline);
}
outline.setAlpha(mFactor * 0.99f);
outline.setAlpha(mFactor * mOutlineAlphaFactor * 0.99f);
}
@Override
@ -1407,6 +1451,11 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
setFactor(mFactor);
}
public void setOutlineAlphaFactor(float f) {
mOutlineAlphaFactor = f;
invalidateSelf();
}
@Override
public int getIntrinsicWidth() {
final boolean showColor = !mColorLineOnly && mColor != 0;
@ -1430,7 +1479,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
public void setColor(int color) {
mColor = color;
mColorDrawable.setColor(color);
mLineDrawable.setColor(color);
// mLineDrawable.setColor(color);
setFactor(mFactor);
}
@ -1442,7 +1491,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
final boolean showLine = mColorLineOnly && hasColor;
final boolean showColor = !mColorLineOnly && hasColor;
mBackgroundDrawable.setAlpha(showBackground ? Math.round(mAlpha * MathUtils.clamp(f, 0, 1)) : 0);
mLineDrawable.setAlpha(showLine ? Math.round(mAlpha * MathUtils.clamp(f, 0, 1)) : 0);
// mLineDrawable.setAlpha(showLine ? Math.round(mAlpha * MathUtils.clamp(f, 0, 1)) : 0);
mColorDrawable.setAlpha(showColor ? Math.round(mAlpha * MathUtils.clamp(f, 0, 1)) : 0);
}

View File

@ -29,6 +29,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
@ -47,7 +48,7 @@ import static org.mariotaku.twidere.util.Utils.getNonEmptyString;
import static org.mariotaku.twidere.util.Utils.trim;
public class DefaultAPIPreference extends DialogPreference implements Constants, TwitterConstants,
OnCheckedChangeListener, OnClickListener {
OnCheckedChangeListener, OnClickListener, CompoundButton.OnCheckedChangeListener {
private EditText mEditAPIUrlFormat;
private CheckBox mEditSameOAuthSigningUrl, mEditNoVersionSuffix;
@ -55,6 +56,7 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
private RadioGroup mEditAuthType;
private RadioButton mButtonOAuth, mButtonxAuth, mButtonBasic, mButtonTwipOMode;
private View mAPIFormatHelpButton;
private boolean mEditNoVersionSuffixChanged;
public DefaultAPIPreference(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.preferenceStyle);
@ -73,6 +75,14 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
mEditSameOAuthSigningUrl.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerKey.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerSecret.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
if (!mEditNoVersionSuffixChanged) {
mEditNoVersionSuffix.setChecked(authType == Accounts.AUTH_TYPE_TWIP_O_MODE);
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mEditNoVersionSuffixChanged = true;
}
@Override
@ -112,6 +122,7 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
mEditConsumerSecret = (EditText) view.findViewById(R.id.consumer_secret);
mAPIFormatHelpButton = view.findViewById(R.id.api_url_format_help);
mEditNoVersionSuffix.setOnCheckedChangeListener(this);
mEditAuthType.setOnCheckedChangeListener(this);
mAPIFormatHelpButton.setOnClickListener(this);

View File

@ -24,7 +24,6 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import org.mariotaku.twidere.BuildConfig;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.constant.IntentConstants;
@ -39,10 +38,7 @@ public class SecretCodeBroadcastReceiver extends BroadcastReceiver implements In
final String title = context.getString(R.string.hidden_settings);
final Bundle args = new Bundle();
args.putInt(EXTRA_RESID, R.xml.preferences_hidden);
final Intent hiddenEntryIntent = new Intent(INTENT_ACTION_HIDDEN_SETTINGS_ENTRY);
hiddenEntryIntent.setPackage(BuildConfig.APPLICATION_ID);
hiddenEntryIntent.addCategory(Intent.CATEGORY_DEFAULT);
args.putParcelable(EXTRA_INTENT, hiddenEntryIntent);
args.putString(EXTRA_SETTINGS_INTENT_ACTION, INTENT_ACTION_HIDDEN_SETTINGS_ENTRY);
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, cls);
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
testIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, title);

View File

@ -58,6 +58,7 @@ public class HeaderDrawerLayout extends ViewGroup {
private boolean mTouchDown, mTouchingScrollableContent;
private int mHeaderOffset;
private int mTop;
public HeaderDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
@ -249,8 +250,10 @@ public class HeaderDrawerLayout extends ViewGroup {
private void notifyOffsetChanged() {
final int top = getHeaderTop();
if (mTop == top) return;
mHeaderOffset = top - getPaddingTop();
mDrawerCallback.topChanged(top);
mTop = top;
}
private void offsetHeaderBy(int dy) {

View File

@ -33,25 +33,25 @@ import static org.mariotaku.twidere.util.Utils.isRTL;
public interface IColorLabelView {
public static final float LABEL_WIDTH = 3.5f;
float LABEL_WIDTH = 3.5f;
public void drawBackground(final int color);
void drawBackground(final int color);
public void drawBottom(final int... colors);
void drawBottom(final int... colors);
public void drawEnd(final int... colors);
void drawEnd(final int... colors);
public void drawLabel(final int[] start, final int[] end, int[] top, int[] bottom, final int background);
void drawLabel(final int[] start, final int[] end, int[] top, int[] bottom, final int background);
public void drawStart(final int... colors);
void drawStart(final int... colors);
public void drawTop(final int... colors);
void drawTop(final int... colors);
public boolean isPaddingsIgnored();
boolean isPaddingsIgnored();
public void setIgnorePaddings(final boolean ignorePaddings);
void setIgnorePaddings(final boolean ignorePaddings);
public void setVisibility(int visibility);
void setVisibility(int visibility);
public static final class Helper {

View File

@ -20,6 +20,7 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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">
@ -39,13 +40,14 @@
android:id="@+id/view_pager_tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/element_size_normal"
android:textColor="?android:textColorSecondary"
android:outlineProvider="background"
android:textColor="?android:textColorSecondary"
app:tabDividerVerticalPadding="@dimen/element_spacing_mlarge"
app:tabExpandEnabled="true"
app:tabHorizontalPadding="@dimen/element_spacing_large"
app:tabIconColor="?android:colorForeground"
app:tabShowDivider="true"/>
app:tabShowDivider="true"
tools:ignore="UnusedAttribute"/>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
@ -59,8 +61,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="@dimen/element_spacing_large"
android:orientation="vertical"
android:padding="@dimen/element_spacing_large"
android:visibility="gone">
<org.mariotaku.twidere.view.ActionIconView

View File

@ -22,6 +22,7 @@
android:id="@+id/header_user_profile"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -30,13 +31,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<View
android:id="@+id/profile_name_background"
android:layout_width="match_parent"
android:layout_alignTop="@+id/profile_name_container"
android:layout_alignBottom="@+id/profile_name_container"
android:layout_height="wrap_content"/>
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
android:id="@+id/profile_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profile_banner_space"
android:layout_toRightOf="@id/profile_image"
android:background="?android:selectableItemBackground"
android:orientation="vertical"
android:paddingBottom="@dimen/element_spacing_xsmall"
android:paddingLeft="@dimen/element_spacing_small"
@ -85,7 +92,8 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="?android:textColorPrimary"/>
android:textColor="?android:textColorPrimary"
tools:text="Name"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/screen_name"
@ -93,7 +101,8 @@
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
android:textColor="?android:textColorPrimary"
tools:text="\@screenname"/>
</LinearLayout>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
@ -101,21 +110,21 @@
<View
android:layout_width="match_parent"
android:layout_height="@dimen/element_spacing_xsmall"
android:layout_above="@id/profile_name_container"
android:layout_above="@+id/profile_name_container"
android:background="@drawable/shadow_top"/>
<FrameLayout
android:id="@+id/profile_details_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profile_name_container"/>
android:layout_below="@+id/profile_name_container"/>
<org.mariotaku.twidere.view.ShapedImageView
android:id="@+id/profile_image"
style="?profileImageStyleLarge"
android:layout_width="@dimen/icon_size_user_profile"
android:layout_height="@dimen/icon_size_user_profile"
android:layout_alignBottom="@id/profile_name_container"
android:layout_alignBottom="@+id/profile_name_container"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:contentDescription="@string/profile_image"/>
@ -124,11 +133,12 @@
style="@style/Widget.ProfileType"
android:layout_width="@dimen/icon_size_profile_type_user_profile"
android:layout_height="@dimen/icon_size_profile_type_user_profile"
android:layout_marginRight="@dimen/element_spacing_minus_msmall"
android:layout_marginBottom="@dimen/element_spacing_minus_msmall"
android:layout_alignBottom="@id/profile_image"
android:layout_alignRight="@id/profile_image"
android:scaleType="fitCenter"/>
android:layout_marginBottom="@dimen/element_spacing_minus_msmall"
android:layout_marginRight="@dimen/element_spacing_minus_msmall"
android:scaleType="fitCenter"
tools:visibility="gone"/>
<org.mariotaku.twidere.view.AssetFontTextView
android:id="@+id/uucky_footer"
@ -146,5 +156,4 @@
android:visibility="gone"
app:fontPath="fonts/LibreBaskerville-Italic.ttf"/>
</RelativeLayout>

View File

@ -26,6 +26,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:focusable="true"
android:focusableInTouchMode="false"
android:minHeight="?android:listPreferredItemHeight"
android:orientation="horizontal"
android:paddingLeft="@dimen/element_spacing_normal"

View File

@ -4,6 +4,7 @@
<color name="nyan_background">#003366</color>
<color name="background_color_window_light">#e3e3e3</color>
<color name="background_color_window_dark">#101010</color>
<color name="background_color_window_settings_wizard">#fafafa</color>
<color name="bg_refresh_progress_color_light">#f5f5f5</color>
<color name="bg_refresh_progress_color_dark">#333333</color>
<color name="bg_color_transparent_dark">#ff000000</color>

View File

@ -589,7 +589,6 @@
<string name="tab_display_option_label">Label</string>
<string name="tab_display_option_icon_and_label">Icon and label</string>
<string name="highlight_and_underline">Highlight and underline</string>
<string name="twip_api_version_notice_message">TWIP can\'t handle Rest Base URL that doesn\'t end with \"/1.1/\" correctly.\n\n You may need to add \"/1.1/\" at the end of Rest Base URL to avoid issues when uploading images.</string>
<string name="back">Back</string>
<string name="theme_font_family">Theme font family</string>
<string name="translation_destination">Translation destination</string>

View File

@ -372,6 +372,7 @@
<style name="Theme.Twidere.Wizard" parent="Theme.Twidere.Settings.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@color/background_color_window_settings_wizard</item>
<item name="android:colorActivatedHighlight">@color/branding_color</item>
</style>