Bug 872388 - Style button toasts. r=bnicholson

This commit is contained in:
Wes Johnston 2013-05-30 17:03:17 -07:00
parent 74087971b0
commit 892361095e
9 changed files with 92 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.gecko.util.UiAsyncTask;
import org.mozilla.gecko.widget.AboutHome;
import org.mozilla.gecko.widget.ButtonToast;
import org.json.JSONArray;
import org.json.JSONException;
@ -104,7 +105,7 @@ abstract public class BrowserApp extends GeckoApp
}
private Vector<MenuItemInfo> mAddonMenuItemsCache;
private ButtonToast mToast;
private PropertyAnimator mMainLayoutAnimator;
private static final Interpolator sTabsInterpolator = new Interpolator() {
@ -359,6 +360,11 @@ abstract public class BrowserApp extends GeckoApp
RelativeLayout actionBar = (RelativeLayout) findViewById(R.id.browser_toolbar);
mToast = new ButtonToast(findViewById(R.id.toast), new ButtonToast.ToastListener() {
public void onButtonClicked(CharSequence token) {
}
});
((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideTabsTouchListener());
((GeckoApp.MainLayout) mMainLayout).setMotionEventInterceptor(new MotionEventInterceptor() {
@Override

View File

@ -634,6 +634,11 @@ RES_DRAWABLE_MDPI = \
res/drawable-mdpi/tab_thumbnail_shadow.png \
res/drawable-mdpi/tabs_count.png \
res/drawable-mdpi/tabs_count_foreground.png \
res/drawable-mdpi/toast.9.png \
res/drawable-mdpi/toast_button_focused.9.png \
res/drawable-mdpi/toast_button_focused.9.png \
res/drawable-mdpi/toast_button_pressed.9.png \
res/drawable-mdpi/toast_divider.9.png \
res/drawable-mdpi/address_bar_url_default.9.png \
res/drawable-mdpi/address_bar_url_default_pb.9.png \
res/drawable-mdpi/address_bar_url_pressed.9.png \
@ -1060,6 +1065,7 @@ MOZ_ANDROID_DRAWABLES += \
mobile/android/base/resources/drawable/tab_thumbnail.xml \
mobile/android/base/resources/drawable/tabs_panel_indicator.xml \
mobile/android/base/resources/drawable/textbox_bg.xml \
mobile/android/base/resources/drawable/toast_button.xml \
mobile/android/base/resources/drawable/webapp_titlebar_bg.xml \
$(NULL)

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

View File

@ -0,0 +1,20 @@
<!--
Copyright 2012 Roman Nurik
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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/toast_button_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/toast_button_focused" android:state_focused="true"/>
<item android:drawable="@android:color/transparent"/>
</selector>

View File

@ -40,4 +40,15 @@
android:layout_height="@dimen/browser_toolbar_height"/>
</view>
<LinearLayout android:id="@+id/toast"
style="@style/Toast">
<TextView android:id="@+id/toast_message"
style="@style/ToastMessage" />
<Button android:id="@+id/toast_button"
style="@style/ToastButton" />
</LinearLayout>
</RelativeLayout>

View File

@ -447,4 +447,52 @@
<item name="android:ellipsize">middle</item>
</style>
<style name="Toast">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_marginLeft">8dp</item>
<item name="android:layout_marginRight">8dp</item>
<item name="android:layout_marginBottom">64dp</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">@drawable/toast</item>
<item name="android:clickable">true</item>
<item name="android:showDividers">middle</item>
<item name="android:divider">@drawable/toast_divider</item>
<item name="android:dividerPadding">16dp</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
</style>
<style name="ToastMessage">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:textColor">#fff</item>
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:layout_marginTop">0dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:layout_marginLeft">8dp</item>
<item name="android:layout_marginRight">0dp</item>
</style>
<style name="ToastButton">
<item name="android:background">@drawable/toast_button</item>
<item name="android:textAppearance">?android:textAppearanceSmall</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#fff</item>
<item name="android:layout_gravity">center_vertical</item>
</style>
</resources>