Search in sources :

Example 6 with Sort

use of com.winsonchiu.reader.data.reddit.Sort in project Reader by TheKeeperOfPie.

the class FragmentComments method onMenuItemClick.

@Override
public boolean onMenuItemClick(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.item_hide_youtube:
            toggleYouTubeVisibility(View.GONE);
            break;
        case R.id.item_load_full_comments:
            fragmentCurrent.loadLinkComments();
            break;
        case R.id.item_expand_post:
            if (fragmentCurrent != null) {
                fragmentCurrent.expandPost(!fragmentCurrent.getPostExpanded());
            }
            break;
    }
    item.setChecked(true);
    Sort sort = Sort.fromMenuId(item.getItemId());
    if (sort != null) {
        fragmentCurrent.setSort(sort);
        fragmentCurrent.scrollToPositionWithOffset(1, 0);
        return true;
    }
    return true;
}
Also used : Sort(com.winsonchiu.reader.data.reddit.Sort)

Example 7 with Sort

use of com.winsonchiu.reader.data.reddit.Sort in project Reader by TheKeeperOfPie.

the class FragmentProfile method onMenuItemClick.

@Override
public boolean onMenuItemClick(MenuItem item) {
    int id = item.getItemId();
    switch(id) {
        case R.id.item_new_message:
            FragmentNewMessage fragmentNewMessage = FragmentNewMessage.newInstance(controllerProfile.getUser().getName(), "", "");
            getFragmentManager().beginTransaction().hide(FragmentProfile.this).add(R.id.frame_fragment, fragmentNewMessage, FragmentNewMessage.TAG).addToBackStack(null).commit();
            break;
        case R.id.item_search:
            return true;
    }
    item.setChecked(true);
    Sort sort = Sort.fromMenuId(item.getItemId());
    if (sort != null) {
        controllerProfile.setSort(sort).subscribe(getReloadObserver());
        flashSearchView();
        return true;
    }
    Time time = Time.fromMenuId(item.getItemId());
    if (time != null) {
        controllerProfile.setTime(time).subscribe(getReloadObserver());
        itemSortTime.setTitle(getString(R.string.time_description, item.toString()));
        flashSearchView();
        return true;
    }
    return false;
}
Also used : Sort(com.winsonchiu.reader.data.reddit.Sort) Time(com.winsonchiu.reader.data.reddit.Time) FragmentNewMessage(com.winsonchiu.reader.FragmentNewMessage)

Aggregations

Sort (com.winsonchiu.reader.data.reddit.Sort)7 Time (com.winsonchiu.reader.data.reddit.Time)5 AppBarLayout (android.support.design.widget.AppBarLayout)2 Link (com.winsonchiu.reader.data.reddit.Link)2 AdapterLink (com.winsonchiu.reader.links.AdapterLink)2 Intent (android.content.Intent)1 Uri (android.net.Uri)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 GestureDetectorCompat (android.support.v4.view.GestureDetectorCompat)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 AppCompatSpinner (android.support.v7.widget.AppCompatSpinner)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SearchView (android.support.v7.widget.SearchView)1 SpannableString (android.text.SpannableString)1 ForegroundColorSpan (android.text.style.ForegroundColorSpan)1 ContextThemeWrapper (android.view.ContextThemeWrapper)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1