Home Package Class Method

Examples of Dialog


Examples of android.app.Dialog

            return true;
        }

        switch (item.getItemId()) {
        case R.id.headlines_toggle_sort_order:
            Dialog dialog = new Dialog(this);

            String sortMode = getSortMode();

            int selectedIndex = 0;

            if (sortMode.equals("feed_dates")) {
                selectedIndex = 1;
            } else if (sortMode.equals("date_reverse")) {
                selectedIndex = 2;
            } else if (sortMode.equals("title")) {
                selectedIndex = 3;
            }

            AlertDialog.Builder builder = new AlertDialog.Builder(this)
                    .setTitle(getString(R.string.headlines_sort_articles_title))
                    .setSingleChoiceItems(
                            new String[] {
                                    getString(R.string.headlines_sort_default),
                                    getString(R.string.headlines_sort_newest_first),
                                    getString(R.string.headlines_sort_oldest_first),
                                    getString(R.string.headlines_sort_title)
                            },
                            selectedIndex, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog,
                                                    int which) {
                                    switch (which) {
                                        case 0:
                                            setSortMode("default");
                                            break;
                                        case 1:
                                            setSortMode("feed_dates");
                                            break;
                                        case 2:
                                            setSortMode("date_reverse");
                                            break;
                                        case 3:
                                            setSortMode("title");
                                            break;
                                    }
                                    dialog.cancel();

                                    refresh();
                                }
                            });

            dialog = builder.create();
            dialog.show();

            return true;
        case R.id.show_feeds:
      setUnreadOnly(!getUnreadOnly());
      invalidateOptionsMenu();
View Full Code Here

Examples of android.app.Dialog

                });
                b.show();
                return true;
            }
            case R.id.about: {
                Dialog d = new Dialog(this);
                d.setTitle(R.string.aboutTitle);
                d.setCancelable(true);
                d.setContentView(R.layout.about_dialog);
                d.show();
            }
                return true;
            case R.id.quit:
                if ( mGLView != null )
                mGLView.disconnect();
View Full Code Here

