Esempio n. 1
0
 /**
  * Launches corresponding activity that was selected from the menu options.
  *
  * @param item menu item that was clicked
  * @return true if menu action was successful, false otherwise
  */
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case 0: // Remove show
       if (FavoriteShows.instance().deleteShow(s.getShowid()))
         Toast.makeText(getApplicationContext(), "Show removed!", Toast.LENGTH_SHORT).show();
       else
         Toast.makeText(
                 getApplicationContext(),
                 "Unable to remove show. Try again :(",
                 Toast.LENGTH_SHORT)
             .show();
       isTracked = false;
       return true;
     case 1: // Add show
       if (FavoriteShows.instance().addShow(s))
         Toast.makeText(getApplicationContext(), "Show added!", Toast.LENGTH_SHORT).show();
       else
         Toast.makeText(
                 getApplicationContext(), "Unable to add show. Try again :(", Toast.LENGTH_SHORT)
             .show();
       isTracked = true;
       return true;
     case 2: // Launch TVRage
       startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(s.getShowlink())));
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
Esempio n. 2
0
 public void launchURL(View v) {
   Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(s.getShowlink()));
   startActivity(browse);
 }