Search in sources :

Example 6 with MyListDivider

use of me.yluo.ruisiapp.widget.MyListDivider in project Ruisi by freedom10086.

the class FrageMyTopic method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    // 从activity传过来的Bundle
    Bundle bundle = getArguments();
    int uid = 0;
    if (bundle != null) {
        uid = bundle.getInt("uid", 0);
        String username = bundle.getString("username", "我的");
        if (uid == 0) {
            title = "我的帖子";
        } else {
            title = username + "的帖子";
        }
    }
    initToolbar(true, title);
    RecyclerView recyclerView = mRootView.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    SwipeRefreshLayout refreshLayout = mRootView.findViewById(R.id.refresh_layout);
    refreshLayout.setEnabled(false);
    String myUid = App.getUid(getActivity());
    url = "home.php?mod=space&uid=" + (uid > 0 ? uid : myUid) + "&do=thread&view=me&mobile=2";
    datas = new ArrayList<>();
    adapter = new MyPostsListAdapter(getActivity(), datas);
    LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.addItemDecoration(new MyListDivider(getActivity(), MyListDivider.VERTICAL));
    recyclerView.addOnScrollListener(new LoadMoreListener(layoutManager, this, 10));
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    refresh();
    return mRootView;
}
Also used : MyListDivider(me.yluo.ruisiapp.widget.MyListDivider) LoadMoreListener(me.yluo.ruisiapp.listener.LoadMoreListener) Bundle(android.os.Bundle) RecyclerView(androidx.recyclerview.widget.RecyclerView) MyPostsListAdapter(me.yluo.ruisiapp.adapter.MyPostsListAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SwipeRefreshLayout(androidx.swiperefreshlayout.widget.SwipeRefreshLayout)

Example 7 with MyListDivider

use of me.yluo.ruisiapp.widget.MyListDivider in project Ruisi by freedom10086.

the class FrageTopicStar method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    // 从activity传过来的Bundle
    Bundle bundle = getArguments();
    if (bundle != null) {
        int type = bundle.getInt("type", -1);
        switch(type) {
            case FrageType.TOPIC:
                currentIndex = 0;
                title = "我的帖子";
                break;
            case FrageType.START:
                currentIndex = 1;
                title = "我的收藏";
                break;
        }
    }
    initToolbar(true, title);
    RecyclerView recyclerView = mRootView.findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);
    SwipeRefreshLayout refreshLayout = mRootView.findViewById(R.id.refresh_layout);
    refreshLayout.setEnabled(false);
    String uid = App.getUid(getActivity());
    switch(currentIndex) {
        case 0:
            // 主题
            url = "home.php?mod=space&uid=" + uid + "&do=thread&view=me&mobile=2";
            break;
        case 1:
            // 我的收藏
            url = "home.php?mod=space&uid=" + uid + "&do=favorite&view=me&type=thread&mobile=2";
            break;
    }
    datas = new ArrayList<>();
    adapter = new SimpleListAdapter(ListType.ARTICLE, getActivity(), datas);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
    recyclerView.addItemDecoration(new MyListDivider(getActivity(), MyListDivider.VERTICAL));
    recyclerView.addOnScrollListener(new LoadMoreListener((LinearLayoutManager) layoutManager, this, 10));
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapter);
    refresh();
    return mRootView;
}
Also used : MyListDivider(me.yluo.ruisiapp.widget.MyListDivider) LoadMoreListener(me.yluo.ruisiapp.listener.LoadMoreListener) Bundle(android.os.Bundle) SimpleListAdapter(me.yluo.ruisiapp.adapter.SimpleListAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 8 with MyListDivider

use of me.yluo.ruisiapp.widget.MyListDivider in project Ruisi by freedom10086.

the class PostActivity method initCommentList.

private void initCommentList() {
    topicList = findViewById(R.id.topic_list);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
    topicList.setLayoutManager(mLayoutManager);
    adapter = new PostAdapter(this, this, datas);
    topicList.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
    topicList.addOnScrollListener(new LoadMoreListener(mLayoutManager, this, 8));
    topicList.setAdapter(adapter);
}
Also used : MyListDivider(me.yluo.ruisiapp.widget.MyListDivider) LoadMoreListener(me.yluo.ruisiapp.listener.LoadMoreListener) PostAdapter(me.yluo.ruisiapp.adapter.PostAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 9 with MyListDivider

use of me.yluo.ruisiapp.widget.MyListDivider in project Ruisi by freedom10086.

the class SearchActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    mainWindow = findViewById(R.id.main_window);
    findViewById(R.id.btn_back).setOnClickListener(this);
    RecyclerView listView = findViewById(R.id.recycler_view);
    searchInput = findViewById(R.id.search_input);
    searchCard = findViewById(R.id.search_card);
    findViewById(R.id.start_search).setOnClickListener(this);
    findViewById(R.id.nav_search).setOnClickListener(this);
    searchInput.setHint("请输入搜索内容!");
    adapter = new SimpleListAdapter(ListType.SERRCH, this, datas);
    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
    listView.setLayoutManager(layoutManager);
    listView.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
    listView.addOnScrollListener(new LoadMoreListener((LinearLayoutManager) layoutManager, this, 20));
    listView.setAdapter(adapter);
    adapter.changeLoadMoreState(BaseAdapter.STATE_LOAD_NOTHING);
    navTitle = findViewById(R.id.nav_title);
    findViewById(R.id.nav_back).setOnClickListener(this);
    searchInput.setOnEditorActionListener(this);
}
Also used : MyListDivider(me.yluo.ruisiapp.widget.MyListDivider) LoadMoreListener(me.yluo.ruisiapp.listener.LoadMoreListener) SimpleListAdapter(me.yluo.ruisiapp.adapter.SimpleListAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 10 with MyListDivider

use of me.yluo.ruisiapp.widget.MyListDivider in project Ruisi by freedom10086.

the class FriendActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = ActivityFriendBinding.inflate(getLayoutInflater());
    setContentView(binding.getRoot());
    initToolBar(true, "我的好友");
    addToolbarMenu(R.drawable.ic_search_white_24dp).setOnClickListener(this);
    datas = new ArrayList<>();
    backUpdatas = new ArrayList<>();
    totalDatas = new ArrayList<>();
    friendsRecyclerView = binding.recyclerView;
    friendsRecyclerView.setHasFixedSize(true);
    friendsRecyclerView.addItemDecoration(new MyListDivider(this, MyListDivider.VERTICAL));
    LinearLayoutManager lm = new LinearLayoutManager(this);
    friendsRecyclerView.setLayoutManager(lm);
    friendsRecyclerView.addOnScrollListener(new LoadMoreListener(lm, this, 12));
    adapter = new FriendAdapter(this, datas, this);
    friendsRecyclerView.setAdapter(adapter);
    searchInput = findViewById(R.id.search_input);
    searchInput.setHint("查找好友");
    searchInput.setOnEditorActionListener(this);
    searchInput.addTextChangedListener(this);
    searchCard = findViewById(R.id.search_card);
    searchCard.setVisibility(View.INVISIBLE);
    findViewById(R.id.btn_back).setOnClickListener(this);
    findViewById(R.id.start_search).setOnClickListener(this);
    final String url = "home.php?mod=space&do=friend&mobile=2";
    new GetDataTask().execute(url);
}
Also used : MyListDivider(me.yluo.ruisiapp.widget.MyListDivider) LoadMoreListener(me.yluo.ruisiapp.listener.LoadMoreListener) FriendAdapter(me.yluo.ruisiapp.adapter.FriendAdapter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Aggregations

MyListDivider (me.yluo.ruisiapp.widget.MyListDivider)12 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)11 LoadMoreListener (me.yluo.ruisiapp.listener.LoadMoreListener)10 RecyclerView (androidx.recyclerview.widget.RecyclerView)6 Bundle (android.os.Bundle)4 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)4 AlertDialog (androidx.appcompat.app.AlertDialog)3 SimpleListAdapter (me.yluo.ruisiapp.adapter.SimpleListAdapter)3 RadioGroup (android.widget.RadioGroup)2 MyDB (me.yluo.ruisiapp.database.MyDB)2 Dialog (android.app.Dialog)1 Intent (android.content.Intent)1 AsyncTask (android.os.AsyncTask)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 RadioButton (android.widget.RadioButton)1