Search in sources :

Example 6 with NinjaWebView

use of de.baumann.browser.View.NinjaWebView in project browser by scoute-dich.

the class BrowserActivity method initRendering.

private void initRendering(View view) {
    if (currentAlbumController instanceof NinjaWebView && sp.getBoolean("sp_invert", false)) {
        Paint paint = new Paint();
        ColorMatrix matrix = new ColorMatrix();
        matrix.set(NEGATIVE_COLOR);
        ColorMatrix gcm = new ColorMatrix();
        gcm.setSaturation(0);
        ColorMatrix concat = new ColorMatrix();
        concat.setConcat(matrix, gcm);
        ColorMatrixColorFilter filter = new ColorMatrixColorFilter(concat);
        paint.setColorFilter(filter);
        // maybe sometime LAYER_TYPE_NONE would better?
        view.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
    } else {
        view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
}
Also used : ColorMatrixColorFilter(android.graphics.ColorMatrixColorFilter) NinjaWebView(de.baumann.browser.View.NinjaWebView) ColorMatrix(android.graphics.ColorMatrix) Paint(android.graphics.Paint)

Example 7 with NinjaWebView

use of de.baumann.browser.View.NinjaWebView in project browser by scoute-dich.

the class BrowserActivity method onLongPress.

@Override
public void onLongPress(String url) {
    WebView.HitTestResult result;
    if (!(currentAlbumController instanceof NinjaWebView)) {
        return;
    }
    result = ((NinjaWebView) currentAlbumController).getHitTestResult();
    bottomSheetDialog = new BottomSheetDialog(BrowserActivity.this);
    View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_menu_link, null);
    if (url != null || (result != null && result.getExtra() != null)) {
        if (url == null) {
            url = result.getExtra();
        }
        bottomSheetDialog.setContentView(dialogView);
        bottomSheetDialog.show();
    }
    final String target = url;
    LinearLayout tv3_main_menu_new_tab = dialogView.findViewById(R.id.tv3_main_menu_new_tab);
    tv3_main_menu_new_tab.setVisibility(View.VISIBLE);
    tv3_main_menu_new_tab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            addAlbum(getString(R.string.album_untitled), target, false, null);
            NinjaToast.show(BrowserActivity.this, getString(R.string.toast_new_tab_successful));
            bottomSheetDialog.cancel();
        }
    });
    LinearLayout tv3_main_menu_share_link = dialogView.findViewById(R.id.tv3_main_menu_share_link);
    tv3_main_menu_share_link.setVisibility(View.VISIBLE);
    tv3_main_menu_share_link.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (prepareRecord()) {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_share_failed));
            } else {
                IntentUnit.share(BrowserActivity.this, "", target);
            }
            bottomSheetDialog.cancel();
        }
    });
    LinearLayout tv3_main_menu_open_link = dialogView.findViewById(R.id.tv3_main_menu_open_link);
    tv3_main_menu_open_link.setVisibility(View.VISIBLE);
    tv3_main_menu_open_link.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(target));
            Intent chooser = Intent.createChooser(intent, getString(R.string.menu_open_with));
            startActivity(chooser);
            bottomSheetDialog.cancel();
        }
    });
    LinearLayout tv3_main_menu_new_tabOpen = dialogView.findViewById(R.id.tv3_main_menu_new_tabOpen);
    tv3_main_menu_new_tabOpen.setVisibility(View.VISIBLE);
    tv3_main_menu_new_tabOpen.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            pinAlbums(target);
            bottomSheetDialog.cancel();
        }
    });
    LinearLayout tv3_main_menu_copy_link = dialogView.findViewById(R.id.tv3_main_menu_copy_link);
    tv3_main_menu_copy_link.setVisibility(View.VISIBLE);
    tv3_main_menu_copy_link.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            BrowserUnit.copyURL(BrowserActivity.this, target);
            bottomSheetDialog.cancel();
        }
    });
    LinearLayout tv3_menu_save_as = dialogView.findViewById(R.id.tv3_menu_save_as);
    tv3_menu_save_as.setVisibility(View.VISIBLE);
    tv3_menu_save_as.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                assert target != null;
                String filename = target.substring(target.lastIndexOf("/") + 1);
                AlertDialog.Builder builder = new AlertDialog.Builder(BrowserActivity.this);
                View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_edit, null);
                final EditText editText = dialogView.findViewById(R.id.dialog_edit);
                editText.setHint(R.string.dialog_title_hint);
                editText.setText(filename);
                editText.setSelection(filename.length());
                builder.setView(dialogView);
                builder.setTitle(R.string.menu_edit);
                builder.setPositiveButton(R.string.app_ok, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int whichButton) {
                        String text = editText.getText().toString().trim();
                        if (text.isEmpty()) {
                            NinjaToast.show(BrowserActivity.this, getString(R.string.toast_input_empty));
                        } else {
                            if (android.os.Build.VERSION.SDK_INT >= 23) {
                                int hasWRITE_EXTERNAL_STORAGE = checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE);
                                if (hasWRITE_EXTERNAL_STORAGE != PackageManager.PERMISSION_GRANTED) {
                                    NinjaToast.show(BrowserActivity.this, R.string.toast_permission_sdCard_sec);
                                } else {
                                    Uri source = Uri.parse(target);
                                    DownloadManager.Request request = new DownloadManager.Request(source);
                                    request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(target));
                                    request.allowScanningByMediaScanner();
                                    // Notify client once download is completed!
                                    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                                    request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, text);
                                    DownloadManager dm = (DownloadManager) BrowserActivity.this.getSystemService(DOWNLOAD_SERVICE);
                                    assert dm != null;
                                    dm.enqueue(request);
                                    hideSoftInput(editText);
                                }
                            } else {
                                Uri source = Uri.parse(target);
                                DownloadManager.Request request = new DownloadManager.Request(source);
                                request.addRequestHeader("Cookie", CookieManager.getInstance().getCookie(target));
                                request.allowScanningByMediaScanner();
                                // Notify client once download is completed!
                                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, text);
                                DownloadManager dm = (DownloadManager) BrowserActivity.this.getSystemService(DOWNLOAD_SERVICE);
                                assert dm != null;
                                dm.enqueue(request);
                                hideSoftInput(editText);
                            }
                        }
                    }
                });
                builder.setNegativeButton(R.string.app_cancel, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int whichButton) {
                        dialog.cancel();
                        hideSoftInput(editText);
                    }
                });
                AlertDialog dialog = builder.create();
                dialog.show();
                bottomSheetDialog.cancel();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) NinjaWebView(de.baumann.browser.View.NinjaWebView) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) NinjaWebView(de.baumann.browser.View.NinjaWebView) AutoCompleteTextView(android.widget.AutoCompleteTextView) DynamicGridView(org.askerov.dynamicgrid.DynamicGridView) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView) Uri(android.net.Uri) DownloadManager(android.app.DownloadManager) Paint(android.graphics.Paint) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) NinjaWebView(de.baumann.browser.View.NinjaWebView) WebView(android.webkit.WebView) LinearLayout(android.widget.LinearLayout)

