зеркало из https://github.com/mozilla/gecko-dev.git
Bug 698598: Reskinning stackable doorhangers. r=mfinkle
This commit is contained in:
Родитель
e1df6e3620
Коммит
8125d3c673
|
@ -54,7 +54,7 @@ import android.widget.LinearLayout;
|
|||
public class BrowserToolbar extends LinearLayout {
|
||||
final private Button mAwesomeBar;
|
||||
final private ImageButton mTabs;
|
||||
final private ImageButton mFavicon;
|
||||
final public ImageButton mFavicon;
|
||||
final private AnimationDrawable mProgressSpinner;
|
||||
|
||||
public BrowserToolbar(Context context, AttributeSet attrs) {
|
||||
|
|
|
@ -39,12 +39,12 @@
|
|||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class DoorHanger extends LinearLayout implements Button.OnClickListener {
|
||||
private Context mContext;
|
||||
|
@ -62,6 +62,9 @@ public class DoorHanger extends LinearLayout implements Button.OnClickListener {
|
|||
mContext = aContext;
|
||||
mValue = aValue;
|
||||
|
||||
setOrientation(VERTICAL);
|
||||
setBackgroundResource(R.drawable.doorhanger_shadow_bg);
|
||||
|
||||
// Load layout into the custom view
|
||||
LayoutInflater inflater =
|
||||
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
@ -99,6 +102,10 @@ public class DoorHanger extends LinearLayout implements Button.OnClickListener {
|
|||
setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return mValue;
|
||||
}
|
||||
|
|
|
@ -42,13 +42,14 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
public class DoorHangerPopup extends PopupWindow {
|
||||
private Context mContext;
|
||||
|
@ -58,13 +59,14 @@ public class DoorHangerPopup extends PopupWindow {
|
|||
super(aContext);
|
||||
mContext = aContext;
|
||||
|
||||
setBackgroundDrawable(new BitmapDrawable());
|
||||
setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
ScrollView scrollContent = (ScrollView) inflater.inflate(R.layout.doorhangerpopup, null);
|
||||
mContent = (LinearLayout) scrollContent.findViewById(R.id.doorhanger_container);
|
||||
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.doorhangerpopup, null);
|
||||
mContent = (LinearLayout) layout.findViewById(R.id.doorhanger_container);
|
||||
|
||||
setContentView(scrollContent);
|
||||
setContentView(layout);
|
||||
}
|
||||
|
||||
public DoorHanger addDoorHanger(Tab tab, String value) {
|
||||
|
@ -90,6 +92,8 @@ public class DoorHangerPopup extends PopupWindow {
|
|||
|
||||
if (tab.getDoorHangers().size() == 0)
|
||||
hide();
|
||||
else
|
||||
fixBackgroundForFirst();
|
||||
}
|
||||
|
||||
public void showDoorHanger(DoorHanger dh) {
|
||||
|
@ -132,10 +136,12 @@ public class DoorHangerPopup extends PopupWindow {
|
|||
|
||||
public void show() {
|
||||
Log.i("DoorHangerPopup", "Showing the DoorHangerPopup");
|
||||
fixBackgroundForFirst();
|
||||
|
||||
if (isShowing())
|
||||
update();
|
||||
else
|
||||
showAsDropDown(GeckoApp.mBrowserToolbar);
|
||||
showAsDropDown(GeckoApp.mBrowserToolbar.mFavicon);
|
||||
}
|
||||
|
||||
public void removeForTab(Tab tab) {
|
||||
|
@ -177,4 +183,14 @@ public class DoorHangerPopup extends PopupWindow {
|
|||
((DoorHanger) doorHangers.get(keys.next())).hidePopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void fixBackgroundForFirst() {
|
||||
for (int i=0; i < mContent.getChildCount(); i++) {
|
||||
DoorHanger dh = (DoorHanger) mContent.getChildAt(i);
|
||||
if (dh.isVisible()) {
|
||||
dh.setBackgroundResource(R.drawable.doorhanger_bg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,6 +281,10 @@ MOZ_ANDROID_DRAWABLES += embedding/android/resources/drawable/address_bar_bg.xml
|
|||
embedding/android/resources/drawable/awesomebar_tab_selected.xml \
|
||||
embedding/android/resources/drawable/awesomebar_tab_unselected.xml \
|
||||
embedding/android/resources/drawable/desktop_notification.png \
|
||||
embedding/android/resources/drawable/doorhanger_arrow.png \
|
||||
embedding/android/resources/drawable/doorhanger_bg.9.png \
|
||||
embedding/android/resources/drawable/doorhanger_shadow_bg.9.png \
|
||||
embedding/android/resources/drawable/doorhanger_popup_bg.9.png \
|
||||
embedding/android/resources/drawable/favicon.png \
|
||||
embedding/android/resources/drawable/progress_spinner.xml \
|
||||
embedding/android/resources/drawable/progress_spinner_1.png \
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.7 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 80 B |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 132 B |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 139 B |
|
@ -1,9 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="#3e3e3e">
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<TextView android:id="@+id/doorhanger_title"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -13,8 +9,9 @@
|
|||
android:padding="10dp"/>
|
||||
|
||||
<LinearLayout android:id="@+id/doorhanger_choices"
|
||||
style="@android:style/ButtonBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"/>
|
||||
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
|
|
|
@ -1,11 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout android:id="@+id/doorhanger_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"/>
|
||||
<ScrollView android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dip"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
</ScrollView>
|
||||
<LinearLayout android:id="@+id/doorhanger_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/doorhanger_popup_bg"/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<ImageView android:layout_width="43dip"
|
||||
android:layout_height="15dip"
|
||||
android:layout_marginLeft="50dip"
|
||||
android:layout_marginTop="10dip"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@drawable/doorhanger_arrow"
|
||||
android:scaleType="fitXY"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Загрузка…
Ссылка в новой задаче