Search in sources :

Example 6 with NinjaRelativeLayout

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

the class HolderActivity method showHolderDialog.

private void showHolderDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(new NinjaContextWrapper(this));
    builder.setCancelable(true);
    @SuppressLint("InflateParams") NinjaRelativeLayout linearLayout = (NinjaRelativeLayout) getLayoutInflater().inflate(R.layout.main_home, null, false);
    builder.setView(linearLayout);
    String[] strings = getResources().getStringArray(R.array.holder_menu);
    List<String> list = new ArrayList<>();
    list.addAll(Arrays.asList(strings));
    ListView listView = linearLayout.findViewById(R.id.home_list);
    DialogAdapter adapter = new DialogAdapter(this, list);
    listView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    final AlertDialog dialog = builder.create();
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            HolderActivity.this.finish();
        }
    });
    dialog.show();
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            switch(position) {
                case 0:
                    Intent toActivity = new Intent(HolderActivity.this, BrowserActivity.class);
                    toActivity.putExtra(IntentUnit.OPEN, first.getURL());
                    startActivity(toActivity);
                    break;
                case 1:
                    BrowserUnit.copyURL(HolderActivity.this, first.getURL());
                    break;
                case 2:
                    IntentUnit.share(HolderActivity.this, first.getTitle(), first.getURL());
                    break;
                default:
                    break;
            }
            dialog.hide();
            dialog.dismiss();
            finish();
        }
    });
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) NinjaContextWrapper(de.baumann.browser.View.NinjaContextWrapper) ListView(android.widget.ListView) NinjaRelativeLayout(de.baumann.browser.View.NinjaRelativeLayout) SuppressLint(android.annotation.SuppressLint) AdapterView(android.widget.AdapterView) DialogAdapter(de.baumann.browser.View.DialogAdapter)

Aggregations

NinjaRelativeLayout (de.baumann.browser.View.NinjaRelativeLayout)6 DynamicGridView (org.askerov.dynamicgrid.DynamicGridView)5 View (android.view.View)4 AdapterView (android.widget.AdapterView)4 ListView (android.widget.ListView)4 Intent (android.content.Intent)3 WebView (android.webkit.WebView)3 AutoCompleteTextView (android.widget.AutoCompleteTextView)3 HorizontalScrollView (android.widget.HorizontalScrollView)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 VideoView (android.widget.VideoView)3 AlbumController (de.baumann.browser.Browser.AlbumController)3 NinjaWebView (de.baumann.browser.View.NinjaWebView)3 PendingIntent (android.app.PendingIntent)2 DialogInterface (android.content.DialogInterface)2 SuppressLint (android.annotation.SuppressLint)1 AlertDialog (android.app.AlertDialog)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1