Move "Done" button and make it theme conpliant in ReCaptcha

pull/3035/head
Stypox 2020-02-01 17:53:43 +01:00
rodzic fe138f6d61
commit 0cc890a1d1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
7 zmienionych plików z 31 dodań i 7 usunięć

Wyświetl plik

@ -17,6 +17,8 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.schabi.newpipe.util.ThemeHelper;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -49,6 +51,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
ThemeHelper.setTheme(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recaptcha);
Toolbar toolbar = findViewById(R.id.toolbar);
@ -92,17 +95,16 @@ public class ReCaptchaActivity extends AppCompatActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean ret = super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu_recaptcha, menu);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_done_white_24dp));
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setTitle(R.string.title_activity_recaptcha);
actionBar.setSubtitle(R.string.subtitle_activity_recaptcha);
}
return ret;
return true;
}
@Override
@ -114,7 +116,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case android.R.id.home:
case R.id.menu_item_done:
saveCookiesAndFinish();
return true;
default:

Wyświetl plik

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
</vector>

Wyświetl plik

@ -14,8 +14,7 @@
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
app:titleTextAppearance="@style/Toolbar.Title"
app:contentInsetStartWithNavigation="0dp" />
app:titleTextAppearance="@style/Toolbar.Title"/>
<WebView
android:id="@+id/reCaptchaWebView"

Wyświetl plik

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_item_done"
android:title="@string/recaptcha_done_button"
android:icon="?attr/ic_done"
app:showAsAction="always"/>
</menu>

Wyświetl plik

@ -45,6 +45,7 @@
<attr name="ic_grid" format="reference"/>
<attr name="ic_delete" format="reference"/>
<attr name="ic_settings_update" format="reference"/>
<attr name="ic_done" format="reference"/>
<attr name="progress_horizontal_drawable" format="reference"/>
<!-- Can't refer to colors directly in drawable's xml-->

Wyświetl plik

@ -331,6 +331,7 @@
<string name="title_activity_recaptcha">reCAPTCHA challenge</string>
<string name="subtitle_activity_recaptcha">Press \"Done\" when solved</string>
<string name="recaptcha_request_toast">reCAPTCHA challenge requested</string>
<string name="recaptcha_done_button">Done</string>
<!-- Downloads -->
<string name="settings_category_downloads_title">Download</string>
<string name="settings_file_charset_title">Allowed characters in filenames</string>

Wyświetl plik

@ -60,6 +60,7 @@
<item name="ic_grid">@drawable/ic_grid_black_24dp</item>
<item name="ic_delete">@drawable/ic_delete_black_24dp</item>
<item name="ic_settings_update">@drawable/ic_settings_update_black</item>
<item name="ic_done">@drawable/ic_done_black_24dp</item>
<item name="separator_color">@color/light_separator_color</item>
<item name="contrast_background_color">@color/light_contrast_background_color</item>
@ -129,6 +130,7 @@
<item name="ic_delete">@drawable/ic_delete_white_24dp</item>
<item name="pause">@drawable/ic_pause_white_24dp</item>
<item name="ic_settings_update">@drawable/ic_settings_update_white</item>
<item name="ic_done">@drawable/ic_done_white_24dp</item>
<item name="separator_color">@color/dark_separator_color</item>
<item name="contrast_background_color">@color/dark_contrast_background_color</item>