1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-24 18:02:20 -05:00

Modify indicator: Larger text size, thinner indicator, no shadow.

This commit is contained in:
Sebastian Kaspari 2015-04-04 21:48:01 +02:00
parent 0de229c130
commit 63e6a70314
3 changed files with 2 additions and 28 deletions

View File

@ -21,7 +21,6 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/ */
package org.yaaic.fragment; package org.yaaic.fragment;
import android.app.ActionBar;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
@ -37,12 +36,9 @@ import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.speech.RecognizerIntent; import android.speech.RecognizerIntent;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.InputType; import android.text.InputType;
import android.text.method.TextKeyListener; import android.text.method.TextKeyListener;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -75,7 +75,7 @@ public class ConversationTabLayout extends HorizontalScrollView {
private static final int TITLE_OFFSET_DIPS = 24; private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16; private static final int TAB_VIEW_PADDING_DIPS = 16;
private static final int TAB_VIEW_TEXT_SIZE_SP = 12; private static final int TAB_VIEW_TEXT_SIZE_SP = 18;
private int mTitleOffset; private int mTitleOffset;
@ -197,11 +197,6 @@ public class ConversationTabLayout extends HorizontalScrollView {
textView.setBackgroundResource(outValue.resourceId); textView.setBackgroundResource(outValue.resourceId);
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
// If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
textView.setAllCaps(true);
}
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding); textView.setPadding(padding, padding, padding, padding);

View File

@ -28,23 +28,16 @@ import android.widget.LinearLayout;
class SlidingTabStrip extends LinearLayout { class SlidingTabStrip extends LinearLayout {
private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 2; private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 4;
private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26;
private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 8;
private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5;
private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1;
private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20; private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20;
private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f; private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f;
private final int mBottomBorderThickness;
private final Paint mBottomBorderPaint;
private final int mSelectedIndicatorThickness; private final int mSelectedIndicatorThickness;
private final Paint mSelectedIndicatorPaint; private final Paint mSelectedIndicatorPaint;
private final int mDefaultBottomBorderColor;
private final Paint mDividerPaint; private final Paint mDividerPaint;
private final float mDividerHeight; private final float mDividerHeight;
@ -68,18 +61,11 @@ class SlidingTabStrip extends LinearLayout {
context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true); context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true);
final int themeForegroundColor = outValue.data; final int themeForegroundColor = outValue.data;
mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor,
DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);
mDefaultTabColorizer = new SimpleTabColorizer(); mDefaultTabColorizer = new SimpleTabColorizer();
mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor, mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor,
DEFAULT_DIVIDER_COLOR_ALPHA)); DEFAULT_DIVIDER_COLOR_ALPHA));
mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
mBottomBorderPaint = new Paint();
mBottomBorderPaint.setColor(mDefaultBottomBorderColor);
mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
mSelectedIndicatorPaint = new Paint(); mSelectedIndicatorPaint = new Paint();
@ -149,9 +135,6 @@ class SlidingTabStrip extends LinearLayout {
height, mSelectedIndicatorPaint); height, mSelectedIndicatorPaint);
} }
// Thin underline along the entire bottom edge
canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint);
// Vertical separators between the titles // Vertical separators between the titles
int separatorTop = (height - dividerHeightPx) / 2; int separatorTop = (height - dividerHeightPx) / 2;
for (int i = 0; i < childCount - 1; i++) { for (int i = 0; i < childCount - 1; i++) {