Examples of android.app.Dialog

                // the wrong text if an image is used multiple times.
                Document doc = Jsoup.parse(ap.getSelectedArticle().content);
                Elements es = doc.getElementsByAttributeValue("src", getLastContentImageHitTestUrl());
                if (es.size() > 0){
                    if (es.get(0).hasAttr("title")){
                        Dialog dia = new Dialog(this);
                        if (es.get(0).hasAttr("alt")){
                            dia.setTitle(es.get(0).attr("alt"));
                        } else {
                            dia.setTitle(es.get(0).attr("title"));
                        }
                        TextView titleText = new TextView(this);
                       
                        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
                          titleText.setPaddingRelative(24, 24, 24, 24);
                        } else {
                          titleText.setPadding(24, 24, 24, 24);
                        }
                       
                        titleText.setTextSize(16);
                        titleText.setText(es.get(0).attr("title"));
                        dia.setContentView(titleText);
                        dia.show();
                    } else {
                        toast(R.string.no_caption_to_display);
                    }
                } else {
                    toast(R.string.no_caption_to_display);
View Full Code Here

Examples of android.app.Dialog

              article.attachments.get(i).content_url;
           
            itemUrls[i] = article.attachments.get(i).content_url;
          }

          Dialog dialog = new Dialog(OnlineActivity.this);
          AlertDialog.Builder builder = new AlertDialog.Builder(OnlineActivity.this)
              .setTitle(R.string.attachments_prompt)
              .setCancelable(true)
              .setSingleChoiceItems(items, 0, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  //
                }
              }).setNeutralButton(R.string.attachment_copy, new OnClickListener() {               
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  int selectedPosition = ((AlertDialog)dialog).getListView().getCheckedItemPosition();
                 
                  copyToClipboard((String)itemUrls[selectedPosition]);
                }
              }).setPositiveButton(R.string.attachment_view, new OnClickListener() {
               
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  int selectedPosition = ((AlertDialog)dialog).getListView().getCheckedItemPosition();
                 
                  Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse((String)itemUrls[selectedPosition]));
                  startActivity(browserIntent);

                  dialog.cancel();
                }
              }).setNegativeButton(R.string.dialog_cancel, new OnClickListener() {
               
                @Override
                public void onClick(DialogInterface dialog, int id) {
                  dialog.cancel();
                }
              });

          dialog = builder.create();
          dialog.show();
        }
      }
      return true;
    case R.id.donate:
      if (true) {
        openUnlockUrl();
      }
      return true;
    case R.id.logout:
      logout();
      return true;
    case R.id.login:
      login();
      return true;
    case R.id.go_offline:
      switchOffline();
      return true;
    case R.id.article_set_note:
      if (ap != null && ap.getSelectedArticle() != null) {
        editArticleNote(ap.getSelectedArticle());       
      }
      return true;
    case R.id.preferences:
      Intent intent = new Intent(OnlineActivity.this,
          PreferencesActivity.class);
      startActivityForResult(intent, 0);
      return true;
    case R.id.search:     
      if (hf != null) {
        Dialog dialog = new Dialog(this);

        final EditText edit = new EditText(this);

        AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(R.string.search)
            .setPositiveButton(getString(R.string.search),
                new OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                   
                    String query = edit.getText().toString().trim();
                   
                    hf.setSearchQuery(query);

                  }
                })
            .setNegativeButton(getString(R.string.cancel),
                new OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                   
                    //

                  }
                }).setView(edit);
       
        dialog = builder.create();
        dialog.show();
      }
      return true;
    case R.id.headlines_mark_as_read:
      if (hf != null) {
       
        int count = hf.getUnreadArticles().size();
       
        boolean confirm = m_prefs.getBoolean("confirm_headlines_catchup", true);
       
        if (count > 0) {
          if (confirm) {
            AlertDialog.Builder builder = new AlertDialog.Builder(
                OnlineActivity.this)
                .setMessage(getResources().getQuantityString(R.plurals.mark_num_headlines_as_read, count, count))
                .setPositiveButton(R.string.catchup,
                    new Dialog.OnClickListener() {
                      public void onClick(DialogInterface dialog,
                          int which) {
 
                        catchupVisibleArticles();                     
                       
                      }
                    })
                .setNegativeButton(R.string.dialog_cancel,
                    new Dialog.OnClickListener() {
                      public void onClick(DialogInterface dialog,
                          int which) {
   
                      }
                    });
   
            AlertDialog dlg = builder.create();
            dlg.show();
          } else {
            catchupVisibleArticles();
          }
        }
      }
      return true;
    case R.id.headlines_view_mode:
      if (hf != null) {
        Dialog dialog = new Dialog(this);
       
        String viewMode = getViewMode();
       
        //Log.d(TAG, "viewMode:" + getViewMode());

        int selectedIndex = 0;
       
        if (viewMode.equals("all_articles")) {
          selectedIndex = 1;
        } else if (viewMode.equals("marked")) {
          selectedIndex = 2;
        } else if (viewMode.equals("published")) {
          selectedIndex = 3;
        } else if (viewMode.equals("unread")) {
          selectedIndex = 4;
        }
       
        AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(R.string.headlines_set_view_mode)
            .setSingleChoiceItems(
                new String[] {
                    getString(R.string.headlines_adaptive),
                    getString(R.string.headlines_all_articles),
                    getString(R.string.headlines_starred),
                    getString(R.string.headlines_published),
                    getString(R.string.headlines_unread) },
                selectedIndex, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                    switch (which) {
                    case 0:
                      setViewMode("adaptive");
                      break;
                    case 1:
                      setViewMode("all_articles");
                      break;
                    case 2:
                      setViewMode("marked");
                      break;
                    case 3:
                      setViewMode("published");
                      break;
                    case 4:
                      setViewMode("unread");
                      break;
                    }
                    dialog.cancel();

                    refresh();
                  }
                });

        dialog = builder.create();
        dialog.show();

      }
      return true;
    case R.id.headlines_select:
      if (hf != null) {
        Dialog dialog = new Dialog(this);
        AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(R.string.headlines_select_dialog)
            .setSingleChoiceItems(
                new String[] {
                    getString(R.string.headlines_select_all),
                    getString(R.string.headlines_select_unread),
                    getString(R.string.headlines_select_none) },
                0, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                    switch (which) {
                    case 0:
                      hf.setSelection(HeadlinesFragment.ArticlesSelection.ALL);
                      break;
                    case 1:
                      hf.setSelection(HeadlinesFragment.ArticlesSelection.UNREAD);
                      break;
                    case 2:
                      hf.setSelection(HeadlinesFragment.ArticlesSelection.NONE);
                      break;
                    }
                    dialog.cancel();
                    invalidateOptionsMenu();
                  }
                });

        dialog = builder.create();
        dialog.show();
      }
      return true;
    case R.id.share_article:
      if (ap != null) {
        shareArticle(ap.getSelectedArticle());
View Full Code Here

Examples of android.app.Dialog

            items[i] = labels.get(i).caption;
            itemIds[i] = labels.get(i).id;
            checkedItems[i] = labels.get(i).checked;
          }
         
          Dialog dialog = new Dialog(OnlineActivity.this);
          AlertDialog.Builder builder = new AlertDialog.Builder(OnlineActivity.this)
              .setTitle(R.string.article_set_labels)
              .setMultiChoiceItems(items, checkedItems, new OnMultiChoiceClickListener() {
               
                @Override
                public void onClick(DialogInterface dialog, int which, final boolean isChecked) {
                  final int labelId = itemIds[which];
                 
                  @SuppressWarnings("serial")
                  HashMap<String, String> map = new HashMap<String, String>() {
                    {
                      put("sid", getSessionId());
                      put("op", "setArticleLabel");
                      put("label_id", String.valueOf(labelId));
                      put("article_ids", String.valueOf(articleId));
                      if (isChecked) put("assign", "true");
                    }
                  };
                 
                  ApiRequest req = new ApiRequest(m_context);
                  req.execute(map);
                 
                }
              }).setPositiveButton(R.string.dialog_close, new OnClickListener() {
               
                @Override
                public void onClick(DialogInterface dialog, int which) {
                  dialog.cancel();
                }
              });

          dialog = builder.create();
          dialog.show();

        }
      }
    };
   
