fixing theme

This commit is contained in:
Mariotaku Lee 2015-01-19 00:15:38 +08:00
parent 2200678565
commit 450818eff2
51 changed files with 929 additions and 572 deletions

View File

@ -65,6 +65,7 @@ dependencies {
compile 'dnsjava:dnsjava:2.1.6'
compile 'com.commonsware.cwac:merge:1.1.1'
compile 'com.diegocarloslima:byakugallery:0.1.0'
compile 'com.rengwuxian.materialedittext:library:1.8.2'
googleCompile 'com.google.android.gms:play-services:6.5.87'
googleCompile 'com.google.maps.android:android-maps-utils:0.3.4'
fdroidCompile 'org.osmdroid:osmdroid-android:4.3'

View File

@ -35,7 +35,6 @@ import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import org.mariotaku.twidere.R;
@ -57,9 +56,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
private EditText mEditConsumerKey, mEditConsumerSecret;
private RadioGroup mEditAuthType;
private RadioButton mButtonOAuth, mButtonxAuth, mButtonBasic, mButtonTwipOMode;
private TextView mAdvancedAPIConfigLabel;
private View mAdvancedAPIConfigContainer;
private View mAdvancedAPIConfigView;
private Button mSaveButton;
private View mAPIFormatHelpButton;
@ -67,7 +63,9 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
public void onCheckedChanged(final RadioGroup group, final int checkedId) {
final int authType = getCheckedAuthType(checkedId);
final boolean isOAuth = authType == Accounts.AUTH_TYPE_OAUTH || authType == Accounts.AUTH_TYPE_XAUTH;
mAdvancedAPIConfigContainer.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditSameOAuthSigningUrl.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerKey.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerSecret.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
}
@Override
@ -84,13 +82,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
saveAndFinish();
break;
}
case R.id.advanced_api_config_label: {
final boolean isVisible = mAdvancedAPIConfigView.isShown();
final int compoundRes = isVisible ? R.drawable.expander_close_holo : R.drawable.expander_open_holo;
mAdvancedAPIConfigLabel.setCompoundDrawablesWithIntrinsicBounds(compoundRes, 0, 0, 0);
mAdvancedAPIConfigView.setVisibility(isVisible ? View.GONE : View.VISIBLE);
break;
}
case R.id.api_url_format_help: {
Toast.makeText(this, R.string.api_url_format_help, Toast.LENGTH_LONG).show();
break;
@ -99,17 +90,14 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mEditAPIUrlFormat = (EditText) findViewById(R.id.api_url_format);
mEditAuthType = (RadioGroup) findViewById(R.id.auth_type);
mButtonOAuth = (RadioButton) findViewById(R.id.oauth);
mButtonxAuth = (RadioButton) findViewById(R.id.xauth);
mButtonBasic = (RadioButton) findViewById(R.id.basic);
mButtonTwipOMode = (RadioButton) findViewById(R.id.twip_o);
mAdvancedAPIConfigContainer = findViewById(R.id.advanced_api_config_container);
mAdvancedAPIConfigLabel = (TextView) findViewById(R.id.advanced_api_config_label);
mAdvancedAPIConfigView = findViewById(R.id.advanced_api_config);
mEditSameOAuthSigningUrl = (CheckBox) findViewById(R.id.same_oauth_signing_url);
mEditNoVersionSuffix = (CheckBox) findViewById(R.id.no_version_suffix);
mEditConsumerKey = (EditText) findViewById(R.id.consumer_key);
@ -191,7 +179,6 @@ public class APIEditorActivity extends BaseSupportDialogActivity implements Twit
}
mEditAuthType.setOnCheckedChangeListener(this);
mAdvancedAPIConfigLabel.setOnClickListener(this);
mSaveButton.setOnClickListener(this);
mAPIFormatHelpButton.setOnClickListener(this);

View File

@ -87,8 +87,8 @@ public class AccountSelectorActivity extends BaseSupportDialogActivity implement
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mListView = (ListView) findViewById(android.R.id.list);
mSelectAccountButtons = findViewById(R.id.select_account_buttons);
}

View File

@ -24,8 +24,8 @@ public class ActivityPickerActivity extends BaseSupportDialogActivity implements
private ListView mListView;
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mListView = (ListView) findViewById(android.R.id.list);
}

View File

@ -21,14 +21,9 @@ package org.mariotaku.twidere.activity.support;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.app.SharedElementCallback;
import android.view.MenuItem;
import android.view.View;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.iface.IControlBarActivity;
@ -39,12 +34,11 @@ import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.MessagesManager;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.view.MainFrameLayout.FitSystemWindowsCallback;
import org.mariotaku.twidere.view.ShapedImageView;
import java.util.ArrayList;
@SuppressLint("Registered")
public class BaseSupportActivity extends ThemedFragmentActivity implements Constants,
public class BaseSupportActivity extends ThemedActionBarActivity implements Constants,
FitSystemWindowsCallback, SystemWindowsInsetsCallback, IControlBarActivity {
private boolean mInstanceStateSaved, mIsVisible, mIsOnTop;

View File

@ -46,6 +46,11 @@ public class BaseSupportDialogActivity extends ThemedFragmentActivity implements
return (TwidereApplication) getApplication();
}
@Override
protected final boolean shouldSetWindowBackground() {
return false;
}
protected boolean isStateSaved() {
return mInstanceStateSaved;
}

View File

@ -79,8 +79,8 @@ public class BrowserSignInActivity extends BaseSupportDialogActivity implements
private GetRequestTokenTask mTask;
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mWebView = (WebView) findViewById(R.id.webview);
mProgressContainer = findViewById(R.id.progress_container);
}

View File

