[Android] One tap opens Feeds or Articles from Categories

Hi,

I implemented a small feature in the Android client to select either Articles or Feeds with one tap from the list of the Categories, and I’d like to share with the TT RSS community and receive a feedback:

Tap on the category name to display the list of the Articles:

Tap on the category icon to display the list of the Feeds:

I believe this behavior may increase the standard one and simplifies settings.
It is done in the FeedCategoriesFragment class:

  1. Add a new View.OnClickListener class:

private class IconOnClickListener implements View.OnClickListener {
private int m_position;
private ViewGroup m_parent;

  public IconOnClickListener (int position, ViewGroup parent) {
  	m_position = position + 1; // Increase by 1 because of Special folder
  	m_parent = parent;
  }

  @Override
  public void onClick(View v) {
  	((ListView) m_parent).performItemClick(v, m_position, 0); // Let the event be handled in onItemClick()
  }

}

  1. Add the listener in the “public View getView(int position, View convertView, ViewGroup parent)” method:
  	if (icon != null) {
  		TypedValue tv = new TypedValue();

  		m_activity.getTheme().resolveAttribute(R.attr.ic_folder_outline, tv, true);
  		icon.setImageResource(tv.resourceId);

  		icon.setOnClickListener(new IconOnClickListener(position, parent)); // setup the listener
  	}
  1. Manage the tap in the “public void onItemClick(AdapterView<?> av, View view, int position, long id)” method:
  	if (cat != null) {
  		if (cat.id < 0) {
  			m_activity.onCatSelected(cat, false);
  		} else {
  			long viewId = view.getId(); // If tap the icon, open the category
  			if (viewId == R.id.icon)
  				m_activity.onCatSelected(cat, false);
  			else
  				m_activity.onCatSelected(cat);
  		}

  	}

I am not an Android developer, so sorry if coding is not clean or “beautiful”.

Gabriele

not going to comment on your code quality just the idea itself

i agree that current way is suboptimal but this isn’t really much better, sorry

it adds UI inconsistency because your onclick-capable folder icon doesn’t look any different from others, which don’t have any special behavior. current way is also not discoverable (which is bad) at least can’t be triggered by a misclick and confuse users.

e:

i personally would never find this feature unless i knew it was there (if only by accident) but long taps on things are at least somewhat standard on android apps (even though rarely used)

proper discoverable UI for this would involve an overflow menu (:) on the feedlist entry but that’s too much UI clutter for something that is not very important, imo, which is why it’s not there.