Search in sources :

Example 1 with Pass

use of de.baumann.browser.Database.Pass in project browser by scoute-dich.

the class BrowserActivity method initPSList.

private void initPSList(final NinjaRelativeLayout layout) {
    final Pass db = new Pass(this);
    db.open();
    final int layoutstyle = R.layout.list_item;
    int[] xml_id = new int[] { R.id.record_item_title, R.id.record_item_url, R.id.record_item_time };
    String[] column = new String[] { "pass_title", "pass_content", "pass_creation" };
    final Cursor row = db.fetchAllData();
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, layoutstyle, row, column, xml_id, 0) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View v = super.getView(position, convertView, parent);
            try {
                Cursor row = (Cursor) listView.getItemAtPosition(position);
                String pass_creation = row.getString(row.getColumnIndexOrThrow("pass_creation"));
                TextView tv = v.findViewById(R.id.record_item_time);
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
                tv.setText(sdf.format(Long.parseLong(pass_creation)));
            } catch (Exception e) {
                initPSList(layout);
                NinjaToast.show(BrowserActivity.this, R.string.toast_error);
            }
            return v;
        }
    };
    listView = layout.findViewById(R.id.home_list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterview, View view, int position, long id) {
            final String pass_content = row.getString(row.getColumnIndexOrThrow("pass_content"));
            final String pass_icon = row.getString(row.getColumnIndexOrThrow("pass_icon"));
            final String pass_attachment = row.getString(row.getColumnIndexOrThrow("pass_attachment"));
            updateAlbum(pass_content);
            toast_login(pass_icon, pass_attachment);
        }
    });
    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            Cursor row = (Cursor) listView.getItemAtPosition(position);
            final String _id = row.getString(row.getColumnIndexOrThrow("_id"));
            final String pass_title = row.getString(row.getColumnIndexOrThrow("pass_title"));
            final String pass_content = row.getString(row.getColumnIndexOrThrow("pass_content"));
            final String pass_icon = row.getString(row.getColumnIndexOrThrow("pass_icon"));
            final String pass_attachment = row.getString(row.getColumnIndexOrThrow("pass_attachment"));
            bottomSheetDialog = new BottomSheetDialog(BrowserActivity.this);
            View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_menu_context, null);
            tv2_menu_newTab = dialogView.findViewById(R.id.tv2_menu_newTab);
            tv2_menu_newTab.setVisibility(View.VISIBLE);
            tv2_menu_newTab.setOnClickListener(new View.OnClickListener() {

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

                @Override
                public void onClick(View v) {
                    bottomSheetDialog.cancel();
                    pinAlbums(pass_content);
                    toast_login(pass_icon, pass_attachment);
                }
            });
            tv2_menu_notification = dialogView.findViewById(R.id.tv2_menu_notification);
            tv2_menu_notification.setVisibility(View.VISIBLE);
            tv2_menu_notification.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bottomSheetDialog.cancel();
                    toast_login(pass_icon, pass_attachment);
                }
            });
            tv2_menu_edit = dialogView.findViewById(R.id.tv2_menu_edit);
            tv2_menu_edit.setVisibility(View.VISIBLE);
            tv2_menu_edit.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bottomSheetDialog.cancel();
                    try {
                        AlertDialog.Builder builder = new AlertDialog.Builder(BrowserActivity.this);
                        View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_login, null);
                        final EditText pass_titleET = dialogView.findViewById(R.id.pass_title);
                        final EditText pass_userNameET = dialogView.findViewById(R.id.pass_userName);
                        final EditText pass_userPWET = dialogView.findViewById(R.id.pass_userPW);
                        final String decrypted_userName = mahEncryptor.decode(pass_icon);
                        final String decrypted_userPW = mahEncryptor.decode(pass_attachment);
                        pass_titleET.setText(pass_title);
                        pass_userNameET.setText(decrypted_userName);
                        pass_userPWET.setText(decrypted_userPW);
                        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) {
                                try {
                                    String input_pass_title = pass_titleET.getText().toString().trim();
                                    String encrypted_userName = mahEncryptor.encode(pass_userNameET.getText().toString().trim());
                                    String encrypted_userPW = mahEncryptor.encode(pass_userPWET.getText().toString().trim());
                                    db.update(Integer.parseInt(_id), helper_main.secString(input_pass_title), helper_main.secString(pass_content), helper_main.secString(encrypted_userName), helper_main.secString(encrypted_userPW), String.valueOf(System.currentTimeMillis()));
                                    initPSList(layout);
                                    hideSoftInput(pass_titleET);
                                    NinjaToast.show(BrowserActivity.this, R.string.toast_edit_successful);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    NinjaToast.show(BrowserActivity.this, R.string.toast_error);
                                }
                            }
                        });
                        builder.setNegativeButton(R.string.app_cancel, new DialogInterface.OnClickListener() {

                            public void onClick(DialogInterface dialog, int whichButton) {
                                dialog.cancel();
                                hideSoftInput(pass_titleET);
                            }
                        });
                        final AlertDialog dialog = builder.create();
                        dialog.show();
                        showSoftInput(pass_titleET);
                    } catch (Exception e) {
                        e.printStackTrace();
                        NinjaToast.show(BrowserActivity.this, R.string.toast_error);
                    }
                }
            });
            tv2_menu_delete = dialogView.findViewById(R.id.tv2_menu_delete);
            tv2_menu_delete.setVisibility(View.VISIBLE);
            tv2_menu_delete.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    bottomSheetDialog.cancel();
                    bottomSheetDialog = new BottomSheetDialog(BrowserActivity.this);
                    View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_action, null);
                    TextView textView = dialogView.findViewById(R.id.dialog_text);
                    textView.setText(R.string.toast_titleConfirm_delete);
                    Button action_ok = dialogView.findViewById(R.id.action_ok);
                    action_ok.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View view) {
                            db.delete(Integer.parseInt(_id));
                            initPSList(layout);
                            bottomSheetDialog.cancel();
                        }
                    });
                    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();
                }
            });
            bottomSheetDialog.setContentView(dialogView);
            bottomSheetDialog.show();
            return true;
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) Cursor(android.database.Cursor) Pass(de.baumann.browser.Database.Pass) FloatingActionButton(android.support.design.widget.FloatingActionButton) ImageButton(android.widget.ImageButton) Button(android.widget.Button) CompoundButton(android.widget.CompoundButton) SimpleCursorAdapter(android.widget.SimpleCursorAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) EditText(android.widget.EditText) ViewGroup(android.view.ViewGroup) 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) Paint(android.graphics.Paint) BottomSheetDialog(android.support.design.widget.BottomSheetDialog) AdapterView(android.widget.AdapterView) SimpleDateFormat(java.text.SimpleDateFormat)

