Move "Done" button and make it theme conpliant in ReCaptcha
This commit is contained in:
parent
fe138f6d61
commit
0cc890a1d1
|
@ -17,6 +17,8 @@ import android.webkit.WebSettings;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import org.schabi.newpipe.util.ThemeHelper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -49,6 +51,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
ThemeHelper.setTheme(this);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_recaptcha);
|
setContentView(R.layout.activity_recaptcha);
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
@ -92,17 +95,16 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
boolean ret = super.onCreateOptionsMenu(menu);
|
getMenuInflater().inflate(R.menu.menu_recaptcha, menu);
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||||
actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_done_white_24dp));
|
|
||||||
actionBar.setTitle(R.string.title_activity_recaptcha);
|
actionBar.setTitle(R.string.title_activity_recaptcha);
|
||||||
actionBar.setSubtitle(R.string.subtitle_activity_recaptcha);
|
actionBar.setSubtitle(R.string.subtitle_activity_recaptcha);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -114,7 +116,7 @@ public class ReCaptchaActivity extends AppCompatActivity {
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case android.R.id.home:
|
case R.id.menu_item_done:
|
||||||
saveCookiesAndFinish();
|
saveCookiesAndFinish();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -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>
|
|
@ -14,8 +14,7 @@
|
||||||
android:minHeight="?attr/actionBarSize"
|
android:minHeight="?attr/actionBarSize"
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
app:popupTheme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||||
app:titleTextAppearance="@style/Toolbar.Title"
|
app:titleTextAppearance="@style/Toolbar.Title"/>
|
||||||
app:contentInsetStartWithNavigation="0dp" />
|
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/reCaptchaWebView"
|
android:id="@+id/reCaptchaWebView"
|
||||||
|
|
|
@ -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>
|
|
@ -45,6 +45,7 @@
|
||||||
<attr name="ic_grid" format="reference"/>
|
<attr name="ic_grid" format="reference"/>
|
||||||
<attr name="ic_delete" format="reference"/>
|
<attr name="ic_delete" format="reference"/>
|
||||||
<attr name="ic_settings_update" format="reference"/>
|
<attr name="ic_settings_update" format="reference"/>
|
||||||
|
<attr name="ic_done" format="reference"/>
|
||||||
|
|
||||||
<attr name="progress_horizontal_drawable" format="reference"/>
|
<attr name="progress_horizontal_drawable" format="reference"/>
|
||||||
<!-- Can't refer to colors directly in drawable's xml-->
|
<!-- Can't refer to colors directly in drawable's xml-->
|
||||||
|
|
|
@ -331,6 +331,7 @@
|
||||||
<string name="title_activity_recaptcha">reCAPTCHA challenge</string>
|
<string name="title_activity_recaptcha">reCAPTCHA challenge</string>
|
||||||
<string name="subtitle_activity_recaptcha">Press \"Done\" when solved</string>
|
<string name="subtitle_activity_recaptcha">Press \"Done\" when solved</string>
|
||||||
<string name="recaptcha_request_toast">reCAPTCHA challenge requested</string>
|
<string name="recaptcha_request_toast">reCAPTCHA challenge requested</string>
|
||||||
|
<string name="recaptcha_done_button">Done</string>
|
||||||
<!-- Downloads -->
|
<!-- Downloads -->
|
||||||
<string name="settings_category_downloads_title">Download</string>
|
<string name="settings_category_downloads_title">Download</string>
|
||||||
<string name="settings_file_charset_title">Allowed characters in filenames</string>
|
<string name="settings_file_charset_title">Allowed characters in filenames</string>
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
<item name="ic_grid">@drawable/ic_grid_black_24dp</item>
|
<item name="ic_grid">@drawable/ic_grid_black_24dp</item>
|
||||||
<item name="ic_delete">@drawable/ic_delete_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_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="separator_color">@color/light_separator_color</item>
|
||||||
<item name="contrast_background_color">@color/light_contrast_background_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="ic_delete">@drawable/ic_delete_white_24dp</item>
|
||||||
<item name="pause">@drawable/ic_pause_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_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="separator_color">@color/dark_separator_color</item>
|
||||||
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
|
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
|
||||||
|
|
Loading…
Reference in New Issue