View Full Code Here

Examples of android.app.Dialog

            /* SharedPreferences.Editor editor = m_prefs.edit();
            editor.putBoolean("offline_oldest_first", !m_prefs.getBoolean("offline_oldest_first", false));
            editor.commit();
            refresh(); */

            Dialog dialog = new Dialog(this);

            int selectedIndex = m_prefs.getBoolean("offline_oldest_first", false) ? 1 : 0;

            AlertDialog.Builder builder = new AlertDialog.Builder(this)
                    .setTitle(getString(R.string.headlines_sort_articles_title))
                    .setSingleChoiceItems(
                            new String[] {
                                    getString(R.string.headlines_sort_default),
                                    getString(R.string.headlines_sort_oldest_first)
                            },
                            selectedIndex, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog,
                                                    int which) {
                                    switch (which) {
                                        case 0:
                                            if (true) {
                                                SharedPreferences.Editor editor = m_prefs.edit();
                                                editor.putBoolean("offline_oldest_first", false);
                                                editor.commit();
                                            }
                                            break;
                                        case 1:
                                            if (true) {
                                                SharedPreferences.Editor editor = m_prefs.edit();
                                                editor.putBoolean("offline_oldest_first", true);
                                                editor.commit();
                                            }
                                            break;
                                    }
                                    dialog.cancel();

                                    refresh();
                                }
                            });

            dialog = builder.create();
            dialog.show();

            return true;
    case R.id.show_feeds:
      setUnreadOnly(!getUnreadOnly());
      invalidateOptionsMenu();
View Full Code Here