Example 2 with Pass

use of de.baumann.browser.Database.Pass in project browser by scoute-dich.

the class BrowserActivity method onClick.

@Override
public void onClick(View v) {
    RecordAction action = new RecordAction(BrowserActivity.this);
    if (currentAlbumController != null && currentAlbumController instanceof NinjaRelativeLayout) {
        ninjaRelativeLayout = (NinjaRelativeLayout) currentAlbumController;
    } else if (currentAlbumController != null && currentAlbumController instanceof NinjaWebView) {
        ninjaWebView = (NinjaWebView) currentAlbumController;
        try {
            title = ninjaWebView.getTitle().trim();
            url = ninjaWebView.getUrl().trim();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    switch(v.getId()) {
        case R.id.tab_prev:
            AlbumController controller = nextAlbumController(false);
            showAlbum(controller, false);
            viewOverflow();
            break;
        case R.id.tab_next:
            AlbumController controller2 = nextAlbumController(true);
            showAlbum(controller2, false);
            viewOverflow();
            break;
        case R.id.web_prev:
            if (ninjaWebView.canGoBack()) {
                ninjaWebView.goBack();
                viewOverflow();
            } else {
                bottomSheetDialog.cancel();
                removeAlbum(currentAlbumController);
            }
            break;
        case R.id.web_next:
            if (ninjaWebView.canGoForward()) {
                ninjaWebView.goForward();
                viewOverflow();
            } else {
                bottomSheetDialog.cancel();
                NinjaToast.show(BrowserActivity.this, R.string.toast_webview_forward);
            }
            break;
        case R.id.tv_new_tabOpen:
            bottomSheetDialog.cancel();
            addAlbum(start_tab);
            break;
        case R.id.tv_closeTab:
            bottomSheetDialog.cancel();
            removeAlbum(currentAlbumController);
            break;
        case R.id.tv_tabPreview:
            bottomSheetDialog.cancel();
            showOmnibox();
            new Handler().postDelayed(new Runnable() {

                public void run() {
                    switcherPanel.collapsed();
                }
            }, 500);
            break;
        case R.id.tv_quit:
            bottomSheetDialog.cancel();
            doubleTapsQuit();
            break;
        case R.id.tv_shareScreenshot:
            bottomSheetDialog.cancel();
            sp.edit().putInt("screenshot", 1).apply();
            new ScreenshotTask(BrowserActivity.this, ninjaWebView).execute();
            break;
        case R.id.tv_shareLink:
            bottomSheetDialog.cancel();
            if (prepareRecord()) {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_share_failed));
            } else {
                IntentUnit.share(BrowserActivity.this, title, url);
            }
            break;
        case R.id.tv_shareClipboard:
            bottomSheetDialog.cancel();
            BrowserUnit.copyURL(BrowserActivity.this, url);
            break;
        case R.id.tv_openWith:
            bottomSheetDialog.cancel();
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(url));
            Intent chooser = Intent.createChooser(intent, getString(R.string.menu_open_with));
            startActivity(chooser);
            break;
        case R.id.tv_saveScreenshot:
            bottomSheetDialog.cancel();
            sp.edit().putInt("screenshot", 0).apply();
            new ScreenshotTask(BrowserActivity.this, ninjaWebView).execute();
            break;
        case R.id.tv_saveBookmark:
            bottomSheetDialog.cancel();
            action.open(true);
            if (action.checkBookmark(url)) {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_entry_exists));
            } else {
                action.addBookmark(new Record(title, url, System.currentTimeMillis()));
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_add_bookmark_successful));
            }
            action.close();
            updateBookmarks();
            updateAutoComplete();
            break;
        case R.id.tv_saveStart:
            bottomSheetDialog.cancel();
            action.open(true);
            if (action.checkGridItem(url)) {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_already_exist_in_home));
            } else {
                Bitmap bitmap = ViewUnit.capture(ninjaWebView, dimen156dp, dimen117dp, Bitmap.Config.ARGB_8888);
                String filename = System.currentTimeMillis() + BrowserUnit.SUFFIX_PNG;
                int ordinal = action.listGrid().size();
                GridItem itemAlbum = new GridItem(title, url, filename, ordinal);
                if (BrowserUnit.bitmap2File(BrowserActivity.this, bitmap, filename) && action.addGridItem(itemAlbum)) {
                    NinjaToast.show(BrowserActivity.this, getString(R.string.toast_add_to_home_successful));
                } else {
                    NinjaToast.show(BrowserActivity.this, getString(R.string.toast_add_to_home_failed));
                }
            }
            action.close();
            break;
        case R.id.tv_saveLogin:
            bottomSheetDialog.cancel();
            AlertDialog.Builder builder = new AlertDialog.Builder(BrowserActivity.this);
            View dialogView = View.inflate(BrowserActivity.this, R.layout.dialog_login, null);
            final EditText pass_title = dialogView.findViewById(R.id.pass_title);
            final EditText pass_userName = dialogView.findViewById(R.id.pass_userName);
            final EditText pass_userPW = dialogView.findViewById(R.id.pass_userPW);
            new Handler().postDelayed(new Runnable() {

                public void run() {
                    pass_title.setText(ninjaWebView.getTitle());
                    showSoftInput(pass_title);
                }
            }, 100);
            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 input_pass_title = pass_title.getText().toString().trim();
                    try {
                        MAHEncryptor mahEncryptor = MAHEncryptor.newInstance(sp.getString("saved_key", ""));
                        String encrypted_userName = mahEncryptor.encode(pass_userName.getText().toString().trim());
                        String encrypted_userPW = mahEncryptor.encode(pass_userPW.getText().toString().trim());
                        Pass db = new Pass(BrowserActivity.this);
                        db.open();
                        if (db.isExist(helper_main.secString(input_pass_title))) {
                            NinjaToast.show(BrowserActivity.this, R.string.toast_newTitle);
                        } else {
                            db.insert(input_pass_title, url, encrypted_userName, helper_main.secString(encrypted_userPW), String.valueOf(System.currentTimeMillis()));
                            NinjaToast.show(BrowserActivity.this, R.string.toast_edit_successful);
                            hideSoftInput(pass_title);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        NinjaToast.show(BrowserActivity.this, R.string.toast_error);
                    }
                }
            });
            builder.setNegativeButton(R.string.app_cancel, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.cancel();
                }
            });
            AlertDialog dialog = builder.create();
            dialog.show();
            break;
        case R.id.tv_relayout:
            bottomSheetDialog.cancel();
            omnibox.setVisibility(View.GONE);
            relayoutOK.setVisibility(View.VISIBLE);
            final DynamicGridView gridView = ninjaRelativeLayout.findViewById(R.id.home_grid);
            final List<GridItem> gridList = ((GridAdapter) gridView.getAdapter()).getList();
            relayoutOK.setOnTouchListener(new View.OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    relayoutOK.setTextColor(ContextCompat.getColor(BrowserActivity.this, (R.color.colorAccent)));
                    return false;
                }
            });
            relayoutOK.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    gridView.stopEditMode();
                    relayoutOK.setVisibility(View.GONE);
                    omnibox.setVisibility(View.VISIBLE);
                    RecordAction action = new RecordAction(BrowserActivity.this);
                    action.open(true);
                    action.clearGrid();
                    for (GridItem item : gridList) {
                        action.addGridItem(item);
                    }
                    action.close();
                    NinjaToast.show(BrowserActivity.this, getString(R.string.toast_relayout_successful));
                }
            });
            gridView.setOnDragListener(new DynamicGridView.OnDragListener() {

                private GridItem dragItem;

                @Override
                public void onDragStarted(int position) {
                    dragItem = gridList.get(position);
                }

                @Override
                public void onDragPositionsChanged(int oldPosition, int newPosition) {
                    if (oldPosition < newPosition) {
                        for (int i = newPosition; i > oldPosition; i--) {
                            GridItem item = gridList.get(i);
                            item.setOrdinal(i - 1);
                        }
                    } else if (oldPosition > newPosition) {
                        for (int i = newPosition; i < oldPosition; i++) {
                            GridItem item = gridList.get(i);
                            item.setOrdinal(i + 1);
                        }
                    }
                    dragItem.setOrdinal(newPosition);
                    Collections.sort(gridList, new Comparator<GridItem>() {

                        @Override
                        public int compare(GridItem first, GridItem second) {
                            if (first.getOrdinal() < second.getOrdinal()) {
                                return -1;
                            } else if (first.getOrdinal() > second.getOrdinal()) {
                                return 1;
                            } else {
                                return 0;
                            }
                        }
                    });
                }
            });
            gridView.startEditMode();
            break;
        case R.id.tv_searchSite:
            bottomSheetDialog.cancel();
            hideSoftInput(inputBox);
            showSearchPanel();
            break;
        case R.id.tv_settings:
            bottomSheetDialog.cancel();
            Intent settings = new Intent(BrowserActivity.this, Settings_Activity.class);
            startActivity(settings);
            break;
        case R.id.tv_help:
            bottomSheetDialog.cancel();
            showHelpDialog();
            break;
        case R.id.floatButton_tab:
            tv_new_tabOpen.setVisibility(View.VISIBLE);
            tv_closeTab.setVisibility(View.VISIBLE);
            tv_tabPreview.setVisibility(View.VISIBLE);
            tv_quit.setVisibility(View.VISIBLE);
            tv_shareScreenshot.setVisibility(View.GONE);
            tv_shareLink.setVisibility(View.GONE);
            tv_shareClipboard.setVisibility(View.GONE);
            tv_openWith.setVisibility(View.GONE);
            tv_saveScreenshot.setVisibility(View.GONE);
            tv_saveBookmark.setVisibility(View.GONE);
            tv_saveStart.setVisibility(View.GONE);
            tv_saveLogin.setVisibility(View.GONE);
            floatButton_tabView.setVisibility(View.VISIBLE);
            floatButton_saveView.setVisibility(View.INVISIBLE);
            floatButton_shareView.setVisibility(View.INVISIBLE);
            floatButton_moreView.setVisibility(View.INVISIBLE);
            tv_relayout.setVisibility(View.GONE);
            tv_searchSite.setVisibility(View.GONE);
            tv_placeHolder.setVisibility(View.GONE);
            tv_placeHolder_2.setVisibility(View.GONE);
            tv_settings.setVisibility(View.GONE);
            tv_help.setVisibility(View.GONE);
            break;
        case R.id.floatButton_share:
            tv_new_tabOpen.setVisibility(View.GONE);
            tv_closeTab.setVisibility(View.GONE);
            tv_tabPreview.setVisibility(View.GONE);
            tv_quit.setVisibility(View.GONE);
            tv_shareScreenshot.setVisibility(View.VISIBLE);
            tv_shareLink.setVisibility(View.VISIBLE);
            tv_shareClipboard.setVisibility(View.VISIBLE);
            tv_openWith.setVisibility(View.VISIBLE);
            tv_saveScreenshot.setVisibility(View.GONE);
            tv_saveBookmark.setVisibility(View.GONE);
            tv_saveStart.setVisibility(View.GONE);
            tv_saveLogin.setVisibility(View.GONE);
            floatButton_tabView.setVisibility(View.INVISIBLE);
            floatButton_saveView.setVisibility(View.INVISIBLE);
            floatButton_shareView.setVisibility(View.VISIBLE);
            floatButton_moreView.setVisibility(View.INVISIBLE);
            tv_relayout.setVisibility(View.GONE);
            tv_searchSite.setVisibility(View.GONE);
            tv_placeHolder.setVisibility(View.GONE);
            tv_placeHolder_2.setVisibility(View.GONE);
            tv_settings.setVisibility(View.GONE);
            tv_help.setVisibility(View.GONE);
            break;
        case R.id.floatButton_save:
            tv_new_tabOpen.setVisibility(View.GONE);
            tv_closeTab.setVisibility(View.GONE);
            tv_tabPreview.setVisibility(View.GONE);
            tv_quit.setVisibility(View.GONE);
            tv_shareScreenshot.setVisibility(View.GONE);
            tv_shareLink.setVisibility(View.GONE);
            tv_shareClipboard.setVisibility(View.GONE);
            tv_openWith.setVisibility(View.GONE);
            tv_saveScreenshot.setVisibility(View.VISIBLE);
            tv_saveBookmark.setVisibility(View.VISIBLE);
            tv_saveStart.setVisibility(View.VISIBLE);
            tv_saveLogin.setVisibility(View.VISIBLE);
            tv_relayout.setVisibility(View.GONE);
            tv_searchSite.setVisibility(View.GONE);
            floatButton_tabView.setVisibility(View.INVISIBLE);
            floatButton_saveView.setVisibility(View.VISIBLE);
            floatButton_shareView.setVisibility(View.INVISIBLE);
            floatButton_moreView.setVisibility(View.INVISIBLE);
            tv_placeHolder.setVisibility(View.GONE);
            tv_placeHolder_2.setVisibility(View.GONE);
            tv_settings.setVisibility(View.GONE);
            tv_help.setVisibility(View.GONE);
            break;
        case R.id.floatButton_more:
            tv_new_tabOpen.setVisibility(View.GONE);
            tv_closeTab.setVisibility(View.GONE);
            tv_tabPreview.setVisibility(View.GONE);
            tv_quit.setVisibility(View.GONE);
            tv_shareScreenshot.setVisibility(View.GONE);
            tv_shareLink.setVisibility(View.GONE);
            tv_shareClipboard.setVisibility(View.GONE);
            tv_openWith.setVisibility(View.GONE);
            tv_saveScreenshot.setVisibility(View.GONE);
            tv_saveBookmark.setVisibility(View.GONE);
            tv_saveStart.setVisibility(View.GONE);
            tv_saveLogin.setVisibility(View.GONE);
            floatButton_tabView.setVisibility(View.INVISIBLE);
            floatButton_saveView.setVisibility(View.INVISIBLE);
            floatButton_shareView.setVisibility(View.INVISIBLE);
            floatButton_moreView.setVisibility(View.VISIBLE);
            tv_placeHolder.setVisibility(View.VISIBLE);
            tv_settings.setVisibility(View.VISIBLE);
            tv_help.setVisibility(View.VISIBLE);
            if (currentAlbumController != null && currentAlbumController instanceof NinjaRelativeLayout) {
                tv_searchSite.setVisibility(View.GONE);
                if (ninjaRelativeLayout.getFlag() == BrowserUnit.FLAG_HOME) {
                    tv_relayout.setVisibility(View.VISIBLE);
                    tv_placeHolder_2.setVisibility(View.GONE);
                } else {
                    tv_relayout.setVisibility(View.GONE);
                    tv_placeHolder_2.setVisibility(View.VISIBLE);
                }
            } else if (currentAlbumController != null && currentAlbumController instanceof NinjaWebView) {
                tv_searchSite.setVisibility(View.VISIBLE);
                tv_relayout.setVisibility(View.GONE);
                tv_placeHolder_2.setVisibility(View.GONE);
            }
            break;
        case R.id.fab_imageButtonNav_center:
        case R.id.fab_imageButtonNav_left:
        case R.id.fab_imageButtonNav_right:
            doubleTapsHide();
            break;
        case R.id.omnibox_refresh:
            if (currentAlbumController == null) {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_refresh_failed));
                return;
            }
            if (currentAlbumController instanceof NinjaWebView) {
                ninjaWebView = (NinjaWebView) currentAlbumController;
                if (ninjaWebView.isLoadFinish()) {
                    ninjaWebView.reload();
                } else {
                    ninjaWebView.stopLoading();
                }
            } else if (currentAlbumController instanceof NinjaRelativeLayout) {
                ninjaRelativeLayout = (NinjaRelativeLayout) currentAlbumController;
                initHomeGrid(ninjaRelativeLayout);
            } else {
                NinjaToast.show(BrowserActivity.this, getString(R.string.toast_refresh_failed));
            }
            break;
        case R.id.omnibox_overflow:
            showOverflow();
            break;
        default:
            break;
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) ScreenshotTask(de.baumann.browser.Task.ScreenshotTask) DialogInterface(android.content.DialogInterface) NinjaWebView(de.baumann.browser.View.NinjaWebView) GridAdapter(de.baumann.browser.View.GridAdapter) Comparator(java.util.Comparator) Bitmap(android.graphics.Bitmap) GridItem(de.baumann.browser.View.GridItem) Pass(de.baumann.browser.Database.Pass) Record(de.baumann.browser.Database.Record) Adapter_Record(de.baumann.browser.View.Adapter_Record) AlbumController(de.baumann.browser.Browser.AlbumController) EditText(android.widget.EditText) Handler(android.os.Handler) 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) Paint(android.graphics.Paint) MotionEvent(android.view.MotionEvent) NinjaRelativeLayout(de.baumann.browser.View.NinjaRelativeLayout) DynamicGridView(org.askerov.dynamicgrid.DynamicGridView) RecordAction(de.baumann.browser.Database.RecordAction) MAHEncryptor(com.mobapphome.mahencryptorlib.MAHEncryptor)

Aggregations

DialogInterface (android.content.DialogInterface)2 Paint (android.graphics.Paint)2 AlertDialog (android.support.v7.app.AlertDialog)2 View (android.view.View)2 WebView (android.webkit.WebView)2 AdapterView (android.widget.AdapterView)2 AutoCompleteTextView (android.widget.AutoCompleteTextView)2 EditText (android.widget.EditText)2 HorizontalScrollView (android.widget.HorizontalScrollView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 TextView (android.widget.TextView)2 VideoView (android.widget.VideoView)2 Pass (de.baumann.browser.Database.Pass)2 NinjaWebView (de.baumann.browser.View.NinjaWebView)2 DynamicGridView (org.askerov.dynamicgrid.DynamicGridView)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 Cursor (android.database.Cursor)1 Bitmap (android.graphics.Bitmap)1