@ -149,7 +149,7 @@ import static org.mariotaku.twidere.util.Utils.getShareStatus;
import static org.mariotaku.twidere.util.Utils.showErrorMessage;
import static org.mariotaku.twidere.util.Utils.showMenuItemToast;
public class ComposeActivity extends BaseSupportDialogActivity implements TextWatcher, LocationListener,
public class ComposeActivity extends ThemedActionBarActivity implements TextWatcher, LocationListener,
OnMenuItemClickListener, OnClickListener, OnEditorActionListener, OnLongClickListener, InvokedListener {
private static final String FAKE_IMAGE_LINK = "https://www.example.com/fake_image.jpg";
@ -544,7 +544,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
super.onCreate(savedInstanceState);
mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mPreferences = SharedPreferencesWrapper.getInstance(this, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
mTwitterWrapper = getTwidereApplication().getTwitterWrapper();
mTwitterWrapper = TwidereApplication.getInstance(this).getTwitterWrapper();
mResolver = getContentResolver();
mValidator = new TwidereValidator(this);
setContentView(R.layout.activity_compose);

View File

@ -186,8 +186,8 @@ public class CustomTabEditorActivity extends BaseSupportDialogActivity implement
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mAccountContainer = findViewById(R.id.account_container);
mSecondaryFieldContainer = findViewById(R.id.secondary_field_container);
mExtraConfigurationsContainer = findViewById(R.id.extra_configurations_container);

View File

@ -35,7 +35,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class ImagePickerActivity extends ThemedFragmentActivity {
public class ImagePickerActivity extends ThemedActionBarActivity {
public static final int REQUEST_PICK_IMAGE = 101;
public static final int REQUEST_TAKE_PHOTO = 102;

View File

@ -284,7 +284,7 @@ public class LinkHandlerActivity extends BaseSupportActivity implements OnClickL
break;
}
case LINK_ID_USER_FRIENDS: {
setTitle(R.string.action_following);
setTitle(R.string.following);
break;
}
case LINK_ID_USER_BLOCKS: {

View File

@ -19,8 +19,6 @@
package org.mariotaku.twidere.activity.support;
import static android.text.TextUtils.isEmpty;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@ -37,118 +35,120 @@ import org.mariotaku.twidere.R;
import org.mariotaku.twidere.util.HtmlEscapeHelper;
import org.mariotaku.twidere.util.PermissionsManager;
import static android.text.TextUtils.isEmpty;
public class RequestPermissionsActivity extends BaseSupportDialogActivity implements OnClickListener {
private PermissionsManager mPermissionsManager;
private PermissionsManager mPermissionsManager;
private ImageView mIconView;
private TextView mNameView, mDescriptionView, mMessageView;
private Button mAcceptButton, mDenyButton;
private ImageView mIconView;
private TextView mNameView, mDescriptionView, mMessageView;
private Button mAcceptButton, mDenyButton;
private String[] mPermissions;
private String mCallingPackage;
private String[] mPermissions;
private String mCallingPackage;
@Override
public void onClick(final View view) {
switch (view.getId()) {
case R.id.accept: {
mPermissionsManager.accept(mCallingPackage, mPermissions);
setResult(RESULT_OK);
finish();
break;
}
case R.id.deny: {
setResult(RESULT_CANCELED);
finish();
break;
}
}
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
mIconView = (ImageView) findViewById(android.R.id.icon);
mNameView = (TextView) findViewById(android.R.id.text1);
mDescriptionView = (TextView) findViewById(android.R.id.text2);
mMessageView = (TextView) findViewById(R.id.message);
mAcceptButton = (Button) findViewById(R.id.accept);
mDenyButton = (Button) findViewById(R.id.deny);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
mPermissionsManager = new PermissionsManager(this);
setContentView(R.layout.request_permissions);
mAcceptButton.setOnClickListener(this);
mDenyButton.setOnClickListener(this);
final String caller = getCallingPackage();
if (caller == null) {
setResult(RESULT_CANCELED);
finish();
return;
}
loadInfo(caller);
}
private void appendPermission(final StringBuilder sb, final String name, final boolean danger) {
if (danger) {
sb.append(String.format("<br/><b><font color='#ff8000'>%s</font></b>", HtmlEscapeHelper.escape(name)));
} else {
sb.append(String.format("<br/>%s", HtmlEscapeHelper.escape(name)));
}
}
private void loadInfo(final String pname) {
final PackageManager pm = getPackageManager();
try {
final ApplicationInfo info = pm.getApplicationInfo(pname, PackageManager.GET_META_DATA);
final Bundle meta = info.metaData;
if (meta == null || !meta.getBoolean(METADATA_KEY_EXTENSION)) {
setResult(RESULT_CANCELED);
finish();
return;
}
mIconView.setImageDrawable(info.loadIcon(pm));
mNameView.setText(info.loadLabel(pm));
final CharSequence desc = info.loadDescription(pm);
mDescriptionView.setText(desc);
mDescriptionView.setVisibility(isEmpty(desc) ? View.GONE : View.VISIBLE);
final String[] permissions = PermissionsManager.parsePermissions(meta
.getString(METADATA_KEY_EXTENSION_PERMISSIONS));
mPermissions = permissions;
mCallingPackage = pname;
final StringBuilder builder = new StringBuilder();
builder.append(HtmlEscapeHelper.escape(getString(R.string.permissions_request_message))).append("<br/>");
if (PermissionsManager.isPermissionValid(permissions)) {
if (PermissionsManager.hasPermissions(permissions, PERMISSION_PREFERENCES)) {
appendPermission(builder, getString(R.string.permission_description_preferences), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_ACCOUNTS)) {
appendPermission(builder, getString(R.string.permission_description_accounts), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_DIRECT_MESSAGES)) {
appendPermission(builder, getString(R.string.permission_description_direct_messages), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_WRITE)) {
appendPermission(builder, getString(R.string.permission_description_write), false);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_READ)) {
appendPermission(builder, getString(R.string.permission_description_read), false);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_REFRESH)) {
appendPermission(builder, getString(R.string.permission_description_refresh), false);
}
} else {
appendPermission(builder, getString(R.string.permission_description_none), false);
}
mMessageView.setText(Html.fromHtml(builder.toString()));
} catch (final NameNotFoundException e) {
setResult(RESULT_CANCELED);
finish();
@Override
public void onClick(final View view) {
switch (view.getId()) {
case R.id.accept: {
mPermissionsManager.accept(mCallingPackage, mPermissions);
setResult(RESULT_OK);
finish();
break;
}
case R.id.deny: {
setResult(RESULT_CANCELED);
finish();
break;
}
}
}
}
@Override
public void onContentChanged() {
super.onContentChanged();
mIconView = (ImageView) findViewById(android.R.id.icon);
mNameView = (TextView) findViewById(android.R.id.text1);
mDescriptionView = (TextView) findViewById(android.R.id.text2);
mMessageView = (TextView) findViewById(R.id.message);
mAcceptButton = (Button) findViewById(R.id.accept);
mDenyButton = (Button) findViewById(R.id.deny);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
mPermissionsManager = new PermissionsManager(this);
setContentView(R.layout.request_permissions);
mAcceptButton.setOnClickListener(this);
mDenyButton.setOnClickListener(this);
final String caller = getCallingPackage();
if (caller == null) {
setResult(RESULT_CANCELED);
finish();
return;
}
loadInfo(caller);
}
private void appendPermission(final StringBuilder sb, final String name, final boolean danger) {
if (danger) {
sb.append(String.format("<br/><b><font color='#ff8000'>%s</font></b>", HtmlEscapeHelper.escape(name)));
} else {
sb.append(String.format("<br/>%s", HtmlEscapeHelper.escape(name)));
}
}
private void loadInfo(final String pname) {
final PackageManager pm = getPackageManager();
try {
final ApplicationInfo info = pm.getApplicationInfo(pname, PackageManager.GET_META_DATA);
final Bundle meta = info.metaData;
if (meta == null || !meta.getBoolean(METADATA_KEY_EXTENSION)) {
setResult(RESULT_CANCELED);
finish();
return;
}
mIconView.setImageDrawable(info.loadIcon(pm));
mNameView.setText(info.loadLabel(pm));
final CharSequence desc = info.loadDescription(pm);
mDescriptionView.setText(desc);
mDescriptionView.setVisibility(isEmpty(desc) ? View.GONE : View.VISIBLE);
final String[] permissions = PermissionsManager.parsePermissions(meta
.getString(METADATA_KEY_EXTENSION_PERMISSIONS));
mPermissions = permissions;
mCallingPackage = pname;
final StringBuilder builder = new StringBuilder();
builder.append(HtmlEscapeHelper.escape(getString(R.string.permissions_request_message))).append("<br/>");
if (PermissionsManager.isPermissionValid(permissions)) {
if (PermissionsManager.hasPermissions(permissions, PERMISSION_PREFERENCES)) {
appendPermission(builder, getString(R.string.permission_description_preferences), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_ACCOUNTS)) {
appendPermission(builder, getString(R.string.permission_description_accounts), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_DIRECT_MESSAGES)) {
appendPermission(builder, getString(R.string.permission_description_direct_messages), true);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_WRITE)) {
appendPermission(builder, getString(R.string.permission_description_write), false);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_READ)) {
appendPermission(builder, getString(R.string.permission_description_read), false);
}
if (PermissionsManager.hasPermissions(permissions, PERMISSION_REFRESH)) {
appendPermission(builder, getString(R.string.permission_description_refresh), false);
}
} else {
appendPermission(builder, getString(R.string.permission_description_none), false);
}
mMessageView.setText(Html.fromHtml(builder.toString()));
} catch (final NameNotFoundException e) {
setResult(RESULT_CANCELED);
finish();
}
}
}

View File

@ -689,7 +689,7 @@ public class SignInActivity extends BaseSupportActivity implements TwitterConsta
@Override
public int getThemeResourceId() {
return ThemeUtils.getSettingsThemeResource(this);
return ThemeUtils.getThemeResource(this);
}
static class SignInResponse {

View File

@ -0,0 +1,149 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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.activity.support;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.AttributeSet;
import android.view.View;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.ColorUtils;
import org.mariotaku.twidere.util.StrictModeUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
import static org.mariotaku.twidere.util.Utils.restartActivity;
public abstract class ThemedActionBarActivity extends ActionBarActivity implements Constants, IThemedActivity {
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
@ShapeStyle
private int mProfileImageStyle;
@Override
public Resources getDefaultResources() {
return super.getResources();
}
@Override
public final int getCurrentThemeResourceId() {
return mCurrentThemeResource;
}
@Override
public int getThemeBackgroundAlpha() {
return ThemeUtils.isTransparentBackground(this) ? ThemeUtils.getUserThemeBackgroundAlpha(this) : 0xff;
}
@Override
public int getCurrentThemeBackgroundAlpha() {
return mCurrentThemeBackgroundAlpha;
}
@Override
public int getCurrentThemeColor() {
return mCurrentThemeColor;
}
@Override
public String getThemeFontFamily() {
return ThemeUtils.getThemeFontFamily(this);
}
@Override
public void navigateUpFromSameTask() {
NavUtils.navigateUpFromSameTask(this);
}
@Override
public final void restart() {
restartActivity(this);
}
@Override
protected void onCreate(final Bundle savedInstanceState) {
if (Utils.isDebugBuild()) {
StrictModeUtils.detectAllVmPolicy();
StrictModeUtils.detectAllThreadPolicy();
}
setTheme();
super.onCreate(savedInstanceState);
}
@Override
protected void onStart() {
super.onStart();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
final SpannableStringBuilder builder = new SpannableStringBuilder(title);
final int themeResId = getCurrentThemeResourceId();
final int themeColor = getThemeColor(), contrastColor = ColorUtils.getContrastYIQ(themeColor, 192);
if (!ThemeUtils.isDarkTheme(themeResId)) {
builder.setSpan(new ForegroundColorSpan(contrastColor), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
super.onTitleChanged(title, color);
}
@Override
public View onCreateView(String name, @NonNull Context context, @NonNull AttributeSet attrs) {
final View view = ThemeUtils.createView(name, context, attrs, mCurrentThemeColor);
if (view instanceof ShapedImageView) {
final ShapedImageView shapedImageView = (ShapedImageView) view;
shapedImageView.setStyle(mProfileImageStyle);
}
if (view != null) return view;
return super.onCreateView(name, context, attrs);
}
@Override
protected void onResume() {
super.onResume();
}
protected boolean shouldSetWindowBackground() {
return true;
}
private void setTheme() {
mCurrentThemeResource = getThemeResourceId();
mCurrentThemeColor = getThemeColor();
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
mProfileImageStyle = Utils.getProfileImageStyle(this);
ThemeUtils.notifyStatusBarColorChanged(this, mCurrentThemeResource, mCurrentThemeColor,
mCurrentThemeBackgroundAlpha);
setTheme(mCurrentThemeResource);
if (shouldSetWindowBackground() && ThemeUtils.isTransparentBackground(mCurrentThemeResource)) {
getWindow().setBackgroundDrawable(ThemeUtils.getWindowBackground(this));
}
}
}

View File

@ -1,18 +1,18 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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/>.
*/
@ -23,8 +23,8 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBarActivity;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
@ -42,7 +42,7 @@ import org.mariotaku.twidere.view.ShapedImageView.ShapeStyle;
import static org.mariotaku.twidere.util.Utils.restartActivity;
public abstract class ThemedFragmentActivity extends ActionBarActivity implements Constants, IThemedActivity {
public abstract class ThemedFragmentActivity extends FragmentActivity implements Constants, IThemedActivity {
private int mCurrentThemeResource, mCurrentThemeColor, mCurrentThemeBackgroundAlpha;
@ShapeStyle

View File

@ -101,8 +101,8 @@ public class UserListSelectorActivity extends BaseSupportDialogActivity implemen
}
@Override
public void onSupportContentChanged() {
super.onSupportContentChanged();
public void onContentChanged() {
super.onContentChanged();
mUsersListContainer = findViewById(R.id.users_list_container);
mUserListsContainer = findViewById(R.id.user_lists_container);
mEditScreenName = (AutoCompleteTextView) findViewById(R.id.edit_screen_name);

View File

@ -65,8 +65,8 @@ import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.activity.support.AccountsManagerActivity;
import org.mariotaku.twidere.activity.support.ComposeActivity;
import org.mariotaku.twidere.activity.support.DraftsActivity;
import org.mariotaku.twidere.activity.support.QuickSearchBarActivity;
import org.mariotaku.twidere.activity.support.HomeActivity;
import org.mariotaku.twidere.activity.support.QuickSearchBarActivity;
import org.mariotaku.twidere.activity.support.UserProfileEditorActivity;
import org.mariotaku.twidere.adapter.ArrayAdapter;
import org.mariotaku.twidere.app.TwidereApplication;
@ -78,6 +78,7 @@ import org.mariotaku.twidere.util.ImageLoaderWrapper;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.content.SupportFragmentReloadCursorObserver;
import org.mariotaku.twidere.view.ShapedImageView;
import java.util.ArrayList;
@ -438,13 +439,13 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
static class AccountProfileImageViewHolder extends ViewHolder implements OnClickListener {
private final AccountSelectorAdapter adapter;
private final ImageView icon;
private final ShapedImageView icon;
public AccountProfileImageViewHolder(AccountSelectorAdapter adapter, View itemView) {
super(itemView);
this.adapter = adapter;
itemView.setOnClickListener(this);
icon = (ImageView) itemView.findViewById(android.R.id.icon);
icon = (ShapedImageView) itemView.findViewById(android.R.id.icon);
}
@Override
@ -461,6 +462,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
private Cursor mCursor;
private Indices mIndices;
private long mSelectedAccountId;
private int mSelectedAccountIndex;
AccountSelectorAdapter(Context context, AccountsDashboardFragment fragment) {
mInflater = LayoutInflater.from(context);
@ -473,9 +475,25 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
if (cursor != null) {
mIndices = new Indices(cursor);
}
updateSelectedAccountIndex();
notifyDataSetChanged();
}
private void updateSelectedAccountIndex() {
final Cursor c = mCursor;
final Indices i = mIndices;
mSelectedAccountIndex = -1;
if (c != null && i != null && c.moveToFirst()) {
while (!c.isAfterLast()) {
if (c.getLong(mIndices.account_id) == mSelectedAccountId) {
mSelectedAccountIndex = c.getPosition();
break;
}
c.moveToNext();
}
}
}
public ParcelableAccount getSelectedAccount() {
final Cursor c = mCursor;
final Indices i = mIndices;
@ -495,6 +513,7 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
public void setSelectedAccountId(long accountId) {
mSelectedAccountId = accountId;
updateSelectedAccountIndex();
notifyDataSetChanged();
}
@ -507,12 +526,14 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
@Override
public void onBindViewHolder(AccountProfileImageViewHolder holder, int position) {
final Cursor c = mCursor;
c.moveToPosition(position);
if (c.getLong(mIndices.account_id) == mSelectedAccountId) {
c.moveToNext();
if (mSelectedAccountIndex != -1 && position >= mSelectedAccountIndex) {
c.moveToPosition(position + 1);
} else {
c.moveToPosition(position);
}
holder.itemView.setAlpha(c.getInt(mIndices.is_activated) == 1 ? 1 : 0.5f);
mImageLoader.displayProfileImage(holder.icon, c.getString(mIndices.profile_image_url));
holder.icon.setBorderColor(c.getInt(mIndices.color));
}
@Override
@ -523,10 +544,12 @@ public class AccountsDashboardFragment extends BaseSupportListFragment implement
private void dispatchItemSelected(int position) {
final Cursor c = mCursor;
c.moveToPosition(position);
if (c.getLong(mIndices.account_id) != mSelectedAccountId || c.moveToNext()) {
mFragment.onAccountSelected(new ParcelableAccount(c, mIndices));
if (mSelectedAccountIndex != -1 && position >= mSelectedAccountIndex) {
c.moveToPosition(position + 1);
} else {
c.moveToPosition(position);
}
mFragment.onAccountSelected(new ParcelableAccount(c, mIndices));
}
}

View File

@ -71,6 +71,7 @@ import org.mariotaku.twidere.util.ParseUtils;
import org.mariotaku.twidere.util.ThemeUtils;
import org.mariotaku.twidere.util.TwidereLinkify;
import org.mariotaku.twidere.util.UserColorNameUtils;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ColorLabelLinearLayout;
import org.mariotaku.twidere.view.HeaderDrawerLayout;
import org.mariotaku.twidere.view.HeaderDrawerLayout.DrawerCallback;
@ -258,7 +259,15 @@ public class UserListFragment extends BaseSupportFragment implements OnClickList
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_user_list, container, false);
final View view = inflater.inflate(R.layout.fragment_user_list, container, false);
final ViewGroup listDetailsContainer = (ViewGroup) view.findViewById(R.id.list_details_container);
final boolean isCompact = Utils.isCompactCards(getActivity());
if (isCompact) {
inflater.inflate(R.layout.layout_user_list_details_compact, listDetailsContainer);
} else {
inflater.inflate(R.layout.layout_user_list_details, listDetailsContainer);
}
return view;
}
@Override

View File

@ -77,9 +77,17 @@ public final class ParcelableUserLoader extends AsyncTaskLoader<SingleResponse<P
final Twitter twitter = getTwitterInstance(context, mAccountId, true);
if (twitter == null) return SingleResponse.getInstance();
if (mLoadFromCache) {
final String where = CachedUsers.USER_ID + " = " + mUserId + " OR " + CachedUsers.SCREEN_NAME + " = '"
+ mScreenName + "'";
final Cursor cur = resolver.query(CachedUsers.CONTENT_URI, CachedUsers.COLUMNS, where, null, null);
final Expression where;
final String[] whereArgs;
if (mUserId > 0) {
where = Expression.equals(CachedUsers.USER_ID, mUserId);
whereArgs = null;
} else {
where = Expression.equalsArgs(CachedUsers.SCREEN_NAME);
whereArgs = new String[]{mScreenName};
}
final Cursor cur = resolver.query(CachedUsers.CONTENT_URI, CachedUsers.COLUMNS,
where.getSQL(), whereArgs, null);
final int count = cur.getCount();
try {
if (count > 0) {

View File

@ -33,7 +33,6 @@ import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import org.mariotaku.twidere.Constants;
@ -55,9 +54,6 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
private EditText mEditConsumerKey, mEditConsumerSecret;
private RadioGroup mEditAuthType;
private RadioButton mButtonOAuth, mButtonxAuth, mButtonBasic, mButtonTwipOMode;
private TextView mAdvancedAPIConfigLabel;
private View mAdvancedAPIConfigContainer;
private View mAdvancedAPIConfigView;
private View mAPIFormatHelpButton;
public DefaultAPIPreference(final Context context, final AttributeSet attrs) {
@ -74,19 +70,14 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
public void onCheckedChanged(final RadioGroup group, final int checkedId) {
final int authType = getCheckedAuthType(checkedId);
final boolean isOAuth = authType == Accounts.AUTH_TYPE_OAUTH || authType == Accounts.AUTH_TYPE_XAUTH;
mAdvancedAPIConfigContainer.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditSameOAuthSigningUrl.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerKey.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
mEditConsumerSecret.setVisibility(isOAuth ? View.VISIBLE : View.GONE);
}
@Override
public void onClick(final View v) {
switch (v.getId()) {
case R.id.advanced_api_config_label: {
final boolean isVisible = mAdvancedAPIConfigView.isShown();
final int compoundRes = isVisible ? R.drawable.expander_close_holo : R.drawable.expander_open_holo;
mAdvancedAPIConfigLabel.setCompoundDrawablesWithIntrinsicBounds(compoundRes, 0, 0, 0);
mAdvancedAPIConfigView.setVisibility(isVisible ? View.GONE : View.VISIBLE);
break;
}
case R.id.api_url_format_help: {
Toast.makeText(getContext(), R.string.api_url_format_help, Toast.LENGTH_LONG).show();
break;
@ -115,9 +106,6 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
mButtonxAuth = (RadioButton) view.findViewById(R.id.xauth);
mButtonBasic = (RadioButton) view.findViewById(R.id.basic);
mButtonTwipOMode = (RadioButton) view.findViewById(R.id.twip_o);
mAdvancedAPIConfigContainer = view.findViewById(R.id.advanced_api_config_container);
mAdvancedAPIConfigLabel = (TextView) view.findViewById(R.id.advanced_api_config_label);
mAdvancedAPIConfigView = view.findViewById(R.id.advanced_api_config);
mEditSameOAuthSigningUrl = (CheckBox) view.findViewById(R.id.same_oauth_signing_url);
mEditNoVersionSuffix = (CheckBox) view.findViewById(R.id.no_version_suffix);
mEditConsumerKey = (EditText) view.findViewById(R.id.consumer_key);
@ -125,7 +113,6 @@ public class DefaultAPIPreference extends DialogPreference implements Constants,
mAPIFormatHelpButton = view.findViewById(R.id.api_url_format_help);
mEditAuthType.setOnCheckedChangeListener(this);
mAdvancedAPIConfigLabel.setOnClickListener(this);
mAPIFormatHelpButton.setOnClickListener(this);
return view;

View File

@ -845,6 +845,9 @@ public class ThemeUtils implements Constants {
case R.style.Theme_Twidere_Dark_Dialog:
case R.style.Theme_Twidere_Dark_Compose:
case R.style.Theme_Twidere_Dark_Transparent:
case R.style.Theme_Twidere_Dark_NoActionBar:
case R.style.Theme_Twidere_Dark_SolidBackground_NoActionBar:
case R.style.Theme_Twidere_Dark_Transparent_NoActionBar:
return true;
}
return false;

View File

@ -11,6 +11,8 @@ import android.widget.ImageButton;
*/
public class ActionIconButton extends ImageButton {
private final int mDefaultColor;
public ActionIconButton(Context context) {
this(context, null);
}
@ -21,8 +23,18 @@ public class ActionIconButton extends ImageButton {
public ActionIconButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
final TypedArray a = context.obtainStyledAttributes(new int[]{android.R.attr.colorForeground});
setColorFilter(a.getColor(0, 0), Mode.SRC_ATOP);
final TypedArray a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.color,
android.R.attr.colorForeground});
if (a.hasValue(0)) {
mDefaultColor = a.getColor(0, 0);
} else {
mDefaultColor = a.getColor(1, 0);
}
setColorFilter(mDefaultColor, Mode.SRC_ATOP);
a.recycle();
}
public int getDefaultColor() {
return mDefaultColor;
}
}

View File

@ -17,10 +17,6 @@ public class ActionIconView extends ImageView {
this(context, null);
}
public int getDefaultColor() {
return mDefaultColor;
}
public ActionIconView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@ -37,4 +33,8 @@ public class ActionIconView extends ImageView {
setColorFilter(mDefaultColor, Mode.SRC_ATOP);
a.recycle();
}
public int getDefaultColor() {
return mDefaultColor;
}
}

View File

@ -221,18 +221,12 @@ public class ShapedImageView extends ImageView {
mStyle = style;
}
public void setBorderColors(int... colors) {
mBorderAlpha = 0xff;
mBorderColors = colors;
updateBorderShader();
invalidate();
public void setBorderColor(int color) {
setBorderColorsInternal(Color.alpha(color), color);
}
public void setBorderColor(int color) {
mBorderAlpha = Color.alpha(color);
mBorderColors = new int[]{color};
updateBorderShader();
invalidate();
public void setBorderColors(int... colors) {
setBorderColorsInternal(0xff, colors);
}
public void setBorderEnabled(boolean enabled) {
@ -324,12 +318,6 @@ public class ShapedImageView extends ImageView {
mBitmapPaint.setColorFilter(cf);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
updateBounds();
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
@ -340,6 +328,12 @@ public class ShapedImageView extends ImageView {
super.dispatchDraw(canvas);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
updateBounds();
}
@Override
public void setBackgroundColor(int color) {
mBackgroundPaint.setColor(0xFF000000 | color);
@ -415,6 +409,37 @@ public class ShapedImageView extends ImageView {
}
}
private void setBorderColorsInternal(int alpha, int... colors) {
mBorderAlpha = alpha;
mBorderColors = colors;
updateBorderShader();
invalidate();
}
private void updateBorderShader() {
final int[] colors = mBorderColors;
if (colors == null || colors.length == 0) {
mBorderPaint.setShader(null);
mBorderAlpha = 0;
return;
}
mDestination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(),
getHeight() - getPaddingBottom());
final float cx = mDestination.centerX(), cy = mDestination.centerY();
final int[] sweepColors = new int[colors.length * 2];
final float[] positions = new float[colors.length * 2];
for (int i = 0, j = colors.length; i < j; i++) {
sweepColors[i * 2] = sweepColors[i * 2 + 1] = colors[i];
positions[i * 2] = i == 0 ? 0 : i / (float) j;
positions[i * 2 + 1] = i == j - 1 ? 1 : (i + 1) / (float) j;
}
final SweepGradient shader = new SweepGradient(cx, cy, sweepColors, positions);
final Matrix matrix = new Matrix();
matrix.setRotate(90, cx, cy);
shader.setLocalMatrix(matrix);
mBorderPaint.setShader(shader);
}
private void updateBounds() {
updateBorderShader();
updateShadowBitmap();
@ -444,29 +469,6 @@ public class ShapedImageView extends ImageView {
invalidate();
}
private void updateBorderShader() {
final int[] colors = mBorderColors;
if (colors == null || colors.length == 0) {
mBorderPaint.setShader(null);
return;
}
mDestination.set(getPaddingLeft(), getPaddingTop(), getWidth() - getPaddingRight(),
getHeight() - getPaddingBottom());
final float cx = mDestination.centerX(), cy = mDestination.centerY();
final int[] sweepColors = new int[colors.length * 2];
final float[] positions = new float[colors.length * 2];
for (int i = 0, j = colors.length; i < j; i++) {
sweepColors[i * 2] = sweepColors[i * 2 + 1] = colors[i];
positions[i * 2] = i == 0 ? 0 : i / (float) j;
positions[i * 2 + 1] = i == j - 1 ? 1 : (i + 1) / (float) j;
}
final SweepGradient shader = new SweepGradient(cx, cy, sweepColors, positions);
final Matrix matrix = new Matrix();
matrix.setRotate(90, cx, cy);
shader.setLocalMatrix(matrix);
mBorderPaint.setShader(shader);
}
@IntDef({SHAPE_CIRCLE, SHAPE_RECTANGLE})
@Retention(RetentionPolicy.SOURCE)
public @interface ShapeStyle {

View File

@ -32,111 +32,122 @@ import org.mariotaku.twidere.view.themed.ThemedMultiAutoCompleteTextView;
public class StatusComposeEditText extends ThemedMultiAutoCompleteTextView implements InputType {
private UserHashtagAutoCompleteAdapter mAdapter;
private UserHashtagAutoCompleteAdapter mAdapter;
public StatusComposeEditText(final Context context) {
this(context, null);
}
public StatusComposeEditText(final Context context) {
this(context, null);
}
public StatusComposeEditText(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.autoCompleteTextViewStyle);
}
public StatusComposeEditText(final Context context, final AttributeSet attrs) {
this(context, attrs, android.R.attr.autoCompleteTextViewStyle);
}
public StatusComposeEditText(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
mAdapter = new UserHashtagAutoCompleteAdapter(this);
setTokenizer(new ScreenNameTokenizer());
setMovementMethod(ArrowKeyMovementMethod.getInstance());
setRawInputType(TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES | TYPE_TEXT_FLAG_MULTI_LINE);
}
public StatusComposeEditText(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
mAdapter = new UserHashtagAutoCompleteAdapter(this);
setTokenizer(new ScreenNameTokenizer());
setMovementMethod(ArrowKeyMovementMethod.getInstance());
setRawInputType(TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES | TYPE_TEXT_FLAG_MULTI_LINE);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mAdapter == null || mAdapter.isCursorClosed()) {
mAdapter = new UserHashtagAutoCompleteAdapter(this);
}
setAdapter(mAdapter);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mAdapter == null || mAdapter.isCursorClosed()) {
mAdapter = new UserHashtagAutoCompleteAdapter(this);
}
setAdapter(mAdapter);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mAdapter != null) {
mAdapter.closeCursor();
mAdapter = null;
}
setAdapter(mAdapter);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mAdapter != null) {
mAdapter.closeCursor();
mAdapter = null;
}
// setAdapter(null);
}
@Override
protected void replaceText(final CharSequence text) {
super.replaceText(text);
append(" ");
}
@Override
protected void replaceText(final CharSequence text) {
super.replaceText(text);
append(" ");
}
private static class ScreenNameTokenizer implements Tokenizer {
@Override
protected int computeVerticalScrollRange() {
return super.computeVerticalScrollRange();
}
@Override
public int findTokenEnd(final CharSequence text, final int cursor) {
int i = cursor;
final int len = text.length();
@Override
protected int computeVerticalScrollExtent() {
return super.computeVerticalScrollExtent();
}
while (i < len) {
if (text.charAt(i) == ' ')
return i;
else {
i++;
}
}
private static class ScreenNameTokenizer implements Tokenizer {
return len;
}
@Override
public int findTokenEnd(final CharSequence text, final int cursor) {
int i = cursor;
final int len = text.length();
@Override
public int findTokenStart(final CharSequence text, final int cursor) {
int start = cursor;
while (i < len) {
if (text.charAt(i) == ' ')
return i;
else {
i++;
}
}
while (start > 0 && text.charAt(start - 1) != ' ') {
start--;
}
return len;
}
while (start < cursor && text.charAt(start) == ' ') {
start++;
}
@Override
public int findTokenStart(final CharSequence text, final int cursor) {
int start = cursor;
if (start < cursor && isToken(text.charAt(start))) {
start++;
} else {
start = cursor;
}
while (start > 0 && text.charAt(start - 1) != ' ') {
start--;
}
return start;
}
while (start < cursor && text.charAt(start) == ' ') {
start++;
}
@Override
public CharSequence terminateToken(final CharSequence text) {
int i = text.length();
if (start < cursor && isToken(text.charAt(start))) {
start++;
} else {
start = cursor;
}
while (i > 0 && isToken(text.charAt(i - 1))) {
i--;
}
return start;
}
if (i > 0 && text.charAt(i - 1) == ' ' || !(text instanceof Spanned)) return text;
final SpannableString sp = new SpannableString(text);
TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0);
return sp;
}
@Override
public CharSequence terminateToken(final CharSequence text) {
int i = text.length();
while (i > 0 && isToken(text.charAt(i - 1))) {
i--;
}
if (i > 0 && text.charAt(i - 1) == ' ' || !(text instanceof Spanned)) return text;
final SpannableString sp = new SpannableString(text);
TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0);
return sp;
}
private static boolean isToken(final char character) {
switch (character) {
case '\uff20':
case '@':
case '\uff03':
case '#':
return true;
}
return false;
}
}
private static boolean isToken(final char character) {
switch (character) {
case '\uff20':
case '@':
case '\uff03':
case '#':
return true;
}
return false;
}
}
}

View File

@ -1,6 +1,7 @@
package org.mariotaku.twidere.view;
import android.content.Context;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.view.MotionEvent;
@ -9,72 +10,72 @@ import org.mariotaku.twidere.view.themed.ThemedTextView;
public class StatusTextView extends ThemedTextView implements IExtendedView {
private TouchInterceptor mTouchInterceptor;
private OnSizeChangedListener mOnSizeChangedListener;
private OnSelectionChangeListener mOnSelectionChangeListener;
private TouchInterceptor mTouchInterceptor;
private OnSizeChangedListener mOnSizeChangedListener;
private OnSelectionChangeListener mOnSelectionChangeListener;
public StatusTextView(final Context context) {
super(context);
}
public StatusTextView(final Context context) {
super(context);
}
public StatusTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public StatusTextView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public StatusTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
public StatusTextView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
public final boolean dispatchTouchEvent(final MotionEvent event) {
if (mTouchInterceptor != null) {
final boolean ret = mTouchInterceptor.dispatchTouchEvent(this, event);
if (ret) return true;
}
return super.dispatchTouchEvent(event);
}
@Override
public final boolean dispatchTouchEvent(@NonNull final MotionEvent event) {
if (mTouchInterceptor != null) {
final boolean ret = mTouchInterceptor.dispatchTouchEvent(this, event);
if (ret) return true;
}
return super.dispatchTouchEvent(event);
}
@Override
public final boolean onTouchEvent(final MotionEvent event) {
if (mTouchInterceptor != null) {
final boolean ret = mTouchInterceptor.onTouchEvent(this, event);
if (ret) return true;
}
return super.onTouchEvent(event);
}
@Override
public final boolean onTouchEvent(@NonNull final MotionEvent event) {
if (mTouchInterceptor != null) {
final boolean ret = mTouchInterceptor.onTouchEvent(this, event);
if (ret) return true;
}
return super.onTouchEvent(event);
}
public void setOnSelectionChangeListener(final OnSelectionChangeListener l) {
mOnSelectionChangeListener = l;
}
public void setOnSelectionChangeListener(final OnSelectionChangeListener l) {
mOnSelectionChangeListener = l;
}
@Override
public final void setOnSizeChangedListener(final OnSizeChangedListener listener) {
mOnSizeChangedListener = listener;
}
@Override
public final void setOnSizeChangedListener(final OnSizeChangedListener listener) {
mOnSizeChangedListener = listener;
}
@Override
public final void setTouchInterceptor(final TouchInterceptor listener) {
mTouchInterceptor = listener;
}
@Override
public final void setTouchInterceptor(final TouchInterceptor listener) {
mTouchInterceptor = listener;
}
@Override
protected void onSelectionChanged(final int selStart, final int selEnd) {
super.onSelectionChanged(selStart, selEnd);
if (mOnSelectionChangeListener != null) {
mOnSelectionChangeListener.onSelectionChanged(selStart, selEnd);
}
}
@Override
protected void onSelectionChanged(final int selStart, final int selEnd) {
super.onSelectionChanged(selStart, selEnd);
if (mOnSelectionChangeListener != null) {
mOnSelectionChangeListener.onSelectionChanged(selStart, selEnd);
}
}
@Override
protected final void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mOnSizeChangedListener != null) {
mOnSizeChangedListener.onSizeChanged(this, w, h, oldw, oldh);
}
}
@Override
protected final void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mOnSizeChangedListener != null) {
mOnSizeChangedListener.onSizeChanged(this, w, h, oldw, oldh);
}
}
public interface OnSelectionChangeListener {
void onSelectionChanged(int selStart, int selEnd);
}
public interface OnSelectionChangeListener {
void onSelectionChanged(int selStart, int selEnd);
}
}

View File

@ -0,0 +1,50 @@
/*
* 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.view.themed;
import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
import com.rengwuxian.materialedittext.MaterialEditText;
import org.mariotaku.twidere.view.iface.IThemedView;
/**
* Created by mariotaku on 15/1/18.
*/
public class ThemedMaterialEditText extends MaterialEditText implements IThemedView {
public ThemedMaterialEditText(Context context) {
super(context);
}
public ThemedMaterialEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ThemedMaterialEditText(Context context, AttributeSet attrs, int style) {
super(context, attrs, style);
}
@Override
public void setThemeTintColor(ColorStateList color) {
setPrimaryColor(color.getDefaultColor());
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -17,30 +17,34 @@
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout
<!-- I don't know why dialog doesn't work unless wrapped with a RelativeLayout -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:showDividers="middle"
android:divider="?android:dividerVertical"
android:orientation="vertical">
android:layout_height="wrap_content">
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_height="wrap_content"
android:divider="?android:dividerVertical"
android:orientation="vertical"
android:showDividers="middle"
tools:context=".activity.APIEditorActivity">
<include layout="@layout/layout_api_editor"/>
</FrameLayout>
<include
layout="@layout/layout_api_editor"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/save"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/button_bar_height"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:text="@android:string/ok"/>
<Button
android:id="@+id/save"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/button_bar_height"
android:gravity="center"
android:text="@android:string/ok"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -23,11 +23,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="?android:dividerVertical"
android:minHeight="@dimen/compose_min_height"
android:minWidth="@dimen/compose_min_width"
android:orientation="vertical"
android:showDividers="middle">
android:orientation="vertical">
<RelativeLayout
@ -50,23 +47,53 @@
android:stretchMode="columnWidth"
tools:listitem="@layout/grid_item_image_preview"/>
<FrameLayout
<LinearLayout
android:id="@+id/edit_text_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal">
android:orientation="vertical">
<org.mariotaku.twidere.view.StatusComposeEditText
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:completionThreshold="1"
android:gravity="top"
android:hint="@string/status_hint"
android:imeOptions="actionDone"
android:minLines="10"/>
</FrameLayout>
android:minLines="6"
android:padding="@dimen/element_spacing_normal"
android:scrollbars="vertical"/>
<LinearLayout
android:id="@+id/location_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:gravity="center"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ActionIconView
android:layout_width="@dimen/element_size_small"
android:layout_height="@dimen/element_size_small"
android:layout_marginLeft="@dimen/element_spacing_normal"
android:layout_marginRight="@dimen/element_spacing_normal"
android:color="?android:textColorSecondary"
android:src="@drawable/ic_action_location"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/element_spacing_normal"/>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/account_selector_container"
@ -88,14 +115,18 @@
android:paddingLeft="@dimen/element_spacing_normal"
android:paddingRight="@dimen/element_spacing_normal"/>
</FrameLayout>
</RelativeLayout>
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?android:colorBackground">
android:background="?android:colorBackground"
android:divider="?android:dividerVertical"
android:orientation="vertical"
android:showDividers="beginning">
<include layout="@layout/activity_compose_bottombar"/>
</FrameLayout>
</LinearLayout>
</LinearLayout>

View File

@ -63,6 +63,7 @@
<org.mariotaku.twidere.view.ActionIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:color="?android:textColorSecondary"
android:contentDescription="@string/send"
android:cropToPadding="false"
android:padding="@dimen/element_spacing_xsmall"

View File

@ -20,6 +20,7 @@
<org.mariotaku.twidere.view.SquareFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/element_spacing_msmall">
@ -28,6 +29,8 @@
android:id="@android:id/icon"
style="?profileImageStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
app:sivBorder="true"
app:sivBorderWidth="1.5dp"/>
</org.mariotaku.twidere.view.SquareFrameLayout>

View File

@ -30,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentLayout="@layout/fragment_content_pages"
app:headerLayout="@layout/header_user_list_details"/>
app:headerLayout="@layout/header_user_list"/>
<include layout="@layout/layout_content_fragment_common"/>

View File

@ -84,14 +84,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceMedium"/>
android:textAppearance="?android:textAppearanceMedium"
android:textColor="?android:textColorPrimary"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/screen_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:textAppearanceSmall"/>
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorPrimary"/>
</LinearLayout>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 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/>.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_details_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

View File

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2014 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/>.
-->
<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="wrap_content"
tools:context=".fragment.support.UserListDetailsFragment">
<android.support.v7.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing_normal"
app:cardBackgroundColor="?cardItemBackgroundColor"
app:cardCornerRadius="@dimen/corner_radius_card"
app:cardElevation="@dimen/elevation_card">
<org.mariotaku.twidere.view.ColorLabelLinearLayout
android:id="@+id/user_list_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:splitMotionEvents="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<LinearLayout
android:id="@+id/name_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/list_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ShapedImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_details"
android:layout_height="@dimen/icon_size_card_details"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:foreground="?android:selectableItemBackground"
android:scaleType="fitCenter"
tools:src="@drawable/ic_profile_image_default"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="?android:dividerVertical"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"
tools:text="@string/sample_status_text"/>
</org.mariotaku.twidere.view.ColorLabelLinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>

View File

@ -21,7 +21,7 @@
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/api_editor_content"
@ -112,28 +112,6 @@
</RadioGroup>
</HorizontalScrollView>
<LinearLayout
android:id="@+id/advanced_api_config_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/advanced_api_config_label"
style="?android:borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/expander_close_holo"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:text="@string/advanced"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<include
layout="@layout/layout_api_editor_advanced_fields"
android:visibility="gone"/>
</LinearLayout>
<include layout="@layout/layout_api_editor_advanced_fields"/>
</LinearLayout>
</ScrollView>

View File

@ -21,9 +21,9 @@
<LinearLayout
android:id="@+id/advanced_api_config"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/advanced_api_config_label"
android:orientation="vertical"
android:paddingLeft="@dimen/element_spacing_normal">
@ -45,32 +45,28 @@
android:text="@string/no_version_suffix"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/consumer_key"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<EditText
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/consumer_key"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/consumer_key"
android:inputType="text|textVisiblePassword"
android:singleLine="true"/>
android:singleLine="true"
app:baseColor="?android:textColorPrimary"
app:floatingLabel="normal"
app:floatingLabelText="@string/consumer_key"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/consumer_secret"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<EditText
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/consumer_secret"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/consumer_secret"
android:inputType="text|textVisiblePassword"
android:singleLine="true"/>
android:singleLine="true"
app:baseColor="?android:textColorPrimary"
app:floatingLabel="normal"
app:floatingLabelText="@string/consumer_secret"/>
</LinearLayout>

View File

@ -55,7 +55,7 @@
android:paddingLeft="@dimen/element_spacing_small"
android:paddingRight="@dimen/element_spacing_small"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorSecondary"
android:textColor="?android:textColorPrimary"
tools:text="Line 1\nLine 2\nLine 3"/>
</LinearLayout>
@ -88,7 +88,7 @@
android:paddingRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorSecondary"
android:textColor="?android:textColorPrimary"
tools:text="Zhengzhou China"/>
</LinearLayout>
@ -122,7 +122,7 @@
android:paddingRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorSecondary"
android:textColor="?android:textColorPrimary"
tools:text="mariotaku.org"/>
</LinearLayout>
@ -155,7 +155,7 @@
android:paddingRight="@dimen/element_spacing_small"
android:singleLine="true"
android:textAppearance="?android:textAppearanceSmall"
android:textColor="?android:textColorSecondary"
android:textColor="?android:textColorPrimary"
tools:text="July 18, 2009 17:00 (20 tweets per day)"/>
</LinearLayout>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<android.support.v7.widget.CardView
android:id="@+id/card"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing_normal"
app:cardBackgroundColor="?cardItemBackgroundColor"
app:cardCornerRadius="@dimen/corner_radius_card"
app:cardElevation="@dimen/elevation_card">
<include layout="@layout/layout_user_list_details_common"/>
</android.support.v7.widget.CardView>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<org.mariotaku.twidere.view.ColorLabelLinearLayout
android:id="@+id/user_list_details"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:splitMotionEvents="false"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<LinearLayout
android:id="@+id/name_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical">
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/list_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/created_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout>
<org.mariotaku.twidere.view.ShapedImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
tools:src="@drawable/ic_profile_image_default"
android:layout_width="@dimen/icon_size_card_details"
android:layout_height="@dimen/icon_size_card_details"
android:layout_weight="0"
android:contentDescription="@string/profile_image"
android:foreground="?android:selectableItemBackground"
android:scaleType="fitCenter"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="?android:dividerVertical"/>
<org.mariotaku.twidere.view.themed.ThemedTextView
android:id="@+id/description"
tools:text="@string/sample_status_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/element_spacing_normal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>
</org.mariotaku.twidere.view.ColorLabelLinearLayout>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<android.support.v7.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="?cardItemBackgroundColor"
app:cardCornerRadius="0dp"
app:cardElevation="0dp"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<include layout="@layout/layout_user_list_details_common"/>
</android.support.v7.widget.CardView>

View File

@ -1,9 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@id/add_account"
android:icon="@drawable/ic_action_add"
android:showAsAction="ifRoom"
app:showAsAction="ifRoom"
android:title="@string/add_account"/>
</menu>

View File

@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@id/open_in_browser"
android:icon="@drawable/ic_action_web"
android:showAsAction="always"
android:title="@string/browser_sign_in"/>
android:title="@string/browser_sign_in"
app:showAsAction="always"/>
<item
android:id="@id/edit_api"
android:icon="@drawable/ic_action_server"
android:showAsAction="always"
android:title="@string/edit_api"/>
android:title="@string/edit_api"
app:showAsAction="always"/>
<item
android:id="@id/settings"
android:icon="@drawable/ic_action_settings"
android:showAsAction="always"
android:title="@string/settings"/>
android:title="@string/settings"
app:showAsAction="always"/>
</menu>

View File

@ -3,10 +3,12 @@
<style name="Widget.CardActionButton" parent="Widget.Base.ImageButton">
<item name="android:background">?android:selectableItemBackgroundBorderless</item>
<item name="android:color">?android:textColorSecondary</item>
</style>
<style name="Widget.Light.CardActionButton" parent="Widget.Base.ImageButton">
<item name="android:background">?android:selectableItemBackgroundBorderless</item>
<item name="android:color">?android:textColorSecondary</item>
</style>
<style name="Widget.ProfileImage.Large">

View File

@ -65,7 +65,6 @@
<!-- Dimensions for compose dialog -->
<dimen name="compose_min_width">400dp</dimen>
<dimen name="compose_min_height">240dp</dimen>
<!-- Dimensions for Tab indicator -->
<dimen name="tab_item_minwidth_vpi">64dp</dimen>

View File

@ -106,10 +106,12 @@
<style name="Widget.CardActionButton" parent="Widget.Base.ImageButton">
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:color">?android:textColorSecondary</item>
</style>
<style name="Widget.Light.CardActionButton" parent="Widget.Base.Light.ImageButton">
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:color">?android:textColorSecondary</item>
</style>

View File

@ -167,7 +167,7 @@
</style>
<style name="Theme.Twidere.Dark.Dialog" parent="Theme.Compat.Base.Dialog">
<style name="Theme.Twidere.Dark.Dialog" parent="Theme.Base.Dialog">
<!-- Custom view styles -->
@ -184,7 +184,7 @@
<item name="messageBubbleColor">@color/message_bubble_color_dark</item>
</style>
<style name="Theme.Twidere.Light.Dialog" parent="Theme.Compat.Base.Light.Dialog">
<style name="Theme.Twidere.Light.Dialog" parent="Theme.Base.Light.Dialog">
<!-- Custom view styles -->