From 61a76e491469916f2f30aebb47b98cda7cceb557 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Fri, 10 Mar 2017 15:52:03 -0700 Subject: [PATCH] Implement a working two-paned mode for `DomainsActivity`. --- app/src/free/res/layout/main_webview.xml | 2 +- app/src/main/AndroidManifest.xml | 39 +++++--- .../{About.java => AboutActivity.java} | 12 +-- ...{Bookmarks.java => BookmarksActivity.java} | 64 +++++++------- ...ava => BookmarksDatabaseViewActivity.java} | 2 +- .../activities/DomainSettingsActivity.java | 63 +++++++++++++ ...{DomainsList.java => DomainsActivity.java} | 47 +++++++--- .../{Guide.java => GuideActivity.java} | 18 ++-- ...nWebView.java => MainWebViewActivity.java} | 88 ++++++++++--------- .../{Settings.java => SettingsActivity.java} | 6 +- .../privacybrowser/definitions/History.java | 4 +- .../{AddDomain.java => AddDomainDialog.java} | 6 +- ...ookmark.java => CreateBookmarkDialog.java} | 14 +-- ...r.java => CreateBookmarkFolderDialog.java} | 10 +-- ...va => CreateHomeScreenShortcutDialog.java} | 10 +-- ...nloadFile.java => DownloadFileDialog.java} | 12 +-- ...oadImage.java => DownloadImageDialog.java} | 12 +-- ...tBookmark.java => EditBookmarkDialog.java} | 20 ++--- ...der.java => EditBookmarkFolderDialog.java} | 18 ++-- ...eToFolder.java => MoveToFolderDialog.java} | 28 +++--- ...or.java => SslCertificateErrorDialog.java} | 8 +- ...{UrlHistory.java => UrlHistoryDialog.java} | 8 +- ...ate.java => ViewSslCertificateDialog.java} | 10 +-- .../{AboutTab.java => AboutTabFragment.java} | 12 +-- .../fragments/DomainSettingsFragment.java | 70 +++++++++++++++ .../{GuideTab.java => GuideTabFragment.java} | 15 ++-- .../fragments/SettingsFragment.java | 4 +- .../helpers/OrbotProxyHelper.java | 10 +-- .../res/drawable/bookmarks_list_selector.xml | 4 +- .../res/drawable/domains_list_selector.xml | 4 +- .../main/res/layout-w900dp/domains_list.xml | 11 ++- app/src/main/res/layout/bare_webview.xml | 2 +- ...domain_details.xml => domain_settings.xml} | 4 +- .../domain_settings_coordinatorlayout.xml | 56 ++++++++++++ ...yout.xml => domains_coordinatorlayout.xml} | 9 +- app/src/main/res/layout/domains_list.xml | 2 +- app/src/main/res/layout/drawerlayout.xml | 2 +- app/src/main/res/layout/main_webview.xml | 2 +- .../main/res/menu/webview_options_menu.xml | 2 +- app/src/main/res/values-es/strings.xml | 6 +- app/src/main/res/values/strings.xml | 1 + 41 files changed, 474 insertions(+), 243 deletions(-) rename app/src/main/java/com/stoutner/privacybrowser/activities/{About.java => AboutActivity.java} (92%) rename app/src/main/java/com/stoutner/privacybrowser/activities/{Bookmarks.java => BookmarksActivity.java} (94%) rename app/src/main/java/com/stoutner/privacybrowser/activities/{BookmarksDatabaseView.java => BookmarksDatabaseViewActivity.java} (99%) create mode 100644 app/src/main/java/com/stoutner/privacybrowser/activities/DomainSettingsActivity.java rename app/src/main/java/com/stoutner/privacybrowser/activities/{DomainsList.java => DomainsActivity.java} (71%) rename app/src/main/java/com/stoutner/privacybrowser/activities/{Guide.java => GuideActivity.java} (85%) rename app/src/main/java/com/stoutner/privacybrowser/activities/{MainWebView.java => MainWebViewActivity.java} (96%) rename app/src/main/java/com/stoutner/privacybrowser/activities/{Settings.java => SettingsActivity.java} (91%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{AddDomain.java => AddDomainDialog.java} (96%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{CreateBookmark.java => CreateBookmarkDialog.java} (95%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{CreateBookmarkFolder.java => CreateBookmarkFolderDialog.java} (95%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{CreateHomeScreenShortcut.java => CreateHomeScreenShortcutDialog.java} (95%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{DownloadFile.java => DownloadFileDialog.java} (96%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{DownloadImage.java => DownloadImageDialog.java} (96%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{EditBookmark.java => EditBookmarkDialog.java} (93%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{EditBookmarkFolder.java => EditBookmarkFolderDialog.java} (92%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{MoveToFolder.java => MoveToFolderDialog.java} (92%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{SslCertificateError.java => SslCertificateErrorDialog.java} (98%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{UrlHistory.java => UrlHistoryDialog.java} (97%) rename app/src/main/java/com/stoutner/privacybrowser/dialogs/{ViewSslCertificate.java => ViewSslCertificateDialog.java} (96%) rename app/src/main/java/com/stoutner/privacybrowser/fragments/{AboutTab.java => AboutTabFragment.java} (97%) create mode 100644 app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java rename app/src/main/java/com/stoutner/privacybrowser/fragments/{GuideTab.java => GuideTabFragment.java} (88%) rename app/src/main/res/layout/{domain_details.xml => domain_settings.xml} (93%) create mode 100644 app/src/main/res/layout/domain_settings_coordinatorlayout.xml rename app/src/main/res/layout/{domains_list_coordinatorlayout.xml => domains_coordinatorlayout.xml} (85%) diff --git a/app/src/free/res/layout/main_webview.xml b/app/src/free/res/layout/main_webview.xml index 5aa146ae..6013ae29 100644 --- a/app/src/free/res/layout/main_webview.xml +++ b/app/src/free/res/layout/main_webview.xml @@ -28,7 +28,7 @@ android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" - tools:context="com.stoutner.privacybrowser.activities.MainWebView" + tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity" tools:showIn="@layout/drawerlayout"> @@ -131,10 +131,23 @@ `android:persistableMode="persistNever"` removes Privacy Browser from the recents screen on a device reboot. `tools:ignore="unusedAttribute"` removes the lint warning that `persistableMode` does not apply to API < 21. --> + + + . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -29,10 +29,10 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import com.stoutner.privacybrowser.fragments.AboutTab; +import com.stoutner.privacybrowser.fragments.AboutTabFragment; import com.stoutner.privacybrowser.R; -public class About extends AppCompatActivity { +public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -56,7 +56,7 @@ public class About extends AppCompatActivity { aboutTabLayout.setupWithViewPager(aboutViewPager); } - public class aboutPagerAdapter extends FragmentPagerAdapter { + private class aboutPagerAdapter extends FragmentPagerAdapter { private aboutPagerAdapter(FragmentManager fm) { super(fm); } @@ -100,7 +100,7 @@ public class About extends AppCompatActivity { @Override // Setup each tab. public Fragment getItem(int tab) { - return AboutTab.createTab(tab); + return AboutTabFragment.createTab(tab); } } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java similarity index 94% rename from app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java index 03ee0d17..b6f9bc61 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/Bookmarks.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksActivity.java @@ -51,28 +51,28 @@ import android.widget.ListView; import android.widget.RadioButton; import android.widget.TextView; -import com.stoutner.privacybrowser.dialogs.EditBookmark; -import com.stoutner.privacybrowser.dialogs.EditBookmarkFolder; -import com.stoutner.privacybrowser.dialogs.MoveToFolder; +import com.stoutner.privacybrowser.dialogs.CreateBookmarkDialog; +import com.stoutner.privacybrowser.dialogs.CreateBookmarkFolderDialog; +import com.stoutner.privacybrowser.dialogs.EditBookmarkDialog; +import com.stoutner.privacybrowser.dialogs.EditBookmarkFolderDialog; +import com.stoutner.privacybrowser.dialogs.MoveToFolderDialog; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; -import com.stoutner.privacybrowser.dialogs.CreateBookmark; -import com.stoutner.privacybrowser.dialogs.CreateBookmarkFolder; import java.io.ByteArrayOutputStream; -public class Bookmarks extends AppCompatActivity implements CreateBookmark.CreateBookmarkListener, CreateBookmarkFolder.CreateBookmarkFolderListener, EditBookmark.EditBookmarkListener, EditBookmarkFolder.EditBookmarkFolderListener, - MoveToFolder.MoveToFolderListener { +public class BookmarksActivity extends AppCompatActivity implements CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener, EditBookmarkDialog.EditBookmarkListener, EditBookmarkFolderDialog.EditBookmarkFolderListener, + MoveToFolderDialog.MoveToFolderListener { - // `bookmarksDatabaseHelper` is public static so it can be accessed from `EditBookmark` and `MoveToFolder`. It is also used in `onCreate()`, + // `bookmarksDatabaseHelper` is public static so it can be accessed from `EditBookmarkDialog` and `MoveToFolderDialog`. It is also used in `onCreate()`, // `onCreateBookmarkCreate()`, `updateBookmarksListView()`, and `updateBookmarksListViewExcept()`. public static BookmarksDatabaseHelper bookmarksDatabaseHelper; - // `currentFolder` is public static so it can be accessed from `MoveToFolder`. + // `currentFolder` is public static so it can be accessed from `MoveToFolderDialog`. // It is used in `onCreate`, `onOptionsItemSelected()`, `onCreateBookmarkCreate`, `onCreateBookmarkFolderCreate`, and `onEditBookmarkSave`. public static String currentFolder; - // `checkedItemIds` is public static so it can be accessed from `EditBookmark`, `EditBookmarkFolder`, and `MoveToFolder`. + // `checkedItemIds` is public static so it can be accessed from `EditBookmarkDialog`, `EditBookmarkFolderDialog`, and `MoveToFolderDialog`. // It is also used in `onActionItemClicked`. public static long[] checkedItemIds; @@ -141,8 +141,8 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Reload the ListView with `currentFolder`. updateBookmarksListView(currentFolder); } else { // Load the URL into `mainWebView`. - // Get the bookmark URL and assign it to formattedUrlString. `mainWebView` will automatically reload when `Bookmarks` closes. - MainWebView.formattedUrlString = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_URL)); + // Get the bookmark URL and assign it to formattedUrlString. `mainWebView` will automatically reload when `BookmarksActivity` closes. + MainWebViewActivity.formattedUrlString = bookmarkCursor.getString(bookmarkCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_URL)); NavUtils.navigateUpFromSameTask(bookmarksActivity); } @@ -307,6 +307,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Select the previously selected bookmark in the new location. bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true); + // Scroll `bookmarksListView` to five items above `selectedBookmarkNewPosition`. bookmarksListView.setSelection(selectedBookmarkNewPosition - 5); break; @@ -344,6 +345,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Select the previously selected bookmark in the new location. bookmarksListView.setItemChecked(selectedBookmarkNewPosition, true); + // Scroll `bookmarksListView` to five items above `selectedBookmarkNewPosition`. bookmarksListView.setSelection(selectedBookmarkNewPosition - 5); break; @@ -351,8 +353,8 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Store `checkedItemIds` for use by the `AlertDialog`. checkedItemIds = bookmarksListView.getCheckedItemIds(); - // Show the `MoveToFolder` `AlertDialog` and name the instance `@string/move_to_folder - AppCompatDialogFragment moveToFolderDialog = new MoveToFolder(); + // Show the `MoveToFolderDialog` `AlertDialog` and name the instance `@string/move_to_folder + AppCompatDialogFragment moveToFolderDialog = new MoveToFolderDialog(); moveToFolderDialog.show(getSupportFragmentManager(), getResources().getString(R.string.move_to_folder)); break; @@ -376,12 +378,12 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Save the current folder name. oldFolderNameString = bookmarksCursor.getString(bookmarksCursor.getColumnIndex(BookmarksDatabaseHelper.BOOKMARK_NAME)); - // Show the `EditBookmarkFolder` `AlertDialog` and name the instance `@string/edit_folder`. - AppCompatDialogFragment editFolderDialog = new EditBookmarkFolder(); + // Show the `EditBookmarkFolderDialog` `AlertDialog` and name the instance `@string/edit_folder`. + AppCompatDialogFragment editFolderDialog = new EditBookmarkFolderDialog(); editFolderDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_folder)); } else { - // Show the `EditBookmark` `AlertDialog` and name the instance `@string/edit_bookmark`. - AppCompatDialogFragment editBookmarkDialog = new EditBookmark(); + // Show the `EditBookmarkDialog` `AlertDialog` and name the instance `@string/edit_bookmark`. + AppCompatDialogFragment editBookmarkDialog = new EditBookmarkDialog(); editBookmarkDialog.show(getSupportFragmentManager(), getResources().getString(R.string.edit_bookmark)); } break; @@ -494,8 +496,8 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat createBookmarkFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - // Show the `CreateBookmark` `AlertDialog` and name the instance `@string/create_bookmark`. - AppCompatDialogFragment createBookmarkDialog = new CreateBookmark(); + // Show the `CreateBookmarkDialog` `AlertDialog` and name the instance `@string/create_bookmark`. + AppCompatDialogFragment createBookmarkDialog = new CreateBookmarkDialog(); createBookmarkDialog.show(getSupportFragmentManager(), getResources().getString(R.string.create_bookmark)); } }); @@ -522,20 +524,20 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat switch (menuItemId) { case android.R.id.home: - if (currentFolder.isEmpty()) { // Exit Bookmarks if currently in the home folder. + if (currentFolder.isEmpty()) { // Exit BookmarksActivity if currently in the home folder. NavUtils.navigateUpFromSameTask(this); } else { // Navigate up one folder. // Place the former parent folder in `currentFolder`. currentFolder = bookmarksDatabaseHelper.getParentFolder(currentFolder); - // Exit Bookmarks if currently in the home folder. + // Exit BookmarksActivity if currently in the home folder. updateBookmarksListView(currentFolder); } break; case R.id.create_folder: - // Show the `CreateBookmarkFolder` `AlertDialog` and name the instance `@string/create_folder`. - AppCompatDialogFragment createBookmarkFolderDialog = new CreateBookmarkFolder(); + // Show the `CreateBookmarkFolderDialog` `AlertDialog` and name the instance `@string/create_folder`. + AppCompatDialogFragment createBookmarkFolderDialog = new CreateBookmarkFolderDialog(); createBookmarkFolderDialog.show(getSupportFragmentManager(), getResources().getString(R.string.create_folder)); break; @@ -548,8 +550,8 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat break; case R.id.bookmarks_database_view: - // Launch `BookmarksDatabaseView`. - Intent bookmarksDatabaseViewIntent = new Intent(this, BookmarksDatabaseView.class); + // Launch `BookmarksDatabaseViewActivity`. + Intent bookmarksDatabaseViewIntent = new Intent(this, BookmarksDatabaseViewActivity.class); startActivity(bookmarksDatabaseViewIntent); break; } @@ -558,7 +560,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat @Override public void onBackPressed() { - if (currentFolder.isEmpty()) { // Exit Bookmarks if currently in the home folder. + if (currentFolder.isEmpty()) { // Exit BookmarksActivity if currently in the home folder. super.onBackPressed(); } else { // Navigate up one folder. // Place the former parent folder in `currentFolder`. @@ -582,7 +584,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat // Convert the favoriteIcon Bitmap to a byte array. ByteArrayOutputStream favoriteIconByteArrayOutputStream = new ByteArrayOutputStream(); // `0` is for lossless compression (the only option for a PNG). - MainWebView.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream); + MainWebViewActivity.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, favoriteIconByteArrayOutputStream); byte[] favoriteIconByteArray = favoriteIconByteArrayOutputStream.toByteArray(); // Display the new bookmark below the current items in the (0 indexed) list. @@ -620,7 +622,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable; folderIconBitmap = folderIconBitmapDrawable.getBitmap(); } else { // Assign `favoriteIcon` from the `WebView`. - folderIconBitmap = MainWebView.favoriteIcon; + folderIconBitmap = MainWebViewActivity.favoriteIcon; } // Convert `folderIconBitmap` to a byte array. `0` is for lossless compression (the only option for a PNG). @@ -661,7 +663,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat bookmarksDatabaseHelper.updateBookmark(selectedBookmarkDatabaseId, bookmarkNameString, bookmarkUrlString); } else { // Update the bookmark using the `WebView` favorite icon. ByteArrayOutputStream newFavoriteIconByteArrayOutputStream = new ByteArrayOutputStream(); - MainWebView.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream); + MainWebViewActivity.favoriteIcon.compress(Bitmap.CompressFormat.PNG, 0, newFavoriteIconByteArrayOutputStream); byte[] newFavoriteIconByteArray = newFavoriteIconByteArrayOutputStream.toByteArray(); // Update the bookmark and the favorite icon. @@ -715,7 +717,7 @@ public class Bookmarks extends AppCompatActivity implements CreateBookmark.Creat BitmapDrawable folderIconBitmapDrawable = (BitmapDrawable) folderIconDrawable; folderIconBitmap = folderIconBitmapDrawable.getBitmap(); } else { // Get the web page icon `ImageView` from the `Dialog`. - folderIconBitmap = MainWebView.favoriteIcon; + folderIconBitmap = MainWebViewActivity.favoriteIcon; } // Convert the folder `Bitmap` to a byte array. `0` is for lossless compression (the only option for a PNG). diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseView.java b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java similarity index 99% rename from app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseView.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java index 44f23bfc..323c1099 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/BookmarksDatabaseViewActivity.java @@ -39,7 +39,7 @@ import android.widget.TextView; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; -public class BookmarksDatabaseView extends AppCompatActivity { +public class BookmarksDatabaseViewActivity extends AppCompatActivity { // `bookmarksDatabaseHelper` is used in `onCreate()` and `updateBookmarksListView()`. private BookmarksDatabaseHelper bookmarksDatabaseHelper; diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainSettingsActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainSettingsActivity.java new file mode 100644 index 00000000..ae3afa96 --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainSettingsActivity.java @@ -0,0 +1,63 @@ +/* + * Copyright 2017 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.activities; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; + +import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.fragments.DomainSettingsFragment; + +public class DomainSettingsActivity extends AppCompatActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.domain_settings_coordinatorlayout); + + // We ned to use `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21. + Toolbar domainSettingsAppBar = (Toolbar) findViewById(R.id.domain_settings_toolbar); + setSupportActionBar(domainSettingsAppBar); + + // Display the home arrow on `appBar`. + final ActionBar appBar = getSupportActionBar(); + assert appBar != null; // This assert removes the incorrect lint warning in Android Studio on the following line that `appBar` might be `null`. + appBar.setDisplayHomeAsUpEnabled(true); + + // Get the intent that started the activity. + final Intent launchingIntent = getIntent(); + + // Extract the `databaseID`. The default value is `0`. + int databaseId = launchingIntent.getIntExtra(DomainSettingsFragment.DATABASE_ID, 0); + + // Store `databaseId` in `argumentsBundle`. + Bundle argumentsBundle = new Bundle(); + argumentsBundle.putInt(DomainSettingsFragment.DATABASE_ID, databaseId); + + // Add `argumentsBundle` to `domainSettingsFragment`. + DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment(); + domainSettingsFragment.setArguments(argumentsBundle); + + // Display `domainSettingsFragment`. + getSupportFragmentManager().beginTransaction().replace(R.id.domain_settings_linearlayout, domainSettingsFragment).commit(); + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsList.java b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java similarity index 71% rename from app/src/main/java/com/stoutner/privacybrowser/activities/DomainsList.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java index fb994f41..0cc4d506 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsList.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/DomainsActivity.java @@ -20,6 +20,7 @@ package com.stoutner.privacybrowser.activities; import android.content.Context; +import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; @@ -36,22 +37,21 @@ import android.widget.ListView; import android.widget.TextView; import com.stoutner.privacybrowser.R; -import com.stoutner.privacybrowser.dialogs.AddDomain; +import com.stoutner.privacybrowser.dialogs.AddDomainDialog; +import com.stoutner.privacybrowser.fragments.DomainSettingsFragment; import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper; -public class DomainsList extends AppCompatActivity implements AddDomain.AddDomainListener { +public class DomainsActivity extends AppCompatActivity implements AddDomainDialog.AddDomainListener { // `domainsDatabaseHelper` is used in `onCreate()`, `onAddDomain()`, and `updateDomainsRecyclerView()`. private static DomainsDatabaseHelper domainsDatabaseHelper; // `domainsRecyclerView` is used in `onCreate()` and `updateDomainsListView()`. private ListView domainsListView; - private boolean twoPaneMode; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.domains_list_coordinatorlayout); + setContentView(R.layout.domains_coordinatorlayout); // We need to use the `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21. final Toolbar bookmarksAppBar = (Toolbar) findViewById(R.id.domains_toolbar); @@ -66,8 +66,8 @@ public class DomainsList extends AppCompatActivity implements AddDomain.AddDomai // The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`. domainsDatabaseHelper = new DomainsDatabaseHelper(this, null, null, 0); - // Determine if we are in two pane mode. `domains_list_framelayout` is only populated if two panes are present. - twoPaneMode = ((findViewById(R.id.domains_list_framelayout)) != null); + // Determine if we are in two pane mode. `domains_settings_linearlayout` is only populated if two panes are present. + final boolean twoPaneMode = ((findViewById(R.id.domain_settings_linearlayout)) != null); // Initialize `domainsListView`. domainsListView = (ListView) findViewById(R.id.domains_listview); @@ -78,11 +78,32 @@ public class DomainsList extends AppCompatActivity implements AddDomain.AddDomai // Convert the id from long to int to match the format of the domains database. int databaseId = (int) id; - // Get the database `Cursor` for this ID and move it to the first row. - Cursor domainCursor = domainsDatabaseHelper.getCursorForId(databaseId); - domainCursor.moveToFirst(); + // Display the Domain Settings. + if (twoPaneMode) { // Display a fragment in two paned mode. + // Highlight the selected domain. + domainsListView.setItemChecked(position, true); + + // Store `databaseId` in `argumentsBundle`. + Bundle argumentsBundle = new Bundle(); + argumentsBundle.putInt(DomainSettingsFragment.DATABASE_ID, databaseId); + + // Add `argumentsBundle` to `domainSettingsFragment`. + DomainSettingsFragment domainSettingsFragment = new DomainSettingsFragment(); + domainSettingsFragment.setArguments(argumentsBundle); + + // Display `domainSettingsFragment`. + getSupportFragmentManager().beginTransaction().replace(R.id.domain_settings_linearlayout, domainSettingsFragment).commit(); + } else { // Load the second activity on smaller screens. + // Get a handle for the context. + Context context = view.getContext(); + + // Create `domainSettingsActivityIntent` with the `databaseId`. + Intent domainSettingsActivityIntent = new Intent(context, DomainSettingsActivity.class); + domainSettingsActivityIntent.putExtra(DomainSettingsFragment.DATABASE_ID, databaseId); - // If the + // Start `DomainSettingsActivity`. + context.startActivity(domainSettingsActivityIntent); + } } }); @@ -90,8 +111,8 @@ public class DomainsList extends AppCompatActivity implements AddDomain.AddDomai addDomainFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - // Show the `AddDomain` `AlertDialog` and name the instance `@string/add_domain`. - AppCompatDialogFragment addDomainDialog = new AddDomain(); + // Show the `AddDomainDialog` `AlertDialog` and name the instance `@string/add_domain`. + AppCompatDialogFragment addDomainDialog = new AddDomainDialog(); addDomainDialog.show(getSupportFragmentManager(), getResources().getString(R.string.add_domain)); } }); diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/Guide.java b/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java similarity index 85% rename from app/src/main/java/com/stoutner/privacybrowser/activities/Guide.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java index 2861f0e3..c0caeabc 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/Guide.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/GuideActivity.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -29,22 +29,22 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import com.stoutner.privacybrowser.fragments.GuideTab; +import com.stoutner.privacybrowser.fragments.GuideTabFragment; import com.stoutner.privacybrowser.R; -public class Guide extends AppCompatActivity { +public class GuideActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_coordinatorlayout); - // We need to use the SupportActionBar from android.support.v7.app.ActionBar until the minimum API is >= 21. + // We need to use `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21. Toolbar guideAppBar = (Toolbar) findViewById(R.id.guide_toolbar); setSupportActionBar(guideAppBar); - // Display the home arrow on supportAppBar. + // Display the home arrow on `ppBar`. final ActionBar appBar = getSupportActionBar(); - assert appBar != null;// This assert removes the incorrect warning in Android Studio on the following line that appBar might be null. + assert appBar != null; // This assert removes the incorrect lint warning in Android Studio on the following line that `appBar` might be `null`. appBar.setDisplayHomeAsUpEnabled(true); // Setup the ViewPager. @@ -58,7 +58,7 @@ public class Guide extends AppCompatActivity { aboutTabLayout.setupWithViewPager(aboutViewPager); } - public class guidePagerAdapter extends FragmentPagerAdapter { + private class guidePagerAdapter extends FragmentPagerAdapter { private guidePagerAdapter(FragmentManager fm) { super(fm); } @@ -105,7 +105,7 @@ public class Guide extends AppCompatActivity { @Override // Setup each tab. public Fragment getItem(int tab) { - return GuideTab.createTab(tab); + return GuideTabFragment.createTab(tab); } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java similarity index 96% rename from app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index e6e5304a..2cad4b6d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -90,13 +90,13 @@ import android.widget.TextView; import com.stoutner.privacybrowser.BannerAd; import com.stoutner.privacybrowser.BuildConfig; import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.dialogs.CreateHomeScreenShortcutDialog; +import com.stoutner.privacybrowser.dialogs.DownloadImageDialog; +import com.stoutner.privacybrowser.dialogs.UrlHistoryDialog; +import com.stoutner.privacybrowser.dialogs.ViewSslCertificateDialog; import com.stoutner.privacybrowser.helpers.OrbotProxyHelper; -import com.stoutner.privacybrowser.dialogs.CreateHomeScreenShortcut; -import com.stoutner.privacybrowser.dialogs.DownloadFile; -import com.stoutner.privacybrowser.dialogs.DownloadImage; -import com.stoutner.privacybrowser.dialogs.SslCertificateError; -import com.stoutner.privacybrowser.dialogs.UrlHistory; -import com.stoutner.privacybrowser.dialogs.ViewSslCertificate; +import com.stoutner.privacybrowser.dialogs.DownloadFileDialog; +import com.stoutner.privacybrowser.dialogs.SslCertificateErrorDialog; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -112,22 +112,22 @@ import java.util.Map; import java.util.Set; // We need to use AppCompatActivity from android.support.v7.app.AppCompatActivity to have access to the SupportActionBar until the minimum API is >= 21. -public class MainWebView extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, CreateHomeScreenShortcut.CreateHomeScreenSchortcutListener, - SslCertificateError.SslCertificateErrorListener, DownloadFile.DownloadFileListener, DownloadImage.DownloadImageListener, UrlHistory.UrlHistoryListener { +public class MainWebViewActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, CreateHomeScreenShortcutDialog.CreateHomeScreenSchortcutListener, + SslCertificateErrorDialog.SslCertificateErrorListener, DownloadFileDialog.DownloadFileListener, DownloadImageDialog.DownloadImageListener, UrlHistoryDialog.UrlHistoryListener { // `appBar` is public static so it can be accessed from `OrbotProxyHelper`. // It is also used in `onCreate()`, `onOptionsItemSelected()`, `closeFindOnPage()`, and `applySettings()`. public static ActionBar appBar; - // `favoriteIcon` is public static so it can be accessed from `CreateHomeScreenShortcut`, `Bookmarks`, `CreateBookmark`, `CreateBookmarkFolder`, and `EditBookmark`. + // `favoriteIcon` is public static so it can be accessed from `CreateHomeScreenShortcutDialog`, `BookmarksActivity`, `CreateBookmarkDialog`, `CreateBookmarkFolderDialog`, and `EditBookmarkDialog`. // It is also used in `onCreate()` and `onCreateHomeScreenShortcutCreate()`. public static Bitmap favoriteIcon; - // `formattedUrlString` is public static so it can be accessed from `Bookmarks`. + // `formattedUrlString` is public static so it can be accessed from `BookmarksActivity`. // It is also used in `onCreate()`, `onOptionsItemSelected()`, `onCreateHomeScreenShortcutCreate()`, and `loadUrlFromTextBox()`. public static String formattedUrlString; - // `sslCertificate` is public static so it can be accessed from `ViewSslCertificate`. It is also used in `onCreate()`. + // `sslCertificate` is public static so it can be accessed from `ViewSslCertificateDialog`. It is also used in `onCreate()`. public static SslCertificate sslCertificate; // `orbotStatus` is public static so it can be accessed from `OrbotProxyHelper`. It is also used in `onCreate()`. @@ -633,7 +633,7 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN urlTextBox.setText(formattedUrlString); } - // Store the SSL certificate so it can be accessed from `ViewSslCertificate`. + // Store the SSL certificate so it can be accessed from `ViewSslCertificateDialog`. sslCertificate = mainWebView.getCertificate(); } } @@ -645,7 +645,7 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN sslErrorHandler = handler; // Display the SSL error `AlertDialog`. - AppCompatDialogFragment sslCertificateErrorDialogFragment = SslCertificateError.displayDialog(error); + AppCompatDialogFragment sslCertificateErrorDialogFragment = SslCertificateErrorDialog.displayDialog(error); sslCertificateErrorDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.ssl_certificate_error)); } }); @@ -735,8 +735,8 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN mainWebView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { - // Show the `DownloadFile` `AlertDialog` and name this instance `@string/download`. - AppCompatDialogFragment downloadFileDialogFragment = DownloadFile.fromUrl(url, contentDisposition, contentLength); + // Show the `DownloadFileDialog` `AlertDialog` and name this instance `@string/download`. + AppCompatDialogFragment downloadFileDialogFragment = DownloadFileDialog.fromUrl(url, contentDisposition, contentLength); downloadFileDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.download)); } }); @@ -756,13 +756,15 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // Initialize the default preference values the first time the program is run. `this` is the context. `false` keeps this command from resetting any current preferences back to default. PreferenceManager.setDefaultValues(this, R.xml.preferences, false); - // Get the intent information that started the app. - final Intent intent = getIntent(); + // Get the intent that started the app. + final Intent launchingIntent = getIntent(); - if (intent.getData() != null) { - // Get the intent data and convert it to a string. - final Uri intentUriData = intent.getData(); - formattedUrlString = intentUriData.toString(); + // Extract the launching intent data as `launchingIntentUriData`. + final Uri launchingIntentUriData = launchingIntent.getData(); + + // Convert the launching intent URI data (if it exists) to a string and store it in `formattedUrlString`. + if (launchingIntentUriData != null) { + formattedUrlString = launchingIntentUriData.toString(); } // Initialize `inFullScreenBrowsingMode`, which is always false at this point because Privacy Browser never starts in full screen browsing mode. @@ -1153,11 +1155,11 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN return true; case R.id.addToHomescreen: - // Show the `CreateHomeScreenShortcut` `AlertDialog` and name this instance `R.string.create_shortcut`. - AppCompatDialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcut(); + // Show the `CreateHomeScreenShortcutDialog` `AlertDialog` and name this instance `R.string.create_shortcut`. + AppCompatDialogFragment createHomeScreenShortcutDialogFragment = new CreateHomeScreenShortcutDialog(); createHomeScreenShortcutDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.create_shortcut)); - //Everything else will be handled by `CreateHomeScreenShortcut` and the associated listener below. + //Everything else will be handled by `CreateHomeScreenShortcutDialog` and the associated listener below. return true; case R.id.print: @@ -1208,14 +1210,14 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // Gte the `WebBackForwardList`. WebBackForwardList webBackForwardList = mainWebView.copyBackForwardList(); - // Show the `UrlHistory` `AlertDialog` and name this instance `R.string.history`. `this` is the `Context`. - AppCompatDialogFragment urlHistoryDialogFragment = UrlHistory.loadBackForwardList(this, webBackForwardList); + // Show the `UrlHistoryDialog` `AlertDialog` and name this instance `R.string.history`. `this` is the `Context`. + AppCompatDialogFragment urlHistoryDialogFragment = UrlHistoryDialog.loadBackForwardList(this, webBackForwardList); urlHistoryDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.history)); break; case R.id.bookmarks: - // Launch Bookmarks. - Intent bookmarksIntent = new Intent(this, Bookmarks.class); + // Launch BookmarksActivity. + Intent bookmarksIntent = new Intent(this, BookmarksActivity.class); startActivity(bookmarksIntent); break; @@ -1230,26 +1232,26 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN break; case R.id.settings: - // Launch `Settings`. - Intent settingsIntent = new Intent(this, Settings.class); + // Launch `SettingsActivity`. + Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivity(settingsIntent); break; case R.id.domains: - // Launch `DomainsList`. - Intent domainsIntent = new Intent(this, DomainsList.class); + // Launch `DomainsActivity`. + Intent domainsIntent = new Intent(this, DomainsActivity.class); startActivity(domainsIntent); break; case R.id.guide: - // Launch `Guide`. - Intent guideIntent = new Intent(this, Guide.class); + // Launch `GuideActivity`. + Intent guideIntent = new Intent(this, GuideActivity.class); startActivity(guideIntent); break; case R.id.about: - // Launch `About`. - Intent aboutIntent = new Intent(this, About.class); + // Launch `AboutActivity`. + Intent aboutIntent = new Intent(this, AboutActivity.class); startActivity(aboutIntent); break; @@ -1455,8 +1457,8 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN menu.add(R.string.download_image).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - // Show the `DownloadImage` `AlertDialog` and name this instance `@string/download`. - AppCompatDialogFragment downloadImageDialogFragment = DownloadImage.imageUrl(imageUrl); + // Show the `DownloadImageDialog` `AlertDialog` and name this instance `@string/download`. + AppCompatDialogFragment downloadImageDialogFragment = DownloadImageDialog.imageUrl(imageUrl); downloadImageDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.download)); return false; } @@ -1501,8 +1503,8 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN menu.add(R.string.download_image).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { - // Show the `DownloadImage` `AlertDialog` and name this instance `@string/download`. - AppCompatDialogFragment downloadImageDialogFragment = DownloadImage.imageUrl(imageUrl); + // Show the `DownloadImageDialog` `AlertDialog` and name this instance `@string/download`. + AppCompatDialogFragment downloadImageDialogFragment = DownloadImageDialog.imageUrl(imageUrl); downloadImageDialogFragment.show(getSupportFragmentManager(), getResources().getString(R.string.download)); return false; } @@ -1640,8 +1642,8 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN } public void viewSslCertificate(View view) { - // Show the `ViewSslCertificate` `AlertDialog` and name this instance `@string/view_ssl_certificate`. - DialogFragment viewSslCertificateDialogFragment = new ViewSslCertificate(); + // Show the `ViewSslCertificateDialog` `AlertDialog` and name this instance `@string/view_ssl_certificate`. + DialogFragment viewSslCertificateDialogFragment = new ViewSslCertificateDialog(); viewSslCertificateDialogFragment.show(getFragmentManager(), getResources().getString(R.string.view_ssl_certificate)); } @@ -1720,7 +1722,7 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN public void onRestart() { super.onRestart(); - // Apply the settings from shared preferences, which might have been changed in `Settings`. + // Apply the settings from shared preferences, which might have been changed in `SettingsActivity`. applySettings(); // Update the privacy icon. `true` runs `invalidateOptionsMenu` as the last step. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/Settings.java b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java similarity index 91% rename from app/src/main/java/com/stoutner/privacybrowser/activities/Settings.java rename to app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java index 027482c7..ddeb7b7b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/Settings.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/SettingsActivity.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -25,7 +25,7 @@ import android.support.v7.app.AppCompatActivity; import com.stoutner.privacybrowser.fragments.SettingsFragment; -public class Settings extends AppCompatActivity { +public class SettingsActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/com/stoutner/privacybrowser/definitions/History.java b/app/src/main/java/com/stoutner/privacybrowser/definitions/History.java index e5804218..180d4cce 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/definitions/History.java +++ b/app/src/main/java/com/stoutner/privacybrowser/definitions/History.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomain.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java similarity index 96% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomain.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java index c176633a..e4cf59f0 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomain.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/AddDomainDialog.java @@ -35,7 +35,7 @@ import android.widget.EditText; import com.stoutner.privacybrowser.R; -public class AddDomain extends AppCompatDialogFragment { +public class AddDomainDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface AddDomainListener { void onAddDomain(AppCompatDialogFragment dialogFragment); @@ -80,7 +80,7 @@ public class AddDomain extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on add. - addDomainListener.onAddDomain(AddDomain.this); + addDomainListener.onAddDomain(AddDomainDialog.this); } }); @@ -103,7 +103,7 @@ public class AddDomain extends AppCompatDialogFragment { // If the event is a key-down on the `enter` key, select the `PositiveButton` `Add`. if ((keyCode == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN)) { // Trigger `addDomainListener` and return the `DialogFragment` to the parent activity. - addDomainListener.onAddDomain(AddDomain.this); + addDomainListener.onAddDomain(AddDomainDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmark.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java similarity index 95% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmark.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java index 5ac074b2..80f16bda 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmark.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkDialog.java @@ -35,10 +35,10 @@ import android.view.View; import android.view.WindowManager; import android.widget.EditText; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; -public class CreateBookmark extends AppCompatDialogFragment { +public class CreateBookmarkDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface CreateBookmarkListener { void onCreateBookmark(AppCompatDialogFragment dialogFragment); @@ -65,7 +65,7 @@ public class CreateBookmark extends AppCompatDialogFragment { @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // Create a drawable version of the favorite icon. - Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebView.favoriteIcon); + Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon); // Use `AlertDialog.Builder` to create the `AlertDialog`. The style formats the color of the button text. AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog); @@ -87,7 +87,7 @@ public class CreateBookmark extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on create. - createBookmarkListener.onCreateBookmark(CreateBookmark.this); + createBookmarkListener.onCreateBookmark(CreateBookmarkDialog.this); } }); @@ -112,7 +112,7 @@ public class CreateBookmark extends AppCompatDialogFragment { // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`. if ((keyCode == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN)) { // Trigger `createBookmarkListener` and return the `DialogFragment` to the parent activity. - createBookmarkListener.onCreateBookmark(CreateBookmark.this); + createBookmarkListener.onCreateBookmark(CreateBookmarkDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. @@ -126,7 +126,7 @@ public class CreateBookmark extends AppCompatDialogFragment { // Set the formattedUrlString as the initial text of `create_bookmark_url_edittext`. EditText createBookmarkUrlEditText = (EditText) alertDialog.findViewById(R.id.create_bookmark_url_edittext); assert createBookmarkUrlEditText != null;// Remove the warning below that `createBookmarkUrlEditText` might be `null`. - createBookmarkUrlEditText.setText(MainWebView.formattedUrlString); + createBookmarkUrlEditText.setText(MainWebViewActivity.formattedUrlString); // Allow the `enter` key on the keyboard to create the bookmark from `create_bookmark_url_edittext`. createBookmarkUrlEditText.setOnKeyListener(new View.OnKeyListener() { @@ -134,7 +134,7 @@ public class CreateBookmark extends AppCompatDialogFragment { // If the event is a key-down on the "enter" key, select the PositiveButton "Create". if ((keyCode == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN)) { // Trigger `createBookmarkListener` and return the DialogFragment to the parent activity. - createBookmarkListener.onCreateBookmark(CreateBookmark.this); + createBookmarkListener.onCreateBookmark(CreateBookmarkDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolder.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java similarity index 95% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolder.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java index 606915c5..2b6986c1 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolder.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateBookmarkFolderDialog.java @@ -34,10 +34,10 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; -public class CreateBookmarkFolder extends AppCompatDialogFragment { +public class CreateBookmarkFolderDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface CreateBookmarkFolderListener { void onCreateBookmarkFolder(AppCompatDialogFragment dialogFragment); @@ -81,7 +81,7 @@ public class CreateBookmarkFolder extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on create. - createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolder.this); + createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolderDialog.this); } }); @@ -106,7 +106,7 @@ public class CreateBookmarkFolder extends AppCompatDialogFragment { // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Trigger `createBookmarkFolderListener` and return the `DialogFragment` to the parent activity. - createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolder.this); + createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolderDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. @@ -120,7 +120,7 @@ public class CreateBookmarkFolder extends AppCompatDialogFragment { // Display the current favorite icon. ImageView webPageIconImageView = (ImageView) alertDialog.findViewById(R.id.create_folder_web_page_icon); assert webPageIconImageView != null; // Remove the warning that `webPageIconImageView` may be null. - webPageIconImageView.setImageBitmap(MainWebView.favoriteIcon); + webPageIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon); // `onCreateDialog()` requires the return of an `AlertDialog`. return alertDialog; diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcut.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java similarity index 95% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcut.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java index 50a3aef5..e5722bf8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcut.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/CreateHomeScreenShortcutDialog.java @@ -36,10 +36,10 @@ import android.view.View; import android.view.WindowManager; import android.widget.EditText; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; -public class CreateHomeScreenShortcut extends AppCompatDialogFragment { +public class CreateHomeScreenShortcutDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface CreateHomeScreenSchortcutListener { void onCreateHomeScreenShortcut(AppCompatDialogFragment dialogFragment); @@ -67,7 +67,7 @@ public class CreateHomeScreenShortcut extends AppCompatDialogFragment { LayoutInflater layoutInflater = getActivity().getLayoutInflater(); // Create a drawable version of the favorite icon. - Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebView.favoriteIcon); + Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon); // Use `AlertDialog.Builder` to create the `AlertDialog`. `R.style.LightAlertDialog` formats the color of the button text. AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog); @@ -88,7 +88,7 @@ public class CreateHomeScreenShortcut extends AppCompatDialogFragment { dialogBuilder.setPositiveButton(R.string.create, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcut.this); + createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcutDialog.this); } }); @@ -113,7 +113,7 @@ public class CreateHomeScreenShortcut extends AppCompatDialogFragment { // If the event is a key-down on the "enter" button, select the PositiveButton "Create". if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Trigger the create listener. - createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcut.this); + createHomeScreenShortcutListener.onCreateHomeScreenShortcut(CreateHomeScreenShortcutDialog.this); // Manually dismiss `alertDialog`. alertDialog.dismiss(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFile.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java similarity index 96% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFile.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java index e4c2156f..9218c38e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFile.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadFileDialog.java @@ -40,13 +40,13 @@ import com.stoutner.privacybrowser.R; import java.util.Locale; -public class DownloadFile extends AppCompatDialogFragment { +public class DownloadFileDialog extends AppCompatDialogFragment { private String downloadUrl; private String downloadFileName; private String fileSize; - public static DownloadFile fromUrl(String urlString, String contentDisposition, long contentLength) { + public static DownloadFileDialog fromUrl(String urlString, String contentDisposition, long contentLength) { // Create `argumentsBundle`. Bundle argumentsBundle = new Bundle(); @@ -69,8 +69,8 @@ public class DownloadFile extends AppCompatDialogFragment { argumentsBundle.putString("File_Name", fileNameString); argumentsBundle.putLong("File_Size", contentLength); - // Add `argumentsBundle` to this instance of `DownloadFile`. - DownloadFile thisDownloadFileDialog = new DownloadFile(); + // Add `argumentsBundle` to this instance of `DownloadFileDialog`. + DownloadFileDialog thisDownloadFileDialog = new DownloadFileDialog(); thisDownloadFileDialog.setArguments(argumentsBundle); return thisDownloadFileDialog; } @@ -144,7 +144,7 @@ public class DownloadFile extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // trigger `onDownloadFile()` and return the `DialogFragment` and the download URL to the parent activity. - downloadFileListener.onDownloadFile(DownloadFile.this, downloadUrl); + downloadFileListener.onDownloadFile(DownloadFileDialog.this, downloadUrl); } }); @@ -177,7 +177,7 @@ public class DownloadFile extends AppCompatDialogFragment { // If the event is an `ACTION_DOWN` on the `enter` key, initiate the download. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // trigger `onDownloadFile()` and return the `DialogFragment` and the URL to the parent activity. - downloadFileListener.onDownloadFile(DownloadFile.this, downloadUrl); + downloadFileListener.onDownloadFile(DownloadFileDialog.this, downloadUrl); // Manually dismiss `alertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImage.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java similarity index 96% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImage.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java index 8de68987..6251e5e2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImage.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/DownloadImageDialog.java @@ -39,12 +39,12 @@ import com.stoutner.privacybrowser.R; // `android.support.v7.app.AlertDialog` uses more of the horizontal screen real estate versus `android.app.AlertDialog's` smaller width. // We have to use `AppCompatDialogFragment` instead of `DialogFragment` or an error is produced on API <=22. -public class DownloadImage extends AppCompatDialogFragment { +public class DownloadImageDialog extends AppCompatDialogFragment { private String imageUrl; private String imageFileName; - public static DownloadImage imageUrl(String imageUrlString) { + public static DownloadImageDialog imageUrl(String imageUrlString) { // Create `argumentsBundle`. Bundle argumentsBundle = new Bundle(); @@ -57,8 +57,8 @@ public class DownloadImage extends AppCompatDialogFragment { argumentsBundle.putString("URL", imageUrlString); argumentsBundle.putString("Image_Name", imageNameString); - // Add `argumentsBundle` to this instance of `DownloadFile`. - DownloadImage thisDownloadFileDialog = new DownloadImage(); + // Add `argumentsBundle` to this instance of `DownloadFileDialog`. + DownloadImageDialog thisDownloadFileDialog = new DownloadImageDialog(); thisDownloadFileDialog.setArguments(argumentsBundle); return thisDownloadFileDialog; } @@ -118,7 +118,7 @@ public class DownloadImage extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // trigger `onDownloadFile()` and return the `DialogFragment` and the download URL to the parent activity. - downloadImageListener.onDownloadImage(DownloadImage.this, imageUrl); + downloadImageListener.onDownloadImage(DownloadImageDialog.this, imageUrl); } }); @@ -147,7 +147,7 @@ public class DownloadImage extends AppCompatDialogFragment { // If the event is an `ACTION_DOWN` on the `enter` key, initiate the download. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // trigger `onDownloadImage()` and return the `DialogFragment` and the URL to the parent activity. - downloadImageListener.onDownloadImage(DownloadImage.this, imageUrl); + downloadImageListener.onDownloadImage(DownloadImageDialog.this, imageUrl); // Manually dismiss `alertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmark.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java similarity index 93% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmark.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java index b502ca88..a2db731b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmark.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDialog.java @@ -37,12 +37,12 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; -import com.stoutner.privacybrowser.activities.Bookmarks; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.BookmarksActivity; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; -public class EditBookmark extends AppCompatDialogFragment { +public class EditBookmarkDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface EditBookmarkListener { void onSaveEditBookmark(AppCompatDialogFragment dialogFragment); @@ -68,11 +68,11 @@ public class EditBookmark extends AppCompatDialogFragment { @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // Get a long array with the the databaseId of the selected bookmark and convert it to an `int`. - long[] selectedBookmarkLongArray = Bookmarks.checkedItemIds; + long[] selectedBookmarkLongArray = BookmarksActivity.checkedItemIds; int selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0]; // Get a `Cursor` with the specified bookmark and move it to the first position. - Cursor bookmarkCursor = Bookmarks.bookmarksDatabaseHelper.getBookmarkCursor(selectedBookmarkDatabaseId); + Cursor bookmarkCursor = BookmarksActivity.bookmarksDatabaseHelper.getBookmarkCursor(selectedBookmarkDatabaseId); bookmarkCursor.moveToFirst(); // Use `AlertDialog.Builder` to create the `AlertDialog`. The style formats the color of the button text. @@ -94,7 +94,7 @@ public class EditBookmark extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on save. - editBookmarkListener.onSaveEditBookmark(EditBookmark.this); + editBookmarkListener.onSaveEditBookmark(EditBookmarkDialog.this); } }); @@ -120,10 +120,10 @@ public class EditBookmark extends AppCompatDialogFragment { assert currentIconImageView != null; // Remove the warning below that `currentIconImageView` might be null; currentIconImageView.setImageBitmap(currentIconBitmap); - // Get a `Bitmap` of the favorite icon from `MainWebView` and display it in `edit_bookmark_web_page_favorite_icon`. + // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_bookmark_web_page_favorite_icon`. ImageView newFavoriteIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_bookmark_web_page_favorite_icon); assert newFavoriteIconImageView != null; // Remove the warning below that `newFavoriteIcon` might be null. - newFavoriteIconImageView.setImageBitmap(MainWebView.favoriteIcon); + newFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon); // Load the text for `edit_bookmark_name_edittext`. EditText bookmarkNameEditText = (EditText) alertDialog.findViewById(R.id.edit_bookmark_name_edittext); @@ -137,7 +137,7 @@ public class EditBookmark extends AppCompatDialogFragment { // If the event is an `ACTION_DOWN` on the `enter` key, save the bookmark. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Trigger `onSaveEditBookmark()` and return the `DialogFragment` to the parent activity. - editBookmarkListener.onSaveEditBookmark(EditBookmark.this); + editBookmarkListener.onSaveEditBookmark(EditBookmarkDialog.this); // Manually dismiss `alertDialog`. alertDialog.dismiss(); // Consume the event. @@ -159,7 +159,7 @@ public class EditBookmark extends AppCompatDialogFragment { // If the event is a key-down on the `enter` button, select the PositiveButton `Save`. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity. - editBookmarkListener.onSaveEditBookmark(EditBookmark.this); + editBookmarkListener.onSaveEditBookmark(EditBookmarkDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolder.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java similarity index 92% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolder.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java index 77726ebe..a2a71152 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolder.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDialog.java @@ -37,12 +37,12 @@ import android.view.WindowManager; import android.widget.EditText; import android.widget.ImageView; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.BookmarksActivity; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; -import com.stoutner.privacybrowser.activities.Bookmarks; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; -public class EditBookmarkFolder extends AppCompatDialogFragment { +public class EditBookmarkFolderDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface EditBookmarkFolderListener { void onSaveEditBookmarkFolder(AppCompatDialogFragment dialogFragment); @@ -68,11 +68,11 @@ public class EditBookmarkFolder extends AppCompatDialogFragment { @NonNull public Dialog onCreateDialog(Bundle savedInstanceState) { // Get a long array with the the databaseId of the selected bookmark and convert it to an `int`. - long[] selectedBookmarkLongArray = Bookmarks.checkedItemIds; + long[] selectedBookmarkLongArray = BookmarksActivity.checkedItemIds; int selectedBookmarkDatabaseId = (int) selectedBookmarkLongArray[0]; // Get a `Cursor` with the specified bookmark and move it to the first position. - Cursor bookmarkCursor = Bookmarks.bookmarksDatabaseHelper.getBookmarkCursor(selectedBookmarkDatabaseId); + Cursor bookmarkCursor = BookmarksActivity.bookmarksDatabaseHelper.getBookmarkCursor(selectedBookmarkDatabaseId); bookmarkCursor.moveToFirst(); // Use `AlertDialog.Builder` to create the `AlertDialog`. The style formats the color of the button text. @@ -94,7 +94,7 @@ public class EditBookmarkFolder extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on save. - editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolder.this); + editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolderDialog.this); } }); @@ -120,10 +120,10 @@ public class EditBookmarkFolder extends AppCompatDialogFragment { assert currentIconImageView != null; // Remove the warning below that `currentIconImageView` might be null. currentIconImageView.setImageBitmap(currentIconBitmap); - // Get a `Bitmap` of the favorite icon from `MainWebView` and display it in `edit_folder_web_page_favorite_icon`. + // Get a `Bitmap` of the favorite icon from `MainWebViewActivity` and display it in `edit_folder_web_page_favorite_icon`. ImageView webPageFavoriteIconImageView = (ImageView) alertDialog.findViewById(R.id.edit_folder_web_page_favorite_icon); assert webPageFavoriteIconImageView != null; // Remove the warning below that `webPageFavoriteIcon` might be null. - webPageFavoriteIconImageView.setImageBitmap(MainWebView.favoriteIcon); + webPageFavoriteIconImageView.setImageBitmap(MainWebViewActivity.favoriteIcon); // Load the text for `edit_folder_name_edittext`. EditText folderNameEditText = (EditText) alertDialog.findViewById(R.id.edit_folder_name_edittext); @@ -136,7 +136,7 @@ public class EditBookmarkFolder extends AppCompatDialogFragment { // If the event is a key-down on the "enter" button, select the PositiveButton `Save`. if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity. - editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolder.this); + editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolderDialog.this); // Manually dismiss the `AlertDialog`. alertDialog.dismiss(); // Consume the event. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolder.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java similarity index 92% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolder.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java index 217281c1..bf863444 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolder.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/MoveToFolderDialog.java @@ -45,12 +45,12 @@ import android.widget.ListView; import android.widget.TextView; import com.stoutner.privacybrowser.R; -import com.stoutner.privacybrowser.activities.Bookmarks; +import com.stoutner.privacybrowser.activities.BookmarksActivity; import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper; import java.io.ByteArrayOutputStream; -public class MoveToFolder extends AppCompatDialogFragment { +public class MoveToFolderDialog extends AppCompatDialogFragment { // The public interface is used to send information back to the parent activity. public interface MoveToFolderListener { void onMoveToFolder(AppCompatDialogFragment dialogFragment); @@ -97,7 +97,7 @@ public class MoveToFolder extends AppCompatDialogFragment { @Override public void onClick(DialogInterface dialog, int which) { // Return the `DialogFragment` to the parent activity on save. - moveToFolderListener.onMoveToFolder(MoveToFolder.this); + moveToFolderListener.onMoveToFolder(MoveToFolderDialog.this); } }); @@ -112,20 +112,20 @@ public class MoveToFolder extends AppCompatDialogFragment { CursorAdapter foldersCursorAdapter; // Check to see if we are in the `Home Folder`. - if (Bookmarks.currentFolder.isEmpty()) { // Don't display `Home Folder` at the top of the `ListView`. + if (BookmarksActivity.currentFolder.isEmpty()) { // Don't display `Home Folder` at the top of the `ListView`. // Initialize `exceptFolders`. exceptFolders = ""; // If a folder is selected, add it and all children to the list of folders not to display. - long[] selectedBookmarksLongArray = Bookmarks.checkedItemIds; + long[] selectedBookmarksLongArray = BookmarksActivity.checkedItemIds; for (long databaseIdLong : selectedBookmarksLongArray) { // Get `databaseIdInt` for each selected bookmark. int databaseIdInt = (int) databaseIdLong; // If `databaseIdInt` is a folder. - if (Bookmarks.bookmarksDatabaseHelper.isFolder(databaseIdInt)) { + if (BookmarksActivity.bookmarksDatabaseHelper.isFolder(databaseIdInt)) { // Get the name of the selected folder. - String folderName = Bookmarks.bookmarksDatabaseHelper.getFolderName(databaseIdInt); + String folderName = BookmarksActivity.bookmarksDatabaseHelper.getFolderName(databaseIdInt); if (exceptFolders.isEmpty()){ // Add the selected folder to the list of folders not to display. @@ -141,7 +141,7 @@ public class MoveToFolder extends AppCompatDialogFragment { } // Get a `Cursor` containing the folders to display. - foldersCursor = Bookmarks.bookmarksDatabaseHelper.getFoldersCursorExcept(exceptFolders); + foldersCursor = BookmarksActivity.bookmarksDatabaseHelper.getFoldersCursorExcept(exceptFolders); // Setup `foldersCursorAdaptor` with `this` context. `false` disables autoRequery. foldersCursorAdapter = new CursorAdapter(alertDialog.getContext(), foldersCursor, false) { @@ -184,18 +184,18 @@ public class MoveToFolder extends AppCompatDialogFragment { homeFolderMatrixCursor.addRow(new Object[]{0, getString(R.string.home_folder), homeFolderIconByteArray}); // Add the parent folder to the list of folders not to display. - exceptFolders = DatabaseUtils.sqlEscapeString(Bookmarks.currentFolder); + exceptFolders = DatabaseUtils.sqlEscapeString(BookmarksActivity.currentFolder); // If a folder is selected, add it and all children to the list of folders not to display. - long[] selectedBookmarksLongArray = Bookmarks.checkedItemIds; + long[] selectedBookmarksLongArray = BookmarksActivity.checkedItemIds; for (long databaseIdLong : selectedBookmarksLongArray) { // Get `databaseIdInt` for each selected bookmark. int databaseIdInt = (int) databaseIdLong; // If `databaseIdInt` is a folder. - if (Bookmarks.bookmarksDatabaseHelper.isFolder(databaseIdInt)) { + if (BookmarksActivity.bookmarksDatabaseHelper.isFolder(databaseIdInt)) { // Get the name of the selected folder. - String folderName = Bookmarks.bookmarksDatabaseHelper.getFolderName(databaseIdInt); + String folderName = BookmarksActivity.bookmarksDatabaseHelper.getFolderName(databaseIdInt); // Add the selected folder to the end of the list of folders not to display. exceptFolders = exceptFolders + "," + DatabaseUtils.sqlEscapeString(folderName); @@ -206,7 +206,7 @@ public class MoveToFolder extends AppCompatDialogFragment { } // Get a `foldersCursor`. - foldersCursor = Bookmarks.bookmarksDatabaseHelper.getFoldersCursorExcept(exceptFolders); + foldersCursor = BookmarksActivity.bookmarksDatabaseHelper.getFoldersCursorExcept(exceptFolders); // Combine `homeFolderMatrixCursor` and `foldersCursor`. MergeCursor foldersMergeCursor = new MergeCursor(new Cursor[]{homeFolderMatrixCursor, foldersCursor}); @@ -249,7 +249,7 @@ public class MoveToFolder extends AppCompatDialogFragment { private void addSubfoldersToExceptFolders(String folderName) { // Get a `Cursor` will all the immediate subfolders. - Cursor subfoldersCursor = Bookmarks.bookmarksDatabaseHelper.getSubfoldersCursor(folderName); + Cursor subfoldersCursor = BookmarksActivity.bookmarksDatabaseHelper.getSubfoldersCursor(folderName); for (int i = 0; i < subfoldersCursor.getCount(); i++) { // Move `subfolderCursor` to the current item. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java similarity index 98% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java index 917b3027..0416d160 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateErrorDialog.java @@ -41,7 +41,7 @@ import com.stoutner.privacybrowser.R; import java.text.DateFormat; import java.util.Date; -public class SslCertificateError extends AppCompatDialogFragment { +public class SslCertificateErrorDialog extends AppCompatDialogFragment { private String primaryError; private String urlWithError; @@ -54,7 +54,7 @@ public class SslCertificateError extends AppCompatDialogFragment { private String startDate; private String endDate; - public static SslCertificateError displayDialog(SslError error) { + public static SslCertificateErrorDialog displayDialog(SslError error) { // Get the various components of the SSL error message. int primaryErrorIntForBundle = error.getPrimaryError(); String urlWithErrorForBundle = error.getUrl(); @@ -81,8 +81,8 @@ public class SslCertificateError extends AppCompatDialogFragment { argumentsBundle.putString("StartDate", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(startDateForBundle)); argumentsBundle.putString("EndDate", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(endDateForBundle)); - // Add `argumentsBundle` to this instance of `SslCertificateError`. - SslCertificateError thisSslCertificateErrorDialog = new SslCertificateError(); + // Add `argumentsBundle` to this instance of `SslCertificateErrorDialog`. + SslCertificateErrorDialog thisSslCertificateErrorDialog = new SslCertificateErrorDialog(); thisSslCertificateErrorDialog.setArguments(argumentsBundle); return thisSslCertificateErrorDialog; } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistory.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java similarity index 97% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistory.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java index a362b704..4811ea2d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistory.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/UrlHistoryDialog.java @@ -47,13 +47,13 @@ import com.stoutner.privacybrowser.definitions.History; import java.io.ByteArrayOutputStream; import java.util.ArrayList; -public class UrlHistory extends AppCompatDialogFragment{ +public class UrlHistoryDialog extends AppCompatDialogFragment{ // `historyArrayList` and `currentPageId` pass information from `onCreate()` to `onCreateDialog()`. private ArrayList historyArrayList = new ArrayList<>(); private int currentPageId; - public static UrlHistory loadBackForwardList(Context context, WebBackForwardList webBackForwardList) { + public static UrlHistoryDialog loadBackForwardList(Context context, WebBackForwardList webBackForwardList) { // Create `argumentsBundle`. Bundle argumentsBundle = new Bundle(); @@ -110,8 +110,8 @@ public class UrlHistory extends AppCompatDialogFragment{ argumentsBundle.putStringArrayList("URL_History", urlArrayList); argumentsBundle.putStringArrayList("Favorite_Icons", iconBase64StringArrayList); - // Add `argumentsBundle` to this instance of `UrlHistory`. - UrlHistory thisUrlHistoryDialog = new UrlHistory(); + // Add `argumentsBundle` to this instance of `UrlHistoryDialog`. + UrlHistoryDialog thisUrlHistoryDialog = new UrlHistoryDialog(); thisUrlHistoryDialog.setArguments(argumentsBundle); return thisUrlHistoryDialog; } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java similarity index 96% rename from app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java rename to app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java index 4b16ab1c..ccd546b2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificateDialog.java @@ -33,7 +33,7 @@ import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.widget.TextView; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; import java.text.DateFormat; @@ -41,13 +41,13 @@ import java.util.Date; // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @SuppressLint("InflateParams") -public class ViewSslCertificate extends DialogFragment { +public class ViewSslCertificateDialog extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { // Get the activity's layout inflater. LayoutInflater layoutInflater = getActivity().getLayoutInflater(); // Create a drawable version of the favorite icon. - Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebView.favoriteIcon); + Drawable favoriteIconDrawable = new BitmapDrawable(getResources(), MainWebViewActivity.favoriteIcon); // Use `AlertDialog.Builder` to create the `AlertDialog`. `R.style.LightAlertDialog` formats the color of the button text. AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog); @@ -57,7 +57,7 @@ public class ViewSslCertificate extends DialogFragment { dialogBuilder.setNegativeButton(R.string.close, null); // Check to see if the website is encrypted. - if (MainWebView.sslCertificate == null) { // The website is not encrypted. + if (MainWebViewActivity.sslCertificate == null) { // The website is not encrypted. // Set the title. dialogBuilder.setTitle(R.string.unencrypted_website); @@ -104,7 +104,7 @@ public class ViewSslCertificate extends DialogFragment { String endDateLabel = getString(R.string.end_date) + " "; // Get the SSL certificate. - SslCertificate sslCertificate = MainWebView.sslCertificate; + SslCertificate sslCertificate = MainWebViewActivity.sslCertificate; // Get the strings from the SSL certificate. String issuedToCNameString = sslCertificate.getIssuedTo().getCName(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTab.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java similarity index 97% rename from app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTab.java rename to app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java index 57971307..b3e9e5a4 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTab.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -34,15 +34,15 @@ import android.widget.TextView; import com.stoutner.privacybrowser.BuildConfig; import com.stoutner.privacybrowser.R; -public class AboutTab extends Fragment { +public class AboutTabFragment extends Fragment { private int tabNumber; - // AboutTab.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate(). - public static AboutTab createTab(int tab) { + // AboutTabFragment.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate(). + public static AboutTabFragment createTab(int tab) { Bundle thisTabArguments = new Bundle(); thisTabArguments.putInt("Tab", tab); - AboutTab thisTab = new AboutTab(); + AboutTabFragment thisTab = new AboutTabFragment(); thisTab.setArguments(thisTabArguments); return thisTab; } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java new file mode 100644 index 00000000..3e28fc7f --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -0,0 +1,70 @@ +/* + * Copyright 2017 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.fragments; + +import android.database.Cursor; +import android.os.Bundle; +// We have to use `android.support.v4.app.Fragment` until minimum API >= 23. Otherwise we cannot call `getContext()`. +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.EditText; + +import com.stoutner.privacybrowser.R; +import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper; + +public class DomainSettingsFragment extends Fragment { + // `DATABASE_ID` is used by activities calling this fragment. + public static final String DATABASE_ID = "database_id"; + + // `databaseId` is used in `onCreate()` and `onCreateView()`. + private int databaseId; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Store the database id in `databaseId`. + databaseId = getArguments().getInt(DATABASE_ID); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + // Inflate `domain_settings`. `false` does not attach it to the root `container`. + View domainSettingsView = inflater.inflate(R.layout.domain_settings, container, false); + + // Initialize the database handler. `this` specifies the context. The two `nulls` do not specify the database name or a `CursorFactory`. + // The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`. + DomainsDatabaseHelper domainsDatabaseHelper = new DomainsDatabaseHelper(getContext(), null, null, 0); + + // Get the database `Cursor` for this ID and move it to the first row. + Cursor domainCursor = domainsDatabaseHelper.getCursorForId(databaseId); + domainCursor.moveToFirst(); + + // Get handles for the `EditTexts`. + EditText domainNameEditText = (EditText) domainSettingsView.findViewById(R.id.domain_settings_name_edittext); + + // Set the text from the database cursor. + domainNameEditText.setText(domainCursor.getString(domainCursor.getColumnIndex(DomainsDatabaseHelper.DOMAIN))); + + return domainSettingsView; + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTab.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java similarity index 88% rename from app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTab.java rename to app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java index 8857aca4..5c8a07b5 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTab.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/GuideTabFragment.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -28,15 +28,16 @@ import android.webkit.WebView; import com.stoutner.privacybrowser.R; -public class GuideTab extends Fragment { +public class GuideTabFragment extends Fragment { + // `tabNumber` is used in `onCreate()` and `onCreateView()`. private int tabNumber; - // GuideTab.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate(). - public static GuideTab createTab (int tab) { + // GuideTabFragment.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate(). + public static GuideTabFragment createTab (int tab) { Bundle thisTabArguments = new Bundle(); thisTabArguments.putInt("Tab", tab); - GuideTab thisTab = new GuideTab(); + GuideTabFragment thisTab = new GuideTabFragment(); thisTab.setArguments(thisTabArguments); return thisTab; } @@ -45,7 +46,7 @@ public class GuideTab extends Fragment { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // Store the tab number in tabNumber. + // Store the tab number in `tabNumber`. tabNumber = getArguments().getInt("Tab"); } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java index 9fee2931..0f7330bb 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.java @@ -1,5 +1,5 @@ -/** - * Copyright 2016 Soren Stoutner . +/* + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java index 8d0e4082..154e6d10 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java @@ -1,4 +1,4 @@ -/** +/* * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . @@ -30,7 +30,7 @@ import android.support.v7.app.AlertDialog; import android.util.ArrayMap; import android.util.Log; -import com.stoutner.privacybrowser.activities.MainWebView; +import com.stoutner.privacybrowser.activities.MainWebViewActivity; import com.stoutner.privacybrowser.R; import java.lang.reflect.Field; @@ -78,14 +78,14 @@ public class OrbotProxyHelper { if (proxyPort.equals("8118")) { // Orbot proxy was turned on. // Set the `appBar` background to be light blue if Orbot proxy support is enabled. - MainWebView.appBar.setBackgroundDrawable(ContextCompat.getDrawable(privacyBrowserContext, R.color.blue_50)); + MainWebViewActivity.appBar.setBackgroundDrawable(ContextCompat.getDrawable(privacyBrowserContext, R.color.blue_50)); try { // Check to see if Orbot is installed. PackageManager packageManager = privacyBrowserContext.getPackageManager(); packageManager.getPackageInfo("org.torproject.android", PackageManager.GET_ACTIVITIES); // Ask Orbot to connect if its current status is not "ON". - if (!MainWebView.orbotStatus.equals("ON")) { + if (!MainWebViewActivity.orbotStatus.equals("ON")) { // Request Orbot to start. Intent orbotIntent = new Intent("org.torproject.android.intent.action.START"); @@ -114,7 +114,7 @@ public class OrbotProxyHelper { alertDialog.show(); } } else { // Otherwise set the default grey `appBar` background. - MainWebView.appBar.setBackgroundDrawable(ContextCompat.getDrawable(privacyBrowserContext, R.color.gray_100)); + MainWebViewActivity.appBar.setBackgroundDrawable(ContextCompat.getDrawable(privacyBrowserContext, R.color.gray_100)); } } } diff --git a/app/src/main/res/drawable/bookmarks_list_selector.xml b/app/src/main/res/drawable/bookmarks_list_selector.xml index 30e99383..3f74269f 100644 --- a/app/src/main/res/drawable/bookmarks_list_selector.xml +++ b/app/src/main/res/drawable/bookmarks_list_selector.xml @@ -1,7 +1,7 @@ - + . --> - + + android:drawable="@color/blue_200" /> \ No newline at end of file diff --git a/app/src/main/res/layout-w900dp/domains_list.xml b/app/src/main/res/layout-w900dp/domains_list.xml index 4d6df86c..48428580 100644 --- a/app/src/main/res/layout-w900dp/domains_list.xml +++ b/app/src/main/res/layout-w900dp/domains_list.xml @@ -22,7 +22,7 @@ + - + android:layout_weight="3" + android:orientation="horizontal" /> \ No newline at end of file diff --git a/app/src/main/res/layout/bare_webview.xml b/app/src/main/res/layout/bare_webview.xml index 9e628092..7960ca5e 100644 --- a/app/src/main/res/layout/bare_webview.xml +++ b/app/src/main/res/layout/bare_webview.xml @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - + + android:labelFor="@+id/domain_settings_name_edittext"/> @@ -45,7 +45,7 @@ diff --git a/app/src/main/res/layout/domain_settings_coordinatorlayout.xml b/app/src/main/res/layout/domain_settings_coordinatorlayout.xml new file mode 100644 index 00000000..7c47eba9 --- /dev/null +++ b/app/src/main/res/layout/domain_settings_coordinatorlayout.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/domains_list_coordinatorlayout.xml b/app/src/main/res/layout/domains_coordinatorlayout.xml similarity index 85% rename from app/src/main/res/layout/domains_list_coordinatorlayout.xml rename to app/src/main/res/layout/domains_coordinatorlayout.xml index 7f870a92..aef0d67b 100644 --- a/app/src/main/res/layout/domains_list_coordinatorlayout.xml +++ b/app/src/main/res/layout/domains_coordinatorlayout.xml @@ -18,16 +18,15 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - + + android:fitsSystemWindows="true" > - + - + diff --git a/app/src/main/res/menu/webview_options_menu.xml b/app/src/main/res/menu/webview_options_menu.xml index 06fa1ac4..8f0df746 100644 --- a/app/src/main/res/menu/webview_options_menu.xml +++ b/app/src/main/res/menu/webview_options_menu.xml @@ -22,7 +22,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" - tools:context=".activities.MainWebView"> + tools:context=".activities.MainWebViewActivity"> Configuración de Navegador Privado es - + Modo Privado Javascript habilitado Javascript deshabilitado @@ -83,7 +83,7 @@ URL URL: - + Caja de navegación Navegación Inicio @@ -98,7 +98,7 @@ Acerca de Eliminar y salir - + Javascript Cookies de primera parte Cookies de terceras partes diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7689f4d3..efe7d613 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -185,6 +185,7 @@ Domains + Domain Settings Add Domain Add Domain Name -- 2.45.2