mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1002303 - Part 2: Show a description page when there are no private tabs. r=lucasr
This commit is contained in:
parent
6bcc04e5ab
commit
54b1be3f60
@ -372,6 +372,7 @@ gbjar.sources += [
|
|||||||
'Tab.java',
|
'Tab.java',
|
||||||
'Tabs.java',
|
'Tabs.java',
|
||||||
'TabsAccessor.java',
|
'TabsAccessor.java',
|
||||||
|
'tabspanel/PrivateTabsPanel.java',
|
||||||
'tabspanel/RemoteTabsContainerPanel.java',
|
'tabspanel/RemoteTabsContainerPanel.java',
|
||||||
'tabspanel/RemoteTabsList.java',
|
'tabspanel/RemoteTabsList.java',
|
||||||
'tabspanel/RemoteTabsPanel.java',
|
'tabspanel/RemoteTabsPanel.java',
|
||||||
|
@ -40,13 +40,11 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
gecko:tabs="tabs_normal"/>
|
gecko:tabs="tabs_normal"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.tabspanel.TabsTray android:id="@+id/private_tabs"
|
<org.mozilla.gecko.tabspanel.PrivateTabsPanel
|
||||||
style="@style/TabsList"
|
android:id="@+id/private_tabs_panel"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:choiceMode="singleChoice"
|
android:visibility="gone"/>
|
||||||
android:visibility="gone"
|
|
||||||
gecko:tabs="tabs_private"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
|
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
|
||||||
android:id="@+id/remote_tabs"
|
android:id="@+id/remote_tabs"
|
||||||
|
50
mobile/android/base/resources/layout/private_tabs_panel.xml
Normal file
50
mobile/android/base/resources/layout/private_tabs_panel.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?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/. -->
|
||||||
|
|
||||||
|
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:gecko="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<org.mozilla.gecko.tabspanel.TabsTray android:id="@+id/private_tabs_tray"
|
||||||
|
style="@style/TabsList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:choiceMode="singleChoice"
|
||||||
|
gecko:tabs="tabs_private"/>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/private_tabs_empty"
|
||||||
|
style="@style/TabsPanelFrame.PrivateTabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout style="@style/TabsPanelSection.PrivateTabs.Header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView style="@style/TabsPanelItem.TextAppearance.Header.PrivateTabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/private_browsing_title"/>
|
||||||
|
|
||||||
|
<TextView style="@style/TabsPanelItem.TextAppearance"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/private_tabs_panel_description"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout style="@style/TabsPanelSection.PrivateTabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/private_tabs_learn_more"
|
||||||
|
style="@style/TabsPanelItem.TextAppearance.Linkified.LearnMore"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:text="@string/private_tabs_panel_learn_more"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</merge>
|
@ -39,13 +39,11 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
gecko:tabs="tabs_normal"/>
|
gecko:tabs="tabs_normal"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.tabspanel.TabsTray android:id="@+id/private_tabs"
|
<org.mozilla.gecko.tabspanel.PrivateTabsPanel
|
||||||
style="@style/TabsList"
|
android:id="@+id/private_tabs_panel"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:choiceMode="singleChoice"
|
android:visibility="gone"/>
|
||||||
android:visibility="gone"
|
|
||||||
gecko:tabs="tabs_private"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
|
<org.mozilla.gecko.tabspanel.RemoteTabsPanel
|
||||||
android:id="@+id/remote_tabs"
|
android:id="@+id/remote_tabs"
|
||||||
|
@ -17,16 +17,24 @@
|
|||||||
<item name="android:nextFocusUp">@+id/info</item>
|
<item name="android:nextFocusUp">@+id/info</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Remote tabs panel -->
|
<!-- Tabs panel -->
|
||||||
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
||||||
<item name="android:orientation">horizontal</item>
|
<item name="android:orientation">horizontal</item>
|
||||||
<item name="android:paddingTop">24dp</item>
|
<item name="android:paddingTop">24dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelFrame.PrivateTabs">
|
||||||
|
<item name="android:paddingTop">0dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelSection" parent="TabsPanelSectionBase">
|
<style name="TabsPanelSection" parent="TabsPanelSectionBase">
|
||||||
<item name="android:layout_weight">1</item>
|
<item name="android:layout_weight">1</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs.Header">
|
||||||
|
<item name="android:paddingTop">18dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItem">
|
<style name="TabsPanelItem">
|
||||||
<item name="android:layout_marginBottom">20dp</item>
|
<item name="android:layout_marginBottom">20dp</item>
|
||||||
<item name="android:layout_gravity">left</item>
|
<item name="android:layout_gravity">left</item>
|
||||||
@ -46,6 +54,16 @@
|
|||||||
<item name="android:visibility">gone</item>
|
<item name="android:visibility">gone</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Header.PrivateTabs">
|
||||||
|
<item name="android:visibility">gone</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Linkified.LearnMore">
|
||||||
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
|
<item name="android:layout_gravity">center</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
<item name="android:gravity">center</item>
|
<item name="android:gravity">center</item>
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<item name="android:paddingTop">30dp</item>
|
<item name="android:paddingTop">30dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Remote tabs panel -->
|
<!-- Tabs panel -->
|
||||||
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
||||||
<item name="android:paddingTop">32dp</item>
|
<item name="android:paddingTop">32dp</item>
|
||||||
<!-- Additional spacing set via margins on TabsPanelSection. -->
|
<!-- Additional spacing set via margins on TabsPanelSection. -->
|
||||||
@ -59,10 +59,23 @@
|
|||||||
<item name="android:paddingRight">0dp</item>
|
<item name="android:paddingRight">0dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelFrame.PrivateTabs">
|
||||||
|
<!-- We set values in tablet portrait. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelSection" parent="TabsPanelSectionBase">
|
<style name="TabsPanelSection" parent="TabsPanelSectionBase">
|
||||||
<!-- To override the values-land style. -->
|
<!-- To override the values-land style. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs">
|
||||||
|
<!-- We set values in tablet portrait. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs.Header">
|
||||||
|
<!-- We set values in tablet portrait. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<style name="TabsPanelItem" parent="TabsPanelItemBase">
|
<style name="TabsPanelItem" parent="TabsPanelItemBase">
|
||||||
<!-- To override the values-land style. -->
|
<!-- To override the values-land style. -->
|
||||||
</style>
|
</style>
|
||||||
@ -81,6 +94,14 @@
|
|||||||
<item name="android:visibility">gone</item>
|
<item name="android:visibility">gone</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Header.PrivateTabs">
|
||||||
|
<item name="android:visibility">visible</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Linkified.LearnMore">
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
</style>
|
</style>
|
||||||
|
@ -93,6 +93,30 @@
|
|||||||
<item name="android:paddingRight">32dp</item>
|
<item name="android:paddingRight">32dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Tabs panel -->
|
||||||
|
<style name="TabsPanelFrame.PrivateTabs">
|
||||||
|
<item name="android:orientation">horizontal</item>
|
||||||
|
<item name="android:paddingTop">0dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs">
|
||||||
|
<item name="android:layout_weight">1</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs.Header">
|
||||||
|
<item name="android:paddingTop">32dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Header.PrivateTabs">
|
||||||
|
<item name="android:visibility">gone</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Linkified.LearnMore">
|
||||||
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
<item name="android:gravity">center</item>
|
||||||
|
<item name="android:layout_gravity">center</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Tabs panel -->
|
<!-- Tabs panel -->
|
||||||
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
<style name="TabsPanelFrame" parent="TabsPanelFrameBase">
|
||||||
<item name="android:paddingLeft">84dp</item>
|
<item name="android:paddingLeft">84dp</item>
|
||||||
|
@ -460,6 +460,10 @@
|
|||||||
<!-- We set values in landscape. -->
|
<!-- We set values in landscape. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelFrame.PrivateTabs">
|
||||||
|
<!-- We set values on tablet. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelSectionBase">
|
<style name="TabsPanelSectionBase">
|
||||||
<item name="android:orientation">vertical</item>
|
<item name="android:orientation">vertical</item>
|
||||||
<item name="android:layout_marginLeft">16dp</item>
|
<item name="android:layout_marginLeft">16dp</item>
|
||||||
@ -470,6 +474,14 @@
|
|||||||
<!-- We set values in landscape. -->
|
<!-- We set values in landscape. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs">
|
||||||
|
<!-- We set values on tablet. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelSection.PrivateTabs.Header">
|
||||||
|
<!-- We set values on landscape and tablet. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItemBase">
|
<style name="TabsPanelItemBase">
|
||||||
<item name="android:layout_marginBottom">28dp</item>
|
<item name="android:layout_marginBottom">28dp</item>
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
@ -509,12 +521,20 @@
|
|||||||
<!-- We change these values on landscape. -->
|
<!-- We change these values on landscape. -->
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Header.PrivateTabs">
|
||||||
|
<!-- We change these values on landscape and tablet. -->
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItem.TextAppearance.Linkified">
|
<style name="TabsPanelItem.TextAppearance.Linkified">
|
||||||
<item name="android:clickable">true</item>
|
<item name="android:clickable">true</item>
|
||||||
<item name="android:focusable">true</item>
|
<item name="android:focusable">true</item>
|
||||||
<item name="android:textColor">#0292D6</item>
|
<item name="android:textColor">#0292D6</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabsPanelItem.TextAppearance.Linkified.LearnMore">
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
<style name="TabsPanelItem.TextAppearance.Linkified.Resend">
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
</style>
|
</style>
|
||||||
|
77
mobile/android/base/tabspanel/PrivateTabsPanel.java
Normal file
77
mobile/android/base/tabspanel/PrivateTabsPanel.java
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||||
|
* 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/. */
|
||||||
|
|
||||||
|
package org.mozilla.gecko.tabspanel;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.mozilla.gecko.BrowserLocaleManager;
|
||||||
|
import org.mozilla.gecko.R;
|
||||||
|
import org.mozilla.gecko.Tabs;
|
||||||
|
import org.mozilla.gecko.tabspanel.TabsPanel.PanelView;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A container that wraps the private tabs {@link android.widget.AdapterView} and empty
|
||||||
|
* {@link android.view.View} to manage both of their visibility states by changing the visibility of
|
||||||
|
* this container as calling {@link android.widget.AdapterView#setVisibility} does not affect the
|
||||||
|
* empty View's visibility.
|
||||||
|
*/
|
||||||
|
class PrivateTabsPanel extends FrameLayout implements PanelView {
|
||||||
|
private TabsPanel tabsPanel;
|
||||||
|
private TabsTray tabsTray;
|
||||||
|
|
||||||
|
public PrivateTabsPanel(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
|
||||||
|
LayoutInflater.from(context).inflate(R.layout.private_tabs_panel, this);
|
||||||
|
tabsTray = (TabsTray) findViewById(R.id.private_tabs_tray);
|
||||||
|
|
||||||
|
final View emptyView = findViewById(R.id.private_tabs_empty);
|
||||||
|
tabsTray.setEmptyView(emptyView);
|
||||||
|
|
||||||
|
final View learnMore = findViewById(R.id.private_tabs_learn_more);
|
||||||
|
learnMore.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
final String locale = BrowserLocaleManager.getLanguageTag(Locale.getDefault());
|
||||||
|
final String url =
|
||||||
|
getResources().getString(R.string.private_tabs_panel_learn_more_link, locale);
|
||||||
|
Tabs.getInstance().loadUrlInTab(url);
|
||||||
|
if (tabsPanel != null) {
|
||||||
|
tabsPanel.autoHidePanel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTabsPanel(TabsPanel panel) {
|
||||||
|
tabsPanel = panel;
|
||||||
|
tabsTray.setTabsPanel(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
tabsTray.show();
|
||||||
|
setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
setVisibility(View.GONE);
|
||||||
|
tabsTray.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldExpand() {
|
||||||
|
return tabsTray.shouldExpand();
|
||||||
|
}
|
||||||
|
}
|
@ -120,7 +120,7 @@ public class TabsPanel extends LinearLayout
|
|||||||
mPanelNormal = (PanelView) findViewById(R.id.normal_tabs);
|
mPanelNormal = (PanelView) findViewById(R.id.normal_tabs);
|
||||||
mPanelNormal.setTabsPanel(this);
|
mPanelNormal.setTabsPanel(this);
|
||||||
|
|
||||||
mPanelPrivate = (PanelView) findViewById(R.id.private_tabs);
|
mPanelPrivate = (PanelView) findViewById(R.id.private_tabs_panel);
|
||||||
mPanelPrivate.setTabsPanel(this);
|
mPanelPrivate.setTabsPanel(this);
|
||||||
|
|
||||||
mPanelRemote = (PanelView) findViewById(R.id.remote_tabs);
|
mPanelRemote = (PanelView) findViewById(R.id.remote_tabs);
|
||||||
|
Loading…
Reference in New Issue
Block a user