Examples of android.app.Dialog

       

        switch (item.getItemId()) {
            case 0:
                AlertDialog ad;
                final Dialog dialoog = new Dialog(this, R.style.CustomDialogTheme);
                dialoog.setContentView(R.layout.dialog);
               
                final LayoutInflater factory = getLayoutInflater();
                final View cView = factory.inflate(R.layout.dialog, null);
                final ListView list = (ListView) cView.findViewById(R.id.list);
                list.setVerticalScrollBarEnabled(true);
                list.setStackFromBottom(true);
               
                ArrayList<String> listItems = getRecordingList();
               
                if (listItems == null){
                    return false;
                }
              
                ListItemsAdapter adapter = new ListItemsAdapter(listItems);
                list.setAdapter(adapter);
                list.setOnItemClickListener(new OnItemClickListener() {

                    public void onItemClick(AdapterView<?> arg0, View arg1,
                            int arg2, long arg3) {
                        TextView tv = (TextView)(arg1.findViewById(R.id.text));
                        final String br = tv.getText().toString();
                       
                        final CharSequence[] items = {getString(R.string.upload), getString(R.string.play)};
                        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivityGroup.this);
                        builder.setTitle(getString(R.string.upload_or_play));
                        DialogInterface.OnClickListener DIO = new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int item) {
                                switch(item) {
                                case 0:
                                try {
                                    File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/rpath.txt");
                                    f.delete();
                                    f.createNewFile();
                                    FileOutputStream fOut = new FileOutputStream(f);
                                    OutputStreamWriter osw = new OutputStreamWriter(fOut);
                                    osw.write(Environment.getExternalStorageDirectory().getAbsolutePath() + "/recordings/" + br);
                                    osw.flush();
                                    osw.close();
                                    } catch (IOException e1) {
                                         e1.printStackTrace();
                                    }
                               
                                    Intent mainIntent = new Intent(getBaseContext(), DescribeActivity.class);
                                    startActivity(mainIntent);
                                    finish();
                          return;
                                case 1:
                                    Intent it;
                                    Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getAbsolutePath() + "/recordings/" + br);
                                    it = new Intent(Intent.ACTION_VIEW, uri);
                                    it.setDataAndType(uri,"video/3gpp");
                                    startActivity(it);
                                    return;
                                }
                               
                               
                            }
                            };
                        builder.setItems(items, DIO);
                        AlertDialog alert = builder.create();
                        alert.show();
                        dialoog.cancel();
                       
                    }

                });
               
                dialoog.setContentView(cView);
                dialoog.show();
                list.setTranscriptMode(ListView.TRANSCRIPT_MODE_DISABLED);
                list.scrollTo(0, 0);
                list.setSelection(0);
               
                return true;
View Full Code Here

Examples of android.app.Dialog

                // the wrong text if an image is used multiple times.
                Document doc = Jsoup.parse(content);
                Elements es = doc.getElementsByAttributeValue("src", getLastContentImageHitTestUrl());
                if (es.size() > 0){
                    if (es.get(0).hasAttr("title")){
                        Dialog dia = new Dialog(this);
                        if (es.get(0).hasAttr("alt")){
                            dia.setTitle(es.get(0).attr("alt"));
                        } else {
                            dia.setTitle(es.get(0).attr("title"));
                        }
                        TextView titleText = new TextView(this);
                       
                        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
                          titleText.setPaddingRelative(24, 24, 24, 24);
                        } else {
                          titleText.setPadding(24, 24, 24, 24);
                        }
                       
                        titleText.setTextSize(16);
                        titleText.setText(es.get(0).attr("title"));
                        dia.setContentView(titleText);
                        dia.show();
                    } else {
                        toast(R.string.no_caption_to_display);
                    }
                } else {
                    toast(R.string.no_caption_to_display);
View Full Code Here

Examples of android.app.Dialog

        editor.commit();
    }  
   
    public static void showRateDialog(final Context mContext, final SharedPreferences.Editor editor) {
        final Dialog dialog = new Dialog(mContext);
        dialog.setTitle("Rate " + APP_TITLE);

        LinearLayout ll = new LinearLayout(mContext);
        ll.setOrientation(LinearLayout.VERTICAL);
       
        TextView tv = new TextView(mContext);
        tv.setText("If you enjoy using " + APP_TITLE + ", please take a moment to rate it. Thanks for your support!");
        tv.setWidth(240);
        tv.setPadding(4, 0, 4, 10);
        ll.addView(tv);
       
        Button b1 = new Button(mContext);
        b1.setText("Rate " + APP_TITLE);
        b1.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
              try {
                mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
              } catch (ActivityNotFoundException e) {
                mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + APP_PNAME)));
              }
                dialog.dismiss();
            }
        });       
        ll.addView(b1);

        Button b2 = new Button(mContext);
        b2.setText("Remind me later");
        b2.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        ll.addView(b2);

        Button b3 = new Button(mContext);
        b3.setText("No, thanks");
        b3.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (editor != null) {
                    editor.putBoolean("dontshowagain", true);
                    editor.commit();
                }
                dialog.dismiss();
            }
        });
        ll.addView(b3);

        dialog.setContentView(ll);       
        dialog.show();       
    }