Example 8 with NinjaWebView

use of de.baumann.browser.View.NinjaWebView in project browser by scoute-dich.

the class BrowserActivity method removeAlbum.

@Override
public synchronized void removeAlbum(final AlbumController controller) {
    if (currentAlbumController == null || BrowserContainer.size() <= 1) {
        if (currentAlbumController != null && currentAlbumController instanceof NinjaWebView) {
            closeTabConfirmation(new Runnable() {

                @Override
                public void run() {
                    switcherContainer.removeView(controller.getAlbumView());
                    BrowserContainer.remove(controller);
                    pinAlbums(null);
                }
            });
        } else {
            doubleTapsQuit();
        }
        return;
    }
    if (controller != currentAlbumController) {
        if (currentAlbumController instanceof NinjaWebView) {
            closeTabConfirmation(new Runnable() {

                @Override
                public void run() {
                    switcherContainer.removeView(controller.getAlbumView());
                    BrowserContainer.remove(controller);
                }
            });
        } else {
            switcherContainer.removeView(controller.getAlbumView());
            BrowserContainer.remove(controller);
        }
    } else {
        if (currentAlbumController instanceof NinjaWebView) {
            closeTabConfirmation(new Runnable() {

                @Override
                public void run() {
                    switcherContainer.removeView(controller.getAlbumView());
                    int index = BrowserContainer.indexOf(controller);
                    BrowserContainer.remove(controller);
                    if (index >= BrowserContainer.size()) {
                        index = BrowserContainer.size() - 1;
                    }
                    showAlbum(BrowserContainer.get(index), false);
                }
            });
        } else {
            switcherContainer.removeView(controller.getAlbumView());
            int index = BrowserContainer.indexOf(controller);
            BrowserContainer.remove(controller);
            if (index >= BrowserContainer.size()) {
                index = BrowserContainer.size() - 1;
            }
            showAlbum(BrowserContainer.get(index), false);
        }
    }
    showOmnibox();
}
Also used : NinjaWebView(de.baumann.browser.View.NinjaWebView) Paint(android.graphics.Paint)

