Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 1003 B |
After Width: | Height: | Size: 511 B |
After Width: | Height: | Size: 532 B |
After Width: | Height: | Size: 839 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 703 B |
After Width: | Height: | Size: 712 B |
After Width: | Height: | Size: 1.9 KiB |
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
|
||||
<com.actionbarsherlock.internal.widget.IcsLinearLayout |
||||
<com.actionbarsherlock.internal.widget.TabsLinearLayout |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
style="?attr/actionBarTabBarStyle" |
||||
/> |
||||
/> |
||||
|
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
/* |
||||
** Copyright 2011, 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. |
||||
*/ |
||||
|
||||
This is an optimized layout for a screen, with the minimum set of features |
||||
enabled. |
||||
--> |
||||
|
||||
<com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:fitsSystemWindows="true"> |
||||
<TextView android:id="@android:id/title" style="?android:attr/windowTitleStyle" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:minHeight="@dimen/abs__alert_dialog_title_height" |
||||
android:paddingLeft="16dip" |
||||
android:paddingRight="16dip" |
||||
android:gravity="center_vertical|left" /> |
||||
<View android:id="@+id/abs__titleDivider" |
||||
android:layout_width="fill_parent" |
||||
android:layout_height="2dip" |
||||
android:background="@color/abs__holo_blue_light" /> |
||||
<FrameLayout |
||||
android:layout_width="match_parent" android:layout_height="0dp" |
||||
android:layout_weight="1" |
||||
android:orientation="vertical" |
||||
android:foreground="?attr/windowContentOverlay"> |
||||
<FrameLayout android:id="@+id/abs__content" |
||||
android:layout_width="fill_parent" |
||||
android:layout_height="fill_parent" /> |
||||
</FrameLayout> |
||||
</com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow> |
@ -1,59 +0,0 @@
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- Copyright (C) 2007 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. |
||||
--> |
||||
|
||||
<com.actionbarsherlock.internal.view.menu.ListMenuItemView xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="fill_parent" |
||||
android:layout_height="?attr/listPreferredItemHeightSmall"> |
||||
|
||||
<!-- Icon will be inserted here. --> |
||||
|
||||
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. --> |
||||
<RelativeLayout |
||||
android:layout_width="0dip" |
||||
android:layout_weight="1" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_vertical" |
||||
android:layout_marginLeft="?attr/listPreferredItemPaddingLeft" |
||||
android:layout_marginRight="?attr/listPreferredItemPaddingRight" |
||||
android:duplicateParentState="true"> |
||||
|
||||
<TextView |
||||
android:id="@+id/abs__title" |
||||
android:layout_width="fill_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentTop="true" |
||||
android:layout_alignParentLeft="true" |
||||
android:textAppearance="?attr/textAppearanceListItemSmall" |
||||
android:singleLine="true" |
||||
android:duplicateParentState="true" |
||||
android:ellipsize="marquee" |
||||
android:fadingEdge="horizontal" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/abs__shortcut" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_below="@id/abs__title" |
||||
android:layout_alignParentLeft="true" |
||||
android:textAppearance="?attr/textAppearanceSmall" |
||||
android:singleLine="true" |
||||
android:duplicateParentState="true" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<!-- Checkbox, and/or radio button will be inserted here. --> |
||||
|
||||
</com.actionbarsherlock.internal.view.menu.ListMenuItemView> |
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<!-- |
||||
/* //device/apps/common/assets/res/any/dimens.xml |
||||
** |
||||
** Copyright 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. |
||||
*/ |
||||
--> |
||||
<resources> |
||||
<!-- The platform's desired minimum size for a dialog's width when it |
||||
is along the major axis (that is the screen is landscape). This may |
||||
be either a fraction or a dimension. --> |
||||
<item type="dimen" name="abs__dialog_min_width_major">55%</item> |
||||
<!-- The platform's desired minimum size for a dialog's width when it |
||||
is along the minor axis (that is the screen is portrait). This may |
||||
be either a fraction or a dimension. --> |
||||
<item type="dimen" name="abs__dialog_min_width_minor">80%</item> |
||||
</resources> |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
package com.actionbarsherlock.internal.widget; |
||||
|
||||
import static android.view.View.MeasureSpec.EXACTLY; |
||||
import android.content.Context; |
||||
import android.content.res.TypedArray; |
||||
import android.util.AttributeSet; |
||||
import android.util.DisplayMetrics; |
||||
import android.util.TypedValue; |
||||
import android.widget.LinearLayout; |
||||
import com.actionbarsherlock.R; |
||||
|
||||
public class FakeDialogPhoneWindow extends LinearLayout { |
||||
final TypedValue mMinWidthMajor = new TypedValue(); |
||||
final TypedValue mMinWidthMinor = new TypedValue(); |
||||
|
||||
public FakeDialogPhoneWindow(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SherlockTheme); |
||||
|
||||
a.getValue(R.styleable.SherlockTheme_windowMinWidthMajor, mMinWidthMajor); |
||||
a.getValue(R.styleable.SherlockTheme_windowMinWidthMinor, mMinWidthMinor); |
||||
|
||||
a.recycle(); |
||||
} |
||||
|
||||
/* Stolen from PhoneWindow */ |
||||
@Override |
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
||||
final DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); |
||||
final boolean isPortrait = metrics.widthPixels < metrics.heightPixels; |
||||
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
||||
|
||||
int width = getMeasuredWidth(); |
||||
boolean measure = false; |
||||
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, EXACTLY); |
||||
|
||||
final TypedValue tv = isPortrait ? mMinWidthMinor : mMinWidthMajor; |
||||
|
||||
if (tv.type != TypedValue.TYPE_NULL) { |
||||
final int min; |
||||
if (tv.type == TypedValue.TYPE_DIMENSION) { |
||||
min = (int)tv.getDimension(metrics); |
||||
} else if (tv.type == TypedValue.TYPE_FRACTION) { |
||||
min = (int)tv.getFraction(metrics.widthPixels, metrics.widthPixels); |
||||
} else { |
||||
min = 0; |
||||
} |
||||
|
||||
if (width < min) { |
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(min, EXACTLY); |
||||
measure = true; |
||||
} |
||||
} |
||||
|
||||
// TODO: Support height?
|
||||
|
||||
if (measure) { |
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
|
||||
|
||||
package com.actionbarsherlock.internal.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.util.Log; |
||||
import android.view.Gravity; |
||||
import android.os.Build.VERSION; |
||||
import android.os.Build.VERSION_CODES; |
||||
import android.widget.TextView; |
||||
import android.widget.Toast; |
||||
|
||||
import com.actionbarsherlock.R; |
||||
|
||||
public class IcsToast extends Toast { |
||||
public static final int LENGTH_LONG = Toast.LENGTH_LONG; |
||||
public static final int LENGTH_SHORT = Toast.LENGTH_SHORT; |
||||
private static final String TAG = "Toast"; |
||||
|
||||
public static Toast makeText(Context context, CharSequence s, int duration) { |
||||
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { |
||||
return Toast.makeText(context, s, duration); |
||||
} |
||||
IcsToast toast = new IcsToast(context); |
||||
toast.setDuration(duration); |
||||
TextView view = new TextView(context); |
||||
view.setText(s); |
||||
// Original AOSP using reference on @android:color/bright_foreground_dark
|
||||
// bright_foreground_dark - reference on @android:color/background_light
|
||||
// background_light - 0xffffffff
|
||||
view.setTextColor(0xffffffff); |
||||
view.setGravity(Gravity.CENTER); |
||||
view.setBackgroundResource(R.drawable.abs__toast_frame); |
||||
toast.setView(view); |
||||
return toast; |
||||
} |
||||
|
||||
public static Toast makeText(Context context, int resId, int duration) { |
||||
return makeText(context, context.getResources().getString(resId), duration); |
||||
} |
||||
|
||||
public IcsToast(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
@Override |
||||
public void setText(CharSequence s) { |
||||
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { |
||||
super.setText(s); |
||||
return; |
||||
} |
||||
if (getView() == null) { |
||||
return; |
||||
} |
||||
try { |
||||
((TextView) getView()).setText(s); |
||||
} catch (ClassCastException e) { |
||||
Log.e(TAG, "This Toast was not created with IcsToast.makeText", e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,113 @@
@@ -0,0 +1,113 @@
|
||||
package com.actionbarsherlock.internal.widget; |
||||
|
||||
import android.content.Context; |
||||
import android.content.res.TypedArray; |
||||
import android.util.AttributeSet; |
||||
import android.view.View; |
||||
import android.widget.LinearLayout; |
||||
|
||||
public class TabsLinearLayout extends IcsLinearLayout { |
||||
private static final int[] R_styleable_LinearLayout = new int[] { |
||||
/* 0 */ android.R.attr.measureWithLargestChild, |
||||
}; |
||||
private static final int LinearLayout_measureWithLargestChild = 0; |
||||
|
||||
private boolean mUseLargestChild; |
||||
|
||||
public TabsLinearLayout(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, /*com.android.internal.R.styleable.*/R_styleable_LinearLayout); |
||||
mUseLargestChild = a.getBoolean(/*com.android.internal.R.styleable.*/LinearLayout_measureWithLargestChild, false); |
||||
|
||||
a.recycle(); |
||||
} |
||||
|
||||
/** |
||||
* When true, all children with a weight will be considered having |
||||
* the minimum size of the largest child. If false, all children are |
||||
* measured normally. |
||||
* |
||||
* @return True to measure children with a weight using the minimum |
||||
* size of the largest child, false otherwise. |
||||
* |
||||
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild |
||||
*/ |
||||
public boolean isMeasureWithLargestChildEnabled() { |
||||
return mUseLargestChild; |
||||
} |
||||
|
||||
/** |
||||
* When set to true, all children with a weight will be considered having |
||||
* the minimum size of the largest child. If false, all children are |
||||
* measured normally. |
||||
* |
||||
* Disabled by default. |
||||
* |
||||
* @param enabled True to measure children with a weight using the |
||||
* minimum size of the largest child, false otherwise. |
||||
* |
||||
* @attr ref android.R.styleable#LinearLayout_measureWithLargestChild |
||||
*/ |
||||
public void setMeasureWithLargestChildEnabled(boolean enabled) { |
||||
mUseLargestChild = enabled; |
||||
} |
||||
|
||||
@Override |
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
||||
|
||||
final int childCount = getChildCount(); |
||||
if (childCount <= 2) return; |
||||
|
||||
final int mode = MeasureSpec.getMode(widthMeasureSpec); |
||||
if (mUseLargestChild && mode == MeasureSpec.UNSPECIFIED) { |
||||
final int orientation = getOrientation(); |
||||
if (orientation == HORIZONTAL) { |
||||
useLargestChildHorizontal(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void useLargestChildHorizontal() { |
||||
final int childCount = getChildCount(); |
||||
|
||||
// Find largest child width
|
||||
int largestChildWidth = 0; |
||||
for (int i = 0; i < childCount; i++) { |
||||
final View child = getChildAt(i); |
||||
largestChildWidth = Math.max(child.getMeasuredWidth(), largestChildWidth); |
||||
} |
||||
|
||||
int totalWidth = 0; |
||||
// Re-measure childs
|
||||
for (int i = 0; i < childCount; i++) { |
||||
final View child = getChildAt(i); |
||||
|
||||
if (child == null || child.getVisibility() == View.GONE) { |
||||
continue; |
||||
} |
||||
|
||||
final LinearLayout.LayoutParams lp = |
||||
(LinearLayout.LayoutParams) child.getLayoutParams(); |
||||
|
||||
float childExtra = lp.weight; |
||||
if (childExtra > 0) { |
||||
child.measure( |
||||
MeasureSpec.makeMeasureSpec(largestChildWidth, |
||||
MeasureSpec.EXACTLY), |
||||
MeasureSpec.makeMeasureSpec(child.getMeasuredHeight(), |
||||
MeasureSpec.EXACTLY)); |
||||
totalWidth += largestChildWidth; |
||||
|
||||
} else { |
||||
totalWidth += child.getMeasuredWidth(); |
||||
} |
||||
|
||||
totalWidth += lp.leftMargin + lp.rightMargin; |
||||
} |
||||
|
||||
totalWidth += getPaddingLeft() + getPaddingRight(); |
||||
setMeasuredDimension(totalWidth, getMeasuredHeight()); |
||||
} |
||||
} |