From af807cce079aaae9cbf0430e7da946fcbe0c99c3 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Fri, 22 Mar 2019 21:27:23 -0700 Subject: [PATCH] Fix closing of tabs. --- .../activities/MainWebViewActivity.java | 265 +++++++----------- .../adapters/WebViewPagerAdapter.java | 114 ++++++++ .../fragments/WebViewTabFragment.java | 29 +- app/src/main/res/layout/main_framelayout.xml | 6 +- .../android/es-ES/full_description.txt | 16 +- 5 files changed, 249 insertions(+), 181 deletions(-) create mode 100644 app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewPagerAdapter.java diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index f092f3e9..caecde4c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -102,9 +102,7 @@ import androidx.core.content.ContextCompat; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.DialogFragment; -import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentPagerAdapter; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.viewpager.widget.ViewPager; @@ -115,6 +113,7 @@ import com.google.android.material.tabs.TabLayout; import com.stoutner.privacybrowser.BuildConfig; import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.adapters.WebViewPagerAdapter; import com.stoutner.privacybrowser.asynctasks.GetHostIpAddresses; import com.stoutner.privacybrowser.dialogs.AdConsentDialog; import com.stoutner.privacybrowser.dialogs.CreateBookmarkDialog; @@ -151,7 +150,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -558,7 +556,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // This is needed to get rid of the Android Studio warning that the action bar might be null. assert actionBar != null; - // Add the custom `url_app_bar` layout, which shows the favorite icon and the URL text bar. + // Add the custom layout, which shows the URL text bar. actionBar.setCustomView(R.layout.url_app_bar); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); @@ -694,7 +692,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public void onPageSelected(int position) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(position); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(position); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -774,8 +772,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } }); - // Add the first tab. - webViewPagerAdapter.addPage(); + // Add the first tab. (It doesn't matter what view is passed. That is just required as part of the ImageView `onClick()` syntax). + addTab(webViewPager); // Set the bookmarks drawer resources according to the theme. This can't be done in the layout due to compatibility issues with the `DrawerLayout` support widget. if (darkTheme) { @@ -1150,9 +1148,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Reload the webpage if displaying of images has been disabled in the Settings activity. if (reloadOnRestart) { // Reload the WebViews. - for (int i = 0; i < webViewPagerAdapter.webViewFragmentsList.size(); i++) { + for (int i = 0; i < webViewPagerAdapter.getCount(); i++) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(i); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -1219,9 +1217,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Run the default commands. super.onResume(); - for (int i = 0; i < webViewPagerAdapter.webViewFragmentsList.size(); i++) { + for (int i = 0; i < webViewPagerAdapter.getCount(); i++) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(i); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -1231,10 +1229,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get the nested scroll WebView from the tab fragment. NestedScrollWebView nestedScrollWebView = fragmentView.findViewById(R.id.nestedscroll_webview); - // Pause the nested scroll WebView JavaScript timers. + // Resume the nested scroll WebView JavaScript timers. nestedScrollWebView.resumeTimers(); - // Pause the nested scroll WebView. + // Resume the nested scroll WebView. nestedScrollWebView.onResume(); } } @@ -1274,9 +1272,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Run the default commands. super.onPause(); - for (int i = 0; i < webViewPagerAdapter.webViewFragmentsList.size(); i++) { + for (int i = 0; i < webViewPagerAdapter.getCount(); i++) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(i); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -1407,11 +1405,27 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook MenuItem nightModeMenuItem = menu.findItem(R.id.night_mode); MenuItem proxyThroughOrbotMenuItem = menu.findItem(R.id.proxy_through_orbot); - // Set the text for the domain menu item. - if (currentWebView.getDomainSettingsApplied()) { - addOrEditDomain.setTitle(R.string.edit_domain_settings); - } else { - addOrEditDomain.setTitle(R.string.add_domain_settings); + // Initialize the current user agent string and the font size. + String currentUserAgent = getString(R.string.user_agent_privacy_browser); + int fontSize = 100; + + // Set items that require the current web view to be populated. It will be null when the program is first opened, as `onPrepareOptionsMenu()` is called before the first WebView is initialized. + if (currentWebView != null) { + // Set the add or edit domain text. + if (currentWebView.getDomainSettingsApplied()) { + addOrEditDomain.setTitle(R.string.edit_domain_settings); + } else { + addOrEditDomain.setTitle(R.string.add_domain_settings); + } + + // Get the current user agent from the WebView. + currentUserAgent = currentWebView.getSettings().getUserAgentString(); + + // Get the current font size from the + fontSize = currentWebView.getSettings().getTextZoom(); + + // Set the status of the display images menu item. + displayImagesMenuItem.setChecked(currentWebView.getSettings().getLoadsImagesAutomatically()); } // Set the status of the menu item checkboxes. @@ -1426,7 +1440,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook ultraPrivacyMenuItem.setChecked(ultraPrivacyEnabled); blockAllThirdPartyRequestsMenuItem.setChecked(blockAllThirdPartyRequests); swipeToRefreshMenuItem.setChecked(swipeRefreshLayout.isEnabled()); - displayImagesMenuItem.setChecked(currentWebView.getSettings().getLoadsImagesAutomatically()); nightModeMenuItem.setChecked(nightMode); proxyThroughOrbotMenuItem.setChecked(proxyThroughOrbot); @@ -1480,9 +1493,6 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook ultraPrivacyMenuItem.setTitle(ultraPrivacyBlockedRequests + " - " + getString(R.string.ultraprivacy)); blockAllThirdPartyRequestsMenuItem.setTitle(thirdPartyBlockedRequests + " - " + getString(R.string.block_all_third_party_requests)); - // Get the current user agent. - String currentUserAgent = currentWebView.getSettings().getUserAgentString(); - // Select the current user agent menu item. A switch statement cannot be used because the user agents are not compile time constants. if (currentUserAgent.equals(getResources().getStringArray(R.array.user_agent_data)[0])) { // Privacy Browser. menu.findItem(R.id.user_agent_privacy_browser).setChecked(true); @@ -1512,8 +1522,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook menu.findItem(R.id.user_agent_custom).setChecked(true); } - // Initialize font size variables. - int fontSize = currentWebView.getSettings().getTextZoom(); + // Instantiate the font size title and the selected font size menu item. String fontSizeTitle; MenuItem selectedFontSizeMenuItem; @@ -2251,7 +2260,10 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Get the current tab number. int currentTabNumber = tabLayout.getSelectedTabPosition(); - // Delete the tab and page. + // Delete the current tab. + tabLayout.removeTabAt(currentTabNumber); + + // Delete the current page. webViewPagerAdapter.deletePage(currentTabNumber); break; @@ -3486,9 +3498,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // TODO this also needs to be set when creating a new tab. // Set the app bar scrolling for each WebView. - for (int i = 0; i < webViewPagerAdapter.webViewFragmentsList.size(); i++) { + for (int i = 0; i < webViewPagerAdapter.getCount(); i++) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(i); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -4076,9 +4088,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Reload the WebViews if requested. if (reloadWebsite) { // Reload the WebViews. - for (int i = 0; i < webViewPagerAdapter.webViewFragmentsList.size(); i++) { + for (int i = 0; i < webViewPagerAdapter.getCount(); i++) { // Get the WebView tab fragment. - WebViewTabFragment webViewTabFragment = webViewPagerAdapter.webViewFragmentsList.get(i); + WebViewTabFragment webViewTabFragment = webViewPagerAdapter.getPageFragment(i); // Get the fragment view. View fragmentView = webViewTabFragment.getView(); @@ -4374,147 +4386,48 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } } - private class WebViewPagerAdapter extends FragmentPagerAdapter { - // The WebView fragments list contains all the WebViews. - private LinkedList webViewFragmentsList = new LinkedList<>(); - - // Define the constructor. - private WebViewPagerAdapter(FragmentManager fragmentManager){ - // Run the default commands. - super(fragmentManager); - } - - @Override - public int getCount() { - // Return the number of pages. - return webViewFragmentsList.size(); - } - - @Override - public int getItemPosition(@NonNull Object object) { - //noinspection SuspiciousMethodCalls - if (webViewFragmentsList.contains(object)) { - // The tab has not been deleted. - return POSITION_UNCHANGED; - } else { - // The tab has been deleted. - return POSITION_NONE; - } - } - - @Override - public Fragment getItem(int pageNumber) { - // Get a WebView for a particular page. Page numbers are 0 indexed. - return webViewFragmentsList.get(pageNumber); - } - - private void addPage() { - // Add a new page. The pages and tabs are 0 indexed, so the size of the current list equals the number of the next page. - webViewFragmentsList.add(WebViewTabFragment.createTab(webViewFragmentsList.size())); - - // Update the view pager. - notifyDataSetChanged(); - } - - private void deletePage(int pageNumber) { - // Get a handle for the tab layout. - TabLayout tabLayout = findViewById(R.id.tablayout); - - // TODO always move to the next tab if possible. - // Select a tab that is not being deleted. - if (pageNumber == 0) { // The first tab is being deleted. - // Get a handle for the second tab. The tabs are 0 indexed. - TabLayout.Tab secondTab = tabLayout.getTabAt(1); - - // Remove the incorrect lint warning below that the second tab might be null. - assert secondTab != null; - - // Select the second tab. - secondTab.select(); - } else { // The first tab is not being deleted. - // Get a handle for the previous tab. - TabLayout.Tab previousTab = tabLayout.getTabAt(pageNumber - 1); + public void addTab(View view) { + // Get a handle for the tab layout. + TabLayout tabLayout = findViewById(R.id.tablayout); - // Remove the incorrect lint warning below tha the previous tab might be null. - assert previousTab != null; + // Get the new page number. The page numbers are 0 indexed, so the new page number will match the current count. + int newTabNumber = tabLayout.getTabCount(); - // Select the previous tab. - previousTab.select(); - } + // Add a new tab. + tabLayout.addTab(tabLayout.newTab()); - // Delete the page. - webViewFragmentsList.remove(pageNumber); + // Get the new tab. + TabLayout.Tab newTab = tabLayout.getTabAt(newTabNumber); - // Delete the tab. - tabLayout.removeTabAt(pageNumber); + // Remove the lint warning below that the current tab might be null. + assert newTab != null; - // Update the view pager. - notifyDataSetChanged(); - } - } + // Set a custom view on the current tab. + newTab.setCustomView(R.layout.custom_tab_view); - public void addTab(View view) { // Add the new WebView page. - webViewPagerAdapter.addPage(); - - // Get a handle for the tab layout. - TabLayout tabLayout = findViewById(R.id.tablayout); - - // Get a handle for the new tab. The tabs are 0 indexed. - TabLayout.Tab newTab = tabLayout.getTabAt(tabLayout.getTabCount() - 1); + webViewPagerAdapter.addPage(newTabNumber); - // Remove the incorrect warning below that the new tab might be null. - assert newTab != null; - - // Move the tab layout to the new tab. - newTab.select(); + if (newTabNumber > 0) { + // Move to the new tab. + newTab.select(); + } } @Override - public void initializeWebView(int tabNumber, ProgressBar progressBar, NestedScrollWebView nestedScrollWebView) { + public void initializeWebView(long pageId, int pageNumber, ProgressBar progressBar, NestedScrollWebView nestedScrollWebView) { // Get handles for the activity views. - final FrameLayout rootFrameLayout = findViewById(R.id.root_framelayout); - final DrawerLayout drawerLayout = findViewById(R.id.drawerlayout); - final RelativeLayout mainContentRelativeLayout = findViewById(R.id.main_content_relativelayout); - final ActionBar actionBar = getSupportActionBar(); + FrameLayout rootFrameLayout = findViewById(R.id.root_framelayout); + DrawerLayout drawerLayout = findViewById(R.id.drawerlayout); + RelativeLayout mainContentRelativeLayout = findViewById(R.id.main_content_relativelayout); + ActionBar actionBar = getSupportActionBar(); EditText urlEditText = findViewById(R.id.url_edittext); - final TabLayout tabLayout = findViewById(R.id.tablayout); - final SwipeRefreshLayout swipeRefreshLayout = findViewById(R.id.swiperefreshlayout); + TabLayout tabLayout = findViewById(R.id.tablayout); + SwipeRefreshLayout swipeRefreshLayout = findViewById(R.id.swiperefreshlayout); // Remove the incorrect lint warnings below that the some of the views might be null. assert actionBar != null; - // TODO. Still doesn't work right. - // Create the tab if it doesn't already exist. - try { - TabLayout.Tab tab = tabLayout.getTabAt(tabNumber); - - assert tab != null; - - tab.getCustomView(); - } catch (Exception exception) { - tabLayout.addTab(tabLayout.newTab()); - } - - // Get the current tab. - TabLayout.Tab currentTab = tabLayout.getTabAt(tabNumber); - - // Remove the lint warning below that the current tab might be null. - assert currentTab != null; - - // Set a custom view on the current tab. - currentTab.setCustomView(R.layout.custom_tab_view); - - // Get the custom view from the tab. - View currentTabView = currentTab.getCustomView(); - - // Remove the incorrect warning below that the current tab view might be null. - assert currentTabView != null; - - // Get the current views from the tab. - ImageView tabFavoriteIconImageView = currentTabView.findViewById(R.id.favorite_icon_imageview); - TextView tabTitleTextView = currentTabView.findViewById(R.id.title_textview); - // Get a handle for the shared preferences. SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); @@ -4738,9 +4651,27 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Only update the favorite icon if the website has finished loading. if (progressBar.getVisibility() == View.GONE) { // Save a copy of the favorite icon. - // TODO. We need to save and access the icons for each tab. favoriteIconBitmap = icon; + // Get the current page position. + int currentPosition = webViewPagerAdapter.getPositionForId(pageId); + + // Get the current tab. + TabLayout.Tab tab = tabLayout.getTabAt(currentPosition); + + // Remove the lint warning below that the current tab might be null. + assert tab != null; + + // Get the custom view from the tab. + View tabView = tab.getCustomView(); + + // Remove the incorrect warning below that the current tab view might be null. + assert tabView != null; + + // Get the favorite icon image view from the tab. + ImageView tabFavoriteIconImageView = tabView.findViewById(R.id.favorite_icon_imageview); + + // Display the favorite icon in the tab. tabFavoriteIconImageView.setImageBitmap(Bitmap.createScaledBitmap(icon, 64, 64, true)); } } @@ -4748,6 +4679,24 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Save a copy of the title when it changes. @Override public void onReceivedTitle(WebView view, String title) { + // Get the current page position. + int currentPosition = webViewPagerAdapter.getPositionForId(pageId); + + // Get the current tab. + TabLayout.Tab tab = tabLayout.getTabAt(currentPosition); + + // Remove the lint warning below that the current tab might be null. + assert tab != null; + + // Get the custom view from the tab. + View tabView = tab.getCustomView(); + + // Remove the incorrect warning below that the current tab view might be null. + assert tabView != null; + + // Get the title text view from the tab. + TextView tabTitleTextView = tabView.findViewById(R.id.title_textview); + // Set the title as the tab text. tabTitleTextView.setText(title); } @@ -5360,8 +5309,8 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } }); - // Check to see if this is the first tab. - if (tabNumber == 0) { + // Check to see if this is the first page. + if (pageNumber == 0) { // Set this nested scroll WebView as the current WebView. currentWebView = nestedScrollWebView; diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewPagerAdapter.java b/app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewPagerAdapter.java new file mode 100644 index 00000000..3bec0052 --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/WebViewPagerAdapter.java @@ -0,0 +1,114 @@ +/* + * Copyright © 2019 Soren Stoutner . + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + +package com.stoutner.privacybrowser.adapters; + +import com.stoutner.privacybrowser.fragments.WebViewTabFragment; + +import java.util.LinkedList; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; + +public class WebViewPagerAdapter extends FragmentPagerAdapter { + // The WebView fragments list contains all the WebViews. + private LinkedList webViewFragmentsList = new LinkedList<>(); + + // Define the constructor. + public WebViewPagerAdapter(FragmentManager fragmentManager){ + // Run the default commands. + super(fragmentManager); + } + + @Override + public int getCount() { + // Return the number of pages. + return webViewFragmentsList.size(); + } + + @Override + public int getItemPosition(@NonNull Object object) { + //noinspection SuspiciousMethodCalls + if (webViewFragmentsList.contains(object)) { + // Return the current page position. + //noinspection SuspiciousMethodCalls + return webViewFragmentsList.indexOf(object); + } else { + // The tab has been deleted. + return POSITION_NONE; + } + } + + @Override + public Fragment getItem(int pageNumber) { + // Get the fragment for a particular page. Page numbers are 0 indexed. + return webViewFragmentsList.get(pageNumber); + } + + @Override + public long getItemId(int position) { + // Return the unique ID for this page. + return webViewFragmentsList.get(position).tabId; + } + + public int getPositionForId(long pageId) { + // Initialize the position variable. + int position = -1; + + // Initialize the while counter. + int i = 0; + + // Find the current position of the WebView fragment with the given ID. + while (position < 0 && i < webViewFragmentsList.size()) { + // Check to see if the tab ID of this WebView matches the page ID. + if (webViewFragmentsList.get(i).tabId == pageId) { + // Store the position if they are a match. + position = i; + } + + // Increment the counter. + i++; + } + + // Return the position. + return position; + } + + public void addPage(int pageNumber) { + // Add a new page. + webViewFragmentsList.add(WebViewTabFragment.createPage(pageNumber)); + + // Update the view pager. + notifyDataSetChanged(); + } + + public void deletePage(int pageNumber) { + // Delete the page. + webViewFragmentsList.remove(pageNumber); + + // Update the view pager. + notifyDataSetChanged(); + } + + public WebViewTabFragment getPageFragment(int pageNumber) { + return webViewFragmentsList.get(pageNumber); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java index ce7e1a43..bbda9799 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/WebViewTabFragment.java @@ -32,10 +32,15 @@ import androidx.fragment.app.Fragment; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.views.NestedScrollWebView; +import java.util.Calendar; + public class WebViewTabFragment extends Fragment { + // Set a unique ID for this tab based on the time it was created. + public long tabId = Calendar.getInstance().getTimeInMillis(); + // The public interface is used to send information back to the parent activity. public interface NewTabListener { - void initializeWebView(int tabNumber, ProgressBar progressBar, NestedScrollWebView nestedScrollWebView); + void initializeWebView(long pageId, int pageNumber, ProgressBar progressBar, NestedScrollWebView nestedScrollWebView); } // The new tab listener is used in `onAttach()` and `onCreateView()`. @@ -50,12 +55,12 @@ public class WebViewTabFragment extends Fragment { newTabListener = (NewTabListener) context; } - public static WebViewTabFragment createTab(int tabNumber) { + public static WebViewTabFragment createPage(int pageNumber) { // Create a bundle. Bundle bundle = new Bundle(); - // Store the tab number in the bundle. - bundle.putInt("tab_number", tabNumber); + // Store the page number in the bundle. + bundle.putInt("page_number", pageNumber); // Create a new instance of the WebView tab fragment. WebViewTabFragment webViewTabFragment = new WebViewTabFragment(); @@ -76,19 +81,19 @@ public class WebViewTabFragment extends Fragment { assert arguments != null; // Get the variables from the arguments - int tabNumber = arguments.getInt("tab_number"); + int pageNumber = arguments.getInt("page_number"); // Inflate the tab's WebView. Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container. The fragment will take care of attaching the root automatically. - View tabView = layoutInflater.inflate(R.layout.webview_framelayout, container, false); + View newPageView = layoutInflater.inflate(R.layout.webview_framelayout, container, false); - // Get a handle for the nested scroll WebView. - NestedScrollWebView nestedScrollWebView = tabView.findViewById(R.id.nestedscroll_webview); - ProgressBar progressBar = tabView.findViewById(R.id.progress_bar); + // Get handles for the views. + NestedScrollWebView nestedScrollWebView = newPageView.findViewById(R.id.nestedscroll_webview); + ProgressBar progressBar = newPageView.findViewById(R.id.progress_bar); // Request the main activity initialize the WebView. - newTabListener.initializeWebView(tabNumber, progressBar, nestedScrollWebView); + newTabListener.initializeWebView(tabId, pageNumber, progressBar, nestedScrollWebView); - // Return the tab view. - return tabView; + // Return the new page view. + return newPageView; } } \ No newline at end of file diff --git a/app/src/main/res/layout/main_framelayout.xml b/app/src/main/res/layout/main_framelayout.xml index 070eb559..a1e0e094 100644 --- a/app/src/main/res/layout/main_framelayout.xml +++ b/app/src/main/res/layout/main_framelayout.xml @@ -79,16 +79,16 @@ android:layout_width="wrap_content" app:tabMode="scrollable" /> + + android:contentDescription="@string/add_tab" + style="?android:attr/borderlessButtonStyle" /> diff --git a/fastlane/metadata/android/es-ES/full_description.txt b/fastlane/metadata/android/es-ES/full_description.txt index cbee7369..602e8942 100644 --- a/fastlane/metadata/android/es-ES/full_description.txt +++ b/fastlane/metadata/android/es-ES/full_description.txt @@ -1,13 +1,13 @@ -Navegador Privado protege tu privacidad desactivando características como JavaScript, almacenamiento DOM y cookies que son utilizadas por los sitios web para rastrear a los usuarios. La configuración se puede ajustar por dominio y sobre la marcha para habilitar estas funciones cuando sea necesario. Además, Navegador Privado incorpora las listas de bloqueo EasyList, que bloquean muchas tecnologías de seguimiento incluso cuando JavaScript está habilitado. +La mayoría de los navegadores proporcionan a los sitios web cantidades masivas de información que les permite rastrearte y comprometer tu privacidad. Los sitios web y las redes publicitarias utilizan tecnologías como JavaScript, cookies, almacenamiento DOM, agentes de usuario y muchas otras cosas para identificar de forma única a cada usuario y rastrearlo entre visitas y a través de la web. -Navegador Privado aún no tiene navegación con pestañas. Esta es una característica planificada para la serie 3. x. +Navegador Privado está diseñado para minimizar la cantidad de información que el navegador presenta a los sitios web. De forma predeterminada, las funciones sensibles a la privacidad están desactivadas. Si una de estas tecnologías es necesaria para el correcto funcionamiento de un sitio web, el usuario puede optar por activarla sólo para esa visita. O bien, puede utilizar la configuración del dominio para activar automáticamente determinadas funciones al entrar en un sitio web específico y desactivarlas de nuevo al salir. -Navegador Privado actualmente utiliza el WebView que trae Android para renderizar páginas web. Como tal, funciona mejor cuando se instala la última versión de WebView. En la serie 4.x, Navegador Privado utilizará una versión bifurcada del WebView de android llamada Privacy WebView (Privacidad de WebView) que permitirá funciones avanzadas de privacidad. +Navegador Privado utiliza actualmente el WebView incorporado de Android para renderizar las páginas web. Como tal, funciona mejor cuando se instala la última versión de WebView (ver https://www.stoutner.com/privacy-browser/common-settings/webview/). En la serie 4.x, Navegador Privado cambiará a una versión bifurcada del WebView de Android llamada Privacy WebView que permitirá características de privacidad avanzadas. -Advertencia: Debido a las limitaciones del sistema operativo, Navegador Privado es susceptible a los ataques MITM (Man In The Middle/Hombre en medio) cuando navega por sitios web inseguros desde dispositivos que ejecutan Android KitKat (versión 4.4. x, API 19). Más información sobre este tema está disponible en https://www.stoutner.com/kitkat-security-problems/. +Advertencia: Android KitKat (versión 4.4.x, API 19) incluye una versión anterior de OpenSSL que es susceptible a ataques MITM (Man In The Middle) cuando se navega por sitios web que utilizan protocolos y suites de cifrado anticuados. Más información sobre este tema está disponible en https://www.stoutner.com/kitkat-security-problems/. Características: -• Soporte para proxy Tor Orbot. -• Fijación de certificados SSL. -• Modo de navegación a pantalla completa. -• Modo nocturno. +- Bloqueo de anuncios EasyList integrado. +- Soporte para proxy de Tor Orbot. +- Fijación de certificados SSL. +- Importar/Exportar la configuración y los marcadores. \ No newline at end of file -- 2.45.2