Example 9 with NinjaWebView

use of de.baumann.browser.View.NinjaWebView in project browser by scoute-dich.

the class BrowserActivity method pinAlbums.

private synchronized void pinAlbums(String url) {
    showOmnibox();
    hideSoftInput(inputBox);
    hideSearchPanel();
    switcherContainer.removeAllViews();
    ninjaWebView = new NinjaWebView(this);
    for (AlbumController controller : BrowserContainer.list()) {
        if (controller instanceof NinjaWebView) {
            ((NinjaWebView) controller).setBrowserController(this);
        } else if (controller instanceof NinjaRelativeLayout) {
            ((NinjaRelativeLayout) controller).setBrowserController(this);
        }
        switcherContainer.addView(controller.getAlbumView(), LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
        controller.getAlbumView().setVisibility(View.VISIBLE);
        controller.deactivate();
    }
    if (BrowserContainer.size() < 1 && url == null) {
        addAlbum(start_tab);
    } else if (BrowserContainer.size() >= 1 && url == null) {
        if (currentAlbumController != null) {
            currentAlbumController.activate();
            return;
        }
        int index = BrowserContainer.size() - 1;
        currentAlbumController = BrowserContainer.get(index);
        contentFrame.removeAllViews();
        contentFrame.addView((View) currentAlbumController);
        currentAlbumController.activate();
        updateOmnibox();
    } else {
        // When url != null
        ninjaWebView.setBrowserController(this);
        ninjaWebView.setFlag(BrowserUnit.FLAG_NINJA);
        ninjaWebView.setAlbumTitle(getString(R.string.album_untitled));
        ViewUnit.bound(this, ninjaWebView);
        ninjaWebView.loadUrl(url);
        BrowserContainer.add(ninjaWebView);
        final View albumView = ninjaWebView.getAlbumView();
        switcherContainer.addView(albumView, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        contentFrame.removeAllViews();
        contentFrame.addView(ninjaWebView);
        if (currentAlbumController != null) {
            currentAlbumController.deactivate();
        }
        currentAlbumController = ninjaWebView;
        currentAlbumController.activate();
        updateOmnibox();
    }
}
Also used : NinjaRelativeLayout(de.baumann.browser.View.NinjaRelativeLayout) NinjaWebView(de.baumann.browser.View.NinjaWebView) AlbumController(de.baumann.browser.Browser.AlbumController) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) NinjaWebView(de.baumann.browser.View.NinjaWebView) AutoCompleteTextView(android.widget.AutoCompleteTextView) DynamicGridView(org.askerov.dynamicgrid.DynamicGridView) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView)

Example 10 with NinjaWebView

use of de.baumann.browser.View.NinjaWebView in project browser by scoute-dich.

the class BrowserActivity method showSwitcher.

private void showSwitcher() {
    bottomSheetDialog = new BottomSheetDialog(BrowserActivity.this);
    View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_toggle, null);
    CheckBox sw_java = dialogView.findViewById(R.id.switch_js);
    final ImageButton whiteList_js = dialogView.findViewById(R.id.imageButton_js);
    CheckBox sw_adBlock = dialogView.findViewById(R.id.switch_adBlock);
    final ImageButton whiteList_ab = dialogView.findViewById(R.id.imageButton_ab);
    CheckBox sw_image = dialogView.findViewById(R.id.switch_images);
    CheckBox sw_cookie = dialogView.findViewById(R.id.switch_cookie);
    final ImageButton whitelist_cookie = dialogView.findViewById(R.id.imageButton_cookie);
    CheckBox sw_location = dialogView.findViewById(R.id.switch_location);
    CheckBox sw_invert = dialogView.findViewById(R.id.switch_invert);
    CheckBox sw_history = dialogView.findViewById(R.id.switch_history);
    CheckBox sw_desktop = dialogView.findViewById(R.id.switch_desktop);
    javaHosts = new Javascript(BrowserActivity.this);
    javaHosts = getJavaHosts();
    cookieHosts = new Cookie(BrowserActivity.this);
    cookieHosts = getCookieHosts();
    adBlock = new AdBlock(BrowserActivity.this);
    adBlock = getAdBlock();
    ninjaWebView = (NinjaWebView) currentAlbumController;
    final String url = ninjaWebView.getUrl();
    if (javaHosts.isWhite(url)) {
        whiteList_js.setImageResource(R.drawable.check_green);
    } else {
        whiteList_js.setImageResource(R.drawable.ic_action_close_red);
    }
    if (cookieHosts.isWhite(url)) {
        whitelist_cookie.setImageResource(R.drawable.check_green);
    } else {
        whitelist_cookie.setImageResource(R.drawable.ic_action_close_red);
    }
    if (sp.getBoolean(getString(R.string.sp_javascript), true)) {
        sw_java.setChecked(true);
    } else {
        sw_java.setChecked(false);
    }
    whiteList_js.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (javaHosts.isWhite(ninjaWebView.getUrl())) {
                whiteList_js.setImageResource(R.drawable.ic_action_close_red);
                javaHosts.removeDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            } else {
                whiteList_js.setImageResource(R.drawable.check_green);
                javaHosts.addDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            }
        }
    });
    whitelist_cookie.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (cookieHosts.isWhite(ninjaWebView.getUrl())) {
                whitelist_cookie.setImageResource(R.drawable.ic_action_close_red);
                cookieHosts.removeDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            } else {
                whitelist_cookie.setImageResource(R.drawable.check_green);
                cookieHosts.addDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            }
        }
    });
    sw_java.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean(getString(R.string.sp_javascript), true).commit();
                IntentUnit.setSPChange(true);
            } else {
                sp.edit().putBoolean(getString(R.string.sp_javascript), false).commit();
                IntentUnit.setSPChange(true);
            }
        }
    });
    if (adBlock.isWhite(url)) {
        whiteList_ab.setImageResource(R.drawable.check_green);
    } else {
        whiteList_ab.setImageResource(R.drawable.ic_action_close_red);
    }
    if (sp.getBoolean(getString(R.string.sp_ad_block), true)) {
        sw_adBlock.setChecked(true);
    } else {
        sw_adBlock.setChecked(false);
    }
    whiteList_ab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (adBlock.isWhite(ninjaWebView.getUrl())) {
                whiteList_ab.setImageResource(R.drawable.ic_action_close_red);
                adBlock.removeDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            } else {
                whiteList_ab.setImageResource(R.drawable.check_green);
                adBlock.addDomain(Uri.parse(url).getHost().replace("www.", "").trim());
            }
        }
    });
    sw_adBlock.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean(getString(R.string.sp_ad_block), true).commit();
                IntentUnit.setSPChange(true);
            } else {
                sp.edit().putBoolean(getString(R.string.sp_ad_block), false).commit();
                IntentUnit.setSPChange(true);
            }
        }
    });
    if (sp.getBoolean(getString(R.string.sp_images), true)) {
        sw_image.setChecked(true);
    } else {
        sw_image.setChecked(false);
    }
    sw_image.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean(getString(R.string.sp_images), true).commit();
                IntentUnit.setSPChange(true);
            } else {
                sp.edit().putBoolean(getString(R.string.sp_images), false).commit();
                IntentUnit.setSPChange(true);
            }
        }
    });
    if (sp.getBoolean(getString(R.string.sp_cookies), true)) {
        sw_cookie.setChecked(true);
    } else {
        sw_cookie.setChecked(false);
    }
    sw_cookie.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean(getString(R.string.sp_cookies), true).commit();
                IntentUnit.setSPChange(true);
            } else {
                sp.edit().putBoolean(getString(R.string.sp_cookies), false).commit();
                IntentUnit.setSPChange(false);
            }
        }
    });
    if (sp.getBoolean("saveHistory", true)) {
        sw_history.setChecked(true);
    } else {
        sw_history.setChecked(false);
    }
    sw_history.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean("saveHistory", true).commit();
            } else {
                sp.edit().putBoolean("saveHistory", false).commit();
            }
        }
    });
    if (!sp.getBoolean(getString(R.string.sp_location), true)) {
        sw_location.setChecked(false);
    } else {
        sw_location.setChecked(true);
    }
    sw_location.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean(getString(R.string.sp_location), true).commit();
                IntentUnit.setSPChange(true);
            } else {
                sp.edit().putBoolean(getString(R.string.sp_location), false).commit();
                IntentUnit.setSPChange(true);
            }
        }
    });
    if (!sp.getBoolean("sp_invert", false)) {
        sw_invert.setChecked(false);
    } else {
        sw_invert.setChecked(true);
    }
    sw_invert.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putBoolean("sp_invert", true).commit();
                initRendering(contentFrame);
            } else {
                sp.edit().putBoolean("sp_invert", false).commit();
                initRendering(contentFrame);
            }
        }
    });
    if ((sp.getString(getString(R.string.sp_user_agent), "0").equals("1"))) {
        sw_desktop.setChecked(true);
    } else {
        sw_desktop.setChecked(false);
    }
    sw_desktop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                sp.edit().putString(getString(R.string.sp_user_agent), "1").commit();
            } else {
                sp.edit().putString(getString(R.string.sp_user_agent), "0").commit();
            }
        }
    });
    final TextView font_text = dialogView.findViewById(R.id.font_text);
    font_text.setText(sp.getString("sp_fontSize", "100"));
    ImageButton font_minus = dialogView.findViewById(R.id.font_minus);
    font_minus.setImageResource(R.drawable.icon_minus);
    font_minus.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (sp.getString("sp_fontSize", "100").equals("100")) {
                Log.i(TAG, "Can not change font size");
            } else if (sp.getString("sp_fontSize", "100").equals("125")) {
                sp.edit().putString("sp_fontSize", "100").commit();
            } else if (sp.getString("sp_fontSize", "100").equals("150")) {
                sp.edit().putString("sp_fontSize", "125").commit();
            } else if (sp.getString("sp_fontSize", "100").equals("175")) {
                sp.edit().putString("sp_fontSize", "150").commit();
            }
            font_text.setText(sp.getString("sp_fontSize", "100"));
        }
    });
    ImageButton font_plus = dialogView.findViewById(R.id.font_plus);
    font_plus.setImageResource(R.drawable.icon_plus);
    font_plus.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (sp.getString("sp_fontSize", "100").equals("100")) {
                sp.edit().putString("sp_fontSize", "125").commit();
            } else if (sp.getString("sp_fontSize", "100").equals("125")) {
                sp.edit().putString("sp_fontSize", "150").commit();
            } else if (sp.getString("sp_fontSize", "100").equals("150")) {
                sp.edit().putString("sp_fontSize", "175").commit();
            } else if (sp.getString("sp_fontSize", "100").equals("175")) {
                Log.i(TAG, "Can not change font size");
            }
            font_text.setText(sp.getString("sp_fontSize", "100"));
        }
    });
    Button but_OK = dialogView.findViewById(R.id.action_ok);
    but_OK.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (ninjaWebView != null) {
                bottomSheetDialog.cancel();
                String url = ninjaWebView.getUrl();
                removeAlbum(currentAlbumController);
                addAlbum(getString(R.string.album_untitled), url, true, null);
            }
        }
    });
    Button action_cancel = dialogView.findViewById(R.id.action_cancel);
    action_cancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            bottomSheetDialog.cancel();
        }
    });
    bottomSheetDialog.setContentView(dialogView);
    bottomSheetDialog.show();
}
Also used : Cookie(de.baumann.browser.Browser.Cookie) AdBlock(de.baumann.browser.Browser.AdBlock) ImageView(android.widget.ImageView) HorizontalScrollView(android.widget.HorizontalScrollView) NinjaWebView(de.baumann.browser.View.NinjaWebView) AutoCompleteTextView(android.widget.AutoCompleteTextView) DynamicGridView(org.askerov.dynamicgrid.DynamicGridView) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) ImageButton(android.widget.ImageButton) FloatingActionButton(android.support.design.widget.FloatingActionButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) CheckBox(android.widget.CheckBox) Javascript(de.baumann.browser.Browser.Javascript) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Aggregations

NinjaWebView (de.baumann.browser.View.NinjaWebView)12 Paint (android.graphics.Paint)7 View (android.view.View)7 WebView (android.webkit.WebView)7 AdapterView (android.widget.AdapterView)7 AutoCompleteTextView (android.widget.AutoCompleteTextView)7 HorizontalScrollView (android.widget.HorizontalScrollView)7 ImageView (android.widget.ImageView)7 ListView (android.widget.ListView)7 TextView (android.widget.TextView)7 VideoView (android.widget.VideoView)7 DynamicGridView (org.askerov.dynamicgrid.DynamicGridView)7 AlbumController (de.baumann.browser.Browser.AlbumController)4 Intent (android.content.Intent)3 PendingIntent (android.app.PendingIntent)2 DialogInterface (android.content.DialogInterface)2 BottomSheetDialog (android.support.design.widget.BottomSheetDialog)2 AlertDialog (android.support.v7.app.AlertDialog)2 KeyEvent (android.view.KeyEvent)2 EditText (android.widget.EditText)2