Exemplo n.º 1
0
  public void filter(String charText) {
    charText = charText.toLowerCase(Locale.getDefault());

    if (charText.length() == 0) {
      story.clear();
      story.addAll(arrayList);
    } else {
      story.clear();
      for (ChannelPojo wp : arrayList) {
        if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText)) {
          story.add(wp);
        }
      }
    }
    audioAdapter.notifyDataSetChanged();
  }
Exemplo n.º 2
0
    // Download Music File from Internet
    @Override
    protected List<ChannelPojo> doInBackground(String... f_url) {
      try {

        /*
         * int lang = LanguageFragment.getIntFromSP(getActivity(),
         * LanguageFragment.LANG_SELECTION);
         *
         * if (lang == 0) lang = 1;
         */
        String response = Downloader.getDataFromServer(audio_url);

        // String response =
        // Downloader.getDataFromServer(String.format(audio_url,godId));

        Log.i("Resposne is", response);
        JSONObject jsonObject = new JSONObject(response);
        JSONArray jsonarray =
            jsonObject.getJSONObject("GetChannelsListResult").getJSONArray("data");
        story = new ArrayList<ChannelPojo>();
        ChannelPojo aPojo;

        for (int i = 0; i < jsonarray.length(); i++) {
          JSONObject obj2 = jsonarray.getJSONObject(i);

          aPojo = new ChannelPojo();
          aPojo.setId(obj2.getString("channelCode"));
          aPojo.setName(obj2.getString("channnelName"));
          aPojo.setLink1(obj2.getString("liveLink"));
          aPojo.setLink2(obj2.getString("rtspLink"));
          aPojo.setImage(obj2.getString("channelImage"));
          story.add(aPojo);

          // String name = obj.getString("name");
          // String url = obj.getString("url");

          // System.out.println(name);
          // System.out.println(url);
        }

      } catch (Exception e) {
        Log.e("Error: ", e.getMessage());
      }
      return story;
    }