Merge "Update the sharing UI according to latest UX specs."
@@ -663,6 +663,17 @@ public class ActivityChooserModel extends DataSetObservable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the history size.
|
||||||
|
*
|
||||||
|
* @return The history size.
|
||||||
|
*/
|
||||||
|
public int getHistorySize() {
|
||||||
|
synchronized (mInstanceLock) {
|
||||||
|
return mHistoricalRecords.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.MeasureSpec;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
@@ -75,6 +76,11 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
*/
|
*/
|
||||||
private final LinearLayout mActivityChooserContent;
|
private final LinearLayout mActivityChooserContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the background drawable to allow hiding and latter showing.
|
||||||
|
*/
|
||||||
|
private final Drawable mActivityChooserContentBackground;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The expand activities action button;
|
* The expand activities action button;
|
||||||
*/
|
*/
|
||||||
@@ -194,12 +200,15 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
|
Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
|
||||||
R.styleable.ActivityChooserView_expandActivityOverflowButtonDrawable);
|
R.styleable.ActivityChooserView_expandActivityOverflowButtonDrawable);
|
||||||
|
|
||||||
|
attributesArray.recycle();
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
inflater.inflate(R.layout.activity_chooser_view, this, true);
|
inflater.inflate(R.layout.activity_chooser_view, this, true);
|
||||||
|
|
||||||
mCallbacks = new Callbacks();
|
mCallbacks = new Callbacks();
|
||||||
|
|
||||||
mActivityChooserContent = (LinearLayout) findViewById(R.id.activity_chooser_view_content);
|
mActivityChooserContent = (LinearLayout) findViewById(R.id.activity_chooser_view_content);
|
||||||
|
mActivityChooserContentBackground = mActivityChooserContent.getBackground();
|
||||||
|
|
||||||
mDefaultActivityButton = (FrameLayout) findViewById(R.id.default_activity_button);
|
mDefaultActivityButton = (FrameLayout) findViewById(R.id.default_activity_button);
|
||||||
mDefaultActivityButton.setOnClickListener(mCallbacks);
|
mDefaultActivityButton.setOnClickListener(mCallbacks);
|
||||||
@@ -217,7 +226,7 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
@Override
|
@Override
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
super.onChanged();
|
super.onChanged();
|
||||||
updateButtons();
|
updateAppearance();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -352,9 +361,16 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
mActivityChooserContent.measure(widthMeasureSpec, heightMeasureSpec);
|
View child = mActivityChooserContent;
|
||||||
setMeasuredDimension(mActivityChooserContent.getMeasuredWidth(),
|
// If the default action is not visible we want to be as tall as the
|
||||||
mActivityChooserContent.getMeasuredHeight());
|
// ActionBar so if this widget is used in the latter it will look as
|
||||||
|
// a normal action button.
|
||||||
|
if (mDefaultActivityButton.getVisibility() != VISIBLE) {
|
||||||
|
heightMeasureSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(heightMeasureSpec),
|
||||||
|
MeasureSpec.EXACTLY);
|
||||||
|
}
|
||||||
|
measureChild(child, widthMeasureSpec, heightMeasureSpec);
|
||||||
|
setMeasuredDimension(child.getMeasuredWidth(), child.getMeasuredHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -367,11 +383,6 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDraw(Canvas canvas) {
|
|
||||||
mActivityChooserContent.onDraw(canvas);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActivityChooserModel getDataModel() {
|
public ActivityChooserModel getDataModel() {
|
||||||
return mAdapter.getDataModel();
|
return mAdapter.getDataModel();
|
||||||
}
|
}
|
||||||
@@ -417,21 +428,29 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
/**
|
/**
|
||||||
* Updates the buttons state.
|
* Updates the buttons state.
|
||||||
*/
|
*/
|
||||||
private void updateButtons() {
|
private void updateAppearance() {
|
||||||
|
// Expand overflow button.
|
||||||
|
if (mAdapter.getCount() > 0) {
|
||||||
|
mExpandActivityOverflowButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
mExpandActivityOverflowButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
// Default activity button.
|
||||||
final int activityCount = mAdapter.getActivityCount();
|
final int activityCount = mAdapter.getActivityCount();
|
||||||
if (activityCount > 0) {
|
final int historySize = mAdapter.getHistorySize();
|
||||||
|
if (activityCount > 0 && historySize > 0) {
|
||||||
mDefaultActivityButton.setVisibility(VISIBLE);
|
mDefaultActivityButton.setVisibility(VISIBLE);
|
||||||
if (mAdapter.getCount() > 0) {
|
|
||||||
mExpandActivityOverflowButton.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
mExpandActivityOverflowButton.setEnabled(false);
|
|
||||||
}
|
|
||||||
ResolveInfo activity = mAdapter.getDefaultActivity();
|
ResolveInfo activity = mAdapter.getDefaultActivity();
|
||||||
PackageManager packageManager = mContext.getPackageManager();
|
PackageManager packageManager = mContext.getPackageManager();
|
||||||
mDefaultActivityButtonImage.setImageDrawable(activity.loadIcon(packageManager));
|
mDefaultActivityButtonImage.setImageDrawable(activity.loadIcon(packageManager));
|
||||||
} else {
|
} else {
|
||||||
mDefaultActivityButton.setVisibility(View.INVISIBLE);
|
mDefaultActivityButton.setVisibility(View.GONE);
|
||||||
mExpandActivityOverflowButton.setEnabled(false);
|
}
|
||||||
|
// Activity chooser content.
|
||||||
|
if (mDefaultActivityButton.getVisibility() == VISIBLE) {
|
||||||
|
mActivityChooserContent.setBackgroundDrawable(mActivityChooserContentBackground);
|
||||||
|
} else {
|
||||||
|
mActivityChooserContent.setBackgroundDrawable(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,6 +697,10 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod
|
|||||||
return mDataModel.getActivityCount();
|
return mDataModel.getActivityCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getHistorySize() {
|
||||||
|
return mDataModel.getHistorySize();
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxActivityCount() {
|
public int getMaxActivityCount() {
|
||||||
return mMaxActivityCount;
|
return mMaxActivityCount;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
core/res/res/drawable-hdpi/ab_share_pack_holo_dark.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
core/res/res/drawable-hdpi/ab_share_pack_holo_light.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 999 B After Width: | Height: | Size: 505 B |
BIN
core/res/res/drawable-mdpi/ab_share_pack_holo_dark.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
core/res/res/drawable-mdpi/ab_share_pack_holo_light.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 874 B After Width: | Height: | Size: 332 B |
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 355 B |
BIN
core/res/res/drawable-xhdpi/ab_share_pack_holo_dark.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
core/res/res/drawable-xhdpi/ab_share_pack_holo_light.9.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 935 B |
@@ -19,33 +19,9 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/activity_chooser_view_content"
|
android:id="@+id/activity_chooser_view_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
style="?android:attr/activityChooserViewStyle">
|
||||||
style="?android:attr/actionButtonStyle"
|
|
||||||
android:padding="0dip">
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/default_activity_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:focusable="true"
|
|
||||||
android:addStatesFromChildren="true"
|
|
||||||
android:background="?android:attr/actionBarItemBackground">
|
|
||||||
|
|
||||||
<ImageView android:id="@+id/image"
|
|
||||||
android:layout_width="32dip"
|
|
||||||
android:layout_height="32dip"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="4dip"
|
|
||||||
android:layout_marginBottom="4dip"
|
|
||||||
android:layout_marginLeft="8dip"
|
|
||||||
android:layout_marginRight="8dip"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:adjustViewBounds="true" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/expand_activities_button"
|
android:id="@+id/expand_activities_button"
|
||||||
@@ -60,10 +36,32 @@
|
|||||||
android:layout_width="32dip"
|
android:layout_width="32dip"
|
||||||
android:layout_height="32dip"
|
android:layout_height="32dip"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="4dip"
|
android:layout_marginTop="2dip"
|
||||||
android:layout_marginBottom="4dip"
|
android:layout_marginBottom="2dip"
|
||||||
android:layout_marginLeft="8dip"
|
android:layout_marginLeft="12dip"
|
||||||
android:layout_marginRight="8dip"
|
android:layout_marginRight="12dip"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:adjustViewBounds="true" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/default_activity_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:focusable="true"
|
||||||
|
android:addStatesFromChildren="true"
|
||||||
|
android:background="?android:attr/actionBarItemBackground">
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/image"
|
||||||
|
android:layout_width="32dip"
|
||||||
|
android:layout_height="32dip"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="2dip"
|
||||||
|
android:layout_marginBottom="2dip"
|
||||||
|
android:layout_marginLeft="12dip"
|
||||||
|
android:layout_marginRight="12dip"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:adjustViewBounds="true" />
|
android:adjustViewBounds="true" />
|
||||||
|
|
||||||
|
|||||||
@@ -597,6 +597,9 @@
|
|||||||
<!-- The DatePicker style. -->
|
<!-- The DatePicker style. -->
|
||||||
<attr name="datePickerStyle" format="reference" />
|
<attr name="datePickerStyle" format="reference" />
|
||||||
|
|
||||||
|
<!-- Default ActivityChooserView style. -->
|
||||||
|
<attr name="activityChooserViewStyle" format="reference" />
|
||||||
|
|
||||||
<!-- Fast scroller styles -->
|
<!-- Fast scroller styles -->
|
||||||
<eat-comment />
|
<eat-comment />
|
||||||
|
|
||||||
|
|||||||
@@ -890,6 +890,14 @@ please see styles_device_defaults.xml.
|
|||||||
<item name="android:textSize">30sp</item>
|
<item name="android:textSize">30sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.ActivityChooserView">
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
|
<item name="android:background">@android:drawable/ab_share_pack_holo_dark</item>
|
||||||
|
<item name="android:divider">?android:attr/dividerVertical</item>
|
||||||
|
<item name="android:showDividers">middle</item>
|
||||||
|
<item name="android:dividerPadding">6dip</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TextAppearance.SuggestionHighlight">
|
<style name="TextAppearance.SuggestionHighlight">
|
||||||
<item name="android:textSize">18sp</item>
|
<item name="android:textSize">18sp</item>
|
||||||
<item name="android:textColor">@android:color/suggestion_highlight_text</item>
|
<item name="android:textColor">@android:color/suggestion_highlight_text</item>
|
||||||
@@ -1651,6 +1659,9 @@ please see styles_device_defaults.xml.
|
|||||||
<item name="android:background">@null</item>
|
<item name="android:background">@null</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.Holo.ActivityChooserView" parent="Widget.ActivityChooserView">
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Holo.ImageWell" parent="Widget.ImageWell">
|
<style name="Widget.Holo.ImageWell" parent="Widget.ImageWell">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -2071,6 +2082,10 @@ please see styles_device_defaults.xml.
|
|||||||
<style name="Widget.Holo.Light.EditText.NumberPickerInputText" parent="Widget.Holo.EditText.NumberPickerInputText">
|
<style name="Widget.Holo.Light.EditText.NumberPickerInputText" parent="Widget.Holo.EditText.NumberPickerInputText">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Widget.Holo.Light.ActivityChooserView" parent="Widget.Holo.ActivityChooserView">
|
||||||
|
<item name="android:background">@android:drawable/ab_share_pack_holo_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Holo.Light.ImageWell" parent="Widget.ImageWell">
|
<style name="Widget.Holo.Light.ImageWell" parent="Widget.ImageWell">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -269,7 +269,8 @@ please see themes_device_defaults.xml.
|
|||||||
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>
|
<item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>
|
||||||
<item name="listPopupWindowStyle">@android:style/Widget.ListPopupWindow</item>
|
<item name="listPopupWindowStyle">@android:style/Widget.ListPopupWindow</item>
|
||||||
<item name="popupMenuStyle">@android:style/Widget.PopupMenu</item>
|
<item name="popupMenuStyle">@android:style/Widget.PopupMenu</item>
|
||||||
|
<item name="activityChooserViewStyle">@android:style/Widget.ActivityChooserView</item>
|
||||||
|
|
||||||
<!-- Preference styles -->
|
<!-- Preference styles -->
|
||||||
<item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
|
<item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
|
||||||
<item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
|
<item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
|
||||||
@@ -1062,6 +1063,7 @@ please see themes_device_defaults.xml.
|
|||||||
<item name="listPopupWindowStyle">@android:style/Widget.Holo.ListPopupWindow</item>
|
<item name="listPopupWindowStyle">@android:style/Widget.Holo.ListPopupWindow</item>
|
||||||
<item name="popupMenuStyle">@android:style/Widget.Holo.PopupMenu</item>
|
<item name="popupMenuStyle">@android:style/Widget.Holo.PopupMenu</item>
|
||||||
<item name="stackViewStyle">@android:style/Widget.Holo.StackView</item>
|
<item name="stackViewStyle">@android:style/Widget.Holo.StackView</item>
|
||||||
|
<item name="activityChooserViewStyle">@android:style/Widget.Holo.ActivityChooserView</item>
|
||||||
|
|
||||||
<!-- Preference styles -->
|
<!-- Preference styles -->
|
||||||
<item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
|
<item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
|
||||||
@@ -1366,6 +1368,7 @@ please see themes_device_defaults.xml.
|
|||||||
<item name="listPopupWindowStyle">@android:style/Widget.Holo.Light.ListPopupWindow</item>
|
<item name="listPopupWindowStyle">@android:style/Widget.Holo.Light.ListPopupWindow</item>
|
||||||
<item name="popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item>
|
<item name="popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item>
|
||||||
<item name="stackViewStyle">@android:style/Widget.Holo.StackView</item>
|
<item name="stackViewStyle">@android:style/Widget.Holo.StackView</item>
|
||||||
|
<item name="activityChooserViewStyle">@android:style/Widget.Holo.Light.ActivityChooserView</item>
|
||||||
|
|
||||||
<!-- Preference styles -->
|
<!-- Preference styles -->
|
||||||
<item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
|
<item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
|
||||||
|
|||||||