parent
54eeaf30ae
commit
8c6802a9b2
|
@ -354,6 +354,21 @@
|
|||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.support.HomeActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.support.AccountsManagerActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/accounts"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="org.mariotaku.twidere.ACCOUNTS"/>
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.support.HomeActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="org.mariotaku.gallery3d.ImageViewerGLActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
|
|
|
@ -1,517 +0,0 @@
|
|||
package com.scvngr.levelup.views.gallery;
|
||||
|
||||
/*
|
||||
* Modified from the Android Source code. The example for how to do so was viewed here:
|
||||
* http://www.inter-fuser.com/2010/01/android-coverflow-widget.html
|
||||
*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.SpinnerAdapter;
|
||||
|
||||
/**
|
||||
* An abstract base class for spinner widgets. SDK users will probably not need
|
||||
* to use this class.
|
||||
*
|
||||
* CHECKSTYLE:OFF Android Attr
|
||||
*
|
||||
* @attr ref android.R.styleable#AbsSpinner_entries CHECKSTYLE:ON
|
||||
*/
|
||||
public abstract class AbsSpinner extends AdapterView<SpinnerAdapter> {
|
||||
|
||||
SpinnerAdapter mAdapter;
|
||||
|
||||
int mHeightMeasureSpec;
|
||||
int mWidthMeasureSpec;
|
||||
boolean mBlockLayoutRequests;
|
||||
int mSelectionLeftPadding = 0;
|
||||
int mSelectionTopPadding = 0;
|
||||
int mSelectionRightPadding = 0;
|
||||
int mSelectionBottomPadding = 0;
|
||||
Rect mSpinnerPadding = new Rect();
|
||||
View mSelectedView = null;
|
||||
Interpolator mInterpolator;
|
||||
|
||||
RecycleBin mRecycler = new RecycleBin();
|
||||
private DataSetObserver mDataSetObserver;
|
||||
|
||||
/*
|
||||
* Temporary frame to hold a child View's frame rectangle.
|
||||
*/
|
||||
private Rect mTouchFrame;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param context the context to inflate into
|
||||
*/
|
||||
public AbsSpinner(final Context context) {
|
||||
super(context);
|
||||
initAbsSpinner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for xml inflation.
|
||||
*
|
||||
* @param context the context to inflate into
|
||||
* @param attrs the xml attrs
|
||||
*/
|
||||
public AbsSpinner(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for xml inflation.
|
||||
*
|
||||
* @param context the context to inflate into
|
||||
* @param attrs the xml attrs
|
||||
* @param defStyle the default style resource
|
||||
*/
|
||||
public AbsSpinner(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
initAbsSpinner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SpinnerAdapter getAdapter() {
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getCount() {
|
||||
return mItemCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View getSelectedView() {
|
||||
if (mItemCount > 0 && mSelectedPosition >= 0)
|
||||
return getChildAt(mSelectedPosition - mFirstPosition);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(final Parcelable state) {
|
||||
final SavedState ss = (SavedState) state;
|
||||
|
||||
super.onRestoreInstanceState(ss.getSuperState());
|
||||
|
||||
if (ss.selectedId >= 0) {
|
||||
mDataChanged = true;
|
||||
mNeedSync = true;
|
||||
mSyncRowId = ss.selectedId;
|
||||
mSyncPosition = ss.position;
|
||||
mSyncMode = SYNC_SELECTED_POSITION;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Parcelable onSaveInstanceState() {
|
||||
final Parcelable superState = super.onSaveInstanceState();
|
||||
final SavedState ss = new SavedState(superState);
|
||||
ss.selectedId = getSelectedItemId();
|
||||
if (ss.selectedId >= 0) {
|
||||
ss.position = getSelectedItemPosition();
|
||||
} else {
|
||||
ss.position = INVALID_POSITION;
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a point to a position in the list.
|
||||
*
|
||||
* @param x X in local coordinate
|
||||
* @param y Y in local coordinate
|
||||
* @return The position of the item which contains the specified point, or
|
||||
* {@link #INVALID_POSITION} if the point does not intersect an
|
||||
* item.
|
||||
*/
|
||||
public final int pointToPosition(final int x, final int y) {
|
||||
Rect frame = mTouchFrame;
|
||||
if (frame == null) {
|
||||
mTouchFrame = new Rect();
|
||||
frame = mTouchFrame;
|
||||
}
|
||||
|
||||
final int count = getChildCount();
|
||||
for (int i = count - 1; i >= 0; i--) {
|
||||
final View child = getChildAt(i);
|
||||
if (child.getVisibility() == View.VISIBLE) {
|
||||
child.getHitRect(frame);
|
||||
if (frame.contains(x, y)) return mFirstPosition + i;
|
||||
}
|
||||
}
|
||||
return INVALID_POSITION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to prevent spamming ourselves with layout requests as we place
|
||||
* views.
|
||||
*
|
||||
* @see android.view.View#requestLayout()
|
||||
*/
|
||||
@Override
|
||||
public final void requestLayout() {
|
||||
if (!mBlockLayoutRequests) {
|
||||
super.requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Adapter is used to provide the data which backs this Spinner. It also
|
||||
* provides methods to transform spinner items based on their position
|
||||
* relative to the selected item.
|
||||
*
|
||||
* @param adapter The SpinnerAdapter to use for this Spinner
|
||||
*/
|
||||
// CHECKSTYLE:OFF unmodified
|
||||
@Override
|
||||
public void setAdapter(final SpinnerAdapter adapter) {
|
||||
if (null != mAdapter) {
|
||||
mAdapter.unregisterDataSetObserver(mDataSetObserver);
|
||||
resetList();
|
||||
}
|
||||
|
||||
mAdapter = adapter;
|
||||
|
||||
mOldSelectedPosition = INVALID_POSITION;
|
||||
mOldSelectedRowId = INVALID_ROW_ID;
|
||||
|
||||
if (mAdapter != null) {
|
||||
mOldItemCount = mItemCount;
|
||||
mItemCount = mAdapter.getCount();
|
||||
checkFocus();
|
||||
|
||||
mDataSetObserver = new AdapterDataSetObserver();
|
||||
mAdapter.registerDataSetObserver(mDataSetObserver);
|
||||
|
||||
final int position = mItemCount > 0 ? 0 : INVALID_POSITION;
|
||||
|
||||
setSelectedPositionInt(position);
|
||||
setNextSelectedPositionInt(position);
|
||||
|
||||
if (mItemCount == 0) {
|
||||
// Nothing selected
|
||||
checkSelectionChanged();
|
||||
}
|
||||
|
||||
} else {
|
||||
checkFocus();
|
||||
resetList();
|
||||
// Nothing selected
|
||||
checkSelectionChanged();
|
||||
}
|
||||
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
// CHECKSTYLE:ON
|
||||
|
||||
@Override
|
||||
public final void setSelection(final int position) {
|
||||
setNextSelectedPositionInt(position);
|
||||
requestLayout();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump directly to a specific item in the adapter data.
|
||||
*
|
||||
* @param position the position to select
|
||||
* @param animate if true, animate the selection
|
||||
*/
|
||||
public final void setSelection(final int position, final boolean animate) {
|
||||
// Animate only if requested position is already on screen somewhere
|
||||
final boolean shouldAnimate = animate && mFirstPosition <= position
|
||||
&& position <= mFirstPosition + getChildCount() - 1;
|
||||
setSelectionInt(position, shouldAnimate);
|
||||
}
|
||||
|
||||
// CHECKSTYLE:OFF overridden in gallery
|
||||
@Override
|
||||
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
||||
// CHECKSTYLE:ON
|
||||
return new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see android.view.View#measure(int, int)
|
||||
*
|
||||
* Figure out the dimensions of this Spinner. The width comes from the
|
||||
* widthMeasureSpec as Spinnners can't have their width set to
|
||||
* UNSPECIFIED. The height is based on the height of the selected item
|
||||
* plus padding.
|
||||
*/
|
||||
// CHECKSTYLE:OFF unmodified
|
||||
@Override
|
||||
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
|
||||
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int widthSize;
|
||||
int heightSize;
|
||||
|
||||
mSpinnerPadding.left = getPaddingLeft() > mSelectionLeftPadding ? getPaddingLeft() : mSelectionLeftPadding;
|
||||
mSpinnerPadding.top = getPaddingTop() > mSelectionTopPadding ? getPaddingTop() : mSelectionTopPadding;
|
||||
mSpinnerPadding.right = getPaddingRight() > mSelectionRightPadding ? getPaddingRight() : mSelectionRightPadding;
|
||||
mSpinnerPadding.bottom = getPaddingBottom() > mSelectionBottomPadding ? getPaddingBottom()
|
||||
: mSelectionBottomPadding;
|
||||
|
||||
if (mDataChanged) {
|
||||
handleDataChanged();
|
||||
}
|
||||
|
||||
int preferredHeight = 0;
|
||||
int preferredWidth = 0;
|
||||
boolean needsMeasuring = true;
|
||||
|
||||
final int selectedPosition = getSelectedItemPosition();
|
||||
if (selectedPosition >= 0 && mAdapter != null) {
|
||||
// Try looking in the recycler. (Maybe we were measured once
|
||||
// already)
|
||||
View view = mRecycler.get(selectedPosition);
|
||||
if (view == null) {
|
||||
// Make a new one
|
||||
view = mAdapter.getView(selectedPosition, null, this);
|
||||
}
|
||||
|
||||
if (view != null) {
|
||||
// Put in recycler for re-measuring and/or layout
|
||||
mRecycler.put(selectedPosition, view);
|
||||
}
|
||||
|
||||
if (view != null) {
|
||||
if (view.getLayoutParams() == null) {
|
||||
mBlockLayoutRequests = true;
|
||||
view.setLayoutParams(generateDefaultLayoutParams());
|
||||
mBlockLayoutRequests = false;
|
||||
}
|
||||
measureChild(view, widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
preferredHeight = getChildHeight(view) + mSpinnerPadding.top + mSpinnerPadding.bottom;
|
||||
preferredWidth = getChildWidth(view) + mSpinnerPadding.left + mSpinnerPadding.right;
|
||||
|
||||
needsMeasuring = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (needsMeasuring) {
|
||||
// No views -- just use padding
|
||||
preferredHeight = mSpinnerPadding.top + mSpinnerPadding.bottom;
|
||||
if (widthMode == MeasureSpec.UNSPECIFIED) {
|
||||
preferredWidth = mSpinnerPadding.left + mSpinnerPadding.right;
|
||||
}
|
||||
}
|
||||
|
||||
preferredHeight = Math.max(preferredHeight, getSuggestedMinimumHeight());
|
||||
preferredWidth = Math.max(preferredWidth, getSuggestedMinimumWidth());
|
||||
|
||||
heightSize = resolveSize(preferredHeight, heightMeasureSpec);
|
||||
widthSize = resolveSize(preferredWidth, widthMeasureSpec);
|
||||
|
||||
setMeasuredDimension(widthSize, heightSize);
|
||||
mHeightMeasureSpec = heightMeasureSpec;
|
||||
mWidthMeasureSpec = widthMeasureSpec;
|
||||
}
|
||||
|
||||
// CHECKSTYLE:ON
|
||||
|
||||
/**
|
||||
* Common code for different constructor flavors.
|
||||
*/
|
||||
private void initAbsSpinner() {
|
||||
setFocusable(true);
|
||||
setWillNotDraw(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the height of the child view passed.
|
||||
*
|
||||
* @param child the child to get the height of
|
||||
* @return the child's measured height
|
||||
*/
|
||||
final int getChildHeight(final View child) {
|
||||
return child.getMeasuredHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the width of the child view passed.
|
||||
*
|
||||
* @param child the child to get the width of
|
||||
* @return the child's measure width
|
||||
*/
|
||||
final int getChildWidth(final View child) {
|
||||
return child.getMeasuredWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
final void handleDataChanged() {
|
||||
/*
|
||||
* FIXME -- this is called from both measure and layout. This is
|
||||
* harmless right now, but we don't want to do redundant work if this
|
||||
* gets more complicated
|
||||
*/
|
||||
super.handleDataChanged();
|
||||
}
|
||||
|
||||
// CHECKSTYLE:OFF unmodified
|
||||
abstract void layout(int delta, boolean animate);
|
||||
|
||||
// CHECKSTYLE:ON
|
||||
|
||||
/**
|
||||
* Recycle all child views.
|
||||
*/
|
||||
final void recycleAllViews() {
|
||||
final int childCount = getChildCount();
|
||||
final AbsSpinner.RecycleBin recycleBin = mRecycler;
|
||||
|
||||
// All views go in recycler
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
final View v = getChildAt(i);
|
||||
final int index = mFirstPosition + i;
|
||||
recycleBin.put(index, v);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear out all children from the list.
|
||||
*/
|
||||
final void resetList() {
|
||||
mDataChanged = false;
|
||||
mNeedSync = false;
|
||||
|
||||
removeAllViewsInLayout();
|
||||
mOldSelectedPosition = INVALID_POSITION;
|
||||
mOldSelectedRowId = INVALID_ROW_ID;
|
||||
|
||||
setSelectedPositionInt(INVALID_POSITION);
|
||||
setNextSelectedPositionInt(INVALID_POSITION);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the item at the supplied position selected.
|
||||
*
|
||||
* @param position Position to select
|
||||
* @param animate Should the transition be animated
|
||||
*
|
||||
*/
|
||||
final void setSelectionInt(final int position, final boolean animate) {
|
||||
if (position != mOldSelectedPosition) {
|
||||
mBlockLayoutRequests = true;
|
||||
final int delta = position - mSelectedPosition;
|
||||
setNextSelectedPositionInt(position);
|
||||
layout(delta, animate);
|
||||
mBlockLayoutRequests = false;
|
||||
}
|
||||
}
|
||||
|
||||
class RecycleBin {
|
||||
private final SparseArray<View> mScrapHeap = new SparseArray<View>();
|
||||
|
||||
public void put(final int position, final View v) {
|
||||
mScrapHeap.put(position, v);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
final SparseArray<View> scrapHeap = mScrapHeap;
|
||||
final int count = scrapHeap.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View view = scrapHeap.valueAt(i);
|
||||
if (view != null) {
|
||||
removeDetachedView(view, true);
|
||||
}
|
||||
}
|
||||
scrapHeap.clear();
|
||||
}
|
||||
|
||||
View get(final int position) {
|
||||
// System.out.print("Looking for " + position);
|
||||
final View result = mScrapHeap.get(position);
|
||||
if (result != null) {
|
||||
// System.out.println(" HIT");
|
||||
mScrapHeap.delete(position);
|
||||
} else {
|
||||
// System.out.println(" MISS");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
View peek(final int position) {
|
||||
// System.out.print("Looking for " + position);
|
||||
return mScrapHeap.get(position);
|
||||
}
|
||||
}
|
||||
|
||||
// CHECKSTYLE:ON
|
||||
|
||||
// CHECKSTYLE:OFF unmodified
|
||||
static class SavedState extends BaseSavedState {
|
||||
long selectedId;
|
||||
int position;
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
|
||||
@Override
|
||||
public SavedState createFromParcel(final Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedState[] newArray(final int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor called from {@link #CREATOR}
|
||||
*/
|
||||
private SavedState(final Parcel in) {
|
||||
super(in);
|
||||
selectedId = in.readLong();
|
||||
position = in.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor called from {@link AbsSpinner#onSaveInstanceState()}
|
||||
*/
|
||||
SavedState(final Parcelable superState) {
|
||||
super(superState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AbsSpinner.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " selectedId="
|
||||
+ selectedId + " position=" + position + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(final Parcel out, final int flags) {
|
||||
super.writeToParcel(out, flags);
|
||||
out.writeLong(selectedId);
|
||||
out.writeInt(position);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -139,7 +139,7 @@ public class EdgeEffect {
|
|||
* for the EdgeEffect
|
||||
*/
|
||||
public EdgeEffect(final Context context) {
|
||||
final int theme_color = ThemeUtils.getUserThemeColor(context);
|
||||
final int theme_color = ThemeUtils.getUserAccentColor(context);
|
||||
mEdge = new Drawable(context, R.drawable.overscroll_edge);
|
||||
mEdge.setColorFilter(theme_color, PorterDuff.Mode.SRC_ATOP);
|
||||
mGlow = new Drawable(context, R.drawable.overscroll_glow);
|
||||
|
|
|
@ -28,10 +28,7 @@ package org.mariotaku.twidere;
|
|||
public interface Constants extends TwidereConstants {
|
||||
|
||||
public static final String DATABASES_NAME = "twidere.sqlite";
|
||||
public static final int DATABASES_VERSION = 67;
|
||||
|
||||
public static final String GOOGLE_MAPS_API_KEY_RELEASE = "0kjPwJOe_zwYjzGc9uYak7vhm_Sf3eob-2L3Xzw";
|
||||
public static final String GOOGLE_MAPS_API_KEY_DEBUG = "0kjPwJOe_zwY9p6kT-kygu4mxwysyOOpfkaXqTA";
|
||||
public static final int DATABASES_VERSION = 68;
|
||||
|
||||
public static final int MENU_GROUP_STATUS_EXTENSION = 10;
|
||||
public static final int MENU_GROUP_COMPOSE_EXTENSION = 11;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.mariotaku.twidere.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
|
@ -41,7 +40,7 @@ public class BaseActivity extends BaseThemedActivity implements Constants {
|
|||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
return ThemeUtils.getUserThemeColor(this);
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,7 +54,7 @@ public class MainActivity extends Activity implements Constants {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
final int themeResource = ThemeUtils.getThemeResource(this);
|
||||
final int accentColor = ThemeUtils.isColoredActionBar(themeResource) ? ThemeUtils.getUserThemeColor(this) : 0;
|
||||
final int accentColor = ThemeUtils.isColoredActionBar(themeResource) ? ThemeUtils.getUserAccentColor(this) : 0;
|
||||
final int backgroundAlpha = ThemeUtils.isTransparentBackground(themeResource) ? ThemeUtils
|
||||
.getUserThemeBackgroundAlpha(this) : 0xFF;
|
||||
ThemeUtils.notifyStatusBarColorChanged(this, themeResource, accentColor, backgroundAlpha);
|
||||
|
|
|
@ -179,7 +179,7 @@ public class SettingsActivity extends BasePreferenceActivity {
|
|||
mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE);
|
||||
mCompactCards = mPreferences.getBoolean(KEY_COMPACT_CARDS, false);
|
||||
mPlainListStyle = mPreferences.getBoolean(KEY_PLAIN_LIST_STYLE, false);
|
||||
mCurrentThemeColor = ThemeUtils.getUserThemeColor(this);
|
||||
mCurrentThemeColor = ThemeUtils.getUserAccentColor(this);
|
||||
mCurrentThemeFontFamily = getThemeFontFamily();
|
||||
mCurrentThemeBackgroundAlpha = getThemeBackgroundAlpha();
|
||||
mCurrentIsDarkDrawerEnabled = isDarkDrawerEnabled();
|
||||
|
@ -198,7 +198,7 @@ public class SettingsActivity extends BasePreferenceActivity {
|
|||
return mCompactCards != mPreferences.getBoolean(KEY_COMPACT_CARDS, false)
|
||||
|| mPlainListStyle != mPreferences.getBoolean(KEY_PLAIN_LIST_STYLE, false)
|
||||
|| getThemeResourceId() != getCurrentThemeResourceId()
|
||||
|| ThemeUtils.getUserThemeColor(this) != mCurrentThemeColor
|
||||
|| ThemeUtils.getUserAccentColor(this) != mCurrentThemeColor
|
||||
|| !CompareUtils.objectEquals(getThemeFontFamily(), mCurrentThemeFontFamily)
|
||||
|| getThemeBackgroundAlpha() != mCurrentThemeBackgroundAlpha
|
||||
|| isDarkDrawerEnabled() != mCurrentIsDarkDrawerEnabled;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package org.mariotaku.twidere.activity.support;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.fragment.iface.IBaseFragment;
|
||||
import org.mariotaku.twidere.fragment.support.AccountsManagerFragment;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/10/26.
|
||||
*/
|
||||
public class AccountsManagerActivity extends BaseSupportActivity {
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_HOME: {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
setContentView(R.layout.activity_content_fragment);
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
final FragmentTransaction ft = fm.beginTransaction();
|
||||
ft.replace(R.id.content_fragment, new AccountsManagerFragment());
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fitSystemWindows(Rect insets) {
|
||||
super.fitSystemWindows(insets);
|
||||
final FragmentManager fm = getSupportFragmentManager();
|
||||
final Fragment f = fm.findFragmentById(R.id.content_fragment);
|
||||
if (f instanceof IBaseFragment) {
|
||||
((IBaseFragment) f).requestFitSystemWindows();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,7 +52,7 @@ public class BaseSupportActivity extends BaseSupportThemedActivity implements Co
|
|||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
return ThemeUtils.getUserThemeColor(this, getThemeResourceId());
|
||||
return ThemeUtils.getUserAccentColor(this, getThemeResourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.mariotaku.twidere.activity.support;
|
|||
|
||||
import android.app.ActionBar;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.NavUtils;
|
||||
|
@ -153,11 +152,8 @@ public abstract class BaseSupportThemedActivity extends FragmentActivity impleme
|
|||
super.onTitleChanged(title, color);
|
||||
final int themeResId = getCurrentThemeResourceId();
|
||||
final int themeColor = getThemeColor(), contrastColor = Utils.getContrastYIQ(themeColor, 192);
|
||||
if (ThemeUtils.isColoredActionBar(themeResId)) {
|
||||
if (!ThemeUtils.isDarkTheme(themeResId)) {
|
||||
builder.setSpan(new ForegroundColorSpan(contrastColor), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else {
|
||||
final int titleColor = ThemeUtils.isLightActionBar(themeResId) ? Color.BLACK : Color.WHITE;
|
||||
builder.setSpan(new ForegroundColorSpan(titleColor), 0, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import android.provider.MediaStore;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -62,7 +63,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
@ -70,10 +70,6 @@ import android.widget.TextView.OnEditorActionListener;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.nostra13.universalimageloader.utils.IoUtils;
|
||||
import com.scvngr.levelup.views.gallery.AdapterView;
|
||||
import com.scvngr.levelup.views.gallery.AdapterView.OnItemClickListener;
|
||||
import com.scvngr.levelup.views.gallery.AdapterView.OnItemLongClickListener;
|
||||
import com.scvngr.levelup.views.gallery.Gallery;
|
||||
import com.twitter.Extractor;
|
||||
|
||||
import org.mariotaku.dynamicgridview.DraggableArrayAdapter;
|
||||
|
@ -81,7 +77,7 @@ import org.mariotaku.menucomponent.widget.MenuBar;
|
|||
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarListener;
|
||||
import org.mariotaku.menucomponent.widget.PopupMenu;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.BaseArrayAdapter;
|
||||
import org.mariotaku.twidere.adapter.ArrayRecyclerAdapter;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.model.Account;
|
||||
|
@ -149,8 +145,7 @@ import static org.mariotaku.twidere.util.Utils.showErrorMessage;
|
|||
import static org.mariotaku.twidere.util.Utils.showMenuItemToast;
|
||||
|
||||
public class ComposeActivity extends BaseSupportDialogActivity implements TextWatcher, LocationListener,
|
||||
MenuBarListener, OnClickListener, OnEditorActionListener, OnItemClickListener, OnItemLongClickListener,
|
||||
OnLongClickListener {
|
||||
MenuBarListener, OnClickListener, OnEditorActionListener, OnLongClickListener {
|
||||
|
||||
private static final String FAKE_IMAGE_LINK = "https://www.example.com/fake_image.jpg";
|
||||
|
||||
|
@ -177,13 +172,11 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
private TextView mTitleView, mSubtitleView;
|
||||
private GridView mMediasPreviewGrid;
|
||||
|
||||
private MenuBar mBottomMenuBar, mActionMenuBar;
|
||||
private MenuBar mMenuBar;
|
||||
private IColorLabelView mColorIndicator;
|
||||
private EditText mEditText;
|
||||
private ProgressBar mProgress;
|
||||
private Gallery mAccountSelector;
|
||||
private View mAccountSelectorDivider, mBottomSendDivider;
|
||||
private View mBottomMenuContainer;
|
||||
// private RecyclerView mAccountSelector;
|
||||
private View mSendView, mBottomSendView;
|
||||
private StatusTextCountView mSendTextCountView, mBottomSendTextCountView;
|
||||
|
||||
|
@ -219,7 +212,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
@Override
|
||||
public int getThemeColor() {
|
||||
return ThemeUtils.getUserThemeColor(this);
|
||||
return ThemeUtils.getUserAccentColor(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -433,13 +426,9 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mTitleView = (TextView) findViewById(R.id.actionbar_title);
|
||||
mSubtitleView = (TextView) findViewById(R.id.actionbar_subtitle);
|
||||
mMediasPreviewGrid = (GridView) findViewById(R.id.medias_thumbnail_preview);
|
||||
mBottomMenuBar = (MenuBar) findViewById(R.id.bottom_menu);
|
||||
mBottomMenuContainer = findViewById(R.id.bottom_menu_container);
|
||||
mActionMenuBar = (MenuBar) findViewById(R.id.action_menu);
|
||||
mMenuBar = (MenuBar) findViewById(R.id.menu_bar);
|
||||
mProgress = (ProgressBar) findViewById(R.id.actionbar_progress_indeterminate);
|
||||
mAccountSelectorDivider = findViewById(R.id.account_selector_divider);
|
||||
mBottomSendDivider = findViewById(R.id.bottom_send_divider);
|
||||
mAccountSelector = (Gallery) findViewById(R.id.account_selector);
|
||||
// mAccountSelector = (RecyclerView) findViewById(R.id.account_selector);
|
||||
final View composeActionBar = findViewById(R.id.compose_actionbar);
|
||||
final View composeBottomBar = findViewById(R.id.compose_bottombar);
|
||||
mSendView = composeActionBar.findViewById(R.id.send);
|
||||
|
@ -462,23 +451,23 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
if (isSingleAccount()) return;
|
||||
final boolean selected = !view.isActivated();
|
||||
final Account account = mAccountSelectorAdapter.getItem(position);
|
||||
mAccountSelectorAdapter.setAccountSelected(account.account_id, selected);
|
||||
mSendAccountIds = mAccountSelectorAdapter.getSelectedAccountIds();
|
||||
updateAccountSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final Account account = mAccountSelectorAdapter.getItem(position);
|
||||
final String displayName = getDisplayName(this, account.account_id, account.name, account.screen_name);
|
||||
showMenuItemToast(view, displayName, true);
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
// if (isSingleAccount()) return;
|
||||
// final boolean selected = !view.isActivated();
|
||||
// final Account account = mAccountSelectorAdapter.getItem(position);
|
||||
// mAccountSelectorAdapter.setAccountSelected(account.account_id, selected);
|
||||
// mSendAccountIds = mAccountSelectorAdapter.getSelectedAccountIds();
|
||||
// updateAccountSelection();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
// final Account account = mAccountSelectorAdapter.getItem(position);
|
||||
// final String displayName = getDisplayName(this, account.account_id, account.name, account.screen_name);
|
||||
// showMenuItemToast(view, displayName, true);
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(final Location location) {
|
||||
|
@ -595,17 +584,15 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
finish();
|
||||
return;
|
||||
}
|
||||
mBottomMenuBar.setIsBottomBar(true);
|
||||
mBottomMenuBar.setMenuBarListener(this);
|
||||
mActionMenuBar.setMenuBarListener(this);
|
||||
mMenuBar.setIsBottomBar(true);
|
||||
mMenuBar.setMenuBarListener(this);
|
||||
mEditText.setOnEditorActionListener(mPreferences.getBoolean(KEY_QUICK_SEND, false) ? this : null);
|
||||
mEditText.addTextChangedListener(this);
|
||||
mAccountSelectorAdapter = new AccountSelectorAdapter(this);
|
||||
mAccountSelector.setAdapter(mAccountSelectorAdapter);
|
||||
mAccountSelector.setOnItemClickListener(this);
|
||||
mAccountSelector.setOnItemLongClickListener(this);
|
||||
mAccountSelector.setScrollAfterItemClickEnabled(false);
|
||||
mAccountSelector.setScrollRightSpacingEnabled(false);
|
||||
// mAccountSelector.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||
// mAccountSelector.setAdapter(mAccountSelectorAdapter);
|
||||
// mAccountSelector.setOnItemClickListener(this);
|
||||
// mAccountSelector.setOnItemLongClickListener(this);
|
||||
|
||||
mMediaPreviewAdapter = new MediaPreviewAdapter(this);
|
||||
mMediasPreviewGrid.setAdapter(mMediaPreviewAdapter);
|
||||
|
@ -638,9 +625,9 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
handleDefaultIntent(intent);
|
||||
}
|
||||
if (mSendAccountIds == null || mSendAccountIds.length == 0) {
|
||||
final long[] ids_in_prefs = ArrayUtils.parseLongArray(
|
||||
final long[] idsInPrefs = ArrayUtils.parseLongArray(
|
||||
mPreferences.getString(KEY_COMPOSE_ACCOUNTS, null), ',');
|
||||
final long[] intersection = ArrayUtils.intersection(ids_in_prefs, mAccountIds);
|
||||
final long[] intersection = ArrayUtils.intersection(idsInPrefs, mAccountIds);
|
||||
mSendAccountIds = intersection.length > 0 ? intersection : mAccountIds;
|
||||
}
|
||||
mOriginalText = ParseUtils.parseString(mEditText.getText());
|
||||
|
@ -649,52 +636,18 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
setTitle(R.string.compose);
|
||||
}
|
||||
|
||||
final boolean useBottomMenu = isSingleAccount() || !mBottomSendButton;
|
||||
if (useBottomMenu) {
|
||||
mBottomMenuBar.inflate(R.menu.menu_compose);
|
||||
} else {
|
||||
mActionMenuBar.inflate(R.menu.menu_compose);
|
||||
}
|
||||
mBottomMenuBar.setVisibility(useBottomMenu ? View.VISIBLE : View.GONE);
|
||||
mActionMenuBar.setVisibility(useBottomMenu ? View.GONE : View.VISIBLE);
|
||||
mMenuBar.inflate(R.menu.menu_compose);
|
||||
mSendView.setVisibility(mBottomSendButton ? View.GONE : View.VISIBLE);
|
||||
mBottomSendDivider.setVisibility(mBottomSendButton ? View.VISIBLE : View.GONE);
|
||||
mBottomSendView.setVisibility(mBottomSendButton ? View.VISIBLE : View.GONE);
|
||||
mSendView.setOnClickListener(this);
|
||||
mBottomSendView.setOnClickListener(this);
|
||||
mSendView.setOnLongClickListener(this);
|
||||
mBottomSendView.setOnLongClickListener(this);
|
||||
final Menu menu = mBottomMenuBar.getMenu(), actionBarMenu = mActionMenuBar.getMenu();
|
||||
final Menu showingMenu = mBottomSendButton ? actionBarMenu : menu;
|
||||
if (showingMenu != null) {
|
||||
final Intent compose_extensions_intent = new Intent(INTENT_ACTION_EXTENSION_COMPOSE);
|
||||
addIntentToMenu(this, showingMenu, compose_extensions_intent, MENU_GROUP_COMPOSE_EXTENSION);
|
||||
final Intent image_extensions_intent = new Intent(INTENT_ACTION_EXTENSION_EDIT_IMAGE);
|
||||
addIntentToMenu(this, showingMenu, image_extensions_intent, MENU_GROUP_IMAGE_EXTENSION);
|
||||
}
|
||||
final LinearLayout.LayoutParams bottomMenuContainerParams = (LinearLayout.LayoutParams) mBottomMenuContainer
|
||||
.getLayoutParams();
|
||||
final LinearLayout.LayoutParams accountSelectorParams = (LinearLayout.LayoutParams) mAccountSelector
|
||||
.getLayoutParams();
|
||||
final int maxItemsShown;
|
||||
final Resources res = getResources();
|
||||
if (isSingleAccount()) {
|
||||
accountSelectorParams.weight = 0;
|
||||
accountSelectorParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
bottomMenuContainerParams.weight = 1;
|
||||
bottomMenuContainerParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
maxItemsShown = res.getInteger(R.integer.max_compose_menu_buttons_bottom_singleaccount);
|
||||
mAccountSelectorDivider.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
accountSelectorParams.weight = 1;
|
||||
accountSelectorParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
bottomMenuContainerParams.weight = 0;
|
||||
bottomMenuContainerParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
maxItemsShown = res.getInteger(R.integer.max_compose_menu_buttons_bottom);
|
||||
mAccountSelectorDivider.setVisibility(mBottomSendButton ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
mBottomMenuContainer.setLayoutParams(bottomMenuContainerParams);
|
||||
mBottomMenuBar.setMaxItemsShown(maxItemsShown);
|
||||
final Menu menu = mMenuBar.getMenu();
|
||||
final Intent composeExtensionsIntent = new Intent(INTENT_ACTION_EXTENSION_COMPOSE);
|
||||
addIntentToMenu(this, menu, composeExtensionsIntent, MENU_GROUP_COMPOSE_EXTENSION);
|
||||
final Intent imageExtensionsIntent = new Intent(INTENT_ACTION_EXTENSION_EDIT_IMAGE);
|
||||
addIntentToMenu(this, menu, imageExtensionsIntent, MENU_GROUP_IMAGE_EXTENSION);
|
||||
setMenu();
|
||||
updateAccountSelection();
|
||||
updateMediasPreview();
|
||||
|
@ -833,26 +786,32 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
mMentionUser = intent.getParcelableExtra(EXTRA_USER);
|
||||
mInReplyToStatus = intent.getParcelableExtra(EXTRA_STATUS);
|
||||
mInReplyToStatusId = mInReplyToStatus != null ? mInReplyToStatus.id : -1;
|
||||
if (INTENT_ACTION_REPLY.equals(action))
|
||||
return handleReplyIntent(mInReplyToStatus);
|
||||
else if (INTENT_ACTION_QUOTE.equals(action))
|
||||
return handleQuoteIntent(mInReplyToStatus);
|
||||
else if (INTENT_ACTION_EDIT_DRAFT.equals(action)) {
|
||||
mDraftItem = intent.getParcelableExtra(EXTRA_DRAFT);
|
||||
return handleEditDraftIntent(mDraftItem);
|
||||
} else if (INTENT_ACTION_MENTION.equals(action))
|
||||
return handleMentionIntent(mMentionUser);
|
||||
else if (INTENT_ACTION_REPLY_MULTIPLE.equals(action)) {
|
||||
final String[] screenNames = intent.getStringArrayExtra(EXTRA_SCREEN_NAMES);
|
||||
final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
|
||||
final long inReplyToUserId = intent.getLongExtra(EXTRA_IN_REPLY_TO_ID, -1);
|
||||
return handleReplyMultipleIntent(screenNames, accountId, inReplyToUserId);
|
||||
} else if (INTENT_ACTION_COMPOSE_TAKE_PHOTO.equals(action)) {
|
||||
takePhoto();
|
||||
return true;
|
||||
} else if (INTENT_ACTION_COMPOSE_PICK_IMAGE.equals(action)) {
|
||||
pickImage();
|
||||
return true;
|
||||
switch (action) {
|
||||
case INTENT_ACTION_REPLY: {
|
||||
return handleReplyIntent(mInReplyToStatus);
|
||||
}
|
||||
case INTENT_ACTION_QUOTE: {
|
||||
return handleQuoteIntent(mInReplyToStatus);
|
||||
}
|
||||
case INTENT_ACTION_EDIT_DRAFT: {
|
||||
mDraftItem = intent.getParcelableExtra(EXTRA_DRAFT);
|
||||
return handleEditDraftIntent(mDraftItem);
|
||||
}
|
||||
case INTENT_ACTION_MENTION: {
|
||||
return handleMentionIntent(mMentionUser);
|
||||
}
|
||||
case INTENT_ACTION_REPLY_MULTIPLE: {
|
||||
final String[] screenNames = intent.getStringArrayExtra(EXTRA_SCREEN_NAMES);
|
||||
final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
|
||||
final long inReplyToUserId = intent.getLongExtra(EXTRA_IN_REPLY_TO_ID, -1);
|
||||
return handleReplyMultipleIntent(screenNames, accountId, inReplyToUserId);
|
||||
}
|
||||
case INTENT_ACTION_COMPOSE_TAKE_PHOTO: {
|
||||
return takePhoto();
|
||||
}
|
||||
case INTENT_ACTION_COMPOSE_PICK_IMAGE: {
|
||||
return pickImage();
|
||||
}
|
||||
}
|
||||
// Unknown action or no intent extras
|
||||
return false;
|
||||
|
@ -928,10 +887,6 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean isSingleAccount() {
|
||||
return mAccountIds != null && mAccountIds.length == 1;
|
||||
}
|
||||
|
||||
private boolean noReplyContent(final String text) {
|
||||
if (text == null) return true;
|
||||
final String action = getIntent().getAction();
|
||||
|
@ -955,7 +910,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
return true;
|
||||
}
|
||||
|
||||
private void pickImage() {
|
||||
private boolean pickImage() {
|
||||
final Intent intent = new Intent(Intent.ACTION_PICK);
|
||||
intent.setType("image/*");
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
@ -963,7 +918,9 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
startActivityForResult(intent, REQUEST_PICK_IMAGE);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
showErrorMessage(this, null, e, false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setCommonMenu(final Menu menu) {
|
||||
|
@ -986,7 +943,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
itemAttachLocation.setChecked(true);
|
||||
} else {
|
||||
setProgressVisibility(false);
|
||||
mPreferences.edit().putBoolean(KEY_ATTACH_LOCATION, false).commit();
|
||||
mPreferences.edit().putBoolean(KEY_ATTACH_LOCATION, false).apply();
|
||||
itemAttachLocation.setChecked(false);
|
||||
}
|
||||
}
|
||||
|
@ -1037,31 +994,30 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
}
|
||||
|
||||
private void setMenu() {
|
||||
if (mBottomMenuBar == null || mActionMenuBar == null) return;
|
||||
final Menu bottomMenu = mBottomMenuBar.getMenu(), actionMenu = mActionMenuBar.getMenu();
|
||||
if (mMenuBar == null) return;
|
||||
final Menu bottomMenu = mMenuBar.getMenu();
|
||||
setCommonMenu(bottomMenu);
|
||||
setCommonMenu(actionMenu);
|
||||
mActionMenuBar.show();
|
||||
mBottomMenuBar.show();
|
||||
mMenuBar.show();
|
||||
}
|
||||
|
||||
private void setProgressVisibility(final boolean visible) {
|
||||
mProgress.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void takePhoto() {
|
||||
private boolean takePhoto() {
|
||||
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
if (getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
final File cache_dir = getExternalCacheDir();
|
||||
final File file = new File(cache_dir, "tmp_photo_" + System.currentTimeMillis());
|
||||
mTempPhotoUri = Uri.fromFile(file);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, mTempPhotoUri);
|
||||
try {
|
||||
startActivityForResult(intent, REQUEST_TAKE_PHOTO);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
showErrorMessage(this, null, e, false);
|
||||
}
|
||||
if (!getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) return false;
|
||||
final File cache_dir = getExternalCacheDir();
|
||||
final File file = new File(cache_dir, "tmp_photo_" + System.currentTimeMillis());
|
||||
mTempPhotoUri = Uri.fromFile(file);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT, mTempPhotoUri);
|
||||
try {
|
||||
startActivityForResult(intent, REQUEST_TAKE_PHOTO);
|
||||
} catch (final ActivityNotFoundException e) {
|
||||
showErrorMessage(this, null, e, false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateAccountSelection() {
|
||||
|
@ -1069,7 +1025,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (mShouldSaveAccounts) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(KEY_COMPOSE_ACCOUNTS, ArrayUtils.toString(mSendAccountIds, ',', false));
|
||||
editor.commit();
|
||||
editor.apply();
|
||||
}
|
||||
mAccountSelectorAdapter.clearAccountSelection();
|
||||
for (final long accountId : mSendAccountIds) {
|
||||
|
@ -1312,12 +1268,16 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
}
|
||||
|
||||
private static class AccountSelectorAdapter extends BaseArrayAdapter<Account> {
|
||||
private static class AccountSelectorAdapter extends ArrayRecyclerAdapter<Account, AccountAvatarHolder> {
|
||||
|
||||
private final LongSparseArray<Boolean> mAccountSelectStates = new LongSparseArray<Boolean>();
|
||||
private final LongSparseArray<Boolean> mAccountSelectStates = new LongSparseArray<>();
|
||||
|
||||
private final LayoutInflater mInflater;
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
|
||||
public AccountSelectorAdapter(final Context context) {
|
||||
super(context, R.layout.gallery_item_compose_account, Account.getAccountsList(context, false));
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mImageLoader = TwidereApplication.getInstance(context).getImageLoaderWrapper();
|
||||
}
|
||||
|
||||
public void clearAccountSelection() {
|
||||
|
@ -1327,7 +1287,7 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
public long[] getSelectedAccountIds() {
|
||||
final ArrayList<Long> list = new ArrayList<Long>();
|
||||
for (int i = 0, j = getCount(); i < j; i++) {
|
||||
for (int i = 0, j = getItemCount(); i < j; i++) {
|
||||
final Account account = getItem(i);
|
||||
if (mAccountSelectStates.get(account.account_id, false)) {
|
||||
list.add(account.account_id);
|
||||
|
@ -1336,22 +1296,38 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
return ArrayUtils.fromList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
final Account account = getItem(position);
|
||||
final ImageLoaderWrapper loader = getImageLoader();
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
loader.displayProfileImage(icon, account.profile_image_url);
|
||||
view.setActivated(mAccountSelectStates.get(account.account_id, false));
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setAccountSelected(final long accountId, final boolean selected) {
|
||||
mAccountSelectStates.put(accountId, selected);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(AccountAvatarHolder holder, int position, Account item) {
|
||||
holder.setAccount(mImageLoader, item, mAccountSelectStates);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountAvatarHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new AccountAvatarHolder(mInflater.inflate(R.layout.gallery_item_compose_account, parent, false));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class AccountAvatarHolder extends ViewHolder {
|
||||
|
||||
private final ImageView icon;
|
||||
|
||||
public AccountAvatarHolder(View itemView) {
|
||||
super(itemView);
|
||||
icon = (ImageView) itemView.findViewById(android.R.id.icon);
|
||||
}
|
||||
|
||||
public void setAccount(ImageLoaderWrapper loader, Account account, LongSparseArray<Boolean> states) {
|
||||
loader.displayProfileImage(icon, account.profile_image_url);
|
||||
states.get(account.account_id, false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddBitmapTask extends AddMediaTask {
|
||||
|
@ -1411,9 +1387,13 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
copyStream(is, os);
|
||||
os.close();
|
||||
if (ContentResolver.SCHEME_FILE.equals(src.getScheme()) && delete_src) {
|
||||
new File(src.getPath()).delete();
|
||||
final File file = new File(src.getPath());
|
||||
if (!file.delete()) {
|
||||
Log.d(LOGTAG, String.format("Unable to delete %s", file));
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
} catch (final IOException e) {
|
||||
Log.w(LOGTAG, e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1451,9 +1431,13 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
if (medias == null) return false;
|
||||
try {
|
||||
for (final ParcelableMediaUpdate media : medias) {
|
||||
final Uri target = Uri.parse(media.uri);
|
||||
if (ContentResolver.SCHEME_FILE.equals(target.getScheme())) {
|
||||
new File(target.getPath()).delete();
|
||||
if (media.uri == null) continue;
|
||||
final Uri uri = Uri.parse(media.uri);
|
||||
if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) {
|
||||
final File file = new File(uri.getPath());
|
||||
if (!file.delete()) {
|
||||
Log.d(LOGTAG, String.format("Unable to delete %s", file));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
|
@ -1488,15 +1472,15 @@ public class ComposeActivity extends BaseSupportDialogActivity implements TextWa
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(final Void... params) {
|
||||
try {
|
||||
for (final ParcelableMediaUpdate media : activity.getMediasList()) {
|
||||
final Uri uri = Uri.parse(media.uri);
|
||||
if (uri == null) return null;
|
||||
if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) {
|
||||
new File(uri.getPath()).delete();
|
||||
for (final ParcelableMediaUpdate media : activity.getMediasList()) {
|
||||
if (media.uri == null) continue;
|
||||
final Uri uri = Uri.parse(media.uri);
|
||||
if (ContentResolver.SCHEME_FILE.equals(uri.getScheme())) {
|
||||
final File file = new File(uri.getPath());
|
||||
if (!file.delete()) {
|
||||
Log.d(LOGTAG, String.format("Unable to delete %s", file));
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class DraftsActivity extends BaseSupportActivity implements LoaderCallbac
|
|||
switch (item.getItemId()) {
|
||||
case MENU_HOME: {
|
||||
onBackPressed();
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
|
|
@ -32,7 +32,7 @@ import android.content.SharedPreferences;
|
|||
import android.content.pm.ActivityInfo;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -537,12 +537,9 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
}
|
||||
mActionsButton.setOnClickListener(this);
|
||||
mActionsButton.setOnLongClickListener(this);
|
||||
initTabs();
|
||||
final boolean tabsNotEmpty = mPagerAdapter.getCount() > 0;
|
||||
mEmptyTabHint.setVisibility(tabsNotEmpty ? View.GONE : View.VISIBLE);
|
||||
mViewPager.setVisibility(tabsNotEmpty ? View.VISIBLE : View.GONE);
|
||||
setTabPosition(initialTabPosition);
|
||||
setupSlidingMenu();
|
||||
setupBars();
|
||||
showDataProfilingRequest();
|
||||
initUnreadCount();
|
||||
updateActionsButton();
|
||||
|
@ -558,24 +555,34 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
}
|
||||
}
|
||||
mPagerPosition = Float.NaN;
|
||||
final int themeColor = getThemeColor(), contrastColor = Utils.getContrastYIQ(themeColor, 192);
|
||||
setupHomeTabs();
|
||||
}
|
||||
|
||||
private void setupBars() {
|
||||
final int themeColor = getThemeColor();
|
||||
final int themeResId = getCurrentThemeResourceId();
|
||||
final boolean isTransparent = ThemeUtils.isTransparentBackground(themeResId);
|
||||
final int actionBarAlpha = isTransparent ? ThemeUtils.getUserThemeBackgroundAlpha(this) : 0xFF;
|
||||
final IHomeActionButton homeActionButton = (IHomeActionButton) mActionsButton;
|
||||
mTabIndicator.setItemContext(ThemeUtils.getActionBarContext(this));
|
||||
if (ThemeUtils.isColoredActionBar(themeResId)) {
|
||||
final int contrastColor = Utils.getContrastYIQ(themeColor, 192);
|
||||
ViewAccessor.setBackground(mTabIndicator, new ColorDrawable(themeColor));
|
||||
homeActionButton.setButtonColor(themeColor);
|
||||
homeActionButton.setIconColor(contrastColor, Mode.SRC_ATOP);
|
||||
mTabIndicator.setStripColor(contrastColor);
|
||||
mTabIndicator.setIconColor(contrastColor);
|
||||
} else {
|
||||
ViewAccessor.setBackground(mTabIndicator, ThemeUtils.getActionBarBackground(this, false));
|
||||
final int backgroundColor = ThemeUtils.getThemeBackgroundColor(mTabIndicator.getItemContext());
|
||||
final int foregroundColor = ThemeUtils.getThemeForegroundColor(mTabIndicator.getItemContext());
|
||||
ViewAccessor.setBackground(mTabIndicator, ThemeUtils.getActionBarBackground(this, themeResId));
|
||||
homeActionButton.setButtonColor(backgroundColor);
|
||||
homeActionButton.setIconColor(foregroundColor, Mode.SRC_ATOP);
|
||||
mTabIndicator.setStripColor(themeColor);
|
||||
mTabIndicator.setIconColor(ThemeUtils.isLightActionBar(themeResId) ? Color.BLACK : Color.WHITE);
|
||||
mTabIndicator.setIconColor(foregroundColor);
|
||||
}
|
||||
mTabIndicator.setAlpha(actionBarAlpha / 255f);
|
||||
if (mActionsButton instanceof IHomeActionButton) {
|
||||
((IHomeActionButton) mActionsButton).setColor(themeColor);
|
||||
mActionsButton.setAlpha(actionBarAlpha / 255f);
|
||||
}
|
||||
mActionsButton.setAlpha(actionBarAlpha / 255f);
|
||||
ViewAccessor.setBackground(mActionBarOverlay, ThemeUtils.getWindowContentOverlay(this));
|
||||
}
|
||||
|
||||
|
@ -701,12 +708,14 @@ public class HomeActivity extends BaseSupportActivity implements OnClickListener
|
|||
return mTwitterWrapper.hasActivatedTask();
|
||||
}
|
||||
|
||||
private void initTabs() {
|
||||
private void setupHomeTabs() {
|
||||
final List<SupportTabSpec> tabs = getHomeTabs(this);
|
||||
mCustomTabs.clear();
|
||||
mCustomTabs.addAll(tabs);
|
||||
mPagerAdapter.clear();
|
||||
mPagerAdapter.addTabs(tabs);
|
||||
mEmptyTabHint.setVisibility(tabs.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
mViewPager.setVisibility(tabs.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private void initUnreadCount() {
|
||||
|
|
|
@ -124,7 +124,7 @@ public class LinkHandlerActivity extends BaseSupportActivity implements OnClickL
|
|||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
setContentView(R.layout.layout_link_handler);
|
||||
setContentView(R.layout.activity_content_fragment);
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
if (data == null || !showFragment(data)) {
|
||||
finish();
|
||||
|
|
|
@ -3,9 +3,9 @@ package org.mariotaku.twidere.activity.support;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
|
@ -16,29 +16,12 @@ import android.widget.ListView;
|
|||
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuAdapter;
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.fragment.support.BaseSupportDialogFragment;
|
||||
import org.mariotaku.twidere.menu.TwidereMenuInflater;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
|
||||
public abstract class MenuDialogFragment extends BaseSupportDialogFragment implements OnItemClickListener {
|
||||
|
||||
private Context mThemedContext;
|
||||
|
||||
public Context getThemedContext() {
|
||||
if (mThemedContext != null) return mThemedContext;
|
||||
final FragmentActivity activity = getActivity();
|
||||
final int themeRes, accentColor;
|
||||
if (activity instanceof IThemedActivity) {
|
||||
themeRes = ((IThemedActivity) activity).getThemeResourceId();
|
||||
accentColor = ((IThemedActivity) activity).getThemeColor();
|
||||
} else {
|
||||
themeRes = ThemeUtils.getSettingsThemeResource(activity);
|
||||
accentColor = ThemeUtils.getUserThemeColor(activity);
|
||||
}
|
||||
return mThemedContext = ThemeUtils.getThemedContextForActionIcons(activity, themeRes, accentColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
final Context context = getThemedContext();
|
||||
|
@ -50,10 +33,17 @@ public abstract class MenuDialogFragment extends BaseSupportDialogFragment imple
|
|||
builder.setView(listView);
|
||||
final Menu menu = MenuUtils.createMenu(context);
|
||||
onCreateMenu(new TwidereMenuInflater(context), menu);
|
||||
final int itemColor = ThemeUtils.getThemeForegroundColor(context);
|
||||
final int highlightColor = ThemeUtils.getUserAccentColor(context);
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, itemColor, highlightColor, Mode.SRC_ATOP);
|
||||
adapter.setMenu(menu);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public Context getThemedContext() {
|
||||
return getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final Fragment parentFragment = getParentFragment();
|
||||
|
|
|
@ -25,7 +25,8 @@ import android.database.Cursor;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
|
||||
import com.mobeta.android.dslv.SimpleDragSortCursorAdapter;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
|
@ -34,91 +35,90 @@ import org.mariotaku.twidere.provider.TweetStore.Accounts;
|
|||
import org.mariotaku.twidere.util.ImageLoaderWrapper;
|
||||
import org.mariotaku.twidere.view.holder.AccountViewHolder;
|
||||
|
||||
public class AccountsAdapter extends SimpleCursorAdapter implements Constants {
|
||||
public class AccountsAdapter extends SimpleDragSortCursorAdapter implements Constants {
|
||||
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final SharedPreferences mPreferences;
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
private int mUserColorIdx, mProfileImageIdx, mScreenNameIdx, mAccountIdIdx;
|
||||
private long mDefaultAccountId;
|
||||
private int mUserColorIdx, mProfileImageIdx, mScreenNameIdx, mAccountIdIdx;
|
||||
private long mDefaultAccountId;
|
||||
|
||||
private boolean mDisplayProfileImage;
|
||||
private int mChoiceMode;
|
||||
private boolean mDisplayProfileImage;
|
||||
private int mChoiceMode;
|
||||
|
||||
public AccountsAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_account, null, new String[] { Accounts.NAME },
|
||||
new int[] { android.R.id.text1 }, 0);
|
||||
final TwidereApplication application = TwidereApplication.getInstance(context);
|
||||
mImageLoader = application.getImageLoaderWrapper();
|
||||
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
public AccountsAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_account, null, new String[]{Accounts.NAME},
|
||||
new int[]{android.R.id.text1}, 0);
|
||||
final TwidereApplication application = TwidereApplication.getInstance(context);
|
||||
mImageLoader = application.getImageLoaderWrapper();
|
||||
mPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(final View view, final Context context, final Cursor cursor) {
|
||||
final int color = cursor.getInt(mUserColorIdx);
|
||||
final AccountViewHolder holder = (AccountViewHolder) view.getTag();
|
||||
holder.screen_name.setText("@" + cursor.getString(mScreenNameIdx));
|
||||
holder.setAccountColor(color);
|
||||
holder.setIsDefault(mDefaultAccountId != -1 && mDefaultAccountId == cursor.getLong(mAccountIdIdx));
|
||||
if (mDisplayProfileImage) {
|
||||
mImageLoader.displayProfileImage(holder.profile_image, cursor.getString(mProfileImageIdx));
|
||||
} else {
|
||||
@Override
|
||||
public void bindView(final View view, final Context context, final Cursor cursor) {
|
||||
final int color = cursor.getInt(mUserColorIdx);
|
||||
final AccountViewHolder holder = (AccountViewHolder) view.getTag();
|
||||
holder.screen_name.setText("@" + cursor.getString(mScreenNameIdx));
|
||||
holder.setAccountColor(color);
|
||||
holder.setIsDefault(mDefaultAccountId != -1 && mDefaultAccountId == cursor.getLong(mAccountIdIdx));
|
||||
if (mDisplayProfileImage) {
|
||||
mImageLoader.displayProfileImage(holder.profile_image, cursor.getString(mProfileImageIdx));
|
||||
} else {
|
||||
mImageLoader.cancelDisplayTask(holder.profile_image);
|
||||
holder.profile_image.setImageResource(R.drawable.ic_profile_image_default);
|
||||
}
|
||||
final boolean isMultipleChoice = mChoiceMode == ListView.CHOICE_MODE_MULTIPLE
|
||||
|| mChoiceMode == ListView.CHOICE_MODE_MULTIPLE_MODAL;
|
||||
holder.checkbox.setVisibility(isMultipleChoice ? View.VISIBLE : View.GONE);
|
||||
super.bindView(view, context, cursor);
|
||||
}
|
||||
holder.profile_image.setImageResource(R.drawable.ic_profile_image_default);
|
||||
}
|
||||
final boolean isMultipleChoice = mChoiceMode == ListView.CHOICE_MODE_MULTIPLE
|
||||
|| mChoiceMode == ListView.CHOICE_MODE_MULTIPLE_MODAL;
|
||||
holder.checkbox.setVisibility(isMultipleChoice ? View.VISIBLE : View.GONE);
|
||||
super.bindView(view, context, cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(final int position) {
|
||||
final Cursor c = getCursor();
|
||||
if (c == null || c.isClosed()) return -1;
|
||||
c.moveToPosition(position);
|
||||
return c.getLong(mAccountIdIdx);
|
||||
}
|
||||
@Override
|
||||
public long getItemId(final int position) {
|
||||
final Cursor c = getCursor();
|
||||
if (c == null || c.isClosed()) return -1;
|
||||
c.moveToPosition(position);
|
||||
return c.getLong(mAccountIdIdx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View newView(final Context context, final Cursor cursor, final ViewGroup parent) {
|
||||
@Override
|
||||
public View newView(final Context context, final Cursor cursor, final ViewGroup parent) {
|
||||
final View view = super.newView(context, cursor, parent);
|
||||
final AccountViewHolder holder = new AccountViewHolder(view);
|
||||
view.setTag(holder);
|
||||
return view;
|
||||
}
|
||||
|
||||
final View view = super.newView(context, cursor, parent);
|
||||
final AccountViewHolder viewholder = new AccountViewHolder(view);
|
||||
view.setTag(viewholder);
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
mDefaultAccountId = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDataSetChanged() {
|
||||
mDefaultAccountId = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
|
||||
super.notifyDataSetChanged();
|
||||
}
|
||||
public void setChoiceMode(final int mode) {
|
||||
if (mChoiceMode == mode) return;
|
||||
mChoiceMode = mode;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setChoiceMode(final int mode) {
|
||||
if (mChoiceMode == mode) return;
|
||||
mChoiceMode = mode;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public void setDisplayProfileImage(final boolean display) {
|
||||
mDisplayProfileImage = display;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setDisplayProfileImage(final boolean display) {
|
||||
mDisplayProfileImage = display;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor swapCursor(final Cursor cursor) {
|
||||
if (cursor != null) {
|
||||
mAccountIdIdx = cursor.getColumnIndex(Accounts.ACCOUNT_ID);
|
||||
mUserColorIdx = cursor.getColumnIndex(Accounts.COLOR);
|
||||
mProfileImageIdx = cursor.getColumnIndex(Accounts.PROFILE_IMAGE_URL);
|
||||
mScreenNameIdx = cursor.getColumnIndex(Accounts.SCREEN_NAME);
|
||||
}
|
||||
return super.swapCursor(cursor);
|
||||
}
|
||||
@Override
|
||||
public Cursor swapCursor(final Cursor cursor) {
|
||||
if (cursor != null) {
|
||||
mAccountIdIdx = cursor.getColumnIndex(Accounts.ACCOUNT_ID);
|
||||
mUserColorIdx = cursor.getColumnIndex(Accounts.COLOR);
|
||||
mProfileImageIdx = cursor.getColumnIndex(Accounts.PROFILE_IMAGE_URL);
|
||||
mScreenNameIdx = cursor.getColumnIndex(Accounts.SCREEN_NAME);
|
||||
}
|
||||
return super.swapCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package org.mariotaku.twidere.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView.Adapter;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/10/27.
|
||||
*/
|
||||
public abstract class ArrayRecyclerAdapter<T, H extends ViewHolder> extends Adapter<H> {
|
||||
|
||||
protected final ArrayList<T> mData = new ArrayList<T>();
|
||||
|
||||
@Override
|
||||
public final void onBindViewHolder(H holder, int position) {
|
||||
onBindViewHolder(holder, position, getItem(position));
|
||||
}
|
||||
|
||||
public abstract void onBindViewHolder(H holder, int position, T item);
|
||||
|
||||
|
||||
public void add(final T item) {
|
||||
if (item == null) return;
|
||||
mData.add(item);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void addAll(final Collection<? extends T> collection) {
|
||||
mData.addAll(collection);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mData.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
public T getItem(final int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
public boolean remove(final int position) {
|
||||
final boolean ret = mData.remove(position) != null;
|
||||
notifyDataSetChanged();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void removeAll(final List<T> collection) {
|
||||
mData.removeAll(collection);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void sort(final Comparator<? super T> comparator) {
|
||||
Collections.sort(mData, comparator);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -98,7 +98,7 @@ public class UserHashtagAutoCompleteAdapter extends SimpleCursorAdapter implemen
|
|||
accentColor = ((IThemedActivity) context).getThemeColor();
|
||||
} else {
|
||||
themeRes = ThemeUtils.getThemeResource(context);
|
||||
accentColor = ThemeUtils.getUserThemeColor(context);
|
||||
accentColor = ThemeUtils.getUserAccentColor(context);
|
||||
}
|
||||
mResources = ThemeUtils.getThemedResourcesForActionIcons(context, themeRes, accentColor);
|
||||
}
|
||||
|
|
|
@ -30,173 +30,185 @@ import android.graphics.Paint;
|
|||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.scvngr.levelup.views.gallery.AdapterView;
|
||||
import com.scvngr.levelup.views.gallery.AdapterView.OnItemClickListener;
|
||||
import com.scvngr.levelup.views.gallery.Gallery;
|
||||
|
||||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.ArrayAdapter;
|
||||
import org.mariotaku.twidere.adapter.ArrayRecyclerAdapter;
|
||||
import org.mariotaku.twidere.view.ColorPickerView;
|
||||
import org.mariotaku.twidere.view.ColorPickerView.OnColorChangedListener;
|
||||
import org.mariotaku.twidere.view.ForegroundColorView;
|
||||
|
||||
public final class ColorPickerDialog extends AlertDialog implements OnItemClickListener, OnColorChangedListener,
|
||||
Constants {
|
||||
public final class ColorPickerDialog extends AlertDialog implements Constants, OnColorChangedListener {
|
||||
|
||||
private final static int[] COLORS = { HOLO_RED_DARK, HOLO_RED_LIGHT, HOLO_ORANGE_DARK, HOLO_ORANGE_LIGHT,
|
||||
HOLO_GREEN_LIGHT, HOLO_GREEN_DARK, HOLO_BLUE_LIGHT, HOLO_BLUE_DARK, HOLO_PURPLE_DARK, HOLO_PURPLE_LIGHT,
|
||||
Color.WHITE };
|
||||
private final static int[] COLORS = {HOLO_RED_DARK, HOLO_RED_LIGHT, HOLO_ORANGE_DARK, HOLO_ORANGE_LIGHT,
|
||||
HOLO_GREEN_LIGHT, HOLO_GREEN_DARK, HOLO_BLUE_LIGHT, HOLO_BLUE_DARK, HOLO_PURPLE_DARK, HOLO_PURPLE_LIGHT,
|
||||
Color.WHITE};
|
||||
|
||||
private final ColorsAdapter mColorsAdapter;
|
||||
private final ColorsAdapter mColorsAdapter;
|
||||
|
||||
private ColorPickerView mColorPicker;
|
||||
private Gallery mColorPresets;
|
||||
private ColorPickerView mColorPicker;
|
||||
private RecyclerView mColorPresets;
|
||||
|
||||
private final Resources mResources;
|
||||
private final Resources mResources;
|
||||
|
||||
private final Bitmap mTempBitmap;
|
||||
private final Canvas mCanvas;
|
||||
private final Bitmap mTempBitmap;
|
||||
private final Canvas mCanvas;
|
||||
|
||||
private final int mIconWidth, mIconHeight;
|
||||
private final int mRectrangleSize, mNumRectanglesHorizontal, mNumRectanglesVertical;
|
||||
private final int mIconWidth, mIconHeight;
|
||||
private final int mRectrangleSize, mNumRectanglesHorizontal, mNumRectanglesVertical;
|
||||
|
||||
public ColorPickerDialog(final Context context, final int initialColor, final boolean showAlphaSlider) {
|
||||
super(context);
|
||||
mColorsAdapter = new ColorsAdapter(context);
|
||||
mResources = context.getResources();
|
||||
final float density = mResources.getDisplayMetrics().density;
|
||||
mIconWidth = (int) (32 * density);
|
||||
mIconHeight = (int) (32 * density);
|
||||
mRectrangleSize = (int) (density * 5);
|
||||
mNumRectanglesHorizontal = (int) Math.ceil(mIconWidth / mRectrangleSize);
|
||||
mNumRectanglesVertical = (int) Math.ceil(mIconHeight / mRectrangleSize);
|
||||
mTempBitmap = Bitmap.createBitmap(mIconWidth, mIconHeight, Config.ARGB_8888);
|
||||
mCanvas = new Canvas(mTempBitmap);
|
||||
init(context, initialColor, showAlphaSlider);
|
||||
initColors();
|
||||
mColorsAdapter.setCurrentColor(initialColor);
|
||||
}
|
||||
public ColorPickerDialog(final Context context, final int initialColor, final boolean showAlphaSlider) {
|
||||
super(context);
|
||||
mColorsAdapter = new ColorsAdapter(context);
|
||||
mResources = context.getResources();
|
||||
final float density = mResources.getDisplayMetrics().density;
|
||||
mIconWidth = (int) (32 * density);
|
||||
mIconHeight = (int) (32 * density);
|
||||
mRectrangleSize = (int) (density * 5);
|
||||
mNumRectanglesHorizontal = (int) Math.ceil(mIconWidth / mRectrangleSize);
|
||||
mNumRectanglesVertical = (int) Math.ceil(mIconHeight / mRectrangleSize);
|
||||
mTempBitmap = Bitmap.createBitmap(mIconWidth, mIconHeight, Config.ARGB_8888);
|
||||
mCanvas = new Canvas(mTempBitmap);
|
||||
init(context, initialColor, showAlphaSlider);
|
||||
initColors();
|
||||
mColorsAdapter.setCurrentColor(initialColor);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColorPicker.getColor();
|
||||
}
|
||||
public int getColor() {
|
||||
return mColorPicker.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onColorChanged(final int color) {
|
||||
mColorsAdapter.setCurrentColor(color);
|
||||
updateColorPreviewBitmap(color);
|
||||
setIcon(new BitmapDrawable(mResources, mTempBitmap));
|
||||
}
|
||||
@Override
|
||||
public void onColorChanged(final int color) {
|
||||
mColorsAdapter.setCurrentColor(color);
|
||||
updateColorPreviewBitmap(color);
|
||||
setIcon(new BitmapDrawable(mResources, mTempBitmap));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
final int color = mColorsAdapter.getItem(position);
|
||||
if (mColorPicker == null) return;
|
||||
mColorPicker.setColor(color, true);
|
||||
}
|
||||
// @Override
|
||||
// public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
|
||||
// final int color = mColorsAdapter.getItem(position);
|
||||
// if (mColorPicker == null) return;
|
||||
// mColorPicker.setColor(color, true);
|
||||
// }
|
||||
|
||||
public final void setAlphaSliderVisible(final boolean visible) {
|
||||
mColorPicker.setAlphaSliderVisible(visible);
|
||||
}
|
||||
public final void setAlphaSliderVisible(final boolean visible) {
|
||||
mColorPicker.setAlphaSliderVisible(visible);
|
||||
}
|
||||
|
||||
public final void setColor(final int color) {
|
||||
mColorPicker.setColor(color);
|
||||
}
|
||||
public final void setColor(final int color) {
|
||||
mColorPicker.setColor(color);
|
||||
}
|
||||
|
||||
public final void setColor(final int color, final boolean callback) {
|
||||
mColorPicker.setColor(color, callback);
|
||||
}
|
||||
public final void setColor(final int color, final boolean callback) {
|
||||
mColorPicker.setColor(color, callback);
|
||||
}
|
||||
|
||||
private void init(final Context context, final int color, final boolean showAlphaSlider) {
|
||||
private void init(final Context context, final int color, final boolean showAlphaSlider) {
|
||||
|
||||
// To fight color branding.
|
||||
getWindow().setFormat(PixelFormat.RGBA_8888);
|
||||
// To fight color branding.
|
||||
getWindow().setFormat(PixelFormat.RGBA_8888);
|
||||
|
||||
final LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
final View dialogView = inflater.inflate(R.layout.dialog_color_picker, null);
|
||||
final LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
final View dialogView = inflater.inflate(R.layout.dialog_color_picker, null);
|
||||
|
||||
mColorPicker = (ColorPickerView) dialogView.findViewById(R.id.color_picker);
|
||||
mColorPresets = (Gallery) dialogView.findViewById(R.id.color_presets);
|
||||
mColorPicker = (ColorPickerView) dialogView.findViewById(R.id.color_picker);
|
||||
mColorPresets = (RecyclerView) dialogView.findViewById(R.id.color_presets);
|
||||
|
||||
mColorPicker.setOnColorChangedListener(this);
|
||||
mColorPresets.setAdapter(mColorsAdapter);
|
||||
mColorPresets.setOnItemClickListener(this);
|
||||
mColorPresets.setScrollAfterItemClickEnabled(false);
|
||||
mColorPresets.setScrollRightSpacingEnabled(false);
|
||||
mColorPicker.setOnColorChangedListener(this);
|
||||
mColorPresets.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false));
|
||||
mColorPresets.setAdapter(mColorsAdapter);
|
||||
// mColorPresets.setOnItemClickListener(this);
|
||||
|
||||
setColor(color, true);
|
||||
setAlphaSliderVisible(showAlphaSlider);
|
||||
setColor(color, true);
|
||||
setAlphaSliderVisible(showAlphaSlider);
|
||||
|
||||
setView(dialogView);
|
||||
setTitle(R.string.pick_color);
|
||||
}
|
||||
setView(dialogView);
|
||||
setTitle(R.string.pick_color);
|
||||
}
|
||||
|
||||
private void initColors() {
|
||||
for (final int color : COLORS) {
|
||||
mColorsAdapter.add(color);
|
||||
}
|
||||
}
|
||||
private void initColors() {
|
||||
for (final int color : COLORS) {
|
||||
mColorsAdapter.add(color);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateColorPreviewBitmap(final int color) {
|
||||
final Rect r = new Rect();
|
||||
boolean verticalStartWhite = true;
|
||||
for (int i = 0; i <= mNumRectanglesVertical; i++) {
|
||||
private void updateColorPreviewBitmap(final int color) {
|
||||
final Rect r = new Rect();
|
||||
boolean verticalStartWhite = true;
|
||||
for (int i = 0; i <= mNumRectanglesVertical; i++) {
|
||||
|
||||
boolean isWhite = verticalStartWhite;
|
||||
for (int j = 0; j <= mNumRectanglesHorizontal; j++) {
|
||||
boolean isWhite = verticalStartWhite;
|
||||
for (int j = 0; j <= mNumRectanglesHorizontal; j++) {
|
||||
|
||||
r.top = i * mRectrangleSize;
|
||||
r.left = j * mRectrangleSize;
|
||||
r.bottom = r.top + mRectrangleSize;
|
||||
r.right = r.left + mRectrangleSize;
|
||||
final Paint paint = new Paint();
|
||||
paint.setColor(isWhite ? Color.WHITE : Color.GRAY);
|
||||
r.top = i * mRectrangleSize;
|
||||
r.left = j * mRectrangleSize;
|
||||
r.bottom = r.top + mRectrangleSize;
|
||||
r.right = r.left + mRectrangleSize;
|
||||
final Paint paint = new Paint();
|
||||
paint.setColor(isWhite ? Color.WHITE : Color.GRAY);
|
||||
|
||||
mCanvas.drawRect(r, paint);
|
||||
mCanvas.drawRect(r, paint);
|
||||
|
||||
isWhite = !isWhite;
|
||||
}
|
||||
isWhite = !isWhite;
|
||||
}
|
||||
|
||||
verticalStartWhite = !verticalStartWhite;
|
||||
verticalStartWhite = !verticalStartWhite;
|
||||
|
||||
}
|
||||
mCanvas.drawColor(color);
|
||||
final Paint paint = new Paint();
|
||||
paint.setColor(Color.WHITE);
|
||||
paint.setStrokeWidth(2.0f);
|
||||
final float[] points = new float[] { 0, 0, mIconWidth, 0, 0, 0, 0, mIconHeight, mIconWidth, 0, mIconWidth,
|
||||
mIconHeight, 0, mIconHeight, mIconWidth, mIconHeight };
|
||||
mCanvas.drawLines(points, paint);
|
||||
}
|
||||
mCanvas.drawColor(color);
|
||||
final Paint paint = new Paint();
|
||||
paint.setColor(Color.WHITE);
|
||||
paint.setStrokeWidth(2.0f);
|
||||
final float[] points = new float[]{0, 0, mIconWidth, 0, 0, 0, 0, mIconHeight, mIconWidth, 0, mIconWidth,
|
||||
mIconHeight, 0, mIconHeight, mIconWidth, mIconHeight};
|
||||
mCanvas.drawLines(points, paint);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class ColorsAdapter extends ArrayAdapter<Integer> {
|
||||
public static class ColorsAdapter extends ArrayRecyclerAdapter<Integer, ColorViewHolder> {
|
||||
|
||||
private int mCurrentColor;
|
||||
private final LayoutInflater mInflater;
|
||||
private int mCurrentColor;
|
||||
|
||||
public ColorsAdapter(final Context context) {
|
||||
super(context, R.layout.gallery_item_color_picker_preset);
|
||||
}
|
||||
public ColorsAdapter(final Context context) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View view = super.getView(position, convertView, parent);
|
||||
final ForegroundColorView colorView = (ForegroundColorView) view.findViewById(R.id.color);
|
||||
final int color = getItem(position);
|
||||
colorView.setColor(color);
|
||||
colorView.setActivated(mCurrentColor == color);
|
||||
return view;
|
||||
}
|
||||
public void setCurrentColor(final int color) {
|
||||
mCurrentColor = color;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setCurrentColor(final int color) {
|
||||
mCurrentColor = color;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
@Override
|
||||
public void onBindViewHolder(ColorViewHolder holder, int position, Integer item) {
|
||||
holder.setColor(item, mCurrentColor == item);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public ColorViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new ColorViewHolder(mInflater.inflate(R.layout.gallery_item_color_picker_preset, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
public static class ColorViewHolder extends ViewHolder {
|
||||
|
||||
private final ForegroundColorView colorView;
|
||||
|
||||
public ColorViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
colorView = (ForegroundColorView) itemView.findViewById(R.id.color);
|
||||
}
|
||||
|
||||
public void setColor(int color, boolean activated) {
|
||||
colorView.setColor(color);
|
||||
colorView.setActivated(activated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ import org.mariotaku.twidere.R;
|
|||
import org.mariotaku.twidere.activity.FiltersActivity;
|
||||
import org.mariotaku.twidere.activity.SettingsActivity;
|
||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
||||
import org.mariotaku.twidere.activity.support.AccountsManagerActivity;
|
||||
import org.mariotaku.twidere.activity.support.ColorPickerDialogActivity;
|
||||
import org.mariotaku.twidere.activity.support.DraftsActivity;
|
||||
import org.mariotaku.twidere.activity.support.HomeActivity;
|
||||
import org.mariotaku.twidere.activity.support.SignInActivity;
|
||||
import org.mariotaku.twidere.activity.support.UserProfileEditorActivity;
|
||||
import org.mariotaku.twidere.adapter.ArrayAdapter;
|
||||
import org.mariotaku.twidere.app.TwidereApplication;
|
||||
|
@ -266,10 +266,8 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
if (!(item instanceof OptionItem)) return;
|
||||
final OptionItem option = (OptionItem) item;
|
||||
switch (option.id) {
|
||||
case MENU_ACCOUNTS:
|
||||
case MENU_ADD_ACCOUNT: {
|
||||
final Intent intent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
|
||||
intent.setClass(getActivity(), SignInActivity.class);
|
||||
case MENU_ACCOUNTS: {
|
||||
final Intent intent = new Intent(getActivity(), AccountsManagerActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
|
@ -355,7 +353,7 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
if (!ThemeUtils.isDarkDrawerEnabled(context))
|
||||
return mThemedContext = ThemeUtils.getThemedContextForActionIcons(context);
|
||||
final int themeResource = ThemeUtils.getDrawerThemeResource(context);
|
||||
final int accentColor = ThemeUtils.getUserThemeColor(context);
|
||||
final int accentColor = ThemeUtils.getUserAccentColor(context);
|
||||
return mThemedContext = new TwidereContextThemeWrapper(context, themeResource, accentColor);
|
||||
}
|
||||
|
||||
|
@ -481,6 +479,7 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
OnCheckedChangeListener {
|
||||
|
||||
private final ImageLoaderWrapper mImageLoader;
|
||||
private final int mActivatedColor;
|
||||
|
||||
private Account.Indices mIndices;
|
||||
private long mSelectedAccountId, mDefaultAccountId;
|
||||
|
@ -491,6 +490,7 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
super(context, R.layout.list_item_drawer_accounts, null, new String[0], new int[0], 0);
|
||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||
mImageLoader = app.getImageLoaderWrapper();
|
||||
mActivatedColor = ThemeUtils.getUserAccentColor(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -498,19 +498,21 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
super.bindView(view, context, cursor);
|
||||
final CompoundButton toggle = (CompoundButton) view.findViewById(R.id.toggle);
|
||||
final TextView name = (TextView) view.findViewById(R.id.name);
|
||||
final TextView screen_name = (TextView) view.findViewById(R.id.screen_name);
|
||||
final TextView default_indicator = (TextView) view.findViewById(R.id.default_indicator);
|
||||
final ImageView profile_image = (ImageView) view.findViewById(R.id.profile_image);
|
||||
final TextView screenNameView = (TextView) view.findViewById(R.id.screen_name);
|
||||
final TextView defaultIndicatorView = (TextView) view.findViewById(R.id.default_indicator);
|
||||
final ImageView profileImageView = (ImageView) view.findViewById(R.id.profile_image);
|
||||
final Account account = new Account(cursor, mIndices);
|
||||
name.setText(account.name);
|
||||
screen_name.setText(String.format("@%s", account.screen_name));
|
||||
default_indicator.setVisibility(account.account_id == mDefaultAccountId ? View.VISIBLE : View.GONE);
|
||||
mImageLoader.displayProfileImage(profile_image, account.profile_image_url);
|
||||
screenNameView.setText(String.format("@%s", account.screen_name));
|
||||
defaultIndicatorView.setVisibility(account.account_id == mDefaultAccountId ? View.VISIBLE : View.GONE);
|
||||
mImageLoader.displayProfileImage(profileImageView, account.profile_image_url);
|
||||
toggle.setChecked(account.is_activated);
|
||||
toggle.setTag(account);
|
||||
toggle.setOnCheckedChangeListener(this);
|
||||
view.setActivated(account.account_id == mSelectedAccountId);
|
||||
((IColorLabelView) view).drawEnd(account.color);
|
||||
final IColorLabelView colorLabelView = (IColorLabelView) view;
|
||||
colorLabelView.drawStart(account.account_id == mSelectedAccountId ? mActivatedColor : 0);
|
||||
colorLabelView.drawEnd(account.color);
|
||||
}
|
||||
|
||||
public long getDefaultAccountId() {
|
||||
|
@ -620,8 +622,11 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
|
||||
private static abstract class OptionItemsAdapter extends ArrayAdapter<OptionItem> {
|
||||
|
||||
private final int mMenuIconColor;
|
||||
|
||||
public OptionItemsAdapter(final Context context) {
|
||||
super(context, R.layout.list_item_menu);
|
||||
mMenuIconColor = ThemeUtils.getThemeForegroundColor(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -631,7 +636,8 @@ public class AccountsDrawerFragment extends BaseSupportListFragment implements L
|
|||
final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
|
||||
text1.setText(option.name);
|
||||
icon.setImageDrawable(getContext().getResources().getDrawable(option.icon));
|
||||
icon.setImageDrawable(icon.getResources().getDrawable(option.icon));
|
||||
icon.setColorFilter(mMenuIconColor);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package org.mariotaku.twidere.fragment.support;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.activity.support.SignInActivity;
|
||||
import org.mariotaku.twidere.adapter.AccountsAdapter;
|
||||
import org.mariotaku.twidere.menu.TwidereMenuInflater;
|
||||
import org.mariotaku.twidere.provider.TweetStore.Accounts;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/10/26.
|
||||
*/
|
||||
public class AccountsManagerFragment extends BaseSupportListFragment implements LoaderCallbacks<Cursor> {
|
||||
|
||||
private AccountsAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case MENU_ADD_ACCOUNT: {
|
||||
final Intent intent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
|
||||
intent.setClass(getActivity(), SignInActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, TwidereMenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_accounts_manager, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
mAdapter = new AccountsAdapter(getActivity());
|
||||
setListAdapter(mAdapter);
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(android.R.layout.list_content, null, false);
|
||||
final ListView originalList = (ListView) view.findViewById(android.R.id.list);
|
||||
final ViewGroup listContainer = (ViewGroup) originalList.getParent();
|
||||
listContainer.removeView(originalList);
|
||||
inflater.inflate(R.layout.fragment_custom_tabs, listContainer, true);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
final Uri uri = Accounts.CONTENT_URI;
|
||||
return new CursorLoader(getActivity(), uri, Accounts.COLUMNS, null, null, Accounts.SORT_POSITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
|
||||
mAdapter.changeCursor(cursor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
mAdapter.changeCursor(null);
|
||||
}
|
||||
}
|
|
@ -112,7 +112,7 @@ public class QuickMenuFragment extends BaseSupportFragment {
|
|||
} else {
|
||||
themeResource = ThemeUtils.getDrawerThemeResource(currentThemeResource);
|
||||
}
|
||||
final int accentColor = ThemeUtils.getUserThemeColor(context);
|
||||
final int accentColor = ThemeUtils.getUserAccentColor(context);
|
||||
return mThemedContext = new TwidereContextThemeWrapper(context, themeResource, accentColor);
|
||||
}
|
||||
|
||||
|
|
|
@ -888,7 +888,7 @@ public class UserProfileFragment extends BaseSupportListFragment implements OnCl
|
|||
final ParcelableUser user = mUser;
|
||||
final Relationship relationship = mRelationship;
|
||||
if (twitter == null || user == null) return;
|
||||
final int activatedColor = ThemeUtils.getUserThemeColor(getActivity());
|
||||
final int activatedColor = ThemeUtils.getUserAccentColor(getActivity());
|
||||
final boolean isMyself = user.account_id == user.id;
|
||||
final boolean isFollowing = relationship != null && relationship.isSourceFollowingTarget();
|
||||
final boolean isProtected = user.is_protected;
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ThemePreviewPreference extends Preference implements Constants, OnS
|
|||
protected View onCreateView(final ViewGroup parent) {
|
||||
final Context context = getContext();
|
||||
final int themeResource = ThemeUtils.getThemeResource(context);
|
||||
final int accentColor = ThemeUtils.getUserThemeColor(context);
|
||||
final int accentColor = ThemeUtils.getUserAccentColor(context);
|
||||
final Context theme = new TwidereContextThemeWrapper(context, themeResource, accentColor);
|
||||
final LayoutInflater inflater = LayoutInflater.from(theme);
|
||||
final View view = inflater.inflate(R.layout.theme_preview, parent, false);
|
||||
|
|
|
@ -123,6 +123,8 @@ public interface TweetStore {
|
|||
|
||||
public static final String CONSUMER_SECRET = "consumer_secret";
|
||||
|
||||
public static final String SORT_POSITION = "sort_position";
|
||||
|
||||
/**
|
||||
* User's profile image URL of the status. <br>
|
||||
* Type: TEXT
|
||||
|
@ -140,11 +142,11 @@ public interface TweetStore {
|
|||
public static final String[] COLUMNS = new String[]{_ID, NAME, SCREEN_NAME, ACCOUNT_ID, AUTH_TYPE,
|
||||
BASIC_AUTH_USERNAME, BASIC_AUTH_PASSWORD, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, CONSUMER_KEY,
|
||||
CONSUMER_SECRET, API_URL_FORMAT, SAME_OAUTH_SIGNING_URL, NO_VERSION_SUFFIX, PROFILE_IMAGE_URL, PROFILE_BANNER_URL, COLOR,
|
||||
IS_ACTIVATED};
|
||||
IS_ACTIVATED, SORT_POSITION};
|
||||
|
||||
public static final String[] TYPES = new String[]{TYPE_PRIMARY_KEY, TYPE_TEXT_NOT_NULL, TYPE_TEXT_NOT_NULL,
|
||||
TYPE_INT_UNIQUE, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT,
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_BOOLEAN};
|
||||
TYPE_BOOLEAN, TYPE_BOOLEAN, TYPE_TEXT, TYPE_TEXT, TYPE_INT, TYPE_BOOLEAN, TYPE_INT};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.content.res.Resources;
|
|||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
|
@ -41,6 +42,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mariotaku.menucomponent.widget.MenuBar.MenuBarMenuInfo;
|
||||
import org.mariotaku.refreshnow.widget.RefreshNowConfig;
|
||||
|
@ -51,6 +53,7 @@ import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
|||
import org.mariotaku.twidere.content.TwidereContextThemeWrapper;
|
||||
import org.mariotaku.twidere.content.TwidereContextWrapper;
|
||||
import org.mariotaku.twidere.content.iface.ITwidereContextWrapper;
|
||||
import org.mariotaku.twidere.util.menu.StatusMenuInfo;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
@ -91,7 +94,7 @@ public class ThemeUtils implements Constants {
|
|||
|
||||
public static void applyBackground(final View view) {
|
||||
if (view == null) return;
|
||||
applyBackground(view, getUserThemeColor(view.getContext()));
|
||||
applyBackground(view, getUserAccentColor(view.getContext()));
|
||||
}
|
||||
|
||||
public static void applyBackground(final View view, final int color) {
|
||||
|
@ -118,23 +121,40 @@ public class ThemeUtils implements Constants {
|
|||
d.setAlpha(getUserThemeBackgroundAlpha(context));
|
||||
}
|
||||
|
||||
public static void applyColorFilterToMenuIcon(Menu menu, int color, int popupColor, PorterDuff.Mode mode, int... excludedGroups) {
|
||||
public static void applyColorFilterToMenuIcon(final Menu menu, final int color,
|
||||
final int highlightColor, final Mode mode,
|
||||
final int... excludedGroups) {
|
||||
applyColorFilterToMenuIcon(menu, color, color, highlightColor, mode, excludedGroups);
|
||||
}
|
||||
|
||||
public static void applyColorFilterToMenuIcon(final Menu menu, final int color, final int popupColor,
|
||||
final int highlightColor, final Mode mode,
|
||||
final int... excludedGroups) {
|
||||
for (int i = 0, j = menu.size(); i < j; i++) {
|
||||
final MenuItem item = menu.getItem(i);
|
||||
final Drawable icon = item.getIcon();
|
||||
final ContextMenuInfo info = item.getMenuInfo();
|
||||
if (icon != null) {
|
||||
if (ArrayUtils.contains(excludedGroups, item.getGroupId())) {
|
||||
icon.mutate().clearColorFilter();
|
||||
} else if (info instanceof MenuBarMenuInfo) {
|
||||
final boolean inPopup = ((MenuBarMenuInfo) info).isInPopup();
|
||||
icon.mutate().setColorFilter(inPopup ? popupColor : color, mode);
|
||||
if (icon != null && !ArrayUtils.contains(excludedGroups, item.getGroupId())) {
|
||||
icon.mutate();
|
||||
if (info instanceof MenuBarMenuInfo) {
|
||||
final MenuBarMenuInfo mbInfo = (MenuBarMenuInfo) info;
|
||||
final boolean inPopup = mbInfo.isInPopup();
|
||||
if (mbInfo.getMenuInfo() instanceof StatusMenuInfo) {
|
||||
final StatusMenuInfo sInfo = (StatusMenuInfo) mbInfo.getMenuInfo();
|
||||
icon.setColorFilter(sInfo.isHighlight() ? highlightColor
|
||||
: (inPopup ? popupColor : color), mode);
|
||||
} else {
|
||||
icon.setColorFilter(inPopup ? popupColor : color, mode);
|
||||
}
|
||||
} else if (info instanceof StatusMenuInfo) {
|
||||
final StatusMenuInfo sInfo = (StatusMenuInfo) info;
|
||||
icon.setColorFilter(sInfo.isHighlight() ? highlightColor : color, mode);
|
||||
} else {
|
||||
icon.mutate().setColorFilter(color, mode);
|
||||
icon.setColorFilter(color, mode);
|
||||
}
|
||||
}
|
||||
if (item.hasSubMenu()) {
|
||||
applyColorFilterToMenuIcon(item.getSubMenu(), color, popupColor, mode, excludedGroups);
|
||||
applyColorFilterToMenuIcon(item.getSubMenu(), color, popupColor, highlightColor, mode, excludedGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +163,7 @@ public class ThemeUtils implements Constants {
|
|||
final IndicatorConfig.Builder builder = new IndicatorConfig.Builder(context);
|
||||
final Resources res = context.getResources();
|
||||
final float width = 3 * res.getDisplayMetrics().density;
|
||||
final int themeColor = getUserThemeColor(context);
|
||||
final int themeColor = getUserAccentColor(context);
|
||||
builder.progressColor(themeColor);
|
||||
builder.indeterminateColor(themeColor);
|
||||
builder.progressStrokeWidth(width);
|
||||
|
@ -202,7 +222,7 @@ public class ThemeUtils implements Constants {
|
|||
a.recycle();
|
||||
}
|
||||
if (resId == 0) return new TwidereContextWrapper(context);
|
||||
return new TwidereContextThemeWrapper(context, resId, getUserThemeColor(context));
|
||||
return new TwidereContextThemeWrapper(context, resId, getUserAccentColor(context));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -250,22 +270,10 @@ public class ThemeUtils implements Constants {
|
|||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Compose:
|
||||
case R.style.Theme_Twidere_Light_Dialog:
|
||||
case R.style.Theme_Twidere_Colored:
|
||||
case R.style.Theme_Twidere_Colored_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Compose:
|
||||
case R.style.Theme_Twidere_ActionBar_Colored_Light:
|
||||
case R.style.Theme_Twidere_Settings_Light:
|
||||
case R.style.Theme_Twidere_Drawer_Light:
|
||||
case R.style.Theme_Twidere_Drawer_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_SolidBackground_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Compose_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Compose_DarkIcon:
|
||||
case R.style.Theme_Twidere_Settings_Light_DarkActionBar_DarkIcon:
|
||||
return 0x99333333;
|
||||
}
|
||||
|
@ -301,14 +309,8 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
|
||||
public static int getComposeThemeResource(final String name, final boolean darkActionBar) {
|
||||
if (VALUE_THEME_NAME_TWIDERE.equals(name))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Colored_DarkActionBar_Compose
|
||||
: R.style.Theme_Twidere_Colored_Compose;
|
||||
else if (VALUE_THEME_NAME_LIGHT.equals(name))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Light_DarkActionBar_Compose
|
||||
: R.style.Theme_Twidere_Light_Compose;
|
||||
else if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dark_Compose;
|
||||
return R.style.Theme_Twidere_Colored_Compose;
|
||||
if (VALUE_THEME_NAME_DARK.equals(name)) return R.style.Theme_Twidere_Dark_Compose;
|
||||
return R.style.Theme_Twidere_Light_Compose;
|
||||
}
|
||||
|
||||
public static boolean getDarkActionBarOption(final Context context) {
|
||||
|
@ -338,9 +340,6 @@ public class ThemeUtils implements Constants {
|
|||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Dark_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
return R.style.Theme_Twidere_Drawer_Dark_Transparent;
|
||||
}
|
||||
return R.style.Theme_Twidere_Drawer_Dark;
|
||||
|
@ -353,9 +352,6 @@ public class ThemeUtils implements Constants {
|
|||
public static int getLightDrawerThemeResource(final int themeRes) {
|
||||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
return R.style.Theme_Twidere_Drawer_Light_Transparent;
|
||||
}
|
||||
return R.style.Theme_Twidere_Drawer_Light;
|
||||
|
@ -390,20 +386,8 @@ public class ThemeUtils implements Constants {
|
|||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Compose:
|
||||
case R.style.Theme_Twidere_Light_Dialog:
|
||||
case R.style.Theme_Twidere_Colored:
|
||||
case R.style.Theme_Twidere_Colored_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Compose:
|
||||
case R.style.Theme_Twidere_ActionBar_Colored_Light:
|
||||
case R.style.Theme_Twidere_Settings_Light:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_SolidBackground_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Compose_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Compose_DarkIcon:
|
||||
case R.style.Theme_Twidere_Settings_Light_DarkActionBar_DarkIcon:
|
||||
return 0x99333333;
|
||||
}
|
||||
|
@ -486,9 +470,6 @@ public class ThemeUtils implements Constants {
|
|||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Dark_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
return 0xa0;
|
||||
}
|
||||
return 0xff;
|
||||
|
@ -526,7 +507,7 @@ public class ThemeUtils implements Constants {
|
|||
accentColor = ((IThemedActivity) context).getThemeColor();
|
||||
} else {
|
||||
themeRes = getSettingsThemeResource(context);
|
||||
accentColor = getUserThemeColor(context, themeRes);
|
||||
accentColor = getUserAccentColor(context, themeRes);
|
||||
}
|
||||
return new TwidereContextThemeWrapper(context, getThemeResActionIcons(themeRes), accentColor);
|
||||
}
|
||||
|
@ -547,7 +528,7 @@ public class ThemeUtils implements Constants {
|
|||
accentColor = ((IThemedActivity) context).getThemeColor();
|
||||
} else {
|
||||
themeRes = getSettingsThemeResource(context);
|
||||
accentColor = getUserThemeColor(context);
|
||||
accentColor = getUserAccentColor(context);
|
||||
}
|
||||
final Context theme = getThemedContextForActionIcons(context, themeRes, accentColor);
|
||||
return LayoutInflater.from(theme);
|
||||
|
@ -561,6 +542,17 @@ public class ThemeUtils implements Constants {
|
|||
return VALUE_THEME_FONT_FAMILY_REGULAR;
|
||||
}
|
||||
|
||||
public static int getThemeBackgroundColor(final Context context) {
|
||||
final Resources res = getResources(context);
|
||||
final Context wrapped = getThemedContext(context, res);
|
||||
final TypedArray a = wrapped.obtainStyledAttributes(new int[]{android.R.attr.colorBackground});
|
||||
try {
|
||||
return a.getColor(0, Color.GRAY);
|
||||
} finally {
|
||||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getThemeForegroundColor(final Context context) {
|
||||
final Resources res = getResources(context);
|
||||
final Context wrapped = getThemedContext(context, res);
|
||||
|
@ -587,30 +579,6 @@ public class ThemeUtils implements Constants {
|
|||
|
||||
public static int getThemeResActionIcons(final int baseThemeRes) {
|
||||
switch (baseThemeRes) {
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar: {
|
||||
return R.style.Theme_Twidere_Light_DarkActionBar_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_SolidBackground: {
|
||||
return R.style.Theme_Twidere_Light_DarkActionBar_SolidBackground_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent: {
|
||||
return R.style.Theme_Twidere_Light_DarkActionBar_Transparent_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Compose: {
|
||||
return R.style.Theme_Twidere_Light_DarkActionBar_Compose_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar: {
|
||||
return R.style.Theme_Twidere_Colored_DarkActionBar_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground: {
|
||||
return R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent: {
|
||||
return R.style.Theme_Twidere_Colored_DarkActionBar_Transparent_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Compose: {
|
||||
return R.style.Theme_Twidere_Colored_DarkActionBar_Compose_DarkIcon;
|
||||
}
|
||||
case R.style.Theme_Twidere_Settings_Light_DarkActionBar: {
|
||||
return R.style.Theme_Twidere_Settings_Light_DarkActionBar_DarkIcon;
|
||||
}
|
||||
|
@ -624,22 +592,12 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
|
||||
public static int getThemeResource(final String name, final String background, final boolean darkActionBar) {
|
||||
if (VALUE_THEME_NAME_TWIDERE.equals(name)) {
|
||||
if (VALUE_THEME_NAME_LIGHT.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground
|
||||
: R.style.Theme_Twidere_Colored_SolidBackground;
|
||||
return R.style.Theme_Twidere_Light_SolidBackground;
|
||||
else if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(background))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Colored_DarkActionBar_Transparent
|
||||
: R.style.Theme_Twidere_Colored_Transparent;
|
||||
return darkActionBar ? R.style.Theme_Twidere_Colored_DarkActionBar : R.style.Theme_Twidere_Colored;
|
||||
} else if (VALUE_THEME_NAME_LIGHT.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Light_DarkActionBar_SolidBackground
|
||||
: R.style.Theme_Twidere_Light_SolidBackground;
|
||||
else if (VALUE_THEME_BACKGROUND_TRANSPARENT.equals(background))
|
||||
return darkActionBar ? R.style.Theme_Twidere_Light_DarkActionBar_Transparent
|
||||
: R.style.Theme_Twidere_Light_Transparent;
|
||||
return darkActionBar ? R.style.Theme_Twidere_Light_DarkActionBar : R.style.Theme_Twidere_Light;
|
||||
return R.style.Theme_Twidere_Light_Transparent;
|
||||
return R.style.Theme_Twidere_Light;
|
||||
|
||||
} else if (VALUE_THEME_NAME_DARK.equals(name)) {
|
||||
if (VALUE_THEME_BACKGROUND_SOLID.equals(background))
|
||||
|
@ -648,7 +606,7 @@ public class ThemeUtils implements Constants {
|
|||
return R.style.Theme_Twidere_Dark_Transparent;
|
||||
return R.style.Theme_Twidere_Dark;
|
||||
}
|
||||
return R.style.Theme_Twidere_Colored_DarkActionBar;
|
||||
return R.style.Theme_Twidere_Light;
|
||||
}
|
||||
|
||||
public static int getTitleTextAppearance(final Context context) {
|
||||
|
@ -667,7 +625,7 @@ public class ThemeUtils implements Constants {
|
|||
|
||||
public static int getUserLinkTextColor(final Context context) {
|
||||
if (context == null) return new TextPaint().linkColor;
|
||||
final int themeColor = getUserThemeColor(context);
|
||||
final int themeColor = getUserAccentColor(context);
|
||||
final float[] hsv = new float[3];
|
||||
Color.colorToHSV(themeColor, hsv);
|
||||
if (isDarkTheme(context)) {
|
||||
|
@ -684,7 +642,7 @@ public class ThemeUtils implements Constants {
|
|||
return pref.getInt(KEY_THEME_BACKGROUND_ALPHA, DEFAULT_THEME_BACKGROUND_ALPHA);
|
||||
}
|
||||
|
||||
public static int getUserThemeColor(final Context context) {
|
||||
public static int getUserAccentColor(final Context context) {
|
||||
if (context == null) return Color.TRANSPARENT;
|
||||
final Resources res = getResources(context);
|
||||
final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
|
||||
|
@ -692,7 +650,7 @@ public class ThemeUtils implements Constants {
|
|||
return pref.getInt(KEY_THEME_COLOR, def);
|
||||
}
|
||||
|
||||
public static int getUserThemeColor(final Context context, int themeRes) {
|
||||
public static int getUserAccentColor(final Context context, int themeRes) {
|
||||
if (context == null) return Color.TRANSPARENT;
|
||||
final int defThemeColor = getThemeColor(context, themeRes);
|
||||
final SharedPreferencesWrapper pref = getSharedPreferencesWrapper(context);
|
||||
|
@ -747,25 +705,6 @@ public class ThemeUtils implements Constants {
|
|||
return getWindowContentOverlay(new ContextThemeWrapper(context, themeRes));
|
||||
}
|
||||
|
||||
public static boolean isColoredActionBar(final Context context) {
|
||||
return isColoredActionBar(getThemeResource(context));
|
||||
}
|
||||
|
||||
public static boolean isColoredActionBar(final int themeRes) {
|
||||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Colored:
|
||||
case R.style.Theme_Twidere_Colored_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_Compose:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Compose:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isDarkDrawerEnabled(final Context context) {
|
||||
final SharedPreferencesWrapper prefs = SharedPreferencesWrapper.getInstance(context, SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE);
|
||||
|
@ -799,26 +738,6 @@ public class ThemeUtils implements Constants {
|
|||
return b;
|
||||
}
|
||||
|
||||
public static boolean isLightActionBar(final Context context) {
|
||||
return isLightActionBar(getThemeResource(context));
|
||||
}
|
||||
|
||||
public static boolean isLightActionBar(final int themeRes) {
|
||||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Light:
|
||||
case R.style.Theme_Twidere_Light_SolidBackground:
|
||||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Compose:
|
||||
case R.style.Theme_Twidere_Colored:
|
||||
case R.style.Theme_Twidere_Colored_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_Compose:
|
||||
case R.style.Theme_Twidere_Settings_Light:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSolidBackground(final Context context) {
|
||||
return VALUE_THEME_BACKGROUND_SOLID.equals(getThemeBackgroundOption(context));
|
||||
}
|
||||
|
@ -829,13 +748,8 @@ public class ThemeUtils implements Constants {
|
|||
|
||||
public static boolean isTransparentBackground(final int themeRes) {
|
||||
switch (themeRes) {
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Dark_Transparent:
|
||||
case R.style.Theme_Twidere_Light_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent:
|
||||
case R.style.Theme_Twidere_Light_DarkActionBar_Transparent_DarkIcon:
|
||||
case R.style.Theme_Twidere_Viewer_Transparent:
|
||||
return true;
|
||||
}
|
||||
|
@ -845,20 +759,20 @@ public class ThemeUtils implements Constants {
|
|||
public static void notifyStatusBarColorChanged(final Context context, final int themeResource,
|
||||
final int accentColor, final int backgroundAlpha) {
|
||||
final Intent intent = new Intent("com.mohammadag.colouredstatusbar.ChangeStatusBarColor");
|
||||
if (isColoredActionBar(themeResource)) {
|
||||
intent.putExtra("status_bar_color", backgroundAlpha << 24 | accentColor);
|
||||
} else {
|
||||
if (isLightActionBar(themeResource)) {
|
||||
intent.putExtra("status_bar_color", backgroundAlpha << 24 | 0xFFDDDDDD);
|
||||
} else {
|
||||
intent.putExtra("status_bar_color", backgroundAlpha << 24 | 0xFF222222);
|
||||
}
|
||||
}
|
||||
if (isLightActionBar(themeResource)) {
|
||||
intent.putExtra("status_bar_icons_color", Color.DKGRAY);
|
||||
} else {
|
||||
intent.putExtra("status_bar_icons_color", Color.WHITE);
|
||||
}
|
||||
// if (isColoredActionBar(themeResource)) {
|
||||
// intent.putExtra("status_bar_color", backgroundAlpha << 24 | accentColor);
|
||||
// } else {
|
||||
// if (isLightActionBar(themeResource)) {
|
||||
// intent.putExtra("status_bar_color", backgroundAlpha << 24 | 0xFFDDDDDD);
|
||||
// } else {
|
||||
// intent.putExtra("status_bar_color", backgroundAlpha << 24 | 0xFF222222);
|
||||
// }
|
||||
// }
|
||||
// if (isLightActionBar(themeResource)) {
|
||||
// intent.putExtra("status_bar_icons_color", Color.DKGRAY);
|
||||
// } else {
|
||||
// intent.putExtra("status_bar_icons_color", Color.WHITE);
|
||||
// }
|
||||
// Please note that these are not yet implemented!!!
|
||||
// You're free to include them in your code so that when they
|
||||
// are implemented, your app will work out of the box.
|
||||
|
@ -905,24 +819,6 @@ public class ThemeUtils implements Constants {
|
|||
activity.overridePendingTransition(activityCloseEnterAnimation, activityCloseExitAnimation);
|
||||
}
|
||||
|
||||
public static boolean shouldApplyColorFilter(final Context context) {
|
||||
return shouldApplyColorFilter(getThemeResource(context));
|
||||
}
|
||||
|
||||
public static boolean shouldApplyColorFilter(final int res) {
|
||||
switch (res) {
|
||||
case R.style.Theme_Twidere_Colored:
|
||||
case R.style.Theme_Twidere_Colored_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_Compose:
|
||||
case R.style.Theme_Twidere_Colored_Transparent:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_SolidBackground:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Compose:
|
||||
case R.style.Theme_Twidere_Colored_DarkActionBar_Transparent:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean shouldApplyColorFilterToActionIcons(final Context context) {
|
||||
return false;
|
||||
|
@ -938,7 +834,7 @@ public class ThemeUtils implements Constants {
|
|||
if (d instanceof LayerDrawable) {
|
||||
final Drawable colorLayer = ((LayerDrawable) d).findDrawableByLayerId(R.id.color_layer);
|
||||
if (colorLayer != null) {
|
||||
final int color = getUserThemeColor(context);
|
||||
final int color = getUserAccentColor(context);
|
||||
colorLayer.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
@ -979,4 +875,16 @@ public class ThemeUtils implements Constants {
|
|||
a.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isColoredActionBar(int themeRes) {
|
||||
return !isDarkTheme(themeRes);
|
||||
}
|
||||
|
||||
public static void initTextView(TextView view) {
|
||||
if (view.isInEditMode()) return;
|
||||
final Context context = view.getContext();
|
||||
view.setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
view.setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
view.setTypeface(ThemeUtils.getUserTypeface(context, view.getTypeface()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
|
@ -98,6 +97,7 @@ import org.apache.http.NameValuePair;
|
|||
import org.json.JSONException;
|
||||
import org.mariotaku.gallery3d.ImageViewerGLActivity;
|
||||
import org.mariotaku.jsonserializer.JSONSerializer;
|
||||
import org.mariotaku.menucomponent.internal.menu.MenuUtils;
|
||||
import org.mariotaku.querybuilder.AllColumns;
|
||||
import org.mariotaku.querybuilder.Columns;
|
||||
import org.mariotaku.querybuilder.Columns.Column;
|
||||
|
@ -173,6 +173,7 @@ import org.mariotaku.twidere.provider.TweetStore.Tabs;
|
|||
import org.mariotaku.twidere.provider.TweetStore.UnreadCounts;
|
||||
import org.mariotaku.twidere.service.RefreshService;
|
||||
import org.mariotaku.twidere.util.content.ContentResolverUtils;
|
||||
import org.mariotaku.twidere.util.menu.StatusMenuInfo;
|
||||
import org.mariotaku.twidere.util.net.TwidereHostResolverFactory;
|
||||
import org.mariotaku.twidere.util.net.TwidereHttpClientFactory;
|
||||
|
||||
|
@ -3428,7 +3429,7 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
|
||||
public static void setMenuForStatus(final Context context, final Menu menu, final ParcelableStatus status) {
|
||||
if (context == null || menu == null || status == null) return;
|
||||
final int activatedColor = ThemeUtils.getUserThemeColor(context);
|
||||
final int activatedColor = ThemeUtils.getUserAccentColor(context);
|
||||
final boolean isMyRetweet = isMyRetweet(status);
|
||||
final MenuItem delete = menu.findItem(MENU_DELETE);
|
||||
if (delete != null) {
|
||||
|
@ -3436,35 +3437,18 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
}
|
||||
final MenuItem retweet = menu.findItem(MENU_RETWEET);
|
||||
if (retweet != null) {
|
||||
final Drawable icon = retweet.getIcon().mutate();
|
||||
retweet.setVisible(!status.user_is_protected || isMyRetweet);
|
||||
if (isMyRetweet) {
|
||||
icon.setColorFilter(activatedColor, Mode.SRC_ATOP);
|
||||
retweet.setTitle(R.string.cancel_retweet);
|
||||
} else {
|
||||
icon.clearColorFilter();
|
||||
retweet.setTitle(R.string.retweet);
|
||||
}
|
||||
MenuUtils.setMenuInfo(retweet, new StatusMenuInfo(isMyRetweet));
|
||||
retweet.setTitle(isMyRetweet ? R.string.cancel_retweet : R.string.retweet);
|
||||
}
|
||||
final MenuItem itemRetweetSubmenu = menu.findItem(R.id.retweet_submenu);
|
||||
if (itemRetweetSubmenu != null) {
|
||||
final Drawable icon = itemRetweetSubmenu.getIcon().mutate();
|
||||
if (isMyRetweet) {
|
||||
icon.setColorFilter(activatedColor, Mode.SRC_ATOP);
|
||||
} else {
|
||||
icon.clearColorFilter();
|
||||
}
|
||||
final MenuItem retweetSubItem = menu.findItem(R.id.retweet_submenu);
|
||||
if (retweetSubItem != null) {
|
||||
MenuUtils.setMenuInfo(retweetSubItem, new StatusMenuInfo(isMyRetweet));
|
||||
}
|
||||
final MenuItem favorite = menu.findItem(MENU_FAVORITE);
|
||||
if (favorite != null) {
|
||||
final Drawable icon = favorite.getIcon().mutate();
|
||||
if (status.is_favorite) {
|
||||
icon.setColorFilter(activatedColor, Mode.SRC_ATOP);
|
||||
favorite.setTitle(R.string.unfavorite);
|
||||
} else {
|
||||
icon.clearColorFilter();
|
||||
favorite.setTitle(R.string.favorite);
|
||||
}
|
||||
MenuUtils.setMenuInfo(favorite, new StatusMenuInfo(status.is_favorite));
|
||||
favorite.setTitle(status.is_favorite ? R.string.unfavorite : R.string.favorite);
|
||||
}
|
||||
final MenuItem translate = menu.findItem(MENU_TRANSLATE);
|
||||
if (translate != null) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.mariotaku.twidere.util.menu;
|
||||
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/10/27.
|
||||
*/
|
||||
public class StatusMenuInfo implements ContextMenuInfo {
|
||||
private final boolean highlight;
|
||||
|
||||
public StatusMenuInfo(boolean highlight) {
|
||||
this.highlight = highlight;
|
||||
}
|
||||
|
||||
public boolean isHighlight() {
|
||||
return highlight;
|
||||
}
|
||||
}
|
|
@ -23,8 +23,10 @@ import android.annotation.TargetApi;
|
|||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.PorterDuff.Mode;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
|
@ -35,7 +37,8 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.accessor.ViewAccessor;
|
||||
import org.mariotaku.twidere.view.iface.IHomeActionButton;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
|
@ -54,22 +57,23 @@ public class HomeActionButton extends FrameLayout implements IHomeActionButton {
|
|||
|
||||
public HomeActionButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
inflate(context, R.layout.action_item_home_actions, this);
|
||||
inflate(ThemeUtils.getActionBarContext(context), R.layout.action_item_home_actions, this);
|
||||
mIconView = (ImageView) findViewById(android.R.id.icon);
|
||||
mProgressBar = (ProgressBar) findViewById(android.R.id.progress);
|
||||
setOutlineProvider(new HomeActionButtonOutlineProvider());
|
||||
setClipToOutline(true);
|
||||
setButtonColor(Color.WHITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
final Drawable drawable = getBackground();
|
||||
if (drawable != null) {
|
||||
drawable.setColorFilter(color, Mode.MULTIPLY);
|
||||
}
|
||||
final int contrastColor = Utils.getContrastYIQ(color, 192);
|
||||
mIconView.setColorFilter(contrastColor, Mode.SRC_ATOP);
|
||||
mProgressBar.setIndeterminateTintList(ColorStateList.valueOf(contrastColor));
|
||||
public void setButtonColor(int color) {
|
||||
ViewAccessor.setBackground(this, new ColorDrawable(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIconColor(int color, Mode mode) {
|
||||
mIconView.setColorFilter(color, mode);
|
||||
mProgressBar.setIndeterminateTintList(ColorStateList.valueOf(color));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ import android.widget.ImageView;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.util.Utils;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.view.iface.IHomeActionButton;
|
||||
|
||||
public class HomeActionButtonCompat extends FrameLayout implements IHomeActionButton {
|
||||
|
@ -49,13 +49,13 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu
|
|||
|
||||
public HomeActionButtonCompat(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
inflate(context, R.layout.action_item_home_actions, this);
|
||||
inflate(ThemeUtils.getActionBarContext(context), R.layout.action_item_home_actions_compat, this);
|
||||
mIconView = (ImageView) findViewById(android.R.id.icon);
|
||||
mProgressBar = (ProgressBar) findViewById(android.R.id.progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(int color) {
|
||||
public void setButtonColor(int color) {
|
||||
final Drawable drawable = getBackground();
|
||||
if (drawable instanceof LayerDrawable) {
|
||||
final Drawable layer = ((LayerDrawable) drawable).findDrawableByLayerId(R.id.color_layer);
|
||||
|
@ -63,7 +63,11 @@ public class HomeActionButtonCompat extends FrameLayout implements IHomeActionBu
|
|||
layer.setColorFilter(color, Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
mIconView.setColorFilter(Utils.getContrastYIQ(color), Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIconColor(int color, Mode mode) {
|
||||
mIconView.setColorFilter(color, mode);
|
||||
}
|
||||
|
||||
public void setIcon(final Bitmap bm) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ListMenuOverflowButton extends ImageView {
|
|||
public ListMenuOverflowButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setScaleType(ScaleType.CENTER_INSIDE);
|
||||
mHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserThemeColor(context);
|
||||
mHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserAccentColor(context);
|
||||
mRect = new Rect();
|
||||
final TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.src });
|
||||
if (!a.hasValue(0)) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class NavigationArrowButton extends ImageButton {
|
|||
|
||||
public NavigationArrowButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
mHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserThemeColor(context);
|
||||
mHighlightColor = isInEditMode() ? 0 : ThemeUtils.getUserAccentColor(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -129,17 +129,25 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
|||
mIndicatorAdapter.setIconColor(color);
|
||||
}
|
||||
|
||||
public Context getItemContext() {
|
||||
return mIndicatorAdapter.getItemContext();
|
||||
}
|
||||
|
||||
public void setItemContext(Context context) {
|
||||
mIndicatorAdapter.setItemContext(context);
|
||||
}
|
||||
|
||||
private static class TabPagerIndicatorAdapter extends Adapter<TabItemHolder> implements OnClickListener, OnLongClickListener {
|
||||
|
||||
private final TabPagerIndicator mIndicator;
|
||||
private final LayoutInflater mInflater;
|
||||
private Context mItemContext;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
private TabProvider mTabProvider;
|
||||
private int mStripColor, mIconColor;
|
||||
|
||||
public TabPagerIndicatorAdapter(TabPagerIndicator indicator) {
|
||||
mIndicator = indicator;
|
||||
mInflater = LayoutInflater.from(indicator.getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -197,6 +205,15 @@ public class TabPagerIndicator extends RecyclerView implements PagerIndicator {
|
|||
mIconColor = color;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setItemContext(Context itemContext) {
|
||||
mItemContext = itemContext;
|
||||
mInflater = LayoutInflater.from(itemContext);
|
||||
}
|
||||
|
||||
public Context getItemContext() {
|
||||
return mItemContext;
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchTabClick(int position) {
|
||||
|
|
|
@ -33,9 +33,10 @@ public class TwidereMenuBar extends MenuBar implements MenuBarListener, Constant
|
|||
|
||||
@Override
|
||||
public void onPreShowMenu(Menu menu) {
|
||||
final int color = ThemeUtils.getTextColorPrimary(getItemViewContext());
|
||||
final int popupColor = ThemeUtils.getTextColorPrimary(getPopupContext());
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, color, popupColor, Mode.SRC_ATOP,
|
||||
final int color = ThemeUtils.getThemeForegroundColor(getItemViewContext());
|
||||
final int popupColor = ThemeUtils.getThemeForegroundColor(getPopupContext());
|
||||
final int highlightColor = ThemeUtils.getUserAccentColor(getContext());
|
||||
ThemeUtils.applyColorFilterToMenuIcon(menu, color, popupColor, highlightColor, Mode.SRC_ATOP,
|
||||
MENU_GROUP_STATUS_SHARE, MENU_GROUP_STATUS_EXTENSION);
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public interface ICardItemView extends IColorLabelView {
|
|||
mGapTextPaint.setColor(a.getColor(R.styleable.CardItemView_cardGapTextColor, Color.GRAY));
|
||||
mGapTextPaint.setTextSize(a.getDimensionPixelSize(R.styleable.CardItemView_cardGapTextSize, 18));
|
||||
mGapTextPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
mThemeColor = ThemeUtils.getUserThemeColor(context);
|
||||
mThemeColor = ThemeUtils.getUserAccentColor(context);
|
||||
mOverflowIconGestureDetector = new GestureDetector(context, new OverflowIconGestureListener(this));
|
||||
mFakeOverflowButton = new FakeOverflowButton(this);
|
||||
mBackgroundAlpha = a.getFraction(R.styleable.CardItemView_cardBackgroundAlpha, 1, 1, 1.0f);
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package org.mariotaku.twidere.view.iface;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/10/23.
|
||||
*/
|
||||
public interface IHomeActionButton {
|
||||
void setColor(int color);
|
||||
void setButtonColor(int color);
|
||||
|
||||
void setIconColor(int color, PorterDuff.Mode mode);
|
||||
|
||||
void setIcon(Bitmap bm);
|
||||
|
||||
|
|
|
@ -37,10 +37,7 @@ public class ThemedAutoCompleteTextView extends AutoCompleteTextView {
|
|||
|
||||
public ThemedAutoCompleteTextView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,11 +37,7 @@ public class ThemedCheckBox extends CheckBox {
|
|||
|
||||
public ThemedCheckBox(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
setTypeface(ThemeUtils.getUserTypeface(context, getTypeface()));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,10 +37,7 @@ public class ThemedEditText extends EditText {
|
|||
|
||||
public ThemedEditText(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,10 +37,7 @@ public class ThemedMultiAutoCompleteTextView extends MultiAutoCompleteTextView {
|
|||
|
||||
public ThemedMultiAutoCompleteTextView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,21 +27,17 @@ import org.mariotaku.twidere.util.ThemeUtils;
|
|||
|
||||
public class ThemedRadioButton extends RadioButton {
|
||||
|
||||
public ThemedRadioButton(final Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
public ThemedRadioButton(final Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ThemedRadioButton(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, android.R.attr.checkboxStyle);
|
||||
}
|
||||
public ThemedRadioButton(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, android.R.attr.checkboxStyle);
|
||||
}
|
||||
|
||||
public ThemedRadioButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
setTypeface(ThemeUtils.getUserTypeface(context, getTypeface()));
|
||||
}
|
||||
}
|
||||
public ThemedRadioButton(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,11 +33,7 @@ public class ThemedSwitch extends Switch {
|
|||
|
||||
public ThemedSwitch(final Context context, final AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
setTypeface(ThemeUtils.getUserTypeface(context, getTypeface()));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,11 +37,7 @@ public class ThemedTextView extends TextView {
|
|||
|
||||
public ThemedTextView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
if (!isInEditMode()) {
|
||||
setLinkTextColor(ThemeUtils.getUserLinkTextColor(context));
|
||||
setHighlightColor(ThemeUtils.getUserHighlightColor(context));
|
||||
setTypeface(ThemeUtils.getUserTypeface(context, getTypeface()));
|
||||
}
|
||||
ThemeUtils.initTextView(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#40ffffff">
|
||||
<item>
|
||||
<color android:color="#ffffff"/>
|
||||
</item>
|
||||
</ripple>
|
|
@ -6,6 +6,5 @@
|
|||
android:layout_height="@dimen/float_action_button_size"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_margin="@dimen/element_spacing_large"
|
||||
android:background="@drawable/btn_home_actions"
|
||||
android:elevation="@dimen/element_spacing_small"
|
||||
android:visibility="visible"/>
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
style="?android:actionButtonStyle"
|
||||
<LinearLayout
|
||||
android:id="@+id/send"
|
||||
style="?android:actionButtonStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/send"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
|
@ -15,7 +16,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:textAppearanceSmall" />
|
||||
android:textAppearance="?android:textAppearanceSmall"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -24,6 +25,6 @@
|
|||
android:cropToPadding="false"
|
||||
android:padding="@dimen/element_spacing_xsmall"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_action_send" />
|
||||
android:src="@drawable/ic_action_send"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,22 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@android:id/progress"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:visibility="gone"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:duplicateParentState="true"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
<ProgressBar
|
||||
android:id="@android:id/progress"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:contentDescription="@string/compose"
|
||||
android:scaleType="centerInside"/>
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:contentDescription="@string/compose"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
</merge>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@android:id/progress"
|
||||
style="?android:attr/progressBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:contentDescription="@string/compose"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
</merge>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/compose_actionbar"
|
||||
style="?android:actionBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
<org.mariotaku.twidere.view.ActionBarHomeAsUpIndicator
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -40,7 +40,7 @@
|
|||
android:id="@+id/actionbar_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true" />
|
||||
android:singleLine="true"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ActionBarSubtitleView
|
||||
android:id="@+id/actionbar_subtitle"
|
||||
|
@ -48,7 +48,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@string/quote_protected_status_notice"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -62,16 +62,8 @@
|
|||
android:layout_weight="0"
|
||||
android:indeterminateOnly="true"
|
||||
android:padding="2dp"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"/>
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
android:id="@+id/action_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:background="@null"
|
||||
android:max="@integer/max_compose_menu_buttons_top" />
|
||||
|
||||
<include layout="@layout/action_item_compose" />
|
||||
<include layout="@layout/action_item_compose"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,41 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:id="@+id/compose_bottombar"
|
||||
style="?android:actionBarSplitStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.scvngr.levelup.views.gallery.Gallery
|
||||
android:id="@+id/account_selector"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/account_selector_divider"
|
||||
android:layout_width="0.2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:layout_weight="0"
|
||||
android:background="#80808080"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/compose_bottombar"
|
||||
style="?android:actionBarSplitStyle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/bottom_menu_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:layout_weight="1"
|
||||
android:fadeScrollbars="false">
|
||||
|
||||
<org.mariotaku.twidere.view.TwidereMenuBar
|
||||
android:id="@+id/bottom_menu"
|
||||
android:id="@+id/menu_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:layout_gravity="center"
|
||||
android:background="@null"
|
||||
android:max="@integer/max_action_buttons"/>
|
||||
android:max="@integer/max_action_buttons_bottom"/>
|
||||
</HorizontalScrollView>
|
||||
|
||||
<View
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.mariotaku.twidere.view.MainFrameLayout
|
||||
android:id="@+id/content_fragment"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/content_fragment"
|
||||
android:layout_height="match_parent"/>
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
<include layout="@layout/empty_tab_hint"/>
|
||||
|
||||
<include layout="@layout/layout_home_actions_button"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tabs_container"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -34,4 +32,6 @@
|
|||
android:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/layout_home_actions_button"/>
|
||||
</FrameLayout>
|
|
@ -12,7 +12,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<com.scvngr.levelup.views.gallery.Gallery
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/color_presets"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/button_bar_height"
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mobeta.android.dslv.DragSortListView 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:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:collapsed_height="2dp"
|
||||
app:drag_enabled="true"
|
||||
app:drag_handle_id="@+id/drag_handle"
|
||||
app:drag_scroll_start="0.33"
|
||||
app:float_alpha="0.6"
|
||||
app:float_background_color="@android:color/transparent"
|
||||
app:max_drag_scroll_speed="0.5"
|
||||
app:remove_enabled="false"
|
||||
app:slide_shuffle_speed="0.3"
|
||||
app:sort_enabled="true"
|
||||
app:track_drag_sort="true"
|
||||
app:use_default_controller="true"
|
||||
tools:context=".fragment.AccountsManagerFragment"/>
|
|
@ -1,26 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.mariotaku.twidere.view.SquareRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
<org.mariotaku.twidere.view.SquareRelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.mariotaku.twidere.view.ForegroundImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="@dimen/element_spacing_xsmall"
|
||||
android:background="?android:activatedBackgroundIndicator"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_xsmall"/>
|
||||
<!--
|
||||
<org.mariotaku.twidere.view.ActivatedCheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
-->
|
||||
<org.mariotaku.twidere.view.ForegroundImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="@dimen/element_spacing_xsmall"
|
||||
android:background="?android:activatedBackgroundIndicator"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:padding="@dimen/element_spacing_xsmall"/>
|
||||
|
||||
</org.mariotaku.twidere.view.SquareRelativeLayout>
|
|
@ -15,68 +15,81 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout 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:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
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:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/icon_size_list_item"
|
||||
android:layout_height="@dimen/icon_size_list_item"
|
||||
android:layout_centerVertical="true"
|
||||
android:contentDescription="@string/my_profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@android:id/checkbox"
|
||||
android:layout_toRightOf="@android:id/icon"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
<View
|
||||
android:id="@+id/drag_handle"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
android:background="@drawable/list_drag_handle"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@dimen/icon_size_list_item"
|
||||
android:layout_height="@dimen/icon_size_list_item"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/drag_handle"
|
||||
android:contentDescription="@string/my_profile_image"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<org.mariotaku.twidere.view.ActivatedCheckBox
|
||||
android:id="@android:id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@android:id/checkbox"
|
||||
android:layout_toRightOf="@android:id/icon"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@android:id/icon"
|
||||
android:layout_alignRight="@android:id/icon"
|
||||
android:background="#80000000"
|
||||
android:singleLine="true"
|
||||
android:text="@string/default_account"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/white"/>
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
|
||||
<org.mariotaku.twidere.view.ActivatedCheckBox
|
||||
android:id="@android:id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/default_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@android:id/icon"
|
||||
android:layout_alignLeft="@android:id/icon"
|
||||
android:background="#80000000"
|
||||
android:singleLine="true"
|
||||
android:text="@string/default_account"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="@android:color/white"/>
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
|
@ -1,52 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:activatedBackgroundIndicator"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:activatedBackgroundIndicator"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:id="@+id/drag_handle"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0"
|
||||
android:background="@drawable/list_drag_handle"/>
|
||||
<View
|
||||
android:id="@+id/drag_handle"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0"
|
||||
android:background="@drawable/list_drag_handle"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="48dip"
|
||||
android:layout_margin="4dip"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/icon"
|
||||
android:scaleType="fitCenter"/>
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="48dip"
|
||||
android:layout_margin="4dip"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/icon"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"/>
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,106 +1,106 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/account_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:activatedBackgroundIndicator"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
app:ignorePadding="true">
|
||||
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/account_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:padding="@dimen/element_spacing_small"
|
||||
app:ignorePadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:listPreferredItemHeightSmall"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
<LinearLayout
|
||||
android:id="@+id/profile_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?android:listPreferredItemHeightSmall"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/icon"
|
||||
android:scaleType="fitCenter"/>
|
||||
<ImageView
|
||||
android:id="@+id/profile_image"
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/icon"
|
||||
android:scaleType="fitCenter"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/element_spacing_small">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/element_spacing_small">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_default_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:id="@+id/name_default_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textSize="@dimen/accounts_drawer_name_size"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textSize="@dimen/accounts_drawer_name_size"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/default_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="4dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/default_account"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/accounts_drawer_default_indicator_size"/>
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:id="@+id/default_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="4dp"
|
||||
android:singleLine="true"
|
||||
android:text="@string/default_account"
|
||||
android:textAppearance="?android:textAppearanceSmall"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/accounts_drawer_default_indicator_size"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="@dimen/accounts_drawer_screen_name_size"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/screen_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textSize="@dimen/accounts_drawer_screen_name_size"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/profile_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.4dp"
|
||||
android:layout_below="@+id/profile_container"
|
||||
android:layout_margin="@dimen/element_spacing_small"
|
||||
android:background="#40808080"/>
|
||||
<View
|
||||
android:id="@+id/profile_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.4dp"
|
||||
android:layout_below="@+id/profile_container"
|
||||
android:layout_margin="@dimen/element_spacing_small"
|
||||
android:background="#40808080"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/profile_divider"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/profile_divider"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_small">
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/show_in_timeline"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textSize="@dimen/accounts_drawer_switch_label_size"/>
|
||||
<org.mariotaku.twidere.view.themed.ThemedTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/show_in_timeline"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textSize="@dimen/accounts_drawer_switch_label_size"/>
|
||||
|
||||
<org.mariotaku.twidere.view.themed.ThemedSwitch
|
||||
android:id="@+id/toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"/>
|
||||
</LinearLayout>
|
||||
<org.mariotaku.twidere.view.themed.ThemedSwitch
|
||||
android:id="@+id/toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"/>
|
||||
</LinearLayout>
|
||||
|
||||
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@id/add_account"
|
||||
android:icon="@drawable/ic_action_add"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/add_account"/>
|
||||
</menu>
|
|
@ -19,11 +19,11 @@
|
|||
<style name="Theme.Twidere.Dark" parent="android:Theme.DeviceDefault">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@color/bg_color_dark</item>
|
||||
<!--<item name="android:colorBackgroundCacheHint">@color/bg_color_dark</item>-->
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_dark</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_dark</item>-->
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
|
||||
|
@ -57,55 +57,14 @@
|
|||
<item name="cardItemViewStyle">@style/Widget.CardItemView</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light" parent="android:Theme.DeviceDefault.Light">
|
||||
<style name="Theme.Twidere.Light" parent="android:Theme.DeviceDefault.Light.DarkActionBar">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@color/bg_color_light</item>
|
||||
<!--<item name="android:colorBackgroundCacheHint">@color/bg_color_light</item>-->
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_light</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<!--<item name="android:actionBarStyle">@style/Widget.Twidere.ActionBar.Light</item>-->
|
||||
<!--<item name="android:actionBarWidgetTheme">@style/Theme.Twidere.Light</item>-->
|
||||
|
||||
<!-- Custom view styles -->
|
||||
<item name="tabItemStyle">@style/Widget.TabPageIndicator.TabItem</item>
|
||||
<item name="tabItemContentStyle">@style/Widget.TabPageIndicator.TabItem.Content</item>
|
||||
<item name="tabItemTextStyle">@style/Widget.TabPageIndicator.TabItem.TextView.Light</item>
|
||||
<item name="staggeredGridViewStyle">@style/Widget.StaggeredGridView</item>
|
||||
|
||||
<!-- Card UI styles -->
|
||||
<item name="cardItemBackground">@drawable/bg_card_item_light</item>
|
||||
<item name="cardItemBackgroundColor">#f8f8f8</item>
|
||||
<item name="cardItemMessageIncomingBackground">
|
||||
@drawable/bg_card_item_message_incoming_light
|
||||
</item>
|
||||
<item name="cardItemMessageOutgoingBackground">
|
||||
@drawable/bg_card_item_message_outgoing_light
|
||||
</item>
|
||||
<item name="cardItemMessageProfileImageIncomingBackground">
|
||||
@drawable/bg_card_item_message_profile_image_incoming_light
|
||||
</item>
|
||||
<item name="cardItemMessageProfileImageOutgoingBackground">
|
||||
@drawable/bg_card_item_message_profile_image_outgoing_light
|
||||
</item>
|
||||
<item name="listMenuOverflowButton">@drawable/ic_list_menu_moreoverflow_normal_holo_light
|
||||
</item>
|
||||
<item name="cardItemViewStyle">@style/Widget.CardItemView.Light</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar" parent="android:Theme.DeviceDefault.Light.DarkActionBar">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@color/bg_color_light</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_light</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_light</item>-->
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
|
||||
|
@ -141,57 +100,13 @@
|
|||
<item name="cardItemViewStyle">@style/Widget.CardItemView.Light</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored" parent="Theme.Twidere.Light">
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<!--<item name="android:actionBarStyle">@style/Widget.Twidere.ActionBar.Colored</item>-->
|
||||
<!--<item name="android:actionBarWidgetTheme">@style/Theme.Twidere.ActionBar.Colored.Light</item>-->
|
||||
<!--<item name="android:actionBarItemBackground">@drawable/list_selector_white_light</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar" parent="Theme.Twidere.Light.DarkActionBar">
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<!--<item name="android:actionBarStyle">@style/Widget.Twidere.ActionBar.Colored.Inverse</item>-->
|
||||
<!--<item name="android:actionBarWidgetTheme">@style/Theme.Twidere.ActionBar.Colored.Dark</item>-->
|
||||
<!--<item name="android:actionBarItemBackground">@drawable/list_selector_white</item>-->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.Transparent">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_light</item>
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.Transparent.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.Transparent">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_light</item>
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.Transparent">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_dark</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_transparent_dark</item>-->
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
|
@ -201,35 +116,10 @@
|
|||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_light</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_transparent_light</item>-->
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.Transparent">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_light</item>
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.Transparent.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.SolidBackground">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.SolidBackground.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.SolidBackground">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Dark.SolidBackground">
|
||||
|
||||
|
@ -243,14 +133,6 @@
|
|||
<item name="android:windowBackground">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.SolidBackground">
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.SolidBackground.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.ActionBar.Colored.Light" parent="Theme.Twidere.Light">
|
||||
<!--<item name="android:actionBarItemBackground">@drawable/list_selector_white_light</item>-->
|
||||
</style>
|
||||
|
@ -341,49 +223,6 @@
|
|||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.Compose">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@drawable/dialog_full_holo_light_darkactionbar</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Light.DarkActionBar.Compose.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.Compose">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@drawable/dialog_full_holo_light_darkactionbar</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Colored.DarkActionBar.Compose.DarkIcon"/>
|
||||
|
||||
<style name="Theme.Twidere.Colored.Compose">
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowBackground">@drawable/dialog_full_holo_light_darkactionbar</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
|
||||
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
|
||||
<item name="android:windowActionModeOverlay">true</item>
|
||||
<item name="android:windowMinWidthMajor">@android:dimen/dialog_min_width_major</item>
|
||||
<item name="android:windowMinWidthMinor">@android:dimen/dialog_min_width_minor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Twidere.Viewer" parent="android:Theme.DeviceDefault">
|
||||
|
||||
<!-- Window attributes -->
|
||||
|
@ -421,7 +260,7 @@
|
|||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowBackground">@color/bg_color_transparent_light</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_transparent_light</item>-->
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
|
@ -481,10 +320,11 @@
|
|||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_dark</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_dark</item>-->
|
||||
|
||||
<!-- ActionBar styles -->
|
||||
<item name="android:actionBarStyle">@android:style/Widget.Holo.ActionBar.Solid</item>
|
||||
<item name="android:actionBarStyle">@android:style/Widget.DeviceDefault.ActionBar.Solid
|
||||
</item>
|
||||
|
||||
<!-- Custom view styles -->
|
||||
<item name="tabItemStyle">@style/Widget.TabPageIndicator.TabItem</item>
|
||||
|
@ -518,7 +358,7 @@
|
|||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_light</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_light</item>-->
|
||||
|
||||
<!-- Custom view styles -->
|
||||
<item name="tabItemStyle">@style/Widget.TabPageIndicator.TabItem</item>
|
||||
|
@ -548,11 +388,11 @@
|
|||
<style name="Theme.Twidere.Settings.Light.DarkActionBar" parent="android:Theme.DeviceDefault.Light.DarkActionBar">
|
||||
|
||||
<!-- Colors -->
|
||||
<item name="android:colorBackgroundCacheHint">@color/bg_color_light</item>
|
||||
<!--<item name="android:colorBackgroundCacheHint">@color/bg_color_light</item>-->
|
||||
|
||||
<!-- Window attributes -->
|
||||
<item name="android:windowAnimationStyle">@style/Animation.Twidere.Activity</item>
|
||||
<item name="android:windowBackground">@color/bg_color_light</item>
|
||||
<!--<item name="android:windowBackground">@color/bg_color_light</item>-->
|
||||
|
||||
<!-- Custom view styles -->
|
||||
<item name="tabItemStyle">@style/Widget.TabPageIndicator.TabItem</item>
|
||||
|
|
Loading…
Reference in New Issue