зеркало из https://github.com/mozilla/gecko-dev.git
Bug 942270 - Fix gingerbread issues with quickshare. r=bnicholson
This commit is contained in:
Родитель
6c857c9797
Коммит
e9da61ad85
|
@ -19,6 +19,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.os.Build;
|
||||
|
||||
public class MenuItemActionView extends LinearLayout
|
||||
implements GeckoMenuItem.Layout {
|
||||
|
@ -37,10 +38,20 @@ public class MenuItemActionView extends LinearLayout
|
|||
this(context, attrs, R.attr.menuItemActionViewStyle);
|
||||
}
|
||||
|
||||
@TargetApi(11)
|
||||
@TargetApi(14)
|
||||
public MenuItemActionView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs);
|
||||
|
||||
// Set these explicitly, since setting a style isn't supported for LinearLayouts until V11.
|
||||
if (Build.VERSION.SDK_INT >= 11) {
|
||||
setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
|
||||
setDividerDrawable(getResources().getDrawable(R.drawable.divider_vertical));
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
setDividerPadding(0);
|
||||
}
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.menu_item_action_view, this);
|
||||
mMenuItem = (MenuItemDefault) findViewById(R.id.menu_item);
|
||||
mMenuButton = (MenuItemActionBar) findViewById(R.id.menu_item_button);
|
||||
|
|
|
@ -53,13 +53,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
|||
private PromptListAdapter mAdapter;
|
||||
|
||||
private static boolean mInitialized = false;
|
||||
private static int mGroupPaddingSize;
|
||||
private static int mLeftRightTextWithIconPadding;
|
||||
private static int mTopBottomTextWithIconPadding;
|
||||
private static int mIconTextPadding;
|
||||
private static int mIconSize;
|
||||
private static int mInputPaddingSize;
|
||||
private static int mMinRowSize;
|
||||
|
||||
public Prompt(Context context, PromptCallback callback) {
|
||||
this(context);
|
||||
|
@ -72,13 +66,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
|||
|
||||
if (!mInitialized) {
|
||||
Resources res = mContext.getResources();
|
||||
mGroupPaddingSize = (int) (res.getDimension(R.dimen.prompt_service_group_padding_size));
|
||||
mLeftRightTextWithIconPadding = (int) (res.getDimension(R.dimen.prompt_service_left_right_text_with_icon_padding));
|
||||
mTopBottomTextWithIconPadding = (int) (res.getDimension(R.dimen.prompt_service_top_bottom_text_with_icon_padding));
|
||||
mIconTextPadding = (int) (res.getDimension(R.dimen.prompt_service_icon_text_padding));
|
||||
mIconSize = (int) (res.getDimension(R.dimen.prompt_service_icon_size));
|
||||
mInputPaddingSize = (int) (res.getDimension(R.dimen.prompt_service_inputs_padding));
|
||||
mMinRowSize = (int) (res.getDimension(R.dimen.prompt_service_min_list_item_height));
|
||||
mInitialized = true;
|
||||
}
|
||||
}
|
||||
|
@ -340,6 +328,8 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
|
|||
}
|
||||
|
||||
if (scrollable) {
|
||||
// If we're showing some sort of scrollable list, force an inverse background.
|
||||
builder.setInverseBackgroundForced(true);
|
||||
builder.setView(root);
|
||||
} else {
|
||||
ScrollView view = new ScrollView(mContext);
|
||||
|
|
|
@ -62,7 +62,7 @@ public class PromptListAdapter extends ArrayAdapter<PromptListItem> {
|
|||
mTopBottomTextWithIconPadding = (int) (res.getDimension(R.dimen.prompt_service_top_bottom_text_with_icon_padding));
|
||||
mIconTextPadding = (int) (res.getDimension(R.dimen.prompt_service_icon_text_padding));
|
||||
mIconSize = (int) (res.getDimension(R.dimen.prompt_service_icon_size));
|
||||
mMinRowSize = (int) (res.getDimension(R.dimen.prompt_service_min_list_item_height));
|
||||
mMinRowSize = (int) (res.getDimension(R.dimen.menu_item_row_height));
|
||||
mTextSize = res.getDimension(R.dimen.menu_item_textsize);
|
||||
|
||||
mInitialized = true;
|
||||
|
|
|
@ -13,18 +13,21 @@ import org.json.JSONObject;
|
|||
import org.json.JSONException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TabWidget;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import android.util.Log;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
public class TabInput extends PromptInput implements AdapterView.OnItemClickListener {
|
||||
public static final String INPUT_TYPE = "tabs";
|
||||
|
@ -54,7 +57,7 @@ public class TabInput extends PromptInput implements AdapterView.OnItemClickList
|
|||
|
||||
@Override
|
||||
public View getView(final Context context) throws UnsupportedOperationException {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
mHost = (TabHost) inflater.inflate(R.layout.tab_prompt_input, null);
|
||||
mHost.setup();
|
||||
|
||||
|
@ -65,14 +68,21 @@ public class TabInput extends PromptInput implements AdapterView.OnItemClickList
|
|||
public View createTabContent(final String tag) {
|
||||
PromptListAdapter adapter = new PromptListAdapter(context, android.R.layout.simple_list_item_1, mTabs.get(tag));
|
||||
ListView listView = new ListView(context);
|
||||
listView.setCacheColorHint(0);
|
||||
listView.setOnItemClickListener(TabInput.this);
|
||||
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
|
||||
listView.setAdapter(adapter);
|
||||
return listView;
|
||||
}
|
||||
});
|
||||
|
||||
spec.setIndicator(title);
|
||||
// On older android versions, we use a custom style for the tabs.
|
||||
if (Build.VERSION.SDK_INT < 11) {
|
||||
TextView textview = (TextView) inflater.inflate(R.layout.tab_prompt_tab, null);
|
||||
textview.setText(title);
|
||||
spec.setIndicator(textview);
|
||||
} else {
|
||||
spec.setIndicator(title);
|
||||
}
|
||||
mHost.addTab(spec);
|
||||
}
|
||||
mView = mHost;
|
||||
|
|
Двоичные данные
mobile/android/base/resources/drawable-hdpi/tab_indicator_background.9.png
Normal file
Двоичные данные
mobile/android/base/resources/drawable-hdpi/tab_indicator_background.9.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 164 B |
Двоичные данные
mobile/android/base/resources/drawable-mdpi/tab_indicator_background.9.png
Normal file
Двоичные данные
mobile/android/base/resources/drawable-mdpi/tab_indicator_background.9.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 163 B |
Двоичные данные
mobile/android/base/resources/drawable-xhdpi/tab_indicator_background.9.png
Normal file
Двоичные данные
mobile/android/base/resources/drawable-xhdpi/tab_indicator_background.9.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 167 B |
|
@ -16,6 +16,7 @@
|
|||
|
||||
<TabWidget
|
||||
android:id="@android:id/tabs"
|
||||
style="@style/TabInput.TabWidget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
</TabWidget>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/TabInput.Tab"/>
|
|
@ -7,5 +7,9 @@
|
|||
|
||||
<dimen name="tabs_counter_size">22sp</dimen>
|
||||
<dimen name="doorhanger_spinner_textsize">6sp</dimen>
|
||||
<!-- This is chosen to be close to Android's listPreferredItemHeightSmall.
|
||||
TODO: We should inherit these from the system.
|
||||
http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/res/res/values/themes.xml#1287 -->
|
||||
<dimen name="menu_item_row_height">44dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -100,4 +100,13 @@
|
|||
<item name="android:src">@drawable/menu_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TabInput"></style>
|
||||
|
||||
<style name="TabInput.TabWidget" parent="android:style/Widget.Holo.Light.TabWidget"/>
|
||||
|
||||
<style name="TabInput.Tab" parent="android:style/Widget.Holo.Light.Tab">
|
||||
<item name="android:minHeight">@dimen/menu_item_row_height</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -48,7 +48,10 @@
|
|||
<dimen name="menu_item_icon">21dp</dimen>
|
||||
<dimen name="menu_item_textsize">16sp</dimen>
|
||||
<dimen name="menu_item_state_icon">18dp</dimen>
|
||||
<dimen name="menu_item_row_height">44dp</dimen>
|
||||
<!-- This is chosen to match Android's listPreferredItemHeight.
|
||||
TODO: We should inherit these from the system.
|
||||
http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/res/res/values/themes.xml#123 -->
|
||||
<dimen name="menu_item_row_height">64dip</dimen>
|
||||
<dimen name="menu_item_row_width">240dp</dimen>
|
||||
<dimen name="menu_item_more_offset">5dp</dimen>
|
||||
<dimen name="menu_popup_arrow_offset">8dp</dimen>
|
||||
|
@ -63,7 +66,6 @@
|
|||
<dimen name="prompt_service_inputs_padding">16dp</dimen>
|
||||
<dimen name="prompt_service_left_right_text_with_icon_padding">10dp</dimen>
|
||||
<dimen name="prompt_service_top_bottom_text_with_icon_padding">8dp</dimen>
|
||||
<dimen name="prompt_service_min_list_item_height">48dp</dimen>
|
||||
<dimen name="remote_tab_child_row_height">64dp</dimen>
|
||||
<dimen name="remote_tab_group_row_height">26dp</dimen>
|
||||
<dimen name="searchpreferences_icon_size">32dp</dimen>
|
||||
|
|
|
@ -604,4 +604,17 @@
|
|||
<item name="android:gravity">right</item>
|
||||
</style>
|
||||
|
||||
<style name="TabInput"></style>
|
||||
|
||||
<style name="TabInput.TabWidget">
|
||||
<item name="android:divider">@drawable/divider_vertical</item>
|
||||
<item name="android:background">@drawable/tab_indicator_background</item>
|
||||
</style>
|
||||
|
||||
<style name="TabInput.Tab">
|
||||
<item name="android:background">@drawable/tabs_panel_indicator</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:minHeight">@dimen/menu_item_row_height</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
<item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
|
||||
<item name="menuItemActionBarStyle">@style/Widget.MenuItemActionBar</item>
|
||||
<item name="menuItemActionModeStyle">@style/GeckoActionBar.Button</item>
|
||||
<item name="menuItemShareActionButtonStyle">@style/Widget.MenuItemSecondaryActionBar</item>
|
||||
</style>
|
||||
|
||||
<style name="Gecko.Preferences" parent="GeckoPreferencesBase"/>
|
||||
|
|
|
@ -598,8 +598,10 @@ public class ActivityChooserModel extends DataSetObservable {
|
|||
}
|
||||
mHistoricalRecordsChanged = false;
|
||||
if (!TextUtils.isEmpty(mHistoryFileName)) {
|
||||
new PersistHistoryAsyncTask().executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,
|
||||
new ArrayList<HistoricalRecord>(mHistoricalRecords), mHistoryFileName);
|
||||
/**
|
||||
* Mozilla: Converted to a normal task.execute call so that this works on < ICS phones.
|
||||
*/
|
||||
new PersistHistoryAsyncTask().execute(new ArrayList<HistoricalRecord>(mHistoricalRecords), mHistoryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче