Example #1
0
  @Override
  public boolean onSingleTapUp(MotionEvent e1) {
    // TODO Auto-generated method stub
    SongInfo songInfo = new SongInfo();
    if (SWITCH_VIEW != SONG_VIEW) {
      return false;
    }
    try {
      int id = lv.pointToPosition((int) e1.getX(), (int) e1.getY());
      // Log.i("SONG",
      // "ID:"+((TextView)lv.getChildAt(id).findViewById(R.id.song_textView)).getText().toString()
      // );
      path = songList.get(id).getData();
      duration = Long.parseLong(songList.get(id).getDuration());
      Log.i("SONG LIST FRAGMENT", songList.get(id).getTitle());

      songInfo.setAlbum(songList.get(id).getAlbum());
      songInfo.setAlbum_art(songList.get(id).getAlbum_art());
      songInfo.setAlbum_id(songList.get(id).getAlbum_id());
      songInfo.setArtist(songList.get(id).getArtist());
      songInfo.setData(songList.get(id).getData());
      songInfo.setDisplayName(songList.get(id).getDisplayName());
      songInfo.setDuration(songList.get(id).getDuration());
      songInfo.setId(songList.get(id).getId());
      songInfo.setTitle(songList.get(id).getTitle());
      StaticMusic.setSongInfo(songInfo);
      StaticMusic.songQueue.addLast(songInfo);
    } catch (NullPointerException e) {
      e.printStackTrace();
      StaticMusic.songQueue = new LinkedList<SongInfo>();
      StaticMusic.songQueue.addLast(songInfo);
      Log.i("SONG LIST FRAGMENT", "here ur new");
    }
    Intent toNowPlaying = new Intent(this, Nowplaying.class);
    toNowPlaying.putExtra("activity", "songlist");
    toNowPlaying.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(toNowPlaying);
    return false;
  }
Example #2
0
    @Override
    public void run() {
      // TODO Auto-generated method stub
      Log.i("DATABASE THREAD", search);

      switch (SWITCH_VIEW) {
        case SONG_VIEW:
          database.open();
          songList = database.searchSong_byName(search);
          // database.close();
          Log.i("DATABASE THREAD", songList.size() + "");
          // TODO Auto-generated method stub
          if (songList.size() == 0) {
            songInfo.setTitle("No Songs Found");
            songList.add(songInfo);
            removeGestureListener();

          } else {
            addGestureListener();
          }
          adapter = new ReadLisstAdapter(activity, songList, lv);
          lv.setAdapter(adapter);
          break;
        case ALBUMS_VIEW:
          database.open();
          all_playlists = new ArrayList<ArrayList<SongInfo>>();
          all_playlists = database.searchSongs_albums(search);
          // database.close();
          if (all_playlists.size() == 0) {
            songInfo.setTitle("No Songs Found");
            songList.clear();
            songList.add(songInfo);
            all_playlists.add(songList);
            removeGestureListener();
          } else {
            addGestureListener();
          }
          common_list_adapter =
              new CommonListAdapter(
                  activity, all_playlists, lv, SWITCH_VIEW, playlistChangedListener);
          lv.setAdapter(common_list_adapter);
          common_list_adapter.notifyDataSetChanged();

          break;
        case ARTIST_VIEW:
          database.open();
          all_playlists = new ArrayList<ArrayList<SongInfo>>();
          all_playlists = database.searchSongs_artists(search);
          // database.close();
          if (all_playlists.size() == 0) {
            songInfo.setTitle("No Songs Found");
            songList.clear();
            songList.add(songInfo);
            all_playlists.add(songList);
            removeGestureListener();
          } else {
            addGestureListener();
          }
          common_list_adapter =
              new CommonListAdapter(
                  activity, all_playlists, lv, SWITCH_VIEW, playlistChangedListener);
          lv.setAdapter(common_list_adapter);
          common_list_adapter.notifyDataSetChanged();

          break;
        case PLAYLIST_VIEW:
          database.open();
          all_playlists = new ArrayList<ArrayList<SongInfo>>();
          all_playlists = database.searchSongs_playlists(search);
          // database.close();
          if (all_playlists.size() == 0) {
            songInfo.setTitle("No Songs Found");
            songList.clear();
            songList.add(songInfo);
            all_playlists.add(songList);
            removeGestureListener();
          } else {
            addGestureListener();
          }
          common_list_adapter =
              new CommonListAdapter(
                  activity, all_playlists, lv, SWITCH_VIEW, playlistChangedListener);
          lv.setAdapter(common_list_adapter);
          common_list_adapter.notifyDataSetChanged();
          break;
      }
    }
 @Test
 public final void testSetTitle() {
   testGetTitle();
   siExtended.setTitle("Hey");
   assertEquals("Hey", siExtended.getTitle());
 }