View Full Code Here

Examples of android.app.Dialog

    case R.id.go_online:
      switchOnline();
      return true
    case R.id.search:
      if (ohf != null) {
        Dialog dialog = new Dialog(this);

        final EditText edit = new EditText(this);

        AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(R.string.search)
            .setPositiveButton(getString(R.string.search),
                new OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                   
                    String query = edit.getText().toString().trim();
                   
                    ohf.setSearchQuery(query);

                  }
                })
            .setNegativeButton(getString(R.string.cancel),
                new OnClickListener() {

                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                   
                    //

                  }
                }).setView(edit);
       
        dialog = builder.create();
        dialog.show();
      }
     
      return true;
    case R.id.preferences:
      Intent intent = new Intent(this, PreferencesActivity.class);
      startActivityForResult(intent, 0);
      return true;
    case R.id.headlines_view_mode:
      if (ohf != null) {
        Dialog dialog = new Dialog(this);
       
        String viewMode = getViewMode();
       
        //Log.d(TAG, "viewMode:" + getViewMode());

        int selectedIndex = 0;
       
        if (viewMode.equals("all_articles")) {
          selectedIndex = 0;
        } else if (viewMode.equals("marked")) {
          selectedIndex = 1;
        } else if (viewMode.equals("published")) {
          selectedIndex = 2;
        } else if (viewMode.equals("unread")) {
          selectedIndex = 3;
        }
       
        AlertDialog.Builder builder = new AlertDialog.Builder(this)
            .setTitle(R.string.headlines_set_view_mode)
            .setSingleChoiceItems(
                new String[] {
                    /* getString(R.string.headlines_adaptive), */
                    getString(R.string.headlines_all_articles),
                    getString(R.string.headlines_starred),
                    getString(R.string.headlines_published),
                    getString(R.string.headlines_unread) },
                selectedIndex, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog,
                      int which) {
                    switch (which) {
                    /* case 0:
                      setViewMode("adaptive");
                      break; */
                    case 0:
                      setViewMode("all_articles");
                      break;
                    case 1:
                      setViewMode("marked");
                      break;
                    case 2:
                      setViewMode("published");
                      break;
                    case 3:
                      setViewMode("unread");
                      break;
                    }
                    dialog.cancel();

                    refresh();
                  }
                });

        dialog = builder.create();
        dialog.show();

      }
      return true;
    case R.id.headlines_select:
      if (ohf != null) {
        Dialog dialog = new Dialog(this);
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(R.string.headlines_select_dialog);

        builder.setSingleChoiceItems(new String[] {
            getString(R.string.headlines_select_all),
            getString(R.string.headlines_select_unread),
            getString(R.string.headlines_select_none) }, 0,
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog,
                  int which) {

                selectArticles(ohf.getFeedId(), ohf.getFeedIsCat(), which);
                invalidateOptionsMenu();
                refresh();

                dialog.cancel();
              }
            });

        dialog = builder.create();
        dialog.show();
      }
      return true;
    case R.id.headlines_mark_as_read:
      if (ohf != null) {
        final int feedId = ohf.getFeedId();
View Full Code Here
TOP
Copyright © 2015 www.androidadb.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.