蒋洪波

修改文件所属公司

修改昨天QA提出的BUG
添加大牛播放器解决直播延时问题
修改图片
正在显示 100 个修改的文件 包含 773 行增加949 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

@@ -9,7 +9,7 @@ import android.view.View; @@ -9,7 +9,7 @@ import android.view.View;
9 * @brief 简要说明 9 * @brief 简要说明
10 * 详细说明,如果没有请删除 10 * 详细说明,如果没有请删除
11 * @date 2017/10/28 11 * @date 2017/10/28
12 - * Copyright (c) 2017, 上品折扣[] 12 + * Copyright (c) 2017, 学点云
13 * All rights reserved. 13 * All rights reserved.
14 */ 14 */
15 public interface OnItemClickListener<T> { 15 public interface OnItemClickListener<T> {
@@ -24,7 +24,7 @@ import retrofit2.Retrofit; @@ -24,7 +24,7 @@ import retrofit2.Retrofit;
24 * @file ShopinGsonConverterFactory.java 24 * @file ShopinGsonConverterFactory.java
25 * @brief 25 * @brief
26 * @date 2017/1/8 26 * @date 2017/1/8
27 - * Copyright (c) 2017, 上品折扣 27 + * Copyright (c) 2017, 学点云
28 * All rights reserved. 28 * All rights reserved.
29 */ 29 */
30 public class ShopinGsonConverterFactory extends Converter.Factory { 30 public class ShopinGsonConverterFactory extends Converter.Factory {
@@ -25,7 +25,7 @@ import okhttp3.RequestBody; @@ -25,7 +25,7 @@ import okhttp3.RequestBody;
25 * @file ShopinRequestParams.java 25 * @file ShopinRequestParams.java
26 * @brief 封装请求参数 26 * @brief 封装请求参数
27 * @date 2017/1/8 27 * @date 2017/1/8
28 - * Copyright (c) 2017, 上品折扣 28 + * Copyright (c) 2017, 学点云
29 * All rights reserved. 29 * All rights reserved.
30 */ 30 */
31 public class ShopinRequestParams { 31 public class ShopinRequestParams {
@@ -24,7 +24,7 @@ import javax.inject.Inject; @@ -24,7 +24,7 @@ import javax.inject.Inject;
24 * @file AppBaseActivity.java 24 * @file AppBaseActivity.java
25 * @brief Activity业务基类 25 * @brief Activity业务基类
26 * @date 2017/12/25 26 * @date 2017/12/25
27 - * Copyright (c) 2017,上品折扣 27 + * Copyright (c) 2017,学点云
28 * All rights reserved. 28 * All rights reserved.
29 */ 29 */
30 public abstract class AppBaseActivity<P extends BasePresenter> extends com.xdy.commonlibrary.core.BaseActivity implements BaseView { 30 public abstract class AppBaseActivity<P extends BasePresenter> extends com.xdy.commonlibrary.core.BaseActivity implements BaseView {
@@ -27,7 +27,7 @@ import rx.subjects.BehaviorSubject; @@ -27,7 +27,7 @@ import rx.subjects.BehaviorSubject;
27 * @file BaseActivity.java 27 * @file BaseActivity.java
28 * @brief Activity无关业务基类 28 * @brief Activity无关业务基类
29 * @date 2017/12/25 29 * @date 2017/12/25
30 - * Copyright (c) 2017,上品折扣 30 + * Copyright (c) 2017,学点云
31 * All rights reserved. 31 * All rights reserved.
32 */ 32 */
33 public abstract class BaseActivity extends PermissifyActivity implements ActivityLifecycleProvider { 33 public abstract class BaseActivity extends PermissifyActivity implements ActivityLifecycleProvider {
@@ -9,7 +9,7 @@ import com.tencent.tinker.loader.shareutil.ShareConstants; @@ -9,7 +9,7 @@ import com.tencent.tinker.loader.shareutil.ShareConstants;
9 * @file BaseApplication.java 9 * @file BaseApplication.java
10 * @brief 请勿修改此类! 10 * @brief 请勿修改此类!
11 * @date 2017/3/16 11 * @date 2017/3/16
12 - * Copyright (c) 2017, 上品折扣 12 + * Copyright (c) 2017, 学点云
13 * All rights reserved. 13 * All rights reserved.
14 */ 14 */
15 public class BaseApplication extends TinkerApplication { 15 public class BaseApplication extends TinkerApplication {
@@ -21,7 +21,7 @@ import rx.subjects.BehaviorSubject; @@ -21,7 +21,7 @@ import rx.subjects.BehaviorSubject;
21 * @file BaseFragment.java 21 * @file BaseFragment.java
22 * @brief 无关业务的Fragment基类 22 * @brief 无关业务的Fragment基类
23 * @date 2017/6/4 23 * @date 2017/6/4
24 - * Copyright (c) 2017, 上品折扣[] 24 + * Copyright (c) 2017, 学点云
25 * All rights reserved. 25 * All rights reserved.
26 */ 26 */
27 public abstract class BaseFragment extends SupportFragment implements FragmentLifecycleProvider { 27 public abstract class BaseFragment extends SupportFragment implements FragmentLifecycleProvider {
@@ -8,7 +8,7 @@ import java.lang.ref.WeakReference; @@ -8,7 +8,7 @@ import java.lang.ref.WeakReference;
8 * @file BaseRunnable.java 8 * @file BaseRunnable.java
9 * @brief runnable简单封装好使用 9 * @brief runnable简单封装好使用
10 * @date 2017/12/25 10 * @date 2017/12/25
11 - * Copyright (c) 2017,上品折扣 11 + * Copyright (c) 2017,学点云
12 * All rights reserved. 12 * All rights reserved.
13 */ 13 */
14 public abstract class BaseRunnable<T> implements Runnable { 14 public abstract class BaseRunnable<T> implements Runnable {
@@ -7,7 +7,7 @@ package com.xdy.commonlibrary.event; @@ -7,7 +7,7 @@ package com.xdy.commonlibrary.event;
7 * @file CheckUpgradeEvent.java 7 * @file CheckUpgradeEvent.java
8 * @brief 检查更新事件 8 * @brief 检查更新事件
9 * @date 2017/3/19 9 * @date 2017/3/19
10 - * Copyright (c) 2017, 上品折扣[] 10 + * Copyright (c) 2017, 学点云
11 * All rights reserved. 11 * All rights reserved.
12 */ 12 */
13 public class CheckUpgradeEvent { 13 public class CheckUpgradeEvent {
@@ -6,7 +6,7 @@ package com.xdy.commonlibrary.exception; @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.exception;
6 * @file ResultException.java 6 * @file ResultException.java
7 * @brief 服务器返回结果异常 7 * @brief 服务器返回结果异常
8 * @date 2017/12/21 8 * @date 2017/12/21
9 - * Copyright (c) 2017, 上品折扣[] 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class ResultException extends RuntimeException { 12 public class ResultException extends RuntimeException {
@@ -10,7 +10,7 @@ import rx.subscriptions.CompositeSubscription; @@ -10,7 +10,7 @@ import rx.subscriptions.CompositeSubscription;
10 * @file BasePresenter.java 10 * @file BasePresenter.java
11 * @brief 11 * @brief
12 * @date 2017/6/4 12 * @date 2017/6/4
13 - * Copyright (c) 2017, 上品折扣[] 13 + * Copyright (c) 2017, 学点云
14 * All rights reserved. 14 * All rights reserved.
15 */ 15 */
16 public class BasePresenter<M extends IModel, V extends BaseView> implements presenter { 16 public class BasePresenter<M extends IModel, V extends BaseView> implements presenter {
@@ -10,7 +10,7 @@ import com.xdy.commonlibrary.widget.dialog.TipDialog; @@ -10,7 +10,7 @@ import com.xdy.commonlibrary.widget.dialog.TipDialog;
10 * @file GlobalDialogActivity.java 10 * @file GlobalDialogActivity.java
11 * @brief 导航界面 11 * @brief 导航界面
12 * @date 2017-12-10 12 * @date 2017-12-10
13 - * Copyright (c) 2017, 上品折扣[] 13 + * Copyright (c) 2017, 学点云
14 * All rights reserved. 14 * All rights reserved.
15 */ 15 */
16 public class GlobalDialogActivity extends Activity { 16 public class GlobalDialogActivity extends Activity {
@@ -8,7 +8,7 @@ import java.util.List; @@ -8,7 +8,7 @@ import java.util.List;
8 * @file ListBaseView.java 8 * @file ListBaseView.java
9 * @brief 9 * @brief
10 * @date 2017/12/27 10 * @date 2017/12/27
11 - * Copyright (c) 2017, 上品折扣[] 11 + * Copyright (c) 2017, 学点云
12 * All rights reserved. 12 * All rights reserved.
13 */ 13 */
14 public interface ListBaseView<T> extends BaseView { 14 public interface ListBaseView<T> extends BaseView {
@@ -6,7 +6,7 @@ package com.xdy.commonlibrary.permission; @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.permission;
6 * @file PermissifyConstants.java 6 * @file PermissifyConstants.java
7 * @brief 7 * @brief
8 * @date 2017/12/21 8 * @date 2017/12/21
9 - * Copyright (c) 2017,上品折扣 9 + * Copyright (c) 2017,学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public interface PermissifyConstants { 12 public interface PermissifyConstants {
@@ -6,7 +6,7 @@ package com.xdy.commonlibrary.utils; @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.utils;
6 * @file Constants.java 6 * @file Constants.java
7 * @brief 7 * @brief
8 * @date 2017/2/10 8 * @date 2017/2/10
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class Constants { 12 public class Constants {
@@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicLong; @@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicLong;
55 * @file ACache.java 55 * @file ACache.java
56 * @brief 缓存管理类 56 * @brief 缓存管理类
57 * @date 2017-10-10 57 * @date 2017-10-10
58 - * Copyright (c) 2017, 上品折扣[] 58 + * Copyright (c) 2017, 学点云
59 * All rights reserved. 59 * All rights reserved.
60 */ 60 */
61 public class ACache implements ICache { 61 public class ACache implements ICache {
@@ -18,7 +18,7 @@ import java.io.Serializable; @@ -18,7 +18,7 @@ import java.io.Serializable;
18 * @file ICache.java 18 * @file ICache.java
19 * @brief 19 * @brief
20 * @date 2017/6/7 20 * @date 2017/6/7
21 - * Copyright (c) 2017, 上品折扣[] 21 + * Copyright (c) 2017, 学点云
22 * All rights reserved. 22 * All rights reserved.
23 */ 23 */
24 public interface ICache { 24 public interface ICache {
@@ -13,7 +13,7 @@ import java.lang.reflect.Type; @@ -13,7 +13,7 @@ import java.lang.reflect.Type;
13 * @file DoubleMayBeEmptyStringDeserializer.java 13 * @file DoubleMayBeEmptyStringDeserializer.java
14 * @brief 双精度类型有可能为空字符串的问题 14 * @brief 双精度类型有可能为空字符串的问题
15 * @date 2017/11/5 15 * @date 2017/11/5
16 - * Copyright (c) 2017, 上品折扣[] 16 + * Copyright (c) 2017, 学点云
17 * All rights reserved. 17 * All rights reserved.
18 */ 18 */
19 public class DoubleMayBeEmptyStringDeserializer implements JsonDeserializer<Double> { 19 public class DoubleMayBeEmptyStringDeserializer implements JsonDeserializer<Double> {
@@ -20,7 +20,7 @@ import java.util.List; @@ -20,7 +20,7 @@ import java.util.List;
20 * @file GsonUtil.java 20 * @file GsonUtil.java
21 * @brief Gson工具类 21 * @brief Gson工具类
22 * @date 2017-10-10 22 * @date 2017-10-10
23 - * Copyright (c) 2017, 上品折扣[] 23 + * Copyright (c) 2017, 学点云
24 * All rights reserved. 24 * All rights reserved.
25 */ 25 */
26 public class GsonUtil { 26 public class GsonUtil {
@@ -13,7 +13,7 @@ import java.lang.reflect.Type; @@ -13,7 +13,7 @@ import java.lang.reflect.Type;
13 * @file ReplenishDeserializer.java 13 * @file ReplenishDeserializer.java
14 * @brief 补货商品反序列化对象,样板对象有可能为空 14 * @brief 补货商品反序列化对象,样板对象有可能为空
15 * @date 2017/11/5 15 * @date 2017/11/5
16 - * Copyright (c) 2017, 上品折扣[] 16 + * Copyright (c) 2017, 学点云
17 * All rights reserved. 17 * All rights reserved.
18 */ 18 */
19 public class IntegerMayBeEmptyStringDeserializer implements JsonDeserializer<Integer> { 19 public class IntegerMayBeEmptyStringDeserializer implements JsonDeserializer<Integer> {
@@ -6,7 +6,7 @@ package com.xdy.commonlibrary.widget; @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.widget;
6 * @file View.java 6 * @file View.java
7 * @brief 7 * @brief
8 * @date 2017/3/21 0021 8 * @date 2017/3/21 0021
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class View { 12 public class View {
@@ -15,7 +15,7 @@ import com.xdy.commonlibrary.R; @@ -15,7 +15,7 @@ import com.xdy.commonlibrary.R;
15 * @file TipDialog.java 15 * @file TipDialog.java
16 * @brief 简单提示 16 * @brief 简单提示
17 * @date 2017/11/24 17 * @date 2017/11/24
18 - * Copyright (c) 2017,上品折扣 18 + * Copyright (c) 2017,学点云
19 * All rights reserved. 19 * All rights reserved.
20 */ 20 */
21 public class TipDialog extends BaseDialog { 21 public class TipDialog extends BaseDialog {
1 <resources> 1 <resources>
2 <string name="im_chat_msg_timetitle_yesday">昨天</string> 2 <string name="im_chat_msg_timetitle_yesday">昨天</string>
3 <string name="permissify_go_to_settings">去设置</string> 3 <string name="permissify_go_to_settings">去设置</string>
4 - <string name="permissify_permission_rationale_title">上品折扣向您申请如下权限</string> 4 + <string name="permissify_permission_rationale_title">学点云向您申请如下权限</string>
5 <string name="permissify_no_text_fallback">Permissify: No fallback text was provided for this permission</string> 5 <string name="permissify_no_text_fallback">Permissify: No fallback text was provided for this permission</string>
6 6
7 <!-- 权限提示 --> 7 <!-- 权限提示 -->
@@ -12,7 +12,7 @@ import java.math.BigDecimal; @@ -12,7 +12,7 @@ import java.math.BigDecimal;
12 * @file EncryptUtilTest.java 12 * @file EncryptUtilTest.java
13 * @brief 13 * @brief
14 * @date 2017/12/19 14 * @date 2017/12/19
15 - * Copyright (c) 2017, 上品折扣[] 15 + * Copyright (c) 2017, 学点云
16 * All rights reserved. 16 * All rights reserved.
17 */ 17 */
18 public class EncryptUtilTest { 18 public class EncryptUtilTest {
@@ -6,7 +6,7 @@ package com.xdy.network; @@ -6,7 +6,7 @@ package com.xdy.network;
6 * @file HttpConstants.java 6 * @file HttpConstants.java
7 * @brief 7 * @brief
8 * @date 2017/3/17 8 * @date 2017/3/17
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class HttpConstants { 12 public class HttpConstants {
@@ -19,7 +19,7 @@ import io.victoralbertos.jolyglot.Types; @@ -19,7 +19,7 @@ import io.victoralbertos.jolyglot.Types;
19 * @file MyCacheSpeak.java 19 * @file MyCacheSpeak.java
20 * @brief 20 * @brief
21 * @date 2017/2/20 21 * @date 2017/2/20
22 - * Copyright (c) 2017, 上品折扣 22 + * Copyright (c) 2017, 学点云
23 * All rights reserved. 23 * All rights reserved.
24 */ 24 */
25 public class MyCacheSpeak implements JolyglotGenerics { 25 public class MyCacheSpeak implements JolyglotGenerics {
@@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer; @@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
7 * @file WrapGsonDeserializerInfo.java 7 * @file WrapGsonDeserializerInfo.java
8 * @brief 包装Gson反序列化对象时需要处理的对象信息 8 * @brief 包装Gson反序列化对象时需要处理的对象信息
9 * @date 2017-6-7 9 * @date 2017-6-7
10 - * Copyright (c) 2017, 上品折扣[] 10 + * Copyright (c) 2017, 学点云
11 * All rights reserved. 11 * All rights reserved.
12 */ 12 */
13 public class WrapGsonDeserializerInfo { 13 public class WrapGsonDeserializerInfo {
@@ -9,7 +9,7 @@ import com.antfortune.freeline.FreelineCore; @@ -9,7 +9,7 @@ import com.antfortune.freeline.FreelineCore;
9 * @file com.xdy.home.application.TestApplication.java 9 * @file com.xdy.home.application.TestApplication.java
10 * @brief 10 * @brief
11 * @date 2017/3/15 11 * @date 2017/3/15
12 - * Copyright (c) 2017, 上品折扣 12 + * Copyright (c) 2017, 学点云
13 * All rights reserved. 13 * All rights reserved.
14 */ 14 */
15 public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication { 15 public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication {
@@ -14,7 +14,7 @@ import com.xdy.commonlibrary.mvp.BaseView; @@ -14,7 +14,7 @@ import com.xdy.commonlibrary.mvp.BaseView;
14 * @file OrderActivity.java 14 * @file OrderActivity.java
15 * @brief 15 * @brief
16 * @date 2017/3/15 16 * @date 2017/3/15
17 - * Copyright (c) 2017, 上品折扣 17 + * Copyright (c) 2017, 学点云
18 * All rights reserved. 18 * All rights reserved.
19 */ 19 */
20 public class OrderActivity extends AppCompatActivity implements BaseView { 20 public class OrderActivity extends AppCompatActivity implements BaseView {
@@ -16,7 +16,7 @@ import com.xdy.util.DisplayUtil; @@ -16,7 +16,7 @@ import com.xdy.util.DisplayUtil;
16 * @file AutoAdaptHeaderViewGroup.java 16 * @file AutoAdaptHeaderViewGroup.java
17 * @brief 自适应状态栏的ViewGroup 17 * @brief 自适应状态栏的ViewGroup
18 * @date 2017/10/13 18 * @date 2017/10/13
19 - * Copyright (c) 2017, 上品折扣[] 19 + * Copyright (c) 2017, 学点云
20 * All rights reserved. 20 * All rights reserved.
21 */ 21 */
22 public class AutoAdaptHeaderViewGroup extends RelativeLayout { 22 public class AutoAdaptHeaderViewGroup extends RelativeLayout {
@@ -11,7 +11,7 @@ import android.view.MotionEvent; @@ -11,7 +11,7 @@ import android.view.MotionEvent;
11 * @file NoScrollViewPager.java 11 * @file NoScrollViewPager.java
12 * @brief 12 * @brief
13 * @date 2017/3/25 13 * @date 2017/3/25
14 - * Copyright (c) 2017, 上品折扣 14 + * Copyright (c) 2017, 学点云
15 * All rights reserved. 15 * All rights reserved.
16 */ 16 */
17 public class NoScrollViewPager extends ViewPager { 17 public class NoScrollViewPager extends ViewPager {
@@ -14,7 +14,7 @@ import java.util.Locale; @@ -14,7 +14,7 @@ import java.util.Locale;
14 * @brief 时间工具类 14 * @brief 时间工具类
15 * 详细说明,如果没有请删除 15 * 详细说明,如果没有请删除
16 * @date 2017/10/12 16 * @date 2017/10/12
17 - * Copyright (c) 2017, 上品折扣[] 17 + * Copyright (c) 2017, 学点云
18 * All rights reserved. 18 * All rights reserved.
19 */ 19 */
20 public class DateUtils { 20 public class DateUtils {
@@ -20,7 +20,7 @@ import java.lang.reflect.Method; @@ -20,7 +20,7 @@ import java.lang.reflect.Method;
20 * @file DisplayUtil.java 20 * @file DisplayUtil.java
21 * @brief 获得当前手机一些屏幕信息 21 * @brief 获得当前手机一些屏幕信息
22 * @date 2017/9/22 22 * @date 2017/9/22
23 - * Copyright (c) 2017, 上品折扣[] 23 + * Copyright (c) 2017, 学点云
24 * All rights reserved. 24 * All rights reserved.
25 */ 25 */
26 public class DisplayUtil { 26 public class DisplayUtil {
@@ -8,7 +8,7 @@ import java.security.MessageDigest; @@ -8,7 +8,7 @@ import java.security.MessageDigest;
8 * @file EncryptUtil.java 8 * @file EncryptUtil.java
9 * @brief 加密工具 9 * @brief 加密工具
10 * @date 2017/10/17 10 * @date 2017/10/17
11 - * Copyright (c) 2017, 上品折扣[] 11 + * Copyright (c) 2017, 学点云
12 * All rights reserved. 12 * All rights reserved.
13 */ 13 */
14 public class EncryptUtil { 14 public class EncryptUtil {
@@ -20,7 +20,7 @@ import java.util.UUID; @@ -20,7 +20,7 @@ import java.util.UUID;
20 * @file FileHelper.java 20 * @file FileHelper.java
21 * @brief 文件操作辅助类 21 * @brief 文件操作辅助类
22 * @date 2017/11/30 22 * @date 2017/11/30
23 - * Copyright (c) 2017, 上品折扣[] 23 + * Copyright (c) 2017, 学点云
24 * All rights reserved. 24 * All rights reserved.
25 */ 25 */
26 public class FileUtil { 26 public class FileUtil {
@@ -42,7 +42,7 @@ public class ResUtil { @@ -42,7 +42,7 @@ public class ResUtil {
42 * @return Resources 42 * @return Resources
43 * @brief 获得当前APP的Resource的方法 43 * @brief 获得当前APP的Resource的方法
44 */ 44 */
45 - private Resources getResource() { 45 + public static Resources getResource() {
46 return ctx.getResources(); 46 return ctx.getResources();
47 } 47 }
48 48
@@ -18,7 +18,7 @@ import java.util.regex.Pattern; @@ -18,7 +18,7 @@ import java.util.regex.Pattern;
18 * @brief 简要说明 18 * @brief 简要说明
19 * 详细说明,如果没有请删除 19 * 详细说明,如果没有请删除
20 * @date 2017/10/12 20 * @date 2017/10/12
21 - * Copyright (c) 2017, 上品折扣[] 21 + * Copyright (c) 2017, 学点云
22 * All rights reserved. 22 * All rights reserved.
23 */ 23 */
24 public class StringUtils { 24 public class StringUtils {
@@ -12,7 +12,7 @@ import android.widget.TextView; @@ -12,7 +12,7 @@ import android.widget.TextView;
12 * @file UIUtils.java 12 * @file UIUtils.java
13 * @brief 视图工具类 13 * @brief 视图工具类
14 * @date 2017-6-10 14 * @date 2017-6-10
15 - * Copyright (c) 2017, 上品折扣[] 15 + * Copyright (c) 2017, 学点云
16 * All rights reserved. 16 * All rights reserved.
17 */ 17 */
18 public class UIUtils { 18 public class UIUtils {
@@ -6,7 +6,7 @@ package com.xdy.util.regex; @@ -6,7 +6,7 @@ package com.xdy.util.regex;
6 * @file RegPattern.java 6 * @file RegPattern.java
7 * @brief 正则表达式模型 7 * @brief 正则表达式模型
8 * @date 2017/10/17 8 * @date 2017/10/17
9 - * Copyright (c) 2017, 上品折扣[] 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class RegPattern { 12 public class RegPattern {
@@ -98,5 +98,4 @@ dependencies { @@ -98,5 +98,4 @@ dependencies {
98 compile rootProject.ext.dependencies["dagger2"] 98 compile rootProject.ext.dependencies["dagger2"]
99 apt rootProject.ext.dependencies["dagger2-apt-compiler"] 99 apt rootProject.ext.dependencies["dagger2-apt-compiler"]
100 compile 'com.rockerhieu.emojicon:library:1.3.1' 100 compile 'com.rockerhieu.emojicon:library:1.3.1'
101 - compile 'com.github.iwgang:simplifyspan:2.0'  
102 } 101 }
@@ -9,7 +9,7 @@ package com.xdy.home; @@ -9,7 +9,7 @@ package com.xdy.home;
9 * @file com.xdy.home.application.TestApplication.java 9 * @file com.xdy.home.application.TestApplication.java
10 * @brief 10 * @brief
11 * @date 2017/3/15 11 * @date 2017/3/15
12 - * Copyright (c) 2017, 上品折扣 12 + * Copyright (c) 2017, 学点云
13 * All rights reserved. 13 * All rights reserved.
14 */ 14 */
15 public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication { 15 public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication {
  1 +/*
  2 + * SmartPlayerJni.java
  3 + * SmartPlayerJni
  4 + *
  5 + * Github: https://github.com/daniulive/SmarterStreaming
  6 + *
  7 + * Created by DaniuLive on 2015/09/26.
  8 + * Copyright © 2014~2016 DaniuLive. All rights reserved.
  9 + */
  10 +
  11 +package com.daniulive.smartplayer;
  12 +
  13 +import com.eventhandle.SmartEventCallback;
  14 +
  15 +public class SmartPlayerJni {
  16 + /**
  17 + * Initialize Player.
  18 + *
  19 + * @param ctx: get by this.getApplicationContext()
  20 + *
  21 + * <pre>This function must be called firstly.</pre>
  22 + *
  23 + * @return player handle if successful, if return 0, which means init failed.
  24 + */
  25 +
  26 + public native long SmartPlayerInit(Object ctx);
  27 +
  28 + /**
  29 + * Set callback event
  30 + *
  31 + * @param callback function
  32 + *
  33 + * @return {0} if successful
  34 + */
  35 + public native int SetSmartPlayerEventCallback(long handle, SmartEventCallback callback);
  36 +
  37 + /**
  38 + * Set Video HW decoder, if support HW decoder, it will return 0
  39 + *
  40 + * @param isHWDecoder: 0: software decoder; 1: hardware decoder.
  41 + *
  42 + * @return {0} if successful
  43 + */
  44 + public native int SetSmartPlayerVideoHWDecoder(long handle, int isHWDecoder);
  45 +
  46 + /**
  47 + * Set Surface view.
  48 + *
  49 + * @param handle: return value from SmartPlayerInit()
  50 + *
  51 + * @param glSurface: surface view
  52 + *
  53 + * <pre> NOTE: if not set or set surface with null, it will playback audio only. </pre>
  54 + *
  55 + * @return {0} if successful
  56 + */
  57 + public native int SmartPlayerSetSurface(long handle, Object surface);
  58 +
  59 +
  60 + /**
  61 + * Set External Render.
  62 + *
  63 + * @param handle: return value from SmartPlayerInit()
  64 + *
  65 + * @param external_render: External Render
  66 + *
  67 + * @return {0} if successful
  68 + */
  69 + public native int SmartPlayerSetExternalRender(long handle, Object external_render);
  70 +
  71 +
  72 + /**
  73 + * Set AudioOutput Type
  74 + *
  75 + * @param handle: return value from SmartPlayerInit()
  76 + *
  77 + * @param use_audiotrack:
  78 + *
  79 + * <pre> NOTE: if use_audiotrack with 0: it will use auto-select output devices; if with 1: will use audiotrack mode. </pre>
  80 + *
  81 + * @return {0} if successful
  82 + */
  83 + public native int SmartPlayerSetAudioOutputType(long handle, int use_audiotrack);
  84 +
  85 +
  86 + /**
  87 + * Set buffer
  88 + *
  89 + * @param handle: return value from SmartPlayerInit()
  90 + *
  91 + * @param buffer:
  92 + *
  93 + * <pre> NOTE: Unit is millisecond, range is 200-5000 ms </pre>
  94 + *
  95 + * @return {0} if successful
  96 + */
  97 + public native int SmartPlayerSetBuffer(long handle, int buffer);
  98 +
  99 +
  100 + /**
  101 + * Set mute or not
  102 + *
  103 + * @param is_mute: if with 1:mute, if with 0: does not mute
  104 + *
  105 + * @return {0} if successful
  106 + */
  107 + public native int SmartPlayerSetMute(long handle, int is_mute);
  108 +
  109 +
  110 + /**
  111 + * It's only used when playback RTSP stream
  112 + *
  113 + * Default with UDP mode
  114 + *
  115 + * @param isUsingTCP: if with 1, it will via TCP mode, while 0 with UDP mode
  116 + *
  117 + * @return {0} if successful
  118 + */
  119 + public native int SmartPlayerSetRTSPTcpMode(long handle, int is_using_tcp);
  120 +
  121 +
  122 +
  123 + /**
  124 + * Set fast startup
  125 + *
  126 + * @param is_fast_startup: if with 1, it will second play back, if with 0: does not it
  127 + *
  128 + * @return {0} if successful
  129 + */
  130 + public native int SmartPlayerSetFastStartup(long handle, int is_fast_startup);
  131 +
  132 +
  133 + /**
  134 + * Set playback orientation.
  135 + *
  136 + * @param handle: return value from SmartPlayerInit()
  137 + *
  138 + * @param surOrg: current orientation, PORTRAIT 1, LANDSCAPE with 2
  139 + *
  140 + * @return {0} if successful
  141 + */
  142 + public native int SmartPlayerSetOrientation(long handle, int surOrg);
  143 +
  144 + /**
  145 + * Start playback stream
  146 + *
  147 + * @param handle: return value from SmartPlayerInit()
  148 + *
  149 + * @param uri: playback uri
  150 + *
  151 + * @return {0} if successful
  152 + */
  153 + public native int SmartPlayerStartPlayback(long handle, String uri);
  154 +
  155 + /**
  156 + * Close player instance.
  157 + *
  158 + * @param handle: return value from SmartPlayerInit()
  159 + *
  160 + * <pre> NOTE: it could not use player handle after call this function. </pre>
  161 + *
  162 + * @return {0} if successful
  163 + */
  164 + public native int SmartPlayerClose(long handle);
  165 +}
@@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
16 package com.xdy.home.adapter; 16 package com.xdy.home.adapter;
17 17
18 import android.content.Context; 18 import android.content.Context;
19 -import android.graphics.Color;  
20 import android.text.TextUtils; 19 import android.text.TextUtils;
21 import android.view.View; 20 import android.view.View;
22 import android.view.ViewGroup; 21 import android.view.ViewGroup;
@@ -38,10 +37,6 @@ import org.kymjs.kjframe.utils.StringUtils; @@ -38,10 +37,6 @@ import org.kymjs.kjframe.utils.StringUtils;
38 import java.util.ArrayList; 37 import java.util.ArrayList;
39 import java.util.List; 38 import java.util.List;
40 39
41 -import cn.iwgang.simplifyspan.SimplifySpanBuild;  
42 -import cn.iwgang.simplifyspan.other.SpecialGravity;  
43 -import cn.iwgang.simplifyspan.unit.SpecialLabelUnit;  
44 -  
45 /** 40 /**
46 * @author kymjs (http://www.kymjs.com/) on 6/8/15. 41 * @author kymjs (http://www.kymjs.com/) on 6/8/15.
47 */ 42 */
@@ -114,13 +109,16 @@ public class ChatAdapter extends BaseAdapter { @@ -114,13 +109,16 @@ public class ChatAdapter extends BaseAdapter {
114 holder.tv_chatcontent = (TextView) v.findViewById(R.id.chat_item_content_text); 109 holder.tv_chatcontent = (TextView) v.findViewById(R.id.chat_item_content_text);
115 holder.tv_date = (TextView) v.findViewById(R.id.chat_item_date); 110 holder.tv_date = (TextView) v.findViewById(R.id.chat_item_date);
116 holder.tv_name = (TextView) v.findViewById(R.id.chat_item_name); 111 holder.tv_name = (TextView) v.findViewById(R.id.chat_item_name);
  112 + holder.tv_teacher_bg= (TextView) v.findViewById(R.id.chat_item_taacher_bg);
117 v.setTag(holder); 113 v.setTag(holder);
118 } else { 114 } else {
119 holder = (ViewHolder) v.getTag(); 115 holder = (ViewHolder) v.getTag();
120 } 116 }
  117 + if (data.getTime()!=null){
  118 + holder.tv_date.setText(StringUtils.getDataTime("HH:mm"));
  119 + holder.tv_date.setVisibility(View.VISIBLE);
  120 + }
121 121
122 - holder.tv_date.setText(StringUtils.getDataTime("HH:mm"));  
123 - holder.tv_date.setVisibility(View.VISIBLE);  
124 122
125 //如果是文本类型,则隐藏图片,如果是图片则隐藏文本 123 //如果是文本类型,则隐藏图片,如果是图片则隐藏文本
126 if (data.getType() == Message.MSG_TYPE_TEXT) { 124 if (data.getType() == Message.MSG_TYPE_TEXT) {
@@ -143,9 +141,9 @@ public class ChatAdapter extends BaseAdapter { @@ -143,9 +141,9 @@ public class ChatAdapter extends BaseAdapter {
143 holder.layout_content.setBackgroundResource(android.R.color.transparent); 141 holder.layout_content.setBackgroundResource(android.R.color.transparent);
144 } else { 142 } else {
145 if (data.getIsSend()) { 143 if (data.getIsSend()) {
146 - holder.layout_content.setBackgroundResource(R.drawable.home_chat_send); 144 + holder.layout_content.setBackgroundResource(R.drawable.chat_pop_send);
147 } else { 145 } else {
148 - holder.layout_content.setBackgroundResource(R.drawable.home_chat_receive); 146 + holder.layout_content.setBackgroundResource(R.drawable.chat_pop_receive);
149 } 147 }
150 } 148 }
151 149
@@ -155,95 +153,87 @@ public class ChatAdapter extends BaseAdapter { @@ -155,95 +153,87 @@ public class ChatAdapter extends BaseAdapter {
155 } else { 153 } else {
156 kjb.display(holder.img_avatar, data.getToUserAvatar()); 154 kjb.display(holder.img_avatar, data.getToUserAvatar());
157 }*/ 155 }*/
158 - if (data.getIsSend()){  
159 - switch (AccountUtils.getUser().getUserRole()){ 156 + if (data.getIsSend()) {
  157 + switch (AccountUtils.getUser().getUserRole()) {
160 case "normal"://普通角色/学生 158 case "normal"://普通角色/学生
161 - if (!TextUtils.isEmpty(data.getFromUserName())){ 159 + if (!TextUtils.isEmpty(data.getFromUserName())) {
162 holder.tv_name.setText(data.getFromUserName()); 160 holder.tv_name.setText(data.getFromUserName());
163 - }else { 161 + } else {
164 holder.tv_name.setText("学生"); 162 holder.tv_name.setText("学生");
165 } 163 }
166 holder.img_avatar.setImageResource(R.mipmap.student); 164 holder.img_avatar.setImageResource(R.mipmap.student);
167 break; 165 break;
168 case "host"://主持人/老师 166 case "host"://主持人/老师
169 - if (TextUtils.isEmpty(data.getFromUserName())){  
170 - data.setFromUserName("主持人"); 167 + if (TextUtils.isEmpty(data.getFromUserName())) {
  168 + data.setFromUserName("老师");
171 } 169 }
172 - holder.tv_name.setText(data.getFromUserName());  
173 - SimplifySpanBuild simplifySpanBuild11 = new SimplifySpanBuild();  
174 - simplifySpanBuild11.append(new SpecialLabelUnit("老师", Color.WHITE, sp2px(12),0xFFFFA500)  
175 - .setLabelBgRadius(5).setLabelBgSize(80,60).setGravity(SpecialGravity.CENTER))  
176 - .append(data.getFromUserName());  
177 holder.img_avatar.setImageResource(R.mipmap.teacher); 170 holder.img_avatar.setImageResource(R.mipmap.teacher);
178 holder.tv_name.setText(data.getFromUserName()); 171 holder.tv_name.setText(data.getFromUserName());
  172 + holder.tv_teacher_bg.setVisibility(View.VISIBLE);
179 break; 173 break;
180 case "presenter"://主讲人 174 case "presenter"://主讲人
181 - if (!TextUtils.isEmpty(data.getFromUserName())){ 175 + if (!TextUtils.isEmpty(data.getFromUserName())) {
182 holder.tv_name.setText(data.getFromUserName()); 176 holder.tv_name.setText(data.getFromUserName());
183 - }else { 177 + } else {
184 holder.tv_name.setText("主讲人"); 178 holder.tv_name.setText("主讲人");
185 } 179 }
186 holder.img_avatar.setImageResource(R.mipmap.student); 180 holder.img_avatar.setImageResource(R.mipmap.student);
187 break; 181 break;
188 case "assistant"://助教 182 case "assistant"://助教
189 - if (!TextUtils.isEmpty(data.getFromUserName())){ 183 + if (!TextUtils.isEmpty(data.getFromUserName())) {
190 holder.tv_name.setText(data.getFromUserName()); 184 holder.tv_name.setText(data.getFromUserName());
191 - }else { 185 + } else {
192 holder.tv_name.setText("助教"); 186 holder.tv_name.setText("助教");
193 } 187 }
194 holder.img_avatar.setImageResource(R.mipmap.student); 188 holder.img_avatar.setImageResource(R.mipmap.student);
195 break; 189 break;
196 case "record":// 暂时没用 190 case "record":// 暂时没用
197 - if (!TextUtils.isEmpty(data.getFromUserName())){ 191 + if (!TextUtils.isEmpty(data.getFromUserName())) {
198 holder.tv_name.setText(data.getFromUserName()); 192 holder.tv_name.setText(data.getFromUserName());
199 - }else { 193 + } else {
200 holder.tv_name.setText("学生"); 194 holder.tv_name.setText("学生");
201 } 195 }
202 holder.img_avatar.setImageResource(R.mipmap.student); 196 holder.img_avatar.setImageResource(R.mipmap.student);
203 break; 197 break;
204 } 198 }
205 - }else {  
206 - switch (data.getUserRole()){ 199 + } else {
  200 + switch (data.getUserRole()) {
207 case "normal"://普通角色/学生 201 case "normal"://普通角色/学生
208 - if (!TextUtils.isEmpty(data.getToUserName())){ 202 + if (!TextUtils.isEmpty(data.getToUserName())) {
209 holder.tv_name.setText(data.getToUserName()); 203 holder.tv_name.setText(data.getToUserName());
210 - }else { 204 + } else {
211 holder.tv_name.setText("学生"); 205 holder.tv_name.setText("学生");
212 } 206 }
213 holder.img_avatar.setImageResource(R.mipmap.student); 207 holder.img_avatar.setImageResource(R.mipmap.student);
214 break; 208 break;
215 case "host"://主持人/老师 209 case "host"://主持人/老师
216 - if (TextUtils.isEmpty(data.getToUserName())){  
217 - data.setFromUserName("主持人"); 210 + if (TextUtils.isEmpty(data.getToUserName())) {
  211 + data.setToUserName("老师");
218 } 212 }
219 - holder.tv_name.setText(data.getToUserName());  
220 - SimplifySpanBuild simplifySpanBuild11 = new SimplifySpanBuild();  
221 - simplifySpanBuild11.append(new SpecialLabelUnit("老师", Color.WHITE, sp2px(12),0xFFFFA500)  
222 - .setLabelBgRadius(5).setLabelBgSize(80,60).setGravity(SpecialGravity.CENTER))  
223 - .append(data.getToUserName()); 213 + holder.tv_teacher_bg.setVisibility(View.VISIBLE);
224 holder.img_avatar.setImageResource(R.mipmap.teacher); 214 holder.img_avatar.setImageResource(R.mipmap.teacher);
225 holder.tv_name.setText(data.getToUserName()); 215 holder.tv_name.setText(data.getToUserName());
226 break; 216 break;
227 case "presenter"://主讲人 217 case "presenter"://主讲人
228 - if (!TextUtils.isEmpty(data.getToUserName())){ 218 + if (!TextUtils.isEmpty(data.getToUserName())) {
229 holder.tv_name.setText(data.getToUserName()); 219 holder.tv_name.setText(data.getToUserName());
230 - }else { 220 + } else {
231 holder.tv_name.setText("主讲人"); 221 holder.tv_name.setText("主讲人");
232 } 222 }
233 holder.img_avatar.setImageResource(R.mipmap.student); 223 holder.img_avatar.setImageResource(R.mipmap.student);
234 break; 224 break;
235 case "assistant"://助教 225 case "assistant"://助教
236 - if (!TextUtils.isEmpty(data.getToUserName())){ 226 + if (!TextUtils.isEmpty(data.getToUserName())) {
237 holder.tv_name.setText(data.getToUserName()); 227 holder.tv_name.setText(data.getToUserName());
238 - }else { 228 + } else {
239 holder.tv_name.setText("助教"); 229 holder.tv_name.setText("助教");
240 } 230 }
241 holder.img_avatar.setImageResource(R.mipmap.student); 231 holder.img_avatar.setImageResource(R.mipmap.student);
242 break; 232 break;
243 case "record":// 暂时没用 233 case "record":// 暂时没用
244 - if (!TextUtils.isEmpty(data.getToUserName())){ 234 + if (!TextUtils.isEmpty(data.getToUserName())) {
245 holder.tv_name.setText(data.getToUserName()); 235 holder.tv_name.setText(data.getToUserName());
246 - }else { 236 + } else {
247 holder.tv_name.setText("学生"); 237 holder.tv_name.setText("学生");
248 } 238 }
249 holder.img_avatar.setImageResource(R.mipmap.student); 239 holder.img_avatar.setImageResource(R.mipmap.student);
@@ -294,6 +284,7 @@ public class ChatAdapter extends BaseAdapter { @@ -294,6 +284,7 @@ public class ChatAdapter extends BaseAdapter {
294 static class ViewHolder { 284 static class ViewHolder {
295 TextView tv_date; 285 TextView tv_date;
296 TextView tv_name; 286 TextView tv_name;
  287 + TextView tv_teacher_bg;
297 ImageView img_avatar; 288 ImageView img_avatar;
298 TextView tv_chatcontent; 289 TextView tv_chatcontent;
299 ImageView img_chatimage; 290 ImageView img_chatimage;
@@ -301,6 +292,7 @@ public class ChatAdapter extends BaseAdapter { @@ -301,6 +292,7 @@ public class ChatAdapter extends BaseAdapter {
301 ProgressBar progress; 292 ProgressBar progress;
302 RelativeLayout layout_content; 293 RelativeLayout layout_content;
303 } 294 }
  295 +
304 private float sp2px(float spValue) { 296 private float sp2px(float spValue) {
305 final float scale = cxt.getResources().getDisplayMetrics().scaledDensity; 297 final float scale = cxt.getResources().getDisplayMetrics().scaledDensity;
306 return spValue * scale; 298 return spValue * scale;
@@ -33,15 +33,15 @@ import java.util.Collection; @@ -33,15 +33,15 @@ import java.util.Collection;
33 * 33 *
34 * @author kymjs (http://www.kymjs.com/) on 6/8/15. 34 * @author kymjs (http://www.kymjs.com/) on 6/8/15.
35 */ 35 */
36 -public class EmojiAdapter extends KJAdapter<Emojicon> { 36 +public class EmojiAdapter extends KJAdapter<String> {
37 37
38 - public EmojiAdapter(AbsListView view, Collection<Emojicon> mDatas) { 38 + public EmojiAdapter(AbsListView view, Collection<String> mDatas) {
39 super(view, mDatas, R.layout.home_chat_item_emoji); 39 super(view, mDatas, R.layout.home_chat_item_emoji);
40 } 40 }
41 41
42 @Override 42 @Override
43 - public void convert(AdapterHolder adapterHolder, Emojicon emojicon, boolean b) { 43 + public void convert(AdapterHolder adapterHolder, String emojicon, boolean b) {
44 TextView itemTvEmoji = adapterHolder.getView(R.id.itemEmoji); 44 TextView itemTvEmoji = adapterHolder.getView(R.id.itemEmoji);
45 - itemTvEmoji.setText(emojicon.getValue()); 45 + itemTvEmoji.setText(emojicon);
46 } 46 }
47 } 47 }
@@ -15,7 +15,7 @@ import me.yokeyword.fragmentation.SupportFragment; @@ -15,7 +15,7 @@ import me.yokeyword.fragmentation.SupportFragment;
15 * @file HomeAdapter.java 15 * @file HomeAdapter.java
16 * @brief 16 * @brief
17 * @date 2017/3/23 0023 17 * @date 2017/3/23 0023
18 - * Copyright (c) 2017, 上品折扣 18 + * Copyright (c) 2017, 学点云
19 * All rights reserved. 19 * All rights reserved.
20 */ 20 */
21 public class HomeAdapter extends FragmentStatePagerAdapter { 21 public class HomeAdapter extends FragmentStatePagerAdapter {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file ClassStatusEntity.java 6 * @file ClassStatusEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class ClassStatusEntity { 12 public class ClassStatusEntity {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file ErrorEvent.java 6 * @file ErrorEvent.java
7 * @brief 7 * @brief
8 * @date 2017/3/29 0029 8 * @date 2017/3/29 0029
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class ErrorEvent { 12 public class ErrorEvent {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file InitResponseEntity.java 6 * @file InitResponseEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/24 0024 8 * @date 2017/3/24 0024
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class InitResponseEntity { 12 public class InitResponseEntity {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file JoinClassOkEntity.java 6 * @file JoinClassOkEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/24 0024 8 * @date 2017/3/24 0024
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class JoinClassOkEntity { 12 public class JoinClassOkEntity {
@@ -15,7 +15,7 @@ import java.util.Map; @@ -15,7 +15,7 @@ import java.util.Map;
15 * @file JsParams.java 15 * @file JsParams.java
16 * @brief js params 16 * @brief js params
17 * @date 2017/3/23 0023 17 * @date 2017/3/23 0023
18 - * Copyright (c) 2017, 上品折扣 18 + * Copyright (c) 2017, 学点云
19 * All rights reserved. 19 * All rights reserved.
20 */ 20 */
21 public class JsParams { 21 public class JsParams {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file PublishVideoPathEntity.java 6 * @file PublishVideoPathEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class PublishVideoPathEntity { 12 public class PublishVideoPathEntity {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file ResponseEntity.java 6 * @file ResponseEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class ResponseEntity { 12 public class ResponseEntity {
@@ -17,7 +17,7 @@ public class UpdateDoc { @@ -17,7 +17,7 @@ public class UpdateDoc {
17 public String curV; //文档垂直方向的滚动值 17 public String curV; //文档垂直方向的滚动值
18 public String curH; ///文档水平方向的滚动值 18 public String curH; ///文档水平方向的滚动值
19 public String scale; //文档的缩放百分比(默认值100的时候就是100%,无缩放) 19 public String scale; //文档的缩放百分比(默认值100的时候就是100%,无缩放)
20 - public String visible; //文档是否显示 20 + public boolean visible; //文档是否显示
21 public String action; //文档的操作类型 21 public String action; //文档的操作类型
22 public String docId; //文档的位置资源标识 22 public String docId; //文档的位置资源标识
23 public String fileName; //文档名称 23 public String fileName; //文档名称
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file UserEntity.java 6 * @file UserEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class UserEntity { 12 public class UserEntity {
@@ -6,7 +6,7 @@ package com.xdy.home.entity; @@ -6,7 +6,7 @@ package com.xdy.home.entity;
6 * @file VideoEntity.java 6 * @file VideoEntity.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class VideoEntity { 12 public class VideoEntity {
  1 +package com.xdy.home.entity;
  2 +
  3 +import android.graphics.Bitmap;
  4 +
  5 +/**
  6 + * @author Administrator
  7 + * @version 1.0
  8 + * @file WrapDocBitMapEntity.java
  9 + * @brief
  10 + * @date 2017/3/31 0031
  11 + * Copyright (c) 2017, 学点云
  12 + * All rights reserved.
  13 + */
  14 +public class WrapDocBitMapEntity {
  15 +
  16 + /**
  17 + * 是否显示没有文档的图片
  18 + */
  19 + private boolean noDoc;
  20 + private Bitmap bitmap;
  21 +
  22 +
  23 + public boolean showNoDoc() {
  24 + return noDoc;
  25 + }
  26 +
  27 + public void setNoDoc(boolean doc) {
  28 + noDoc = doc;
  29 + }
  30 +
  31 + public Bitmap getBitmap() {
  32 + return bitmap;
  33 + }
  34 +
  35 + public void setBitmap(Bitmap bitmap) {
  36 + this.bitmap = bitmap;
  37 + }
  38 +}
@@ -6,7 +6,7 @@ package com.xdy.home.event; @@ -6,7 +6,7 @@ package com.xdy.home.event;
6 * @file ActionPushOrClose.java 6 * @file ActionPushOrClose.java
7 * @brief 推流或者关闭推流 7 * @brief 推流或者关闭推流
8 * @date 2017/3/26 8 * @date 2017/3/26
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public class ActionPushOrClose { 12 public class ActionPushOrClose {
@@ -9,7 +9,7 @@ import com.xdy.util.LogUtil; @@ -9,7 +9,7 @@ import com.xdy.util.LogUtil;
9 * @file EventHande.java 9 * @file EventHande.java
10 * @brief 10 * @brief
11 * @date 2017/3/26 11 * @date 2017/3/26
12 - * Copyright (c) 2017, 上品折扣 12 + * Copyright (c) 2017, 学点云
13 * All rights reserved. 13 * All rights reserved.
14 */ 14 */
15 public class EventHande implements SmartEventCallback { 15 public class EventHande implements SmartEventCallback {
@@ -8,7 +8,7 @@ import android.webkit.ValueCallback; @@ -8,7 +8,7 @@ import android.webkit.ValueCallback;
8 * @file DoNothingCallBack.java 8 * @file DoNothingCallBack.java
9 * @brief 9 * @brief
10 * @date 2017/3/23 0023 10 * @date 2017/3/23 0023
11 - * Copyright (c) 2017, 上品折扣 11 + * Copyright (c) 2017, 学点云
12 * All rights reserved. 12 * All rights reserved.
13 */ 13 */
14 public class DoNothingCallBack implements ValueCallback<String> { 14 public class DoNothingCallBack implements ValueCallback<String> {
@@ -3,6 +3,8 @@ package com.xdy.home.ui; @@ -3,6 +3,8 @@ package com.xdy.home.ui;
3 import android.content.Context; 3 import android.content.Context;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.annotation.NonNull; 5 import android.support.annotation.NonNull;
  6 +import android.text.Selection;
  7 +import android.text.Spannable;
6 import android.text.TextUtils; 8 import android.text.TextUtils;
7 import android.view.MotionEvent; 9 import android.view.MotionEvent;
8 import android.view.View; 10 import android.view.View;
@@ -38,7 +40,7 @@ import java.util.List; @@ -38,7 +40,7 @@ import java.util.List;
38 * @file ChatFragment.java 40 * @file ChatFragment.java
39 * @brief 41 * @brief
40 * @date 2017/3/23 0023 42 * @date 2017/3/23 0023
41 - * Copyright (c) 2017, 上品折扣 43 + * Copyright (c) 2017, 学点云
42 * All rights reserved. 44 * All rights reserved.
43 */ 45 */
44 public class ChatFragment extends AppBaseFragment<LivePresenter> implements LiveContract.ChatView { 46 public class ChatFragment extends AppBaseFragment<LivePresenter> implements LiveContract.ChatView {
@@ -104,12 +106,22 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live @@ -104,12 +106,22 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
104 } 106 }
105 107
106 @Override 108 @Override
107 - public void selectedEmoji(Emojicon emoji) {  
108 - box.getEditTextBox().append(emoji.getValue()); 109 + public void selectedEmoji(String emoji) {
  110 + if (!TextUtils.isEmpty(emoji)){
  111 + int start = box.getEditTextBox().getSelectionStart();
  112 + CharSequence content = box.getEditTextBox().getText().insert(start, emoji);
  113 + box.getEditTextBox().setText(content);
  114 + // 定位光标位置
  115 + CharSequence info = box.getEditTextBox().getText();
  116 + if (info instanceof Spannable) {
  117 + Spannable spanText = (Spannable) info;
  118 + Selection.setSelection(spanText, start + emoji.length());
  119 + }
  120 + }
109 } 121 }
110 122
111 @Override 123 @Override
112 - public void selectedBackSpace(Emojicon back) { 124 + public void selectedBackSpace(String back) {
113 DisplayRules.backspace(box.getEditTextBox()); 125 DisplayRules.backspace(box.getEditTextBox());
114 } 126 }
115 127
@@ -193,12 +205,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live @@ -193,12 +205,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
193 @Override 205 @Override
194 public void renderChatMsg(ChatMsgEntity entity) { 206 public void renderChatMsg(ChatMsgEntity entity) {
195 if (entity != null && adapter != null) { 207 if (entity != null && adapter != null) {
196 -  
197 Message message; 208 Message message;
198 if (entity.fromNodeId.equals(AccountUtils.getUser().getNodeId().toString())) { 209 if (entity.fromNodeId.equals(AccountUtils.getUser().getNodeId().toString())) {
199 message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole, 210 message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole,
200 entity.fromName, "", "", 211 entity.fromName, "", "",
201 - "", entity.message, true, true, new Date()); 212 + "", entity.message, true, true, replay?null:new Date());
202 datas.add(message); 213 datas.add(message);
203 adapter.refresh(datas); 214 adapter.refresh(datas);
204 mRealListView.setSelection(adapter.getCount() - 1); 215 mRealListView.setSelection(adapter.getCount() - 1);
@@ -206,7 +217,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live @@ -206,7 +217,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
206 LogUtil.i("返回的聊天内容===" + entity.message); 217 LogUtil.i("返回的聊天内容===" + entity.message);
207 message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole, "", 218 message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole, "",
208 "", entity.fromName, "", entity.message, false, 219 "", entity.fromName, "", entity.message, false,
209 - true, new Date()); 220 + true, replay?null:new Date());
210 datas.add(message); 221 datas.add(message);
211 adapter.refresh(datas); 222 adapter.refresh(datas);
212 mRealListView.setSelection(adapter.getCount() - 1); 223 mRealListView.setSelection(adapter.getCount() - 1);
1 package com.xdy.home.ui; 1 package com.xdy.home.ui;
2 2
3 import android.graphics.Bitmap; 3 import android.graphics.Bitmap;
4 -import android.graphics.Color; 4 +import android.graphics.BitmapFactory;
5 import android.os.Bundle; 5 import android.os.Bundle;
6 import android.support.annotation.NonNull; 6 import android.support.annotation.NonNull;
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 import android.util.DisplayMetrics; 8 import android.util.DisplayMetrics;
9 import android.view.View; 9 import android.view.View;
10 -import android.widget.RelativeLayout;  
11 10
12 import com.bumptech.glide.Glide; 11 import com.bumptech.glide.Glide;
13 import com.xdy.commonlibrary.core.AppBaseFragment; 12 import com.xdy.commonlibrary.core.AppBaseFragment;
14 import com.xdy.commonlibrary.core.di.AppComponent; 13 import com.xdy.commonlibrary.core.di.AppComponent;
15 import com.xdy.home.R; 14 import com.xdy.home.R;
16 -import com.xdy.home.entity.PointGroupEntity;  
17 import com.xdy.home.entity.UpdateDoc; 15 import com.xdy.home.entity.UpdateDoc;
18 import com.xdy.home.entity.WhiteboardUpdateEntity; 16 import com.xdy.home.entity.WhiteboardUpdateEntity;
  17 +import com.xdy.home.entity.WrapDocBitMapEntity;
19 import com.xdy.home.vp.LiveContract; 18 import com.xdy.home.vp.LiveContract;
20 import com.xdy.home.vp.LivePresenter; 19 import com.xdy.home.vp.LivePresenter;
21 import com.xdy.home.widget.CanvasView; 20 import com.xdy.home.widget.CanvasView;
22 import com.xdy.util.LogUtil; 21 import com.xdy.util.LogUtil;
23 22
24 -import java.util.ArrayList;  
25 -import java.util.List;  
26 import java.util.concurrent.ExecutionException; 23 import java.util.concurrent.ExecutionException;
27 24
28 import rx.Observable; 25 import rx.Observable;
@@ -37,7 +34,7 @@ import rx.schedulers.Schedulers; @@ -37,7 +34,7 @@ import rx.schedulers.Schedulers;
37 * @file DocFragment.java 34 * @file DocFragment.java
38 * @brief 35 * @brief
39 * @date 2017/3/23 0023 36 * @date 2017/3/23 0023
40 - * Copyright (c) 2017, 上品折扣 37 + * Copyright (c) 2017, 学点云
41 * All rights reserved. 38 * All rights reserved.
42 */ 39 */
43 public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveContract.DocView, View.OnClickListener { 40 public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveContract.DocView, View.OnClickListener {
@@ -45,7 +42,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -45,7 +42,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
45 int winWidth; 42 int winWidth;
46 int winHeight; 43 int winHeight;
47 CanvasView mCanvasView; 44 CanvasView mCanvasView;
48 - private RelativeLayout mShowNoDoc;  
49 private UpdateDoc mUpdateDoc; 45 private UpdateDoc mUpdateDoc;
50 46
51 public void setPresenter(LivePresenter presenter) { 47 public void setPresenter(LivePresenter presenter) {
@@ -67,7 +63,9 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -67,7 +63,9 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
67 DisplayMetrics metric = new DisplayMetrics(); 63 DisplayMetrics metric = new DisplayMetrics();
68 getWindowWith(metric); 64 getWindowWith(metric);
69 mCanvasView = (CanvasView) v.findViewById(R.id.cv); 65 mCanvasView = (CanvasView) v.findViewById(R.id.cv);
70 - mShowNoDoc = (RelativeLayout) v.findViewById(R.id.iv_show_nodoc); 66 +
  67 + //展示没有文档图片
  68 + docUrlTransformBitmap(null);
71 } 69 }
72 70
73 private void getWindowWith(DisplayMetrics metric) { 71 private void getWindowWith(DisplayMetrics metric) {
@@ -76,68 +74,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -76,68 +74,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
76 winHeight = metric.heightPixels; // 屏幕高度(像素) 74 winHeight = metric.heightPixels; // 屏幕高度(像素)
77 } 75 }
78 76
79 -  
80 - public List<PointGroupEntity> getData() {  
81 - List<PointGroupEntity> pointXies = new ArrayList<>();  
82 - PointGroupEntity xy = new PointGroupEntity();  
83 - xy.w = 127.0f;  
84 - xy.h = 377.0f;  
85 - pointXies.add(xy);  
86 -  
87 - PointGroupEntity wh1 = new PointGroupEntity();  
88 - wh1.w = 145.40204f;  
89 - wh1.h = 386.0f;  
90 - pointXies.add(wh1);  
91 -  
92 - PointGroupEntity wh2 = new PointGroupEntity();  
93 - wh2.w = 148.0f;  
94 - wh2.h = 386.0f;  
95 - pointXies.add(wh2);  
96 -  
97 - PointGroupEntity wh3 = new PointGroupEntity();  
98 - wh3.w = 151.875f;  
99 - wh3.h = 386.0f;  
100 - pointXies.add(wh3);  
101 - PointGroupEntity wh4 = new PointGroupEntity();  
102 - wh4.w = 156.41933f;  
103 - wh4.h = 386.0f;  
104 - pointXies.add(wh4);  
105 -  
106 - PointGroupEntity wh5 = new PointGroupEntity();  
107 - wh5.w = 163.03827f;  
108 - wh5.h = 386.0f;  
109 - pointXies.add(wh5);  
110 - PointGroupEntity wh6 = new PointGroupEntity();  
111 - wh6.w = 171.26802f;  
112 - wh6.h = 378.28864f;  
113 - pointXies.add(wh6);  
114 -  
115 - PointGroupEntity wh7 = new PointGroupEntity();  
116 - wh7.w = 178.50021f;  
117 - wh7.h = 375.79993f;  
118 - pointXies.add(wh7);  
119 -  
120 - PointGroupEntity wh8 = new PointGroupEntity();  
121 - wh8.w = 186.9014f;  
122 - wh8.h = 374.51642f;  
123 - pointXies.add(wh8);  
124 -  
125 - PointGroupEntity wh9 = new PointGroupEntity();  
126 - wh9.w = 191.49982f;  
127 - wh9.h = 373.12506f;  
128 - pointXies.add(wh9);  
129 -  
130 - PointGroupEntity wh0 = new PointGroupEntity();  
131 - wh0.w = 194.86517f;  
132 - wh0.h = 372.04492f;  
133 - pointXies.add(wh0);  
134 - PointGroupEntity wh11 = new PointGroupEntity();  
135 - wh11.w = 197.6098f;  
136 - wh11.h = 372.0f;  
137 - pointXies.add(wh11);  
138 - return pointXies;  
139 - }  
140 -  
141 @Override 77 @Override
142 protected void initData() { 78 protected void initData() {
143 } 79 }
@@ -150,21 +86,19 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -150,21 +86,19 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
150 86
151 @Override 87 @Override
152 public void onClick(View v) { 88 public void onClick(View v) {
153 -  
154 } 89 }
155 90
156 @Override 91 @Override
157 public void renderDocAddress(UpdateDoc updateDoc, String url) { 92 public void renderDocAddress(UpdateDoc updateDoc, String url) {
158 this.mUpdateDoc = updateDoc; 93 this.mUpdateDoc = updateDoc;
159 - updateDocUrl(url); 94 + docUrlTransformBitmap(url);
160 } 95 }
161 96
162 @Override 97 @Override
163 public void renderDeleteDocId(String itemIdx) { 98 public void renderDeleteDocId(String itemIdx) {
164 //刪除文檔后 99 //刪除文檔后
165 if (mUpdateDoc != null && !TextUtils.isEmpty(mUpdateDoc.itemIdx) && mUpdateDoc.itemIdx.equals(itemIdx)) { 100 if (mUpdateDoc != null && !TextUtils.isEmpty(mUpdateDoc.itemIdx) && mUpdateDoc.itemIdx.equals(itemIdx)) {
166 - mCanvasView.setVisibility(View.GONE);  
167 - mShowNoDoc.setVisibility(View.VISIBLE); 101 + docUrlTransformBitmap(null);
168 } 102 }
169 } 103 }
170 104
@@ -175,47 +109,47 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -175,47 +109,47 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
175 public void renderUpdateAnnotation(WhiteboardUpdateEntity entity) { 109 public void renderUpdateAnnotation(WhiteboardUpdateEntity entity) {
176 if (entity != null) { 110 if (entity != null) {
177 if (entity.isFresh) { 111 if (entity.isFresh) {
178 - if (mCanvasView!=null){ 112 + if (mCanvasView != null) {
179 mCanvasView.clear(); 113 mCanvasView.clear();
180 } 114 }
181 } 115 }
  116 +
182 if (entity.annotaionItems != null) { 117 if (entity.annotaionItems != null) {
183 - for (int i = 0; i < entity.annotaionItems.size(); i++) {  
184 - try {  
185 - String color = entity.annotaionItems.get(i).color;  
186 - int c = Color.parseColor(color);  
187 - mCanvasView.drawLine(entity.annotaionItems.get(i).pointGroup, c);  
188 - } catch (Exception e) {  
189 - e.printStackTrace();  
190 - }  
191 - } 118 + mCanvasView.drawLine(entity.annotaionItems);
192 } 119 }
193 } 120 }
194 } 121 }
195 122
196 - private void updateDocUrl(final String url) {  
197 - LogUtil.i(TAG,url);  
198 -  
199 - if (!TextUtils.isEmpty(url)) {  
200 - mShowNoDoc.setVisibility(View.GONE);  
201 - mCanvasView.setVisibility(View.VISIBLE); 123 + @Override
  124 + public void clear() {
  125 + mCanvasView.clear();
  126 + docUrlTransformBitmap(null);
  127 + }
202 128
203 - } 129 + private void docUrlTransformBitmap(final String url) {
  130 + LogUtil.i(TAG, url != null ? url : "显示没有文档界面");
204 Observable.just(url) 131 Observable.just(url)
205 .subscribeOn(Schedulers.io()) 132 .subscribeOn(Schedulers.io())
206 - .map(new Func1<String, Bitmap>() { 133 + .map(new Func1<String, WrapDocBitMapEntity>() {
207 @Override 134 @Override
208 - public Bitmap call(String s) { 135 + public WrapDocBitMapEntity call(String s) {
209 136
210 try { 137 try {
211 -  
212 - Bitmap bitmap = Glide.with(getContext())  
213 - .load(s)  
214 - .asBitmap()  
215 - .into(winWidth, winWidth)  
216 - .get();  
217 - return bitmap;  
218 - 138 + WrapDocBitMapEntity wrapDocBitMapEntity = new WrapDocBitMapEntity();
  139 + if (s == null) {
  140 + wrapDocBitMapEntity.setNoDoc(true);
  141 + wrapDocBitMapEntity.setBitmap(getNoDocBitmap());
  142 + //直接使用无文档图片
  143 + } else {
  144 + Bitmap bitmap = Glide.with(getContext())
  145 + .load(s)
  146 + .asBitmap()
  147 + .into(winWidth, winWidth)
  148 + .get();
  149 + wrapDocBitMapEntity.setNoDoc(false);
  150 + wrapDocBitMapEntity.setBitmap(bitmap);
  151 + }
  152 + return wrapDocBitMapEntity;
219 } catch (InterruptedException e) { 153 } catch (InterruptedException e) {
220 e.printStackTrace(); 154 e.printStackTrace();
221 } catch (ExecutionException e) { 155 } catch (ExecutionException e) {
@@ -226,15 +160,24 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC @@ -226,15 +160,24 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
226 }) 160 })
227 .subscribeOn(Schedulers.io()) 161 .subscribeOn(Schedulers.io())
228 .observeOn(AndroidSchedulers.mainThread()) 162 .observeOn(AndroidSchedulers.mainThread())
229 - .subscribe(new Action1<Bitmap>() { 163 + .subscribe(new Action1<WrapDocBitMapEntity>() {
230 @Override 164 @Override
231 - public void call(Bitmap resource) {  
232 - if (resource == null) { 165 + public void call(WrapDocBitMapEntity resource) {
  166 +
  167 + if (resource.getBitmap() == null) {
233 showMessage("图片获取失败"); 168 showMessage("图片获取失败");
234 - return; 169 + Bitmap bitmap = getNoDocBitmap();
  170 + mCanvasView.setBitmap(bitmap, false);
  171 + } else {
  172 + mCanvasView.setBitmap(resource.getBitmap(), !resource.showNoDoc());
235 } 173 }
236 - mCanvasView.setBitmap(resource);  
237 } 174 }
238 }); 175 });
239 } 176 }
  177 +
  178 + private Bitmap getNoDocBitmap() {
  179 + Bitmap resource;
  180 + resource = BitmapFactory.decodeResource(getResources(), R.mipmap.no_doc);
  181 + return resource;
  182 + }
240 } 183 }
@@ -25,7 +25,7 @@ import static android.view.View.GONE; @@ -25,7 +25,7 @@ import static android.view.View.GONE;
25 * @file HomeActivity.java 25 * @file HomeActivity.java
26 * @brief 26 * @brief
27 * @date 2017/3/15 27 * @date 2017/3/15
28 - * Copyright (c) 2017, 上品折扣 28 + * Copyright (c) 2017, 学点云
29 * All rights reserved. 29 * All rights reserved.
30 */ 30 */
31 public class HomeActivity extends TitleBaseActivity<LivePresenter> { 31 public class HomeActivity extends TitleBaseActivity<LivePresenter> {
@@ -12,6 +12,7 @@ import android.util.Log; @@ -12,6 +12,7 @@ import android.util.Log;
12 import android.view.MotionEvent; 12 import android.view.MotionEvent;
13 import android.view.SurfaceView; 13 import android.view.SurfaceView;
14 import android.view.View; 14 import android.view.View;
  15 +import android.view.ViewGroup;
15 import android.view.ViewParent; 16 import android.view.ViewParent;
16 import android.webkit.ConsoleMessage; 17 import android.webkit.ConsoleMessage;
17 import android.webkit.JavascriptInterface; 18 import android.webkit.JavascriptInterface;
@@ -30,6 +31,7 @@ import com.pili.pldroid.player.AVOptions; @@ -30,6 +31,7 @@ import com.pili.pldroid.player.AVOptions;
30 import com.pili.pldroid.player.PLMediaPlayer; 31 import com.pili.pldroid.player.PLMediaPlayer;
31 import com.pili.pldroid.player.widget.PLVideoTextureView; 32 import com.pili.pldroid.player.widget.PLVideoTextureView;
32 import com.pili.pldroid.player.widget.PLVideoView; 33 import com.pili.pldroid.player.widget.PLVideoView;
  34 +import com.videoengine.NTRenderer;
33 import com.xdy.commonlibrary.core.AppBaseFragment; 35 import com.xdy.commonlibrary.core.AppBaseFragment;
34 import com.xdy.commonlibrary.core.di.AppComponent; 36 import com.xdy.commonlibrary.core.di.AppComponent;
35 import com.xdy.commonlibrary.permission.PermissifyConstants; 37 import com.xdy.commonlibrary.permission.PermissifyConstants;
@@ -38,7 +40,6 @@ import com.xdy.home.R; @@ -38,7 +40,6 @@ import com.xdy.home.R;
38 import com.xdy.home.adapter.HomeAdapter; 40 import com.xdy.home.adapter.HomeAdapter;
39 import com.xdy.home.entity.VideoEntity; 41 import com.xdy.home.entity.VideoEntity;
40 import com.xdy.home.util.Constants; 42 import com.xdy.home.util.Constants;
41 -import com.xdy.home.util.MediaController;  
42 import com.xdy.home.vp.DaggerLiveComponent; 43 import com.xdy.home.vp.DaggerLiveComponent;
43 import com.xdy.home.vp.LiveComponent; 44 import com.xdy.home.vp.LiveComponent;
44 import com.xdy.home.vp.LiveContract; 45 import com.xdy.home.vp.LiveContract;
@@ -59,17 +60,20 @@ import java.util.Random; @@ -59,17 +60,20 @@ import java.util.Random;
59 60
60 import me.yokeyword.fragmentation.SupportFragment; 61 import me.yokeyword.fragmentation.SupportFragment;
61 62
  63 +import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION;
  64 +
62 /** 65 /**
63 * @author Administrator 66 * @author Administrator
64 * @version 1.0 67 * @version 1.0
65 * @file LiveFragment.java 68 * @file LiveFragment.java
66 * @brief 69 * @brief
67 * @date 2017/3/23 0023 70 * @date 2017/3/23 0023
68 - * Copyright (c) 2017, 上品折扣 71 + * Copyright (c) 2017, 学点云
69 * All rights reserved. 72 * All rights reserved.
70 */ 73 */
71 public class LiveFragment extends AppBaseFragment<LivePresenter> implements LiveContract.LiveView, BridgeWebView.OnReceivedErrorListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener { 74 public class LiveFragment extends AppBaseFragment<LivePresenter> implements LiveContract.LiveView, BridgeWebView.OnReceivedErrorListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener {
72 75
  76 +
73 static String REPLAY = "replay"; 77 static String REPLAY = "replay";
74 static String EXTRAL_CLASSID = "classId"; 78 static String EXTRAL_CLASSID = "classId";
75 static String EXTRAL_PORTAL = "portal"; 79 static String EXTRAL_PORTAL = "portal";
@@ -104,12 +108,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -104,12 +108,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
104 private String role; 108 private String role;
105 private String userId; 109 private String userId;
106 private RelativeLayout screen; 110 private RelativeLayout screen;
107 - private MediaController mMediaController;  
108 // private PLMediaPlayer mMediaPlayer; 111 // private PLMediaPlayer mMediaPlayer;
109 private FrameLayout mMediaContainer; 112 private FrameLayout mMediaContainer;
110 private ImageButton mPauseButton; 113 private ImageButton mPauseButton;
111 private SeekBar mSeekBar; 114 private SeekBar mSeekBar;
112 private RelativeLayout mPauseContainer; 115 private RelativeLayout mPauseContainer;
  116 + private TextView mClassName;
  117 + private SurfaceView mSurfaceView = null;
113 118
114 public static LiveFragment newInstance(boolean replay, @NonNull long classId, @NonNull String portal, String role, String userId) { 119 public static LiveFragment newInstance(boolean replay, @NonNull long classId, @NonNull String portal, String role, String userId) {
115 LiveFragment liveFragment = new LiveFragment(); 120 LiveFragment liveFragment = new LiveFragment();
@@ -150,7 +155,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -150,7 +155,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
150 slidingTab = (SlidingTabLayout) v.findViewById(R.id.stl_tab); 155 slidingTab = (SlidingTabLayout) v.findViewById(R.id.stl_tab);
151 screen = (RelativeLayout) v.findViewById(R.id.rl_live); 156 screen = (RelativeLayout) v.findViewById(R.id.rl_live);
152 mVideoView = (PLVideoTextureView) v.findViewById(R.id.plv); 157 mVideoView = (PLVideoTextureView) v.findViewById(R.id.plv);
  158 +
  159 +
  160 + mClassName = (TextView) v.findViewById(R.id.tv_classname);
153 mMediaContainer = (FrameLayout) v.findViewById(R.id.fl_media); 161 mMediaContainer = (FrameLayout) v.findViewById(R.id.fl_media);
  162 + mMeadiaContrillerRight = (RelativeLayout) v.findViewById(R.id.rl_meadia_contriller_right);
154 mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play); 163 mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play);
155 mPauseContainer = (RelativeLayout) v.findViewById(R.id.rl_operation_play); 164 mPauseContainer = (RelativeLayout) v.findViewById(R.id.rl_operation_play);
156 mEndTime = (TextView) v.findViewById(R.id.tv_end_time); 165 mEndTime = (TextView) v.findViewById(R.id.tv_end_time);
@@ -159,10 +168,20 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -159,10 +168,20 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
159 mSeekBar.setOnSeekBarChangeListener(mSeekListener); 168 mSeekBar.setOnSeekBarChangeListener(mSeekListener);
160 169
161 videoContainer = (FrameLayout) v.findViewById(R.id.fl_videoview_container); 170 videoContainer = (FrameLayout) v.findViewById(R.id.fl_videoview_container);
  171 + if (!replay) {
  172 + boolean create = createView();
  173 + if (create)
  174 + videoContainer.addView(mSurfaceView);
  175 + }
  176 + initPic = new ImageView(getContext());
  177 + initPic.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
  178 + initPic.setScaleType(ImageView.ScaleType.CENTER_CROP);
  179 + initPic.setImageResource(R.mipmap.no_video);
  180 + videoContainer.addView(initPic);
  181 +
162 operation = (RelativeLayout) v.findViewById(R.id.rl_operation_video); 182 operation = (RelativeLayout) v.findViewById(R.id.rl_operation_video);
163 viewPager = (NoScrollViewPager) v.findViewById(R.id.home_vp); 183 viewPager = (NoScrollViewPager) v.findViewById(R.id.home_vp);
164 viewPager.setOnRplayTouchListener(this); 184 viewPager.setOnRplayTouchListener(this);
165 - initPic = (ImageView) v.findViewById(R.id.iv_init_pic);  
166 operationIcon = (ImageView) v.findViewById(R.id.iv_operation_video); 185 operationIcon = (ImageView) v.findViewById(R.id.iv_operation_video);
167 186
168 mPauseContainer.setOnClickListener(new View.OnClickListener() { 187 mPauseContainer.setOnClickListener(new View.OnClickListener() {
@@ -173,9 +192,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -173,9 +192,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
173 mPresenter.pauseAndStart(!pause); 192 mPresenter.pauseAndStart(!pause);
174 } 193 }
175 }); 194 });
176 - mMediaContainer.setOnTouchListener(new View.OnTouchListener() { 195 + mMeadiaContrillerRight.setOnTouchListener(new View.OnTouchListener() {
177 @Override 196 @Override
178 public boolean onTouch(View v, MotionEvent event) { 197 public boolean onTouch(View v, MotionEvent event) {
  198 + if (mPauseContainer != null) {
  199 + mPauseContainer.requestLayout();
  200 + mPauseContainer.requestFocus();
  201 + }
179 showMediaContainer(TIME_OUT); 202 showMediaContainer(TIME_OUT);
180 return true; 203 return true;
181 } 204 }
@@ -199,6 +222,26 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -199,6 +222,26 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
199 } 222 }
200 } 223 }
201 224
  225 + /* Create rendering */
  226 + private boolean createView() {
  227 +
  228 + if (mSurfaceView == null) {
  229 + /*
  230 + * useOpenGLES2:
  231 + * If with true: Check if system supports openGLES, if supported, it will choose openGLES.
  232 + * If with false: it will set with default surfaceView;
  233 + */
  234 + mSurfaceView = NTRenderer.CreateRenderer(mRootView.getContext(), true);
  235 + }
  236 +
  237 + if (mSurfaceView == null) {
  238 + Log.i(TAG, "Create render failed..");
  239 + return false;
  240 + }
  241 + return true;
  242 + }
  243 +
  244 +
202 @Override 245 @Override
203 protected void initData() { 246 protected void initData() {
204 247
@@ -247,7 +290,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -247,7 +290,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
247 mVideoView.setOnInfoListener(this); 290 mVideoView.setOnInfoListener(this);
248 mVideoView.setOnErrorListener(this); 291 mVideoView.setOnErrorListener(this);
249 mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener); 292 mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
250 - mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_FIT_PARENT); 293 + mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_PAVED_PARENT);
251 AVOptions options = new AVOptions(); 294 AVOptions options = new AVOptions();
252 295
253 // 解码方式: 296 // 解码方式:
@@ -255,7 +298,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -255,7 +298,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
255 // codec=AVOptions.MEDIA_CODEC_SW_DECODE, 软解 298 // codec=AVOptions.MEDIA_CODEC_SW_DECODE, 软解
256 // codec=AVOptions.MEDIA_CODEC_AUTO, 硬解优先,失败后自动切换到软解 299 // codec=AVOptions.MEDIA_CODEC_AUTO, 硬解优先,失败后自动切换到软解
257 // 默认值是:MEDIA_CODEC_SW_DECODE 300 // 默认值是:MEDIA_CODEC_SW_DECODE
258 - options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_AUTO); 301 + options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_HW_DECODE);
259 302
260 // 准备超时时间,包括创建资源、建立连接、请求码流等,单位是 ms 303 // 准备超时时间,包括创建资源、建立连接、请求码流等,单位是 ms
261 // 默认值是:无 304 // 默认值是:无
@@ -266,24 +309,23 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -266,24 +309,23 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
266 options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000); 309 options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
267 310
268 // 当前播放的是否为在线直播,如果是,则底层会有一些播放优化 311 // 当前播放的是否为在线直播,如果是,则底层会有一些播放优化
269 -// 默认值是:0 312 +// 默认值是:0为关闭 1为是
270 if (!replay) { 313 if (!replay) {
271 options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1); 314 options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
272 // 是否开启"延时优化",只在在线直播流中有效 315 // 是否开启"延时优化",只在在线直播流中有效
273 // 默认值是:0 316 // 默认值是:0
274 - options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1); 317 + options.setInteger(KEY_DELAY_OPTIMIZATION, 1);
275 } else { 318 } else {
276 LogUtil.i(TAG, "回放设置AVOptions.KEY_LIVE_STREAMING, 0"); 319 LogUtil.i(TAG, "回放设置AVOptions.KEY_LIVE_STREAMING, 0");
277 options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0); 320 options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
278 } 321 }
279 // 默认的缓存大小,单位是 ms 322 // 默认的缓存大小,单位是 ms
280 // 默认值是:2000 323 // 默认值是:2000
281 - options.setInteger(AVOptions.KEY_CACHE_BUFFER_DURATION, 2000); 324 + options.setInteger(AVOptions.KEY_CACHE_BUFFER_DURATION, 300);
282 325
283 // 最大的缓存大小,单位是 ms 326 // 最大的缓存大小,单位是 ms
284 // 默认值是:4000 327 // 默认值是:4000
285 - options.setInteger(AVOptions.KEY_MAX_CACHE_BUFFER_DURATION, 4000);  
286 - 328 + options.setInteger(AVOptions.KEY_MAX_CACHE_BUFFER_DURATION, 300);
287 // 是否自动启动播放,如果设置为 1,则在调用 `prepareAsync` 或者 `setVideoPath` 之后自动启动播放,无需调用 `start()` 329 // 是否自动启动播放,如果设置为 1,则在调用 `prepareAsync` 或者 `setVideoPath` 之后自动启动播放,无需调用 `start()`
288 // 默认值是:1 330 // 默认值是:1
289 options.setInteger(AVOptions.KEY_START_ON_PREPARED, 1); 331 options.setInteger(AVOptions.KEY_START_ON_PREPARED, 1);
@@ -291,6 +333,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -291,6 +333,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
291 // 播放前最大探测流的字节数,单位是 byte 333 // 播放前最大探测流的字节数,单位是 byte
292 // 默认值是:128 * 1024 334 // 默认值是:128 * 1024
293 options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024); 335 options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
  336 + options.setInteger(AVOptions.KEY_BUFFER_TIME, 100);
294 337
295 // 请在开始播放之前配置 338 // 请在开始播放之前配置
296 mVideoView.setAVOptions(options); 339 mVideoView.setAVOptions(options);
@@ -373,10 +416,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -373,10 +416,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
373 } 416 }
374 417
375 @Override 418 @Override
376 - public void addSurfaceView(SurfaceView surfaceview) {  
377 - ViewParent parent = surfaceview.getParent();  
378 - if (parent == null) {  
379 - videoContainer.addView(surfaceview); 419 + public void addSurfaceView(SurfaceView surfaceview, boolean show) {
  420 + if (show) {
  421 + ViewParent parent = surfaceview.getParent();
  422 + if (parent == null) {
  423 + videoContainer.addView(surfaceview);
  424 + }
  425 + } else {
  426 + videoContainer.removeView(surfaceview);
380 } 427 }
381 } 428 }
382 429
@@ -386,51 +433,70 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -386,51 +433,70 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
386 initPic.setVisibility(View.VISIBLE); 433 initPic.setVisibility(View.VISIBLE);
387 operationIcon.setImageResource(R.mipmap.video_open); 434 operationIcon.setImageResource(R.mipmap.video_open);
388 435
389 - if (mVideoView.isPlaying()) {  
390 - mVideoView.stopPlayback();  
391 - } 436 + if (!replay) {
  437 + mPresenter.start(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
  438 + } else {
  439 + if (mVideoView.isPlaying()) {
  440 + mVideoView.stopPlayback();
  441 + }
  442 +
  443 + mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
  444 + mVideoView.start();
  445 + if (replay) {
  446 + mVideoView.seekTo(rtmpUrl.getSeek());
  447 + }
  448 +
392 449
393 - mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());  
394 - if (replay)  
395 - mVideoView.seekTo(rtmpUrl.getSeek());  
396 - mVideoView.start(); 450 + }
397 } 451 }
398 452
399 @Override 453 @Override
400 - public void stopVideo() { 454 + public void stopAudio() {
401 initPic.setImageResource(R.mipmap.no_video); 455 initPic.setImageResource(R.mipmap.no_video);
402 initPic.setVisibility(View.VISIBLE); 456 initPic.setVisibility(View.VISIBLE);
403 - if (mVideoView != null)  
404 - mVideoView.stopPlayback(); 457 + operationIcon.setImageResource(R.mipmap.video_close);
  458 + if (!replay) {
  459 + mPresenter.close();
  460 + } else {
  461 + if (!mPresenter.isVideoMode() && mVideoView != null)
  462 + mVideoView.stopPlayback();
  463 + }
405 } 464 }
406 465
407 @Override 466 @Override
408 - public void playVideo(VideoEntity rtmpUrl) {  
409 - 467 + public void stopVideo() {
410 initPic.setImageResource(R.mipmap.no_video); 468 initPic.setImageResource(R.mipmap.no_video);
411 - operationIcon.setImageResource(R.mipmap.video_close);  
412 -  
413 - if (mVideoView.isPlaying()) {  
414 - mVideoView.stopPlayback(); 469 + initPic.setVisibility(View.VISIBLE);
  470 + if (!replay) {
  471 +// addSurfaceView(surfaceView, false);
  472 + mPresenter.close();
  473 + } else {
  474 + if (mPresenter.isVideoMode() && mVideoView != null)
  475 + mVideoView.stopPlayback();
415 } 476 }
416 - mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());  
417 - mVideoView.start();  
418 -  
419 - if (replay)  
420 - mVideoView.seekTo(rtmpUrl.getSeek());  
421 } 477 }
422 478
423 @Override 479 @Override
424 - public void stopAudio() { 480 + public void playVideo(VideoEntity rtmpUrl) {
  481 +
425 initPic.setImageResource(R.mipmap.no_video); 482 initPic.setImageResource(R.mipmap.no_video);
426 - initPic.setVisibility(View.VISIBLE);  
427 operationIcon.setImageResource(R.mipmap.video_close); 483 operationIcon.setImageResource(R.mipmap.video_close);
  484 + if (!replay) {
  485 + mPresenter.start(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
  486 +// SurfaceView surfaceView = mPresenter.getsSurfaceView();
  487 +// addSurfaceView(surfaceView, true);
  488 + } else {
  489 + if (mVideoView.isPlaying()) {
  490 + mVideoView.stopPlayback();
  491 + }
  492 + mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
  493 + mVideoView.start();
428 494
429 - if (mVideoView != null)  
430 - mVideoView.stopPlayback(); 495 + if (replay)
  496 + mVideoView.seekTo(rtmpUrl.getSeek());
  497 + }
431 } 498 }
432 499
433 -  
434 @Override 500 @Override
435 public void requestCameraAndAudio() { 501 public void requestCameraAndAudio() {
436 getBaseActivity().getPermissifyManager(). 502 getBaseActivity().getPermissifyManager().
@@ -547,14 +613,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -547,14 +613,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
547 public void onClick(DialogInterface dialogInterface, int i) { 613 public void onClick(DialogInterface dialogInterface, int i) {
548 mPresenter.leaveClass(replay); 614 mPresenter.leaveClass(replay);
549 if (replay) 615 if (replay)
550 - pop(); 616 + quit();
551 } 617 }
552 }) 618 })
553 .create(); 619 .create();
554 alertDialog.show(); 620 alertDialog.show();
555 621
556 } else { 622 } else {
557 - pop(); 623 + quit();
558 } 624 }
559 return true; 625 return true;
560 } 626 }
@@ -566,6 +632,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -566,6 +632,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
566 private TextView mEndTime, mCurrentTime; 632 private TextView mEndTime, mCurrentTime;
567 private boolean mShowing; 633 private boolean mShowing;
568 private boolean mDragging; 634 private boolean mDragging;
  635 + private RelativeLayout mMeadiaContrillerRight;
569 636
570 637
571 @SuppressLint("HandlerLeak") 638 @SuppressLint("HandlerLeak")
@@ -649,6 +716,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -649,6 +716,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
649 } 716 }
650 } 717 }
651 718
  719 + @Override
  720 + public void renderClassName(String className) {
  721 + mClassName.setText(className);
  722 + }
  723 +
  724 + @Override
  725 + public void hideInitPic() {
  726 + getBaseActivity().runOnUiThread(new Runnable() {
  727 + @Override
  728 + public void run() {
  729 + initPic.setVisibility(View.INVISIBLE);
  730 + }
  731 + });
  732 + }
  733 +
  734 + @Override
  735 + public SurfaceView getSurfaceView() {
  736 + return mSurfaceView;
  737 + }
652 738
653 private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() { 739 private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
654 740
@@ -688,8 +774,12 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live @@ -688,8 +774,12 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
688 */ 774 */
689 public void showMediaContainer(int timeout) { 775 public void showMediaContainer(int timeout) {
690 if (!mShowing) { 776 if (!mShowing) {
691 - if (mPauseButton != null)  
692 - mPauseButton.requestFocus(); 777 + if (mPauseContainer != null) {
  778 + mPauseContainer.requestLayout();
  779 + mPauseContainer.requestFocus();
  780 + }
  781 +
  782 +
693 mShowing = true; 783 mShowing = true;
694 } 784 }
695 updatePausePlay(); 785 updatePausePlay();
@@ -18,7 +18,7 @@ import com.xdy.home.vp.LivePresenter; @@ -18,7 +18,7 @@ import com.xdy.home.vp.LivePresenter;
18 * @file SiteInputFragment.java 18 * @file SiteInputFragment.java
19 * @brief 站点输入界面 19 * @brief 站点输入界面
20 * @date 2017/3/23 0023 20 * @date 2017/3/23 0023
21 - * Copyright (c) 2017, 上品折扣 21 + * Copyright (c) 2017, 学点云
22 * All rights reserved. 22 * All rights reserved.
23 */ 23 */
24 public class SiteInputFragment extends AppBaseFragment<LivePresenter> implements View.OnClickListener { 24 public class SiteInputFragment extends AppBaseFragment<LivePresenter> implements View.OnClickListener {
@@ -14,7 +14,7 @@ import com.xdy.home.entity.UserEntity; @@ -14,7 +14,7 @@ import com.xdy.home.entity.UserEntity;
14 * @file AccountUtils.java 14 * @file AccountUtils.java
15 * @brief 账户管理工具类 15 * @brief 账户管理工具类
16 * @date 2017-10-24 16 * @date 2017-10-24
17 - * Copyright (c) 2017, 上品折扣[] 17 + * Copyright (c) 2017, 学点云
18 * All rights reserved. 18 * All rights reserved.
19 */ 19 */
20 public class AccountUtils { 20 public class AccountUtils {
@@ -90,6 +90,7 @@ public class AccountUtils { @@ -90,6 +90,7 @@ public class AccountUtils {
90 user.setRecordPlaybackMaxTime(userInfo.getRecordPlaybackMaxTime()); 90 user.setRecordPlaybackMaxTime(userInfo.getRecordPlaybackMaxTime());
91 user.setClassTimestamp(userInfo.getClassTimestamp()); 91 user.setClassTimestamp(userInfo.getClassTimestamp());
92 user.setClassId(userInfo.getClassId()); 92 user.setClassId(userInfo.getClassId());
  93 + user.setClassName(userInfo.getClassName());
93 } 94 }
94 //保存到缓存 95 //保存到缓存
95 mCacheUtil.put(CacheKey.USERINFO, result); 96 mCacheUtil.put(CacheKey.USERINFO, result);
@@ -6,7 +6,7 @@ package com.xdy.home.util; @@ -6,7 +6,7 @@ package com.xdy.home.util;
6 * @file CacheKey.java 6 * @file CacheKey.java
7 * @brief 7 * @brief
8 * @date 2017/3/25 8 * @date 2017/3/25
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public interface CacheKey { 12 public interface CacheKey {
@@ -6,7 +6,7 @@ package com.xdy.home.util; @@ -6,7 +6,7 @@ package com.xdy.home.util;
6 * @file Constants.java 6 * @file Constants.java
7 * @brief 7 * @brief
8 * @date 2017/3/23 0023 8 * @date 2017/3/23 0023
9 - * Copyright (c) 2017, 上品折扣 9 + * Copyright (c) 2017, 学点云
10 * All rights reserved. 10 * All rights reserved.
11 */ 11 */
12 public interface Constants { 12 public interface Constants {
1 -package com.xdy.home.util;  
2 -  
3 -import android.annotation.SuppressLint;  
4 -import android.content.Context;  
5 -import android.content.res.Resources;  
6 -import android.graphics.Rect;  
7 -import android.media.AudioManager;  
8 -import android.os.Build;  
9 -import android.os.Handler;  
10 -import android.os.Message;  
11 -import android.util.AttributeSet;  
12 -import android.util.Log;  
13 -import android.view.Gravity;  
14 -import android.view.KeyEvent;  
15 -import android.view.LayoutInflater;  
16 -import android.view.MotionEvent;  
17 -import android.view.View;  
18 -import android.widget.FrameLayout;  
19 -import android.widget.ImageButton;  
20 -import android.widget.PopupWindow;  
21 -import android.widget.ProgressBar;  
22 -import android.widget.SeekBar;  
23 -import android.widget.TextView;  
24 -  
25 -import com.pili.pldroid.player.IMediaController;  
26 -import com.xdy.home.R;  
27 -  
28 -import java.util.Locale;  
29 -  
30 -/**  
31 - * You can write a custom MediaController instead of this class  
32 - * A MediaController widget must implement all the interface defined by com.pili.pldroid.player.IMediaController  
33 - */  
34 -public class MediaController extends FrameLayout implements IMediaController {  
35 -  
36 - private static final String TAG = "PLMediaController";  
37 - private MediaPlayerControl mPlayer;  
38 - private Context mContext;  
39 - private PopupWindow mWindow;  
40 - private int mAnimStyle;  
41 - private View mAnchor;  
42 - private View mRoot;  
43 - private ProgressBar mProgress;  
44 - private TextView mEndTime, mCurrentTime;  
45 - private long mDuration;  
46 - private boolean mShowing;  
47 - private boolean mDragging;  
48 - private boolean mInstantSeeking = true;  
49 - private static int sDefaultTimeout = 3000;  
50 - private static final int SEEK_TO_POST_DELAY_MILLIS = 200;  
51 -  
52 - private static final int FADE_OUT = 1;  
53 - private static final int SHOW_PROGRESS = 2;  
54 - private boolean mFromXml = false;  
55 - private ImageButton mPauseButton;  
56 - private ImageButton mFfwdButton;  
57 - private ImageButton mRewButton;  
58 - private ImageButton mNextButton;  
59 - private ImageButton mPrevButton;  
60 -  
61 - private boolean mUseFastForward;  
62 -  
63 - private static final int IC_MEDIA_PAUSE_ID = Resources.getSystem().getIdentifier("ic_media_pause", "drawable", "android");  
64 - private static final int IC_MEDIA_PLAY_ID = Resources.getSystem().getIdentifier("ic_media_play", "drawable", "android");  
65 - private static final int MEDIA_CONTROLLER_ID = Resources.getSystem().getIdentifier("media_controller", "layout", "android");  
66 - private static final int PRV_BUTTON_ID = Resources.getSystem().getIdentifier("prev", "id", "android");  
67 - private static final int FFWD_BUTTON_ID = Resources.getSystem().getIdentifier("ffwd", "id", "android");  
68 - private static final int NEXT_BUTTON_ID = Resources.getSystem().getIdentifier("next", "id", "android");  
69 - private static final int REW_BUTTON_ID = Resources.getSystem().getIdentifier("rew", "id", "android");  
70 - private static final int PAUSE_BUTTON_ID = Resources.getSystem().getIdentifier("pauseAndStart", "id", "android");  
71 - private static final int MEDIACONTROLLER_PROGRESS_ID = Resources.getSystem().getIdentifier("mediacontroller_progress", "id", "android");  
72 - private static final int END_TIME_ID = Resources.getSystem().getIdentifier("time", "id", "android");  
73 - private static final int CURRENT_TIME_ID = Resources.getSystem().getIdentifier("time_current", "id", "android");  
74 -  
75 - private AudioManager mAM;  
76 - private Runnable mLastSeekBarRunnable;  
77 - private boolean mDisableProgress = false;  
78 -  
79 - public MediaController(Context context, AttributeSet attrs) {  
80 - super(context, attrs);  
81 - mRoot = this;  
82 - mFromXml = true;  
83 - initController(context);  
84 - }  
85 -  
86 - public MediaController(Context context) {  
87 - super(context);  
88 - if (!mFromXml && initController(context))  
89 - initFloatingWindow();  
90 - }  
91 -  
92 - public MediaController(Context context, boolean useFastForward, boolean disableProgressBar) {  
93 - this(context);  
94 - mUseFastForward = useFastForward;  
95 - mDisableProgress = disableProgressBar;  
96 - }  
97 -  
98 - public MediaController(Context context, boolean useFastForward) {  
99 - this(context);  
100 - mUseFastForward = useFastForward;  
101 - mContext = context.getApplicationContext();  
102 - mAM = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);  
103 - mRoot = this;  
104 - initFloatingWindow();  
105 - }  
106 -  
107 - private boolean initController(Context context) {  
108 - mUseFastForward = true;  
109 - mContext = context.getApplicationContext();  
110 - mAM = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);  
111 - return true;  
112 - }  
113 -  
114 - @Override  
115 - public void onFinishInflate() {  
116 - if (mRoot != null)  
117 - initControllerView(mRoot);  
118 - super.onFinishInflate();  
119 - }  
120 -  
121 - private void initFloatingWindow() {  
122 - mWindow = new PopupWindow(mContext);  
123 - mWindow.setFocusable(false);  
124 - mWindow.setBackgroundDrawable(null);  
125 - mWindow.setOutsideTouchable(true);  
126 - mAnimStyle = android.R.style.Animation;  
127 - }  
128 -  
129 - /**  
130 - * Create the view that holds the widgets that control playback. Derived  
131 - * classes can override this to create their own.  
132 - * @return The controller view.  
133 - */  
134 - protected View makeControllerView() {  
135 - return ((LayoutInflater) mContext  
136 - .getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.home_media_controller, this);  
137 - }  
138 -  
139 - private void initControllerView(View v) {  
140 - // By default these are hidden.  
141 - mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);  
142 - if (mPrevButton != null) {  
143 - mPrevButton.setVisibility(View.GONE);  
144 - }  
145 - mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);  
146 - if (mNextButton != null) {  
147 - mNextButton.setVisibility(View.GONE);  
148 - }  
149 -  
150 - mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);  
151 - if (mFfwdButton != null) {  
152 - mFfwdButton.setOnClickListener(mFfwdListener);  
153 - if (!mFromXml) {  
154 - mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);  
155 - }  
156 - }  
157 -  
158 - mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);  
159 - if (mRewButton != null) {  
160 - mRewButton.setOnClickListener(mRewListener);  
161 - if (!mFromXml) {  
162 - mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);  
163 - }  
164 - }  
165 -  
166 - //自定义  
167 - mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play);  
168 - if (mPauseButton != null) {  
169 - mPauseButton.requestFocus();  
170 - mPauseButton.setOnClickListener(mPauseListener);  
171 - }  
172 - //自定义  
173 - mProgress = (SeekBar) v.findViewById(R.id.sb_live);  
174 - if (mProgress != null) {  
175 - if (mProgress instanceof SeekBar) {  
176 - SeekBar seeker = (SeekBar) mProgress;  
177 - seeker.setOnSeekBarChangeListener(mSeekListener);  
178 - seeker.setThumbOffset(1);  
179 - }  
180 - mProgress.setMax(1000);  
181 - mProgress.setEnabled(!mDisableProgress);  
182 - }  
183 -  
184 - mEndTime = (TextView) v.findViewById(R.id.tv_end_time);  
185 - mCurrentTime = (TextView) v.findViewById(R.id.tv_current_time);  
186 - }  
187 -  
188 - /**  
189 - * Control the action when the seekbar dragged by user  
190 - * @param seekWhenDragging True the media will seek periodically  
191 - */  
192 - public void setInstantSeeking(boolean seekWhenDragging) {  
193 - mInstantSeeking = seekWhenDragging;  
194 - }  
195 -  
196 - private void disableUnsupportedButtons() {  
197 - try {  
198 - if (mPauseButton != null && !mPlayer.canPause())  
199 - mPauseButton.setEnabled(false);  
200 - } catch (IncompatibleClassChangeError ex) {  
201 - }  
202 - }  
203 -  
204 - /**  
205 - * <p>  
206 - * Change the animation style resource for this controller.  
207 - * </p>  
208 - * <p>  
209 - * <p>  
210 - * If the controller is showing, calling this method will take effect only  
211 - * the next time the controller is shown.  
212 - * </p>  
213 - * @param animationStyle animation style to use when the controller appears and disappears.  
214 - * Set to -1 for the default animation, 0 for no animation,  
215 - * or a resource identifier for an explicit animation.  
216 - */  
217 - public void setAnimationStyle(int animationStyle) {  
218 - mAnimStyle = animationStyle;  
219 - }  
220 -  
221 - public interface OnShownListener {  
222 - public void onShown();  
223 - }  
224 -  
225 - private OnShownListener mShownListener;  
226 -  
227 - public void setOnShownListener(OnShownListener l) {  
228 - mShownListener = l;  
229 - }  
230 -  
231 - public interface OnHiddenListener {  
232 - public void onHidden();  
233 - }  
234 -  
235 - private OnHiddenListener mHiddenListener;  
236 -  
237 - public void setOnHiddenListener(OnHiddenListener l) {  
238 - mHiddenListener = l;  
239 - }  
240 -  
241 - @SuppressLint("HandlerLeak")  
242 - private Handler mHandler = new Handler() {  
243 - @Override  
244 - public void handleMessage(Message msg) {  
245 - long pos;  
246 - switch (msg.what) {  
247 - case FADE_OUT:  
248 - hide();  
249 - break;  
250 - case SHOW_PROGRESS:  
251 - pos = setProgress();  
252 - if (!mDragging && mShowing) {  
253 - msg = obtainMessage(SHOW_PROGRESS);  
254 - sendMessageDelayed(msg, 1000 - (pos % 1000));  
255 - updatePausePlay();  
256 - }  
257 - break;  
258 - }  
259 - }  
260 - };  
261 -  
262 - private long setProgress() {  
263 - if (mPlayer == null || mDragging)  
264 - return 0;  
265 -  
266 - long position = mPlayer.getCurrentPosition();  
267 - long duration = mPlayer.getDuration();  
268 - if (mProgress != null) {  
269 - if (duration > 0) {  
270 - long pos = 1000L * position / duration;  
271 - mProgress.setProgress((int) pos);  
272 - }  
273 - int percent = mPlayer.getBufferPercentage();  
274 - mProgress.setSecondaryProgress(percent * 10);  
275 - }  
276 -  
277 - mDuration = duration;  
278 -  
279 - if (mEndTime != null)  
280 - mEndTime.setText(generateTime(mDuration));  
281 - if (mCurrentTime != null)  
282 - mCurrentTime.setText(generateTime(position));  
283 -  
284 - return position;  
285 - }  
286 -  
287 - private static String generateTime(long position) {  
288 - int totalSeconds = (int) (position / 1000);  
289 -  
290 - int seconds = totalSeconds % 60;  
291 - int minutes = (totalSeconds / 60) % 60;  
292 - int hours = totalSeconds / 3600;  
293 -  
294 - if (hours > 0) {  
295 - return String.format(Locale.US, "%02d:%02d:%02d", hours, minutes,  
296 - seconds).toString();  
297 - } else {  
298 - return String.format(Locale.US, "%02d:%02d", minutes, seconds)  
299 - .toString();  
300 - }  
301 - }  
302 -  
303 - @Override  
304 - public boolean onTouchEvent(MotionEvent event) {  
305 - show(sDefaultTimeout);  
306 - return true;  
307 - }  
308 -  
309 - @Override  
310 - public boolean onTrackballEvent(MotionEvent ev) {  
311 - show(sDefaultTimeout);  
312 - return false;  
313 - }  
314 -  
315 - @Override  
316 - public boolean dispatchKeyEvent(KeyEvent event) {  
317 - int keyCode = event.getKeyCode();  
318 - if (event.getRepeatCount() == 0  
319 - && (keyCode == KeyEvent.KEYCODE_HEADSETHOOK  
320 - || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {  
321 - doPauseResume();  
322 - show(sDefaultTimeout);  
323 - if (mPauseButton != null)  
324 - mPauseButton.requestFocus();  
325 - return true;  
326 - } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {  
327 - if (mPlayer.isPlaying()) {  
328 - mPlayer.pause();  
329 - updatePausePlay();  
330 - }  
331 - return true;  
332 - } else if (keyCode == KeyEvent.KEYCODE_BACK  
333 - || keyCode == KeyEvent.KEYCODE_MENU) {  
334 - hide();  
335 - return true;  
336 - } else {  
337 - show(sDefaultTimeout);  
338 - }  
339 - return super.dispatchKeyEvent(event);  
340 - }  
341 -  
342 - private OnClickListener mPauseListener = new OnClickListener() {  
343 - public void onClick(View v) {  
344 - doPauseResume();  
345 - show(sDefaultTimeout);  
346 - }  
347 - };  
348 -  
349 - private void updatePausePlay() {  
350 - if (mRoot == null || mPauseButton == null)  
351 - return;  
352 -  
353 - if (mPlayer.isPlaying())  
354 - mPauseButton.setImageResource(R.mipmap.stop);  
355 - else  
356 - mPauseButton.setImageResource(R.mipmap.play);  
357 - }  
358 -  
359 - private void doPauseResume() {  
360 - if (mPlayer.isPlaying()) {  
361 - mPlayer.pause();  
362 - } else {  
363 - mPlayer.start();  
364 - }  
365 - updatePausePlay();  
366 - }  
367 -  
368 - private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {  
369 -  
370 - public void onStartTrackingTouch(SeekBar bar) {  
371 - mDragging = true;  
372 - show(3600000);  
373 - mHandler.removeMessages(SHOW_PROGRESS);  
374 - if (mInstantSeeking)  
375 - mAM.setStreamMute(AudioManager.STREAM_MUSIC, true);  
376 - }  
377 -  
378 - public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {  
379 - if (!fromuser)  
380 - return;  
381 -  
382 - final long newposition = (long) (mDuration * progress) / 1000;  
383 - String time = generateTime(newposition);  
384 - if (mInstantSeeking) {  
385 - mHandler.removeCallbacks(mLastSeekBarRunnable);  
386 - mLastSeekBarRunnable = new Runnable() {  
387 - @Override  
388 - public void run() {  
389 - mPlayer.seekTo(newposition);  
390 - }  
391 - };  
392 - mHandler.postDelayed(mLastSeekBarRunnable, SEEK_TO_POST_DELAY_MILLIS);  
393 - }  
394 - if (mCurrentTime != null)  
395 - mCurrentTime.setText(time);  
396 - }  
397 -  
398 - public void onStopTrackingTouch(SeekBar bar) {  
399 - if (!mInstantSeeking)  
400 - mPlayer.seekTo(mDuration * bar.getProgress() / 1000);  
401 -  
402 - show(sDefaultTimeout);  
403 - mHandler.removeMessages(SHOW_PROGRESS);  
404 - mAM.setStreamMute(AudioManager.STREAM_MUSIC, false);  
405 - mDragging = false;  
406 - mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);  
407 - }  
408 - };  
409 -  
410 - private OnClickListener mRewListener = new OnClickListener() {  
411 - public void onClick(View v) {  
412 - long pos = mPlayer.getCurrentPosition();  
413 - pos -= 5000; // milliseconds  
414 - mPlayer.seekTo(pos);  
415 - setProgress();  
416 -  
417 - show(sDefaultTimeout);  
418 - }  
419 - };  
420 -  
421 - private OnClickListener mFfwdListener = new OnClickListener() {  
422 - public void onClick(View v) {  
423 - long pos = mPlayer.getCurrentPosition();  
424 - pos += 15000; // milliseconds  
425 - mPlayer.seekTo(pos);  
426 - setProgress();  
427 -  
428 - show(sDefaultTimeout);  
429 - }  
430 - };  
431 -  
432 - /**  
433 - * Set the view that acts as the anchor for the control view.  
434 - * <p>  
435 - * - This can for example be a VideoView, or your Activity's main view.  
436 - * - AudioPlayer has no anchor view, so the view parameter will be null.  
437 - * @param view The view to which to anchor the controller when it is visible.  
438 - */  
439 - @Override  
440 - public void setAnchorView(View view) {  
441 - mAnchor = view;  
442 - if (mAnchor == null) {  
443 - sDefaultTimeout = 0; // showMediaContainer forever  
444 - }  
445 - if (!mFromXml) {  
446 - removeAllViews();  
447 - mRoot = makeControllerView();  
448 - mWindow.setContentView(mRoot);  
449 - mWindow.setWidth(LayoutParams.MATCH_PARENT);  
450 - mWindow.setHeight(LayoutParams.WRAP_CONTENT);  
451 - }  
452 - initControllerView(mRoot);  
453 - }  
454 -  
455 - @Override  
456 - public void setMediaPlayer(MediaPlayerControl player) {  
457 - mPlayer = player;  
458 - updatePausePlay();  
459 - }  
460 -  
461 - @Override  
462 - public void show() {  
463 - show(sDefaultTimeout);  
464 - }  
465 -  
466 - /**  
467 - * Show the controller on screen. It will go away automatically after  
468 - * 'timeout' milliseconds of inactivity.  
469 - * @param timeout The timeout in milliseconds. Use 0 to showMediaContainer the controller until hideMediaContainer() is called.  
470 - */  
471 - @Override  
472 - public void show(int timeout) {  
473 - if (!mShowing) {  
474 - if (mAnchor != null && mAnchor.getWindowToken() != null) {  
475 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {  
476 - mAnchor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);  
477 - }  
478 - }  
479 - if (mPauseButton != null)  
480 - mPauseButton.requestFocus();  
481 - disableUnsupportedButtons();  
482 -  
483 - if (mFromXml) {  
484 - setVisibility(View.VISIBLE);  
485 - } else {  
486 - int[] location = new int[2];  
487 -  
488 - if (mAnchor != null) {  
489 - mAnchor.getLocationOnScreen(location);  
490 - Rect anchorRect = new Rect(location[0], location[1],  
491 - location[0] + mAnchor.getWidth(), location[1]  
492 - + mAnchor.getHeight());  
493 -  
494 - mWindow.setAnimationStyle(mAnimStyle);  
495 - mWindow.showAtLocation(mAnchor, Gravity.BOTTOM,  
496 - anchorRect.left, 0);  
497 - } else {  
498 - Rect anchorRect = new Rect(location[0], location[1],  
499 - location[0] + mRoot.getWidth(), location[1]  
500 - + mRoot.getHeight());  
501 -  
502 - mWindow.setAnimationStyle(mAnimStyle);  
503 - mWindow.showAtLocation(mRoot, Gravity.BOTTOM,  
504 - anchorRect.left, 0);  
505 - }  
506 - }  
507 - mShowing = true;  
508 - if (mShownListener != null)  
509 - mShownListener.onShown();  
510 - }  
511 - updatePausePlay();  
512 - mHandler.sendEmptyMessage(SHOW_PROGRESS);  
513 -  
514 - if (timeout != 0) {  
515 - mHandler.removeMessages(FADE_OUT);  
516 - mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT),  
517 - timeout);  
518 - }  
519 - }  
520 -  
521 - @Override  
522 - public boolean isShowing() {  
523 - return mShowing;  
524 - }  
525 -  
526 - @Override  
527 - public void hide() {  
528 - if (mShowing) {  
529 - if (mAnchor != null) {  
530 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {  
531 - //mAnchor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);  
532 - }  
533 - }  
534 - try {  
535 - mHandler.removeMessages(SHOW_PROGRESS);  
536 - if (mFromXml)  
537 - setVisibility(View.GONE);  
538 - else  
539 - mWindow.dismiss();  
540 - } catch (IllegalArgumentException ex) {  
541 - Log.d(TAG, "MediaController already removed");  
542 - }  
543 - mShowing = false;  
544 - if (mHiddenListener != null)  
545 - mHiddenListener.onHidden();  
546 - }  
547 - }  
548 -  
549 - @Override  
550 - public void setEnabled(boolean enabled) {  
551 - if (mPauseButton != null) {  
552 - mPauseButton.setEnabled(enabled);  
553 - }  
554 - if (mFfwdButton != null) {  
555 - mFfwdButton.setEnabled(enabled);  
556 - }  
557 - if (mRewButton != null) {  
558 - mRewButton.setEnabled(enabled);  
559 - }  
560 - if (mProgress != null && !mDisableProgress)  
561 - mProgress.setEnabled(enabled);  
562 - disableUnsupportedButtons();  
563 - super.setEnabled(enabled);  
564 - }  
565 -}  
@@ -33,7 +33,7 @@ import com.xdy.home.model.DefaultPresenterCallBack; @@ -33,7 +33,7 @@ import com.xdy.home.model.DefaultPresenterCallBack;
33 * @file RefundContract.java 33 * @file RefundContract.java
34 * @brief 直播契约类 34 * @brief 直播契约类
35 * @date 2017/3/24 35 * @date 2017/3/24
36 - * Copyright (c) 2017, 上品折扣 36 + * Copyright (c) 2017, 学点云
37 * All rights reserved. 37 * All rights reserved.
38 */ 38 */
39 public interface LiveContract { 39 public interface LiveContract {
@@ -94,8 +94,9 @@ public interface LiveContract { @@ -94,8 +94,9 @@ public interface LiveContract {
94 /** 94 /**
95 * 添加surfaceview 95 * 添加surfaceview
96 * @param surfaceview 96 * @param surfaceview
  97 + * @param show
97 */ 98 */
98 - void addSurfaceView(SurfaceView surfaceview); 99 + void addSurfaceView(SurfaceView surfaceview, boolean show);
99 100
100 /** 101 /**
101 * 刷新按钮 102 * 刷新按钮
@@ -109,6 +110,20 @@ public interface LiveContract { @@ -109,6 +110,20 @@ public interface LiveContract {
109 void seek(int keyFrameSeek); 110 void seek(int keyFrameSeek);
110 111
111 void pauseOrStartEverything(); 112 void pauseOrStartEverything();
  113 +
  114 + /**
  115 + * 显示课堂名称
  116 + * @param className
  117 + */
  118 + void renderClassName(String className);
  119 +
  120 + void hideInitPic();
  121 +
  122 + /**
  123 + * 获取显示的界面
  124 + * @return
  125 + */
  126 + SurfaceView getSurfaceView();
112 } 127 }
113 128
114 interface ChatView extends BaseView { 129 interface ChatView extends BaseView {
@@ -126,6 +141,11 @@ public interface LiveContract { @@ -126,6 +141,11 @@ public interface LiveContract {
126 141
127 //返回的更新标注 142 //返回的更新标注
128 void renderUpdateAnnotation(WhiteboardUpdateEntity entity); 143 void renderUpdateAnnotation(WhiteboardUpdateEntity entity);
  144 +
  145 + /**
  146 + * 清除文档界面
  147 + */
  148 + void clear();
129 } 149 }
130 150
131 interface Model extends IModel { 151 interface Model extends IModel {
@@ -13,7 +13,7 @@ import dagger.Provides; @@ -13,7 +13,7 @@ import dagger.Provides;
13 * @version 1.0 13 * @version 1.0
14 * @file RefundModule.java 14 * @file RefundModule.java
15 * @date 2017/2/24 15 * @date 2017/2/24
16 - * Copyright (c) 2017, 上品折扣 16 + * Copyright (c) 2017, 学点云
17 * All rights reserved. 17 * All rights reserved.
18 */ 18 */
19 @Module 19 @Module
@@ -7,7 +7,9 @@ import android.hardware.Camera; @@ -7,7 +7,9 @@ import android.hardware.Camera;
7 import android.text.TextUtils; 7 import android.text.TextUtils;
8 import android.util.Log; 8 import android.util.Log;
9 9
  10 +import com.daniulive.smartplayer.SmartPlayerJni;
10 import com.daniulive.smartplayer.SmartPublisherJni; 11 import com.daniulive.smartplayer.SmartPublisherJni;
  12 +import com.eventhandle.SmartEventCallback;
11 import com.voiceengine.NTAudioRecord; 13 import com.voiceengine.NTAudioRecord;
12 import com.xdy.commonlibrary.core.CommonAppLike; 14 import com.xdy.commonlibrary.core.CommonAppLike;
13 import com.xdy.commonlibrary.di.scope.ActivityScope; 15 import com.xdy.commonlibrary.di.scope.ActivityScope;
@@ -25,7 +27,6 @@ import com.xdy.home.entity.UserEntity; @@ -25,7 +27,6 @@ import com.xdy.home.entity.UserEntity;
25 import com.xdy.home.entity.VideoEntity; 27 import com.xdy.home.entity.VideoEntity;
26 import com.xdy.home.entity.WhiteboardUpdateEntity; 28 import com.xdy.home.entity.WhiteboardUpdateEntity;
27 import com.xdy.home.event.ActionPushOrClose; 29 import com.xdy.home.event.ActionPushOrClose;
28 -import com.xdy.home.event.EventHande;  
29 import com.xdy.home.model.DefaultPresenterCallBack; 30 import com.xdy.home.model.DefaultPresenterCallBack;
30 import com.xdy.home.util.AccountUtils; 31 import com.xdy.home.util.AccountUtils;
31 import com.xdy.home.util.Constants; 32 import com.xdy.home.util.Constants;
@@ -54,9 +55,12 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -54,9 +55,12 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
54 55
55 static { 56 static {
56 // 推流使用,做1对1放开 System.load("libSmartPublisher.so"); 57 // 推流使用,做1对1放开 System.load("libSmartPublisher.so");
  58 + System.loadLibrary("SmartPlayer");
57 // System.load("libSmartPlayer.so"); 59 // System.load("libSmartPlayer.so");
58 } 60 }
59 61
  62 + private long playerHandle = 0;
  63 +
60 private LiveContract.DocView docView; 64 private LiveContract.DocView docView;
61 65
62 private LiveContract.ChatView chatView; 66 private LiveContract.ChatView chatView;
@@ -85,7 +89,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -85,7 +89,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
85 * 退出标记 89 * 退出标记
86 */ 90 */
87 private boolean quit; 91 private boolean quit;
88 - 92 + /**
  93 + * 是否结束了
  94 + */
  95 + private boolean isOver;
89 96
90 @Inject 97 @Inject
91 public LivePresenter(LiveContract.Model model, 98 public LivePresenter(LiveContract.Model model,
@@ -94,8 +101,44 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -94,8 +101,44 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
94 this.docView = docView; 101 this.docView = docView;
95 this.chatView = chatView; 102 this.chatView = chatView;
96 EventBus.getDefault().register(this); 103 EventBus.getDefault().register(this);
  104 +
  105 + libPlayer = new SmartPlayerJni();
97 } 106 }
98 107
  108 + public void close() {
  109 + if (isPlaybackViewStarted) {
  110 + int i = libPlayer.SmartPlayerClose(playerHandle);
  111 + playerHandle = 0;
  112 + isPlaybackViewStarted = false;
  113 + Log.i(TAG, "Stop playback stream--");
  114 + }
  115 + }
  116 +
  117 + public void start(String playbackUrl) {
  118 + isPlaybackViewStarted = true;
  119 + playerHandle = libPlayer.SmartPlayerInit(mRootView.getContext());
  120 +
  121 + if (playerHandle == 0) {
  122 + Log.e(TAG, "surfaceHandle with nil..");
  123 + return;
  124 + }
  125 +
  126 + libPlayer.SetSmartPlayerEventCallback(playerHandle, new EventHande());
  127 +
  128 + libPlayer.SmartPlayerSetSurface(playerHandle, mRootView.getSurfaceView()); //if set the second param with null, it means it will playback audio
  129 +
  130 + libPlayer.SmartPlayerSetAudioOutputType(playerHandle, 0);
  131 +
  132 + libPlayer.SmartPlayerSetBuffer(playerHandle, 200);
  133 +
  134 +
  135 + int iPlaybackRet = libPlayer.SmartPlayerStartPlayback(playerHandle, playbackUrl);
  136 +
  137 + if (iPlaybackRet != 0) {
  138 + LogUtil.e(TAG, "StartPlayback strem failed..");
  139 + return;
  140 + }
  141 + }
99 142
100 /** 143 /**
101 * 初始化课堂 144 * 初始化课堂
@@ -200,6 +243,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -200,6 +243,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
200 if (user != null) { 243 if (user != null) {
201 AccountUtils.saveUser(user); 244 AccountUtils.saveUser(user);
202 recordPlaybackMaxTime = user.getRecordPlaybackMaxTime(); 245 recordPlaybackMaxTime = user.getRecordPlaybackMaxTime();
  246 + String className = user.getClassName();
  247 + mRootView.renderClassName(className);
203 mRootView.renderLogin(false, false); 248 mRootView.renderLogin(false, false);
204 } else { 249 } else {
205 mRootView.quit(); 250 mRootView.quit();
@@ -218,7 +263,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -218,7 +263,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
218 case Constants.DOCUMENT_UPDATE: 263 case Constants.DOCUMENT_UPDATE:
219 UpdateDoc updateDoc = GsonUtil.json2Bean(pa, UpdateDoc.class); 264 UpdateDoc updateDoc = GsonUtil.json2Bean(pa, UpdateDoc.class);
220 // // 获取文档的图片地址 265 // // 获取文档的图片地址
221 - getDocAddress(updateDoc, updateDoc.relativeUrl, updateDoc.fileType, updateDoc.pageNum, updateDoc.curPageNo); 266 + if (updateDoc.visible)
  267 + getDocAddress(updateDoc, updateDoc.relativeUrl, updateDoc.fileType, updateDoc.pageNum, updateDoc.curPageNo);
222 break; 268 break;
223 case Constants.DOCUMENT_DELETE: 269 case Constants.DOCUMENT_DELETE:
224 try { 270 try {
@@ -256,12 +302,15 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -256,12 +302,15 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
256 switch (status) { 302 switch (status) {
257 case Constants.RECORD_READY: 303 case Constants.RECORD_READY:
258 pause = true; 304 pause = true;
  305 + isOver = false;
259 break; 306 break;
260 case Constants.RECORD_PLAYING: 307 case Constants.RECORD_PLAYING:
261 pause = false; 308 pause = false;
  309 + isOver = false;
262 mRootView.pauseOrStartEverything(); 310 mRootView.pauseOrStartEverything();
263 break; 311 break;
264 case Constants.RECORD_SEEK: 312 case Constants.RECORD_SEEK:
  313 + isOver = false;
265 pause = false; 314 pause = false;
266 int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime"); 315 int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime");
267 mRootView.seek(keyFrameSeek); 316 mRootView.seek(keyFrameSeek);
@@ -269,12 +318,18 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -269,12 +318,18 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
269 case Constants.RECORD_STOP: 318 case Constants.RECORD_STOP:
270 pause = true; 319 pause = true;
271 //停止后 录制回放要进行初始化 320 //停止后 录制回放要进行初始化
272 - if (!quit) { 321 + if (!quit) {//回放结束了
  322 + isOver = true;
  323 + if (currentTime < recordPlaybackMaxTime)
  324 + currentTime++;
273 int classId = AccountUtils.getUser().getClassId(); 325 int classId = AccountUtils.getUser().getClassId();
274 mModel.initRecordPlayback(classId, portal, userRole, userId); 326 mModel.initRecordPlayback(classId, portal, userRole, userId);
  327 + //停止视频
  328 + mRootView.stopVideo();
275 } 329 }
276 break; 330 break;
277 case Constants.RECORD_PAUSE: 331 case Constants.RECORD_PAUSE:
  332 + isOver = false;
278 pause = true; 333 pause = true;
279 mRootView.pauseOrStartEverything(); 334 mRootView.pauseOrStartEverything();
280 break; 335 break;
@@ -359,7 +414,6 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -359,7 +414,6 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
359 414
360 @Override 415 @Override
361 public void loadSuccess(String s) { 416 public void loadSuccess(String s) {
362 - LogUtil.i(TAG,s);  
363 try { 417 try {
364 String replace = s.replace("\\", ""); 418 String replace = s.replace("\\", "");
365 String substring = replace.substring(1, replace.length() - 1); 419 String substring = replace.substring(1, replace.length() - 1);
@@ -368,7 +422,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -368,7 +422,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
368 s = jsonArray.getString(page - 1); 422 s = jsonArray.getString(page - 1);
369 } catch (JSONException e) { 423 } catch (JSONException e) {
370 e.printStackTrace(); 424 e.printStackTrace();
371 - LogUtil.i(TAG,"文档解析失败"); 425 + LogUtil.i(TAG, "文档解析失败");
372 } 426 }
373 427
374 docView.renderDocAddress(updateDoc, s); 428 docView.renderDocAddress(updateDoc, s);
@@ -417,6 +471,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -417,6 +471,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
417 } 471 }
418 472
419 //----------------------------- 1 对 1 使用 接口 473 //----------------------------- 1 对 1 使用 接口
  474 + private SmartPlayerJni libPlayer = null;
  475 + private boolean isPlaybackViewStarted = false;
  476 + private String playbackUrl = null;
  477 + private boolean isMute = false;
420 478
421 /** 479 /**
422 * 消息动作类型 0 (没有动作); 1(开启摄像头推流) ;2(停止推流关闭摄像头) 480 * 消息动作类型 0 (没有动作); 1(开启摄像头推流) ;2(停止推流关闭摄像头)
@@ -705,10 +763,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -705,10 +763,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
705 763
706 @Override 764 @Override
707 public void onDestroy() { 765 public void onDestroy() {
708 -// if (playerHandle != 0) {  
709 -// libPlayer.SmartPlayerClose(playerHandle);  
710 -// playerHandle = 0;  
711 -// } 766 + if (playerHandle != 0) {
  767 + libPlayer.SmartPlayerClose(playerHandle);
  768 + playerHandle = 0;
  769 + }
712 EventBus.getDefault().unregister(this); 770 EventBus.getDefault().unregister(this);
713 super.onDestroy(); 771 super.onDestroy();
714 } 772 }
@@ -719,6 +777,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -719,6 +777,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
719 if (b) 777 if (b)
720 mModel.pauseRecordPlayback(); 778 mModel.pauseRecordPlayback();
721 else { 779 else {
  780 + if (isOver) {
  781 + docView.clear();
  782 + chatView.clearChatHistory();
  783 + }
722 mModel.startRecordPlayback(); 784 mModel.startRecordPlayback();
723 } 785 }
724 } 786 }
@@ -747,4 +809,38 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac @@ -747,4 +809,38 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
747 public void setCurrentTime(int currentTime) { 809 public void setCurrentTime(int currentTime) {
748 this.currentTime = currentTime; 810 this.currentTime = currentTime;
749 } 811 }
  812 +
  813 +
  814 + class EventHande implements SmartEventCallback {
  815 + @Override
  816 + public void onCallback(int code, long param1, long param2, String param3, String param4, Object param5) {
  817 + switch (code) {
  818 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_STARTED:
  819 + Log.i(TAG, "开始。。");
  820 + if (videoMode)
  821 + mRootView.hideInitPic();
  822 + break;
  823 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTING:
  824 + Log.i(TAG, "连接中。。");
  825 + break;
  826 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTION_FAILED:
  827 + Log.i(TAG, "连接失败。。");
  828 + break;
  829 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTED:
  830 + Log.i(TAG, "连接成功。。");
  831 + break;
  832 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_DISCONNECTED:
  833 + Log.i(TAG, "连接断开。。");
  834 + break;
  835 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_STOP:
  836 + Log.i(TAG, "关闭。。");
  837 + break;
  838 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_RESOLUTION_INFO:
  839 + Log.i(TAG, "分辨率信息: width: " + param1 + ", height: " + param2);
  840 + break;
  841 + case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_NO_MEDIADATA_RECEIVED:
  842 + Log.i(TAG, "收不到媒体数据,可能是url错误。。");
  843 + }
  844 + }
  845 + }
750 } 846 }
@@ -16,10 +16,13 @@ import android.view.SurfaceHolder; @@ -16,10 +16,13 @@ import android.view.SurfaceHolder;
16 import android.view.SurfaceView; 16 import android.view.SurfaceView;
17 import android.view.View; 17 import android.view.View;
18 18
  19 +import com.xdy.home.R;
  20 +import com.xdy.home.entity.AnnotaionEntity;
19 import com.xdy.home.entity.PointGroupEntity; 21 import com.xdy.home.entity.PointGroupEntity;
20 import com.xdy.home.entity.PointXY; 22 import com.xdy.home.entity.PointXY;
21 import com.xdy.util.DisplayUtil; 23 import com.xdy.util.DisplayUtil;
22 import com.xdy.util.LogUtil; 24 import com.xdy.util.LogUtil;
  25 +import com.xdy.util.ResUtil;
23 26
24 import java.util.ArrayList; 27 import java.util.ArrayList;
25 import java.util.Iterator; 28 import java.util.Iterator;
@@ -55,6 +58,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -55,6 +58,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
55 private Bitmap mBitmap; 58 private Bitmap mBitmap;
56 private int screenWidth; 59 private int screenWidth;
57 private int currentTop; 60 private int currentTop;
  61 + private boolean adjust;
58 62
59 private void initRect() { 63 private void initRect() {
60 mCurrentMaxScale = Math.max( 64 mCurrentMaxScale = Math.max(
@@ -112,50 +116,63 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -112,50 +116,63 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
112 finalWidth = w = mSurfaceWidth; 116 finalWidth = w = mSurfaceWidth;
113 finalHeight = h = (int) (mImageHeight * scaleRatio); 117 finalHeight = h = (int) (mImageHeight * scaleRatio);
114 118
115 - if (finalHeight < mSurfaceHeight && mImageHeight != 0) {  
116 - //比surfaceview高度要小,则放到中间显示  
117 - int top = 0;  
118 - if ((top = (int) ((mSurfaceHeight - finalHeight) / 2 + 0.5f)) != currentTop) {//重新设置path坐标  
119 - currentTop = top;  
120 -  
121 - pathLists.clear();  
122 - this.historyPointer = 0;  
123 - for (List<PointGroupEntity> pointGroupEntities : originPoint) {  
124 - pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));  
125 - this.historyPointer++;  
126 - for (int j = 0; j < pointGroupEntities.size(); j++) {  
127 - PointGroupEntity pointGroupEntity = pointGroupEntities.get(j);  
128 - Path path = this.getCurrentPath();  
129 - path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop); 119 +
  120 + if (adjust) {
  121 + if (finalHeight < mSurfaceHeight && mImageHeight != 0) {
  122 + //比surfaceview高度要小,则放到中间显示
  123 + int top = 0;
  124 + if ((top = (int) ((mSurfaceHeight - finalHeight) / 2 + 0.5f)) != currentTop) {//重新设置path坐标
  125 + currentTop = top;
  126 +
  127 + pathLists.clear();
  128 + this.historyPointer = 0;
  129 + for (List<PointGroupEntity> pointGroupEntities : originPoint) {
  130 + pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));
  131 + this.historyPointer++;
  132 + for (int j = 0; j < pointGroupEntities.size(); j++) {
  133 + PointGroupEntity pointGroupEntity = pointGroupEntities.get(j);
  134 + Path path = this.getCurrentPath();
  135 + path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
  136 + }
130 } 137 }
131 } 138 }
  139 + mRectDes.left = 0;
  140 + mRectDes.top = currentTop;
  141 + mRectDes.right = w;
  142 + mRectDes.bottom = h + currentTop;
  143 + } else {
  144 + mRectDes.left = 0;
  145 + mRectDes.top = 0;
  146 + mRectDes.right = w;
  147 + mRectDes.bottom = h;
132 } 148 }
133 - mRectDes.left = 0;  
134 - mRectDes.top = currentTop;  
135 - mRectDes.right = w;  
136 - mRectDes.bottom = h + currentTop;  
137 - } else {  
138 - mRectDes.left = 0;  
139 - mRectDes.top = 0;  
140 - mRectDes.right = w;  
141 - mRectDes.bottom = h;  
142 - }  
143 149
144 - mCenterX = w / 2;  
145 - mCenterY = h / 2; 150 + mCenterX = w / 2;
  151 + mCenterY = h / 2;
146 152
147 - mRectSrc.left = 0;  
148 - mRectSrc.top = 0;  
149 - mRectSrc.right = mImageWidth;  
150 - mRectSrc.bottom = mImageHeight; 153 + mRectSrc.left = 0;
  154 + mRectSrc.top = 0;
  155 + mRectSrc.right = mImageWidth;
  156 + mRectSrc.bottom = mImageHeight;
  157 + } else {
  158 + mRectSrc.left = 0;
  159 + mRectSrc.top = 0;
  160 + mRectSrc.right = mImageWidth;
  161 + mRectSrc.bottom = mImageHeight;
  162 +
  163 + mRectDes.left = (mSurfaceWidth - mImageWidth) / 2;
  164 + mRectDes.top = (mSurfaceHeight - mImageHeight) / 2;
  165 + mRectDes.right = (mSurfaceWidth - mImageWidth) / 2 + mImageWidth;
  166 + mRectDes.bottom = (mSurfaceHeight - mImageHeight) / 2 + mImageHeight;
  167 + }
151 } 168 }
152 169
153 public void setMaxZoom(float value) { 170 public void setMaxZoom(float value) {
154 mCurrentMaxScale = value; 171 mCurrentMaxScale = value;
155 } 172 }
156 173
157 - public void setBitmap(Bitmap b) {  
158 - 174 + public void setBitmap(Bitmap b, boolean adjust) {
  175 + this.adjust = adjust;
159 if (b == null) { 176 if (b == null) {
160 return; 177 return;
161 } 178 }
@@ -183,26 +200,28 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -183,26 +200,28 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
183 mCenterX -= offsetX; 200 mCenterX -= offsetX;
184 mCenterY -= offsetY; 201 mCenterY -= offsetY;
185 202
186 - if (finalHeight > mSurfaceHeight) {  
187 - int tempTop = mRectDes.top + offsetY;  
188 -  
189 - int deltaTop = 0;  
190 - if (tempTop < mSurfaceHeight - finalHeight) {//过头了  
191 - deltaTop = Math.abs(tempTop) - Math.abs(mSurfaceHeight - finalHeight);//超过的范围,用正整数表达易于理解  
192 - mRectDes.top += (offsetY + deltaTop);  
193 - mRectDes.bottom += (offsetY + deltaTop);  
194 - adjustPath(offsetY + deltaTop);  
195 - } else if (tempTop > 0) {  
196 - mRectDes.top += (offsetY - tempTop);  
197 - mRectDes.bottom += (offsetY - tempTop);  
198 - adjustPath(offsetY - tempTop);  
199 - } else {  
200 - mRectDes.top += offsetY;  
201 - mRectDes.bottom += offsetY;  
202 - adjustPath(offsetY); 203 + if (adjust) {
  204 + if (finalHeight > mSurfaceHeight) {
  205 + int tempTop = mRectDes.top + offsetY;
  206 +
  207 + int deltaTop = 0;
  208 + if (tempTop < mSurfaceHeight - finalHeight) {//过头了
  209 + deltaTop = Math.abs(tempTop) - Math.abs(mSurfaceHeight - finalHeight);//超过的范围,用正整数表达易于理解
  210 + mRectDes.top += (offsetY + deltaTop);
  211 + mRectDes.bottom += (offsetY + deltaTop);
  212 + adjustPath(offsetY + deltaTop);
  213 + } else if (tempTop > 0) {
  214 + mRectDes.top += (offsetY - tempTop);
  215 + mRectDes.bottom += (offsetY - tempTop);
  216 + adjustPath(offsetY - tempTop);
  217 + } else {
  218 + mRectDes.top += offsetY;
  219 + mRectDes.bottom += offsetY;
  220 + adjustPath(offsetY);
  221 + }
203 } 222 }
  223 + drawSurface();
204 } 224 }
205 - drawSurface();  
206 } 225 }
207 } 226 }
208 227
@@ -417,6 +436,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -417,6 +436,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
417 this.setOnTouchListener(this); 436 this.setOnTouchListener(this);
418 // 设置背景为透明 否则是黑色 437 // 设置背景为透明 否则是黑色
419 this.setZOrderOnTop(true); 438 this.setZOrderOnTop(true);
  439 + this.setZOrderMediaOverlay(true);
420 this.getHolder().setFormat(PixelFormat.TRANSLUCENT); 440 this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
421 441
422 // this.pathLists.add(new Path()); 442 // this.pathLists.add(new Path());
@@ -483,22 +503,26 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -483,22 +503,26 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
483 this.drawer = drawer; 503 this.drawer = drawer;
484 } 504 }
485 505
486 -  
487 /** 506 /**
488 * 知道想x,yd的坐标绘制线 507 * 知道想x,yd的坐标绘制线
489 - * @param pointXies 508 + * @param annotations
490 */ 509 */
491 - public void drawLine(List<PointGroupEntity> pointXies, int color) {  
492 - setPaintFillColor(color);  
493 - copyArr(pointXies);  
494 - operatePoints.add(pointXies);  
495 - pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));  
496 - paintLists.add(this.createPaint(color));  
497 - this.historyPointer++;  
498 - for (int i = 0; i < pointXies.size(); i++) {  
499 - Path path = this.getCurrentPath();  
500 - path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop); 510 + public void drawLine(List<AnnotaionEntity> annotations) {
  511 + for (AnnotaionEntity annotation : annotations) {
  512 + List<PointGroupEntity> pointXies = annotation.pointGroup;
  513 + int color = Color.parseColor(annotation.color);
  514 + setPaintFillColor(color);
  515 + copyArr(pointXies);
  516 + operatePoints.add(pointXies);
  517 + pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));
  518 + paintLists.add(this.createPaint(color));
  519 + this.historyPointer++;
  520 + for (int i = 0; i < pointXies.size(); i++) {
  521 + Path path = this.getCurrentPath();
  522 + path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop);
  523 + }
501 } 524 }
  525 +
502 drawSurface();//获取到一个坐标就刷新下界面 526 drawSurface();//获取到一个坐标就刷新下界面
503 } 527 }
504 528
@@ -536,7 +560,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -536,7 +560,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
536 560
537 //draw bitmap 561 //draw bitmap
538 if (canvas != null && mBitmap != null) { 562 if (canvas != null && mBitmap != null) {
539 - canvas.drawColor(Color.WHITE); 563 + canvas.drawColor(ResUtil.get().getColor(R.color.home_background));
540 canvas.drawBitmap(mBitmap, mRectSrc, mRectDes, null); 564 canvas.drawBitmap(mBitmap, mRectSrc, mRectDes, null);
541 for (int i = 0; i < this.historyPointer; i++) { 565 for (int i = 0; i < this.historyPointer; i++) {
542 Path path = this.pathLists.get(i); 566 Path path = this.pathLists.get(i);
@@ -570,8 +594,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V @@ -570,8 +594,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
570 this.pathLists.clear(); 594 this.pathLists.clear();
571 this.paintLists.clear(); 595 this.paintLists.clear();
572 historyPointer = 0; 596 historyPointer = 0;
573 - drawSurface();  
574 -  
575 } 597 }
576 598
577 /** 599 /**
@@ -30,9 +30,9 @@ public interface OnOperationListener { @@ -30,9 +30,9 @@ public interface OnOperationListener {
30 30
31 void selectedFace(Faceicon content); 31 void selectedFace(Faceicon content);
32 32
33 - void selectedEmoji(Emojicon content); 33 + void selectedEmoji(String content);
34 34
35 - void selectedBackSpace(Emojicon back); 35 + void selectedBackSpace(String back);
36 36
37 void selectedFunction(int index); 37 void selectedFunction(int index);
38 } 38 }
@@ -18,7 +18,7 @@ import me.yokeyword.fragmentation.SupportFragment; @@ -18,7 +18,7 @@ import me.yokeyword.fragmentation.SupportFragment;
18 * @file LoginDialog.java 18 * @file LoginDialog.java
19 * @brief 19 * @brief
20 * @date 2017/3/25 20 * @date 2017/3/25
21 - * Copyright (c) 2017, 上品折扣 21 + * Copyright (c) 2017, 学点云
22 * All rights reserved. 22 * All rights reserved.
23 */ 23 */
24 public class LoginDialog extends BaseDialog { 24 public class LoginDialog extends BaseDialog {
@@ -113,6 +113,14 @@ public enum DisplayRules { @@ -113,6 +113,14 @@ public enum DisplayRules {
113 } 113 }
114 } 114 }
115 115
  116 + public static boolean isCustomDeleteEmojicon(String emoji) {
  117 + if (emoji != null) {
  118 + return (emoji.equals("[img:shanchu]"));
  119 + } else {
  120 + return false;
  121 + }
  122 + }
  123 +
116 public static List<Emojicon> getAllByType() { 124 public static List<Emojicon> getAllByType() {
117 List<Emojicon> datas = new ArrayList<Emojicon>(values().length); 125 List<Emojicon> datas = new ArrayList<Emojicon>(values().length);
118 for (DisplayRules data : values()) { 126 for (DisplayRules data : values()) {
@@ -57,7 +57,7 @@ public class EmojiPageFragment extends SupportFragment { @@ -57,7 +57,7 @@ public class EmojiPageFragment extends SupportFragment {
57 private RadioButton[] pointViews; 57 private RadioButton[] pointViews;
58 private OnOperationListener listener; 58 private OnOperationListener listener;
59 59
60 - private List<Emojicon> datas; 60 + private List<String> datas;
61 61
62 @Override 62 @Override
63 protected View inflaterView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { 63 protected View inflaterView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
@@ -69,7 +69,8 @@ public class EmojiPageFragment extends SupportFragment { @@ -69,7 +69,8 @@ public class EmojiPageFragment extends SupportFragment {
69 @Override 69 @Override
70 protected void initData() { 70 protected void initData() {
71 super.initData(); 71 super.initData();
72 - datas = DisplayRules.getAllByType(); 72 + datas=EmojiconHandler.mEmoticons;
  73 + // datas = DisplayRules.getAllByType();
73 } 74 }
74 75
75 76
@@ -89,7 +90,7 @@ public class EmojiPageFragment extends SupportFragment { @@ -89,7 +90,7 @@ public class EmojiPageFragment extends SupportFragment {
89 int start = x * ITEM_PAGE_COUNT; 90 int start = x * ITEM_PAGE_COUNT;
90 int end = (start + ITEM_PAGE_COUNT) > total ? total 91 int end = (start + ITEM_PAGE_COUNT) > total ? total
91 : (start + ITEM_PAGE_COUNT); 92 : (start + ITEM_PAGE_COUNT);
92 - final List<Emojicon> itemDatas = datas.subList(start, end); 93 + final List<String> itemDatas = datas.subList(start, end);
93 GridView view = new GridView(aty); 94 GridView view = new GridView(aty);
94 EmojiAdapter faceAdapter = new EmojiAdapter(view, itemDatas); 95 EmojiAdapter faceAdapter = new EmojiAdapter(view, itemDatas);
95 96
@@ -112,8 +113,8 @@ public class EmojiPageFragment extends SupportFragment { @@ -112,8 +113,8 @@ public class EmojiPageFragment extends SupportFragment {
112 public void onItemClick(AdapterView<?> parent, View view, 113 public void onItemClick(AdapterView<?> parent, View view,
113 int position, long id) { 114 int position, long id) {
114 if (listener != null) { 115 if (listener != null) {
115 - Emojicon emoji = itemDatas.get(position);  
116 - if (DisplayRules.isDeleteEmojicon(emoji)) { 116 + String emoji = itemDatas.get(position);
  117 + if (EmojiconHandler.isCustomDeleteEmojicon(emoji)) {
117 listener.selectedBackSpace(emoji); 118 listener.selectedBackSpace(emoji);
118 } else { 119 } else {
119 listener.selectedEmoji(emoji); 120 listener.selectedEmoji(emoji);
1 package com.xdy.home.widget.emoji; 1 package com.xdy.home.widget.emoji;
2 2
  3 +import android.content.Context;
  4 +import android.graphics.Bitmap;
  5 +import android.graphics.BitmapFactory;
  6 +import android.text.Spannable;
  7 +import android.text.SpannableStringBuilder;
  8 +import android.text.style.ImageSpan;
  9 +
  10 +import com.xdy.commonlibrary.core.CommonAppLike;
3 import com.xdy.home.R; 11 import com.xdy.home.R;
  12 +import com.xdy.util.ResUtil;
4 13
5 import java.util.ArrayList; 14 import java.util.ArrayList;
6 import java.util.HashMap; 15 import java.util.HashMap;
7 import java.util.List; 16 import java.util.List;
8 import java.util.Map; 17 import java.util.Map;
  18 +import java.util.regex.Matcher;
  19 +import java.util.regex.Pattern;
9 20
10 /** 21 /**
11 * Created by Admin on 2017/3/29. 22 * Created by Admin on 2017/3/29.
@@ -70,8 +81,11 @@ public class EmojiconHandler { @@ -70,8 +81,11 @@ public class EmojiconHandler {
70 mEmoticons.add("[img:liuhan]"); 81 mEmoticons.add("[img:liuhan]");
71 mEmoticonsId.put("[img:hanxiao]", R.drawable.hanxiao); 82 mEmoticonsId.put("[img:hanxiao]", R.drawable.hanxiao);
72 mEmoticons.add("[img:hanxiao]"); 83 mEmoticons.add("[img:hanxiao]");
73 -  
74 - 84 + mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
  85 + mEmoticons.add("[img:shanchu]");
  86 + mEmoticonsId.put("[img:hanxiao]", R.drawable.hanxiao);
  87 + mEmoticons.add("[img:hanxiao]");
  88 + //orca_emoji_backspace_back_normal
75 mEmoticonsId.put("[img:dabing]", R.drawable.dabing); 89 mEmoticonsId.put("[img:dabing]", R.drawable.dabing);
76 mEmoticons.add("[img:dabing]"); 90 mEmoticons.add("[img:dabing]");
77 mEmoticonsId.put("[img:fendou]", R.drawable.fendou); 91 mEmoticonsId.put("[img:fendou]", R.drawable.fendou);
@@ -126,8 +140,12 @@ public class EmojiconHandler { @@ -126,8 +140,12 @@ public class EmojiconHandler {
126 mEmoticons.add("[img:kafei]"); 140 mEmoticons.add("[img:kafei]");
127 mEmoticonsId.put("[img:hua]", R.drawable.hua); 141 mEmoticonsId.put("[img:hua]", R.drawable.hua);
128 mEmoticons.add("[img:hua]"); 142 mEmoticons.add("[img:hua]");
  143 + mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
  144 + mEmoticons.add("[img:shanchu]");
129 mEmoticonsId.put("[img:tiaoxie]", R.drawable.tiaoxie); 145 mEmoticonsId.put("[img:tiaoxie]", R.drawable.tiaoxie);
130 mEmoticons.add("[img:tiaoxie]"); 146 mEmoticons.add("[img:tiaoxie]");
  147 +
  148 +
131 mEmoticonsId.put("[img:xin]", R.drawable.xin); 149 mEmoticonsId.put("[img:xin]", R.drawable.xin);
132 mEmoticons.add("[img:xin]"); 150 mEmoticons.add("[img:xin]");
133 mEmoticonsId.put("[img:dangao]", R.drawable.dangao); 151 mEmoticonsId.put("[img:dangao]", R.drawable.dangao);
@@ -143,8 +161,17 @@ public class EmojiconHandler { @@ -143,8 +161,17 @@ public class EmojiconHandler {
143 mEmoticonsId.put("[img:woshou]", R.drawable.woshou); 161 mEmoticonsId.put("[img:woshou]", R.drawable.woshou);
144 mEmoticons.add("[img:woshou]"); 162 mEmoticons.add("[img:woshou]");
145 mEmoticonsId.put("[img:baoquan]", R.drawable.baoquan); 163 mEmoticonsId.put("[img:baoquan]", R.drawable.baoquan);
146 - mEmoticons.add("[img:baoquan ]"); 164 + mEmoticons.add("[img:baoquan]");
147 mEmoticonsId.put("[img:zancheng]", R.drawable.zancheng); 165 mEmoticonsId.put("[img:zancheng]", R.drawable.zancheng);
148 mEmoticons.add("[img:zancheng]"); 166 mEmoticons.add("[img:zancheng]");
  167 + mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
  168 + mEmoticons.add("[img:shanchu]");
  169 + }
  170 + public static boolean isCustomDeleteEmojicon(String emoji) {
  171 + if (emoji != null) {
  172 + return (emoji.equals("[img:shanchu]"));
  173 + } else {
  174 + return false;
  175 + }
149 } 176 }
150 } 177 }
@@ -44,7 +44,7 @@ public class EmoticonsEditText extends EditText { @@ -44,7 +44,7 @@ public class EmoticonsEditText extends EditText {
44 mUseSystemDefault = a.getBoolean(com.rockerhieu.emojicon.R.styleable.Emojicon_emojiconUseSystemDefault, false); 44 mUseSystemDefault = a.getBoolean(com.rockerhieu.emojicon.R.styleable.Emojicon_emojiconUseSystemDefault, false);
45 a.recycle(); 45 a.recycle();
46 mEmojiconTextSize = (int) getTextSize(); 46 mEmojiconTextSize = (int) getTextSize();
47 - setText(getText()); 47 + //setText(getText());
48 } 48 }
49 49
50 @Override 50 @Override
@@ -92,28 +92,4 @@ public class EmoticonsEditText extends EditText { @@ -92,28 +92,4 @@ public class EmoticonsEditText extends EditText {
92 } 92 }
93 } 93 }
94 94
95 - @Override  
96 - protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {  
97 - updateText();  
98 - }  
99 -  
100 - /**  
101 - * Set the size of emojicon in pixels.  
102 - */  
103 - public void setEmojiconSize(int pixels) {  
104 - mEmojiconSize = pixels;  
105 -  
106 - updateText();  
107 - }  
108 -  
109 - private void updateText() {  
110 - com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), getText(), mEmojiconSize, mEmojiconTextSize, mUseSystemDefault);  
111 - }  
112 -  
113 - /**  
114 - * Set whether to use system default emojicon  
115 - */  
116 - public void setUseSystemDefault(boolean useSystemDefault) {  
117 - mUseSystemDefault = useSystemDefault;  
118 - }  
119 } 95 }
@@ -56,9 +56,9 @@ public class EmoticonsTextView extends TextView { @@ -56,9 +56,9 @@ public class EmoticonsTextView extends TextView {
56 @Override 56 @Override
57 public void setText(CharSequence text, BufferType type) { 57 public void setText(CharSequence text, BufferType type) {
58 if (!TextUtils.isEmpty(text)) { 58 if (!TextUtils.isEmpty(text)) {
59 - SpannableStringBuilder builder = new SpannableStringBuilder(text);  
60 - com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mEmojiconTextSize, mTextStart, mTextLength, mUseSystemDefault);  
61 - text = builder; 59 + // SpannableStringBuilder builder = new SpannableStringBuilder(text);
  60 + // com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mEmojiconTextSize, mTextStart, mTextLength, mUseSystemDefault);
  61 + // text = builder;
62 super.setText(replace(text), type); 62 super.setText(replace(text), type);
63 } else { 63 } else {
64 super.setText(text, type); 64 super.setText(text, type);
This file is too large to display.

4.0 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.9 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.8 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

2.9 KB | 宽: | 高:

2.6 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.1 KB | 宽: | 高:

2.5 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.0 KB | 宽: | 高:

5.0 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.1 KB | 宽: | 高:

4.8 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.0 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.1 KB | 宽: | 高:

2.1 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.3 KB | 宽: | 高:

4.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.7 KB | 宽: | 高:

2.2 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.4 KB | 宽: | 高:

2.5 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

3.9 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.3 KB | 宽: | 高:

3.7 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖

4.1 KB | 宽: | 高:

2.4 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