Пример #1
0
  private void addThumbnail(String thumbnail) {
    if (!Var.isEmpty(thumbnail)) {
      userPictureThumbnails.add(thumbnail);

      if (Var.isEmpty(editUser.getThumbnail())) {
        editUser.setThumbnail(userPictureThumbnails.get(0));
        userPicture_sp.setSelection(0);
      }

      iconAdapter.notifyDataSetChanged();
    }
  }
Пример #2
0
  @Override
  public void onClick(View v) {
    Log.d(TAG, "onclick " + (v == action_fab) + ", " + searchMode);
    if (v == search_fab) {
      if (searchMode == Var.SEARCH_NONE) toggleSearch(Var.SEARCH_OPTIONS);
      else if (searchMode == Var.SEARCH_OPTIONS) toggleSearch(Var.SEARCH_NONE);
    }

    if (v == action_fab) {
      if (searchMode == Var.SEARCH_YT_CHANNEL) {
        SparseBooleanArray checked = search_lv.getCheckedItemPositions();
        for (int i = 0; i < checked.size(); i++) {
          if (checked.valueAt(i) == true) {
            YoutubeFeed youtubeFeed = (YoutubeFeed) search_lv.getItemAtPosition(checked.keyAt(i));
            youtubeFeed.setChannelHandle(searchChannel.getFeedId());
            editUser.getMediaFeed().add(youtubeFeed);
          }
        }

        feedAdapter.notifyDataSetChanged();
        clearSearchOptions();

        toggleSearch(Var.SEARCH_NONE);
      } else if (searchMode == Var.SEARCH_NONE) {

        editUser.setName(userName_edt.getText().toString().trim());
        editUser.setNotification(notification_sw.isChecked());
        editUser.setThumbnail((String) userPicture_sp.getSelectedItem());

        UserORM.saveUser(this, editUser);

        finish();
      }
    }
    if (v == youtube_ll) toggleSearch(Var.SEARCH_YOUTUBE);
    if (v == twitter_ll) toggleSearch(Var.SEARCH_TWITTER);
    if (v == search_v) toggleSearch(Var.SEARCH_NONE);
    if (v == searchTwitterLogin_tv) {
      twitter.resetAccessToken();
      if (!twitter.hasAccessToken()) twitter.authorize();
      // Hide the signin
      searchTwitter_v.setVisibility(View.GONE);
      searchDiv_v.setVisibility(View.GONE);
    }
    if (v == clearSearch_iv) search_edt.getText().clear();
  }