() {
255 | @Override
256 | public void onSubscribe(@NonNull Subscription s) {
257 | mSubscription = s;
258 | s.request(10);
259 | }
260 |
261 | @Override
262 | public void onNext(PandaDanmuEntity danmuEntity) {
263 | EventBus.getDefault().post(new PandaDanmuEvent(danmuEntity, roomId));
264 | if (TextUtils.equals("1", danmuEntity.getType()))
265 | mView.addDanmu(new BaseDanmu(danmuEntity.getData().getContent(), 1));
266 | }
267 |
268 | @Override
269 | public void onError(Throwable t) {
270 | t.printStackTrace();
271 | }
272 |
273 | @Override
274 | public void onComplete() {
275 |
276 | }
277 | });
278 |
279 | }
280 | }
281 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/ui/settings/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.ui.settings;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.view.MenuItem;
6 |
7 | import io.playcode.streambox.R;
8 |
9 | public class SettingsActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_settings);
15 | if (getSupportActionBar() != null) {
16 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
17 | }
18 | }
19 |
20 | @Override
21 | public boolean onOptionsItemSelected(MenuItem item) {
22 | if (item.getItemId() == android.R.id.home) {
23 | finish();
24 | return true;
25 | }
26 | return super.onOptionsItemSelected(item);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/ui/settings/SettingsFragment.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.ui.settings;
2 |
3 | import android.os.Bundle;
4 | import android.preference.Preference;
5 | import android.preference.PreferenceFragment;
6 | import android.preference.PreferenceScreen;
7 | import android.support.annotation.Nullable;
8 |
9 | import io.playcode.streambox.R;
10 |
11 | /**
12 | * Created by anpoz on 2017/4/23.
13 | */
14 |
15 | public class SettingsFragment extends PreferenceFragment {
16 | @Override
17 | public void onCreate(@Nullable Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | addPreferencesFromResource(R.xml.settings);
20 | }
21 |
22 | @Override
23 | public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
24 | return super.onPreferenceTreeClick(preferenceScreen, preference);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/util/FormatUtil.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.util;
2 |
3 | /**
4 | * Created by anpoz on 2017/4/16.
5 | */
6 |
7 | public class FormatUtil {
8 | public static String formatPersonNum(String src) {
9 | String personNum;
10 | if (src.length() <= 4) {
11 | personNum = src;
12 | } else if (src.length() == 5) {
13 | if (src.charAt(1) == '0') {
14 | personNum = src.charAt(0) + "万";
15 | } else {
16 | personNum = src.charAt(0) + "." + src.charAt(1) + "万";
17 | }
18 | } else {
19 | personNum = src.substring(0, src.length() - 4) + "万";
20 | }
21 | return personNum;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/util/ImageLoader.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.util;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.bumptech.glide.Glide;
7 |
8 | /**
9 | * Created by anpoz on 2017/4/12.
10 | */
11 |
12 | public class ImageLoader {
13 | public static void with(Context context, String imageUrl, ImageView imageView) {
14 | Glide.with(context)
15 | .load(imageUrl)
16 | .crossFade()
17 | .into(imageView);
18 | }
19 |
20 | public static void withCenterCrop(Context context, String imageUrl, ImageView imageView) {
21 | Glide.with(context)
22 | .load(imageUrl)
23 | .crossFade()
24 | .centerCrop()
25 | .into(imageView);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/util/PandaDanmuUtil.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.util;
2 |
3 | import io.playcode.streambox.data.bean.PandaStreamDanmuServerEntity;
4 |
5 | /**
6 | * Created by anpoz on 2017/4/15.
7 | */
8 |
9 | public class PandaDanmuUtil {
10 |
11 | public final static byte[] START_FLAG = {0x00, 0x06, 0x00, 0x02}; //连接弹幕服务器帧头
12 | public final static byte[] RESPONSE = {0x00, 0x06, 0x00, 0x06}; //连接弹幕服务器响应
13 | public final static byte[] KEEP_ALIVE = {0x00, 0x06, 0x00, 0x00}; //与弹幕服务器心跳心跳保持
14 | public final static byte[] RECEIVE_MSG = {0x00, 0x06, 0x00, 0x03}; //接收到弹幕消息的帧头
15 | public final static byte[] HEART_BEAT_RESPONSE = {0x00, 0x06, 0x00, 0x01};//心跳保持服务器返回的值
16 | public final static int IGNORE_BYTE_LENGTH = 16;//弹幕消息体忽略的字节数
17 | public final static int MAX_AUTO_CONNECT_TIME = 5;//自动断线重连次数
18 |
19 | /**
20 | * 建立连接请求数据包
21 | *
22 | * @param bean
23 | * @return
24 | */
25 | public static byte[] getConnectData(PandaStreamDanmuServerEntity.DataEntity bean) {
26 | String contentMsg = "u:" + bean.getRid() + "" +
27 | "@" + bean.getAppid() + "" +
28 | "\nk:1" +
29 | "\nt:300" +
30 | "\nts:" + bean.getTs() + "" +
31 | "\nsign:" + bean.getSign() + "" +
32 | "\nauthtype:" + bean.getAuthType();
33 | byte content[] = contentMsg.getBytes();
34 | byte length[] = {(byte) (content.length >> 8), (byte) (content.length & 0xff)};
35 | byte sendMessage[] = new byte[START_FLAG.length + 2 + content.length];
36 | /**
37 | * 1.帧头
38 | * 2.content[]的数据长度
39 | * 3.content[]
40 | */
41 | System.arraycopy(START_FLAG, 0, sendMessage, 0, START_FLAG.length);
42 | System.arraycopy(length, 0, sendMessage, START_FLAG.length, length.length);
43 | System.arraycopy(content, 0, sendMessage, START_FLAG.length + length.length, content.length);
44 | return sendMessage;
45 | }
46 |
47 | public static byte[] getHeartData() {
48 | return KEEP_ALIVE;
49 | }
50 |
51 | public static int byte2Int(byte[] bytes) {
52 | int value = 0;
53 | byte temp;
54 |
55 | for (int i = 0; i < bytes.length; i++) {
56 | temp = bytes[i];
57 | value += (temp & 0xFF) << (8 * i);
58 | }
59 | return value;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/io/playcode/streambox/widget/DanmakuVideoPlayer.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.support.v7.widget.SwitchCompat;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.shuyu.gsyvideoplayer.GSYVideoManager;
11 | import com.shuyu.gsyvideoplayer.GSYVideoPlayer;
12 | import com.shuyu.gsyvideoplayer.utils.Debuger;
13 | import com.shuyu.gsyvideoplayer.video.GSYBaseVideoPlayer;
14 | import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
15 |
16 | import java.util.HashMap;
17 |
18 | import io.playcode.streambox.R;
19 | import io.playcode.streambox.data.bean.BaseDanmu;
20 | import master.flame.danmaku.controller.IDanmakuView;
21 | import master.flame.danmaku.danmaku.model.BaseDanmaku;
22 | import master.flame.danmaku.danmaku.model.DanmakuTimer;
23 | import master.flame.danmaku.danmaku.model.IDisplayer;
24 | import master.flame.danmaku.danmaku.model.android.DanmakuContext;
25 | import master.flame.danmaku.danmaku.model.android.Danmakus;
26 | import master.flame.danmaku.danmaku.parser.BaseDanmakuParser;
27 | import master.flame.danmaku.ui.widget.DanmakuView;
28 |
29 | /**
30 | * Created by guoshuyu on 2017/2/16.
31 | *
32 | * 配置弹幕使用的播放器,目前使用的是本地模拟数据。
33 | *
34 | * 模拟数据的弹幕时常比较短,后面的时长点是没有数据的。
35 | *
36 | * 注意:这只是一个例子,演示如何集合弹幕,需要完善如弹出输入弹幕等的,可以自行完善。
37 | * 注意:b站的弹幕so只有v5 v7 x86、没有64,所以记得配置上ndk过滤。
38 | */
39 |
40 | public class DanmakuVideoPlayer extends StandardGSYVideoPlayer {
41 |
42 | private BaseDanmakuParser mParser;//解析器对象
43 | private IDanmakuView mDanmakuView;//弹幕view
44 | private DanmakuContext mDanmakuContext;
45 |
46 | private SwitchCompat mToggleDanmaku;
47 |
48 | public DanmakuVideoPlayer(Context context, Boolean fullFlag) {
49 | super(context, fullFlag);
50 | }
51 |
52 | public DanmakuVideoPlayer(Context context) {
53 | super(context);
54 | }
55 |
56 | public DanmakuVideoPlayer(Context context, AttributeSet attrs) {
57 | super(context, attrs);
58 | }
59 |
60 | @Override
61 | public int getLayoutId() {
62 | return R.layout.view_danmu_video;
63 | }
64 |
65 |
66 | @Override
67 | protected void init(Context context) {
68 | super.init(context);
69 | mDanmakuView = (DanmakuView) findViewById(R.id.danmaku_view);
70 | mToggleDanmaku = (SwitchCompat) findViewById(R.id.switch_danmu);
71 | //初始化弹幕显示
72 | initDanmaku();
73 |
74 | mToggleDanmaku.setOnCheckedChangeListener((buttonView, isChecked) -> resolveDanmakuShow());
75 | }
76 |
77 | @Override
78 | public void onPrepared() {
79 | super.onPrepared();
80 | onPrepareDanmaku(this);
81 | }
82 |
83 | @Override
84 | public void onVideoPause() {
85 | super.onVideoPause();
86 | if (mDanmakuView != null && mDanmakuView.isPrepared()) {
87 | mDanmakuView.pause();
88 | }
89 | }
90 |
91 | @Override
92 | public void onVideoResume() {
93 | super.onVideoResume();
94 | if (mDanmakuView != null && mDanmakuView.isPrepared() && mDanmakuView.isPaused()) {
95 | mDanmakuView.resume();
96 | }
97 | }
98 |
99 |
100 | @Override
101 | public void onCompletion() {
102 | releaseDanmaku(this);
103 | }
104 |
105 | /**
106 | * 处理播放器在全屏切换时,弹幕显示的逻辑
107 | * 需要格外注意的是,因为全屏和小屏,是切换了播放器,所以需要同步之间的弹幕状态
108 | */
109 | @Override
110 | public GSYBaseVideoPlayer startWindowFullscreen(Context context, boolean actionBar, boolean statusBar) {
111 | GSYBaseVideoPlayer gsyBaseVideoPlayer = super.startWindowFullscreen(context, actionBar, statusBar);
112 | if (gsyBaseVideoPlayer != null) {
113 | DanmakuVideoPlayer gsyVideoPlayer = (DanmakuVideoPlayer) gsyBaseVideoPlayer;
114 | //对弹幕设置偏移记录
115 | gsyVideoPlayer.getToggleDanmaku().setChecked(getToggleDanmaku().isChecked());
116 | onPrepareDanmaku(gsyVideoPlayer);
117 | }
118 | return gsyBaseVideoPlayer;
119 | }
120 |
121 | /**
122 | * 处理播放器在退出全屏时,弹幕显示的逻辑
123 | * 需要格外注意的是,因为全屏和小屏,是切换了播放器,所以需要同步之间的弹幕状态
124 | */
125 | @Override
126 | protected void resolveNormalVideoShow(View oldF, ViewGroup vp, GSYVideoPlayer gsyVideoPlayer) {
127 | super.resolveNormalVideoShow(oldF, vp, gsyVideoPlayer);
128 | if (gsyVideoPlayer != null) {
129 | DanmakuVideoPlayer gsyDanmaVideoPlayer = (DanmakuVideoPlayer) gsyVideoPlayer;
130 | getToggleDanmaku().setChecked(gsyDanmaVideoPlayer.getToggleDanmaku().isChecked());
131 | if (gsyDanmaVideoPlayer.getDanmakuView() != null &&
132 | gsyDanmaVideoPlayer.getDanmakuView().isPrepared()) {
133 | resolveDanmakuSeek(this, gsyDanmaVideoPlayer.getCurrentPositionWhenPlaying());
134 | resolveDanmakuShow();
135 | releaseDanmaku(gsyDanmaVideoPlayer);
136 | }
137 | }
138 | }
139 |
140 |
141 | private void initDanmaku() {
142 | // 设置最大显示行数
143 | HashMap maxLinesPair = new HashMap<>();
144 | maxLinesPair.put(BaseDanmaku.TYPE_SCROLL_RL, 5); // 滚动弹幕最大显示5行
145 | // 设置是否禁止重叠
146 | HashMap overlappingEnablePair = new HashMap<>();
147 | overlappingEnablePair.put(BaseDanmaku.TYPE_SCROLL_RL, true);
148 | overlappingEnablePair.put(BaseDanmaku.TYPE_FIX_TOP, true);
149 |
150 | mDanmakuContext = DanmakuContext.create();
151 | mDanmakuContext.setDanmakuStyle(IDisplayer.DANMAKU_STYLE_STROKEN, 3)
152 | .setDuplicateMergingEnabled(false)
153 | .setScrollSpeedFactor(1.2f)
154 | .setScaleTextSize(1.2f)
155 | .setMaximumLines(maxLinesPair)
156 | .preventOverlapping(overlappingEnablePair);
157 | if (mDanmakuView != null) {
158 | mParser = new BaseDanmakuParser() {
159 | @Override
160 | protected Danmakus parse() {
161 | return new Danmakus();
162 | }
163 | };
164 | mDanmakuView.setCallback(new master.flame.danmaku.controller.DrawHandler.Callback() {
165 | @Override
166 | public void updateTimer(DanmakuTimer timer) {
167 | }
168 |
169 | @Override
170 | public void drawingFinished() {
171 |
172 | }
173 |
174 | @Override
175 | public void danmakuShown(BaseDanmaku danmaku) {
176 | }
177 |
178 | @Override
179 | public void prepared() {
180 | if (getDanmakuView() != null) {
181 | getDanmakuView().start();
182 | resolveDanmakuShow();
183 | }
184 | }
185 | });
186 | mDanmakuView.enableDanmakuDrawingCache(true);
187 | }
188 | }
189 |
190 | /**
191 | * 弹幕的显示与关闭
192 | */
193 | private void resolveDanmakuShow() {
194 | post(() -> {
195 | if (getToggleDanmaku().isChecked()) {
196 | if (!getDanmakuView().isShown())
197 | getDanmakuView().show();
198 | }
199 | else {
200 | if (getDanmakuView().isShown()) {
201 | getDanmakuView().hide();
202 | }
203 | }
204 | });
205 | }
206 |
207 | /**
208 | * 开始播放弹幕
209 | */
210 | private void onPrepareDanmaku(DanmakuVideoPlayer gsyVideoPlayer) {
211 | if (gsyVideoPlayer.getDanmakuView() != null && !gsyVideoPlayer.getDanmakuView().isPrepared()) {
212 | gsyVideoPlayer.getDanmakuView().prepare(gsyVideoPlayer.getParser(),
213 | gsyVideoPlayer.getDanmakuContext());
214 | }
215 | }
216 |
217 | /**
218 | * 弹幕偏移
219 | */
220 | private void resolveDanmakuSeek(DanmakuVideoPlayer gsyVideoPlayer, long time) {
221 | if (GSYVideoManager.instance().getMediaPlayer() != null && mHadPlay
222 | && gsyVideoPlayer.getDanmakuView() != null && gsyVideoPlayer.getDanmakuView().isPrepared()) {
223 | gsyVideoPlayer.getDanmakuView().seekTo(time);
224 | }
225 | }
226 |
227 | /**
228 | * 释放弹幕控件
229 | */
230 | private void releaseDanmaku(DanmakuVideoPlayer danmakuVideoPlayer) {
231 | if (danmakuVideoPlayer != null && danmakuVideoPlayer.getDanmakuView() != null) {
232 | Debuger.printfError("release Danmaku!");
233 | danmakuVideoPlayer.getDanmakuView().release();
234 | }
235 | }
236 |
237 | public BaseDanmakuParser getParser() {
238 | return mParser;
239 | }
240 |
241 | public DanmakuContext getDanmakuContext() {
242 | return mDanmakuContext;
243 | }
244 |
245 | public IDanmakuView getDanmakuView() {
246 | return mDanmakuView;
247 | }
248 |
249 | public SwitchCompat getToggleDanmaku() {
250 | return mToggleDanmaku;
251 | }
252 |
253 | /**
254 | * 模拟添加弹幕数据
255 | */
256 | public void addDanmaku(BaseDanmu baseDanmu) {
257 | BaseDanmaku danmaku = mDanmakuContext.mDanmakuFactory.createDanmaku(BaseDanmaku.TYPE_SCROLL_RL);
258 | if (danmaku == null || mDanmakuView == null) {
259 | return;
260 | }
261 | danmaku.text = baseDanmu.getText();
262 | danmaku.padding = 5;
263 | danmaku.priority = 8; // 可能会被各种过滤器过滤并隐藏显示,所以提高等级
264 | danmaku.isLive = true;
265 | danmaku.setTime(mDanmakuView.getCurrentTime() + 500);
266 | danmaku.textSize = 16f * (mParser.getDisplayer().getDensity() - 0.6f);
267 | switch (baseDanmu.getType()) {
268 | case 1:
269 | danmaku.textColor = Color.WHITE;
270 | break;
271 | case 2:
272 | danmaku.textColor = Color.parseColor("#F06292");
273 | break;
274 | case 3:
275 | danmaku.textColor = Color.parseColor("#FF8A65");
276 | break;
277 | case 4:
278 | danmaku.textColor = Color.parseColor("#E57373");
279 | break;
280 | default:
281 | danmaku.textColor = Color.WHITE;
282 | }
283 | mDanmakuView.addDanmaku(danmaku);
284 | }
285 |
286 | }
287 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_card_stream_info.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_enlarge.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_shrink.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_search_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sync_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_visibility_grey_500_18dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wrap_ic_visibility_grey_500_18dp.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_common_stream.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
28 |
29 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
25 |
26 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_panda_stream.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
21 |
22 |
28 |
29 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_chatroom.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_common_category.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_common_list.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
14 |
15 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_panda_category.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
15 |
16 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_stream_info.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
19 |
20 |
23 |
24 |
31 |
32 |
45 |
46 |
60 |
61 |
76 |
77 |
90 |
91 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_stream_list.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
14 |
15 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_chat_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_live_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
17 |
18 |
23 |
24 |
36 |
37 |
43 |
44 |
58 |
59 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_danmu_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
17 |
23 |
24 |
25 |
29 |
30 |
42 |
43 |
51 |
52 |
63 |
64 |
76 |
77 |
82 |
83 |
88 |
89 |
100 |
101 |
102 |
107 |
108 |
115 |
116 |
122 |
123 |
130 |
131 |
138 |
139 |
140 |
147 |
148 |
155 |
156 |
157 |
166 |
167 |
177 |
178 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_bottom_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #9E9E9E
4 | #616161
5 | #F5F5F5
6 | #607D8B
7 | #212121
8 | #757575
9 | #212121
10 | #BDBDBD
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | StreamBox
3 | 设置
4 | enableMediaCodec
5 | enableRotateViewAuto
6 | enableShowFullAnimation
7 | enableNeedShowWifiTip
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
11 |
12 |
17 |
18 |
23 |
24 |
30 |
31 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/test/java/io/playcode/streambox/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package io.playcode.streambox;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.1.2-4'
5 | repositories {
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0-beta5'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | jcenter()
21 | maven { url 'https://jitpack.io' }
22 | flatDir{
23 | dirs 'libs'
24 | }
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
32 | ext {
33 | supportVersion = "26.0.2"
34 | deps = [
35 | appcompatv7 : "com.android.support:appcompat-v7:$supportVersion",
36 | supportv4 : "com.android.support:support-v4:$supportVersion",
37 | recyclerviewv7: "com.android.support:recyclerview-v7:$supportVersion",
38 | design : "com.android.support:design:$supportVersion",
39 | cardviewv7 : "com.android.support:cardview-v7:$supportVersion"
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Thu Apr 13 11:33:24 CST 2017
16 | systemProp.https.proxyPort=25378
17 | systemProp.http.proxyHost=127.0.0.1
18 | org.gradle.jvmargs=-Xmx1536m
19 | systemProp.https.proxyHost=127.0.0.1
20 | systemProp.http.proxyPort=25378
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anpoz/StreamBox/873d922b45812dd925e73f745fb5a9abe795f3e2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 12 18:14:32 GMT+08:00 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------