kimi
2021-02-18 749a5510a9f014446a3cd6ba57b3cb0cc8148dc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * Copyright (c) 2020 WildFireChat. All rights reserved.
 */
 
package cn.wildfire.chat.kit.channel;
 
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
 
import androidx.annotation.Nullable;
 
import cn.wildfire.chat.kit.R;
import cn.wildfire.chat.kit.WfcBaseActivity;
 
public class ChannelListActivity extends WfcBaseActivity {
    private boolean pick;
 
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        pick = getIntent().getBooleanExtra("pick", false);
        super.onCreate(savedInstanceState);
    }
 
    @Override
    protected int menu() {
        return R.menu.channel_list;
    }
 
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.create) {
            createChannel();
            return true;
        } else if (item.getItemId() == R.id.subscribe) {
            subscribe();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
 
    @Override
    protected int contentLayout() {
        return R.layout.fragment_container_activity;
    }
 
    @Override
    protected void afterViews() {
        Bundle bundle = new Bundle();
        bundle.putBoolean("pick", pick);
        ChannelListFragment fragment = new ChannelListFragment();
        fragment.setArguments(bundle);
        getSupportFragmentManager().beginTransaction()
            .replace(R.id.containerFrameLayout, fragment)
            .commit();
    }
 
    void createChannel() {
        Intent intent = new Intent(this, CreateChannelActivity.class);
        startActivity(intent);
        finish();
    }
 
    void subscribe() {
        Intent intent = new Intent(this, SearchChannelActivity.class);
        startActivity(intent);
    }
}