蒋洪波

修改文件所属公司

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

要显示太多修改。

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

... ... @@ -9,7 +9,7 @@ import android.view.View;
* @brief 简要说明
* 详细说明,如果没有请删除
* @date 2017/10/28
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface OnItemClickListener<T> {
... ...
... ... @@ -24,7 +24,7 @@ import retrofit2.Retrofit;
* @file ShopinGsonConverterFactory.java
* @brief
* @date 2017/1/8
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ShopinGsonConverterFactory extends Converter.Factory {
... ...
... ... @@ -25,7 +25,7 @@ import okhttp3.RequestBody;
* @file ShopinRequestParams.java
* @brief 封装请求参数
* @date 2017/1/8
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ShopinRequestParams {
... ...
... ... @@ -24,7 +24,7 @@ import javax.inject.Inject;
* @file AppBaseActivity.java
* @brief Activity业务基类
* @date 2017/12/25
* Copyright (c) 2017,上品折扣
* Copyright (c) 2017,学点云
* All rights reserved.
*/
public abstract class AppBaseActivity<P extends BasePresenter> extends com.xdy.commonlibrary.core.BaseActivity implements BaseView {
... ...
... ... @@ -27,7 +27,7 @@ import rx.subjects.BehaviorSubject;
* @file BaseActivity.java
* @brief Activity无关业务基类
* @date 2017/12/25
* Copyright (c) 2017,上品折扣
* Copyright (c) 2017,学点云
* All rights reserved.
*/
public abstract class BaseActivity extends PermissifyActivity implements ActivityLifecycleProvider {
... ...
... ... @@ -9,7 +9,7 @@ import com.tencent.tinker.loader.shareutil.ShareConstants;
* @file BaseApplication.java
* @brief 请勿修改此类!
* @date 2017/3/16
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class BaseApplication extends TinkerApplication {
... ...
... ... @@ -21,7 +21,7 @@ import rx.subjects.BehaviorSubject;
* @file BaseFragment.java
* @brief 无关业务的Fragment基类
* @date 2017/6/4
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public abstract class BaseFragment extends SupportFragment implements FragmentLifecycleProvider {
... ...
... ... @@ -8,7 +8,7 @@ import java.lang.ref.WeakReference;
* @file BaseRunnable.java
* @brief runnable简单封装好使用
* @date 2017/12/25
* Copyright (c) 2017,上品折扣
* Copyright (c) 2017,学点云
* All rights reserved.
*/
public abstract class BaseRunnable<T> implements Runnable {
... ...
... ... @@ -7,7 +7,7 @@ package com.xdy.commonlibrary.event;
* @file CheckUpgradeEvent.java
* @brief 检查更新事件
* @date 2017/3/19
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class CheckUpgradeEvent {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.exception;
* @file ResultException.java
* @brief 服务器返回结果异常
* @date 2017/12/21
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ResultException extends RuntimeException {
... ...
... ... @@ -10,7 +10,7 @@ import rx.subscriptions.CompositeSubscription;
* @file BasePresenter.java
* @brief
* @date 2017/6/4
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class BasePresenter<M extends IModel, V extends BaseView> implements presenter {
... ...
... ... @@ -10,7 +10,7 @@ import com.xdy.commonlibrary.widget.dialog.TipDialog;
* @file GlobalDialogActivity.java
* @brief 导航界面
* @date 2017-12-10
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class GlobalDialogActivity extends Activity {
... ...
... ... @@ -8,7 +8,7 @@ import java.util.List;
* @file ListBaseView.java
* @brief
* @date 2017/12/27
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface ListBaseView<T> extends BaseView {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.permission;
* @file PermissifyConstants.java
* @brief
* @date 2017/12/21
* Copyright (c) 2017,上品折扣
* Copyright (c) 2017,学点云
* All rights reserved.
*/
public interface PermissifyConstants {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.utils;
* @file Constants.java
* @brief
* @date 2017/2/10
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class Constants {
... ...
... ... @@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicLong;
* @file ACache.java
* @brief 缓存管理类
* @date 2017-10-10
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ACache implements ICache {
... ...
... ... @@ -18,7 +18,7 @@ import java.io.Serializable;
* @file ICache.java
* @brief
* @date 2017/6/7
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface ICache {
... ...
... ... @@ -13,7 +13,7 @@ import java.lang.reflect.Type;
* @file DoubleMayBeEmptyStringDeserializer.java
* @brief 双精度类型有可能为空字符串的问题
* @date 2017/11/5
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class DoubleMayBeEmptyStringDeserializer implements JsonDeserializer<Double> {
... ...
... ... @@ -20,7 +20,7 @@ import java.util.List;
* @file GsonUtil.java
* @brief Gson工具类
* @date 2017-10-10
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class GsonUtil {
... ...
... ... @@ -13,7 +13,7 @@ import java.lang.reflect.Type;
* @file ReplenishDeserializer.java
* @brief 补货商品反序列化对象,样板对象有可能为空
* @date 2017/11/5
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class IntegerMayBeEmptyStringDeserializer implements JsonDeserializer<Integer> {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.commonlibrary.widget;
* @file View.java
* @brief
* @date 2017/3/21 0021
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class View {
... ...
... ... @@ -15,7 +15,7 @@ import com.xdy.commonlibrary.R;
* @file TipDialog.java
* @brief 简单提示
* @date 2017/11/24
* Copyright (c) 2017,上品折扣
* Copyright (c) 2017,学点云
* All rights reserved.
*/
public class TipDialog extends BaseDialog {
... ...
<resources>
<string name="im_chat_msg_timetitle_yesday">昨天</string>
<string name="permissify_go_to_settings">去设置</string>
<string name="permissify_permission_rationale_title">上品折扣向您申请如下权限</string>
<string name="permissify_permission_rationale_title">学点云向您申请如下权限</string>
<string name="permissify_no_text_fallback">Permissify: No fallback text was provided for this permission</string>
<!-- 权限提示 -->
... ...
... ... @@ -12,7 +12,7 @@ import java.math.BigDecimal;
* @file EncryptUtilTest.java
* @brief
* @date 2017/12/19
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class EncryptUtilTest {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.network;
* @file HttpConstants.java
* @brief
* @date 2017/3/17
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class HttpConstants {
... ...
... ... @@ -19,7 +19,7 @@ import io.victoralbertos.jolyglot.Types;
* @file MyCacheSpeak.java
* @brief
* @date 2017/2/20
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class MyCacheSpeak implements JolyglotGenerics {
... ...
... ... @@ -7,7 +7,7 @@ import com.google.gson.JsonDeserializer;
* @file WrapGsonDeserializerInfo.java
* @brief 包装Gson反序列化对象时需要处理的对象信息
* @date 2017-6-7
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class WrapGsonDeserializerInfo {
... ...
... ... @@ -9,7 +9,7 @@ import com.antfortune.freeline.FreelineCore;
* @file com.xdy.home.application.TestApplication.java
* @brief
* @date 2017/3/15
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication {
... ...
... ... @@ -14,7 +14,7 @@ import com.xdy.commonlibrary.mvp.BaseView;
* @file OrderActivity.java
* @brief
* @date 2017/3/15
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class OrderActivity extends AppCompatActivity implements BaseView {
... ...
... ... @@ -16,7 +16,7 @@ import com.xdy.util.DisplayUtil;
* @file AutoAdaptHeaderViewGroup.java
* @brief 自适应状态栏的ViewGroup
* @date 2017/10/13
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class AutoAdaptHeaderViewGroup extends RelativeLayout {
... ...
... ... @@ -11,7 +11,7 @@ import android.view.MotionEvent;
* @file NoScrollViewPager.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class NoScrollViewPager extends ViewPager {
... ...
... ... @@ -14,7 +14,7 @@ import java.util.Locale;
* @brief 时间工具类
* 详细说明,如果没有请删除
* @date 2017/10/12
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class DateUtils {
... ...
... ... @@ -20,7 +20,7 @@ import java.lang.reflect.Method;
* @file DisplayUtil.java
* @brief 获得当前手机一些屏幕信息
* @date 2017/9/22
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class DisplayUtil {
... ...
... ... @@ -8,7 +8,7 @@ import java.security.MessageDigest;
* @file EncryptUtil.java
* @brief 加密工具
* @date 2017/10/17
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class EncryptUtil {
... ...
... ... @@ -20,7 +20,7 @@ import java.util.UUID;
* @file FileHelper.java
* @brief 文件操作辅助类
* @date 2017/11/30
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class FileUtil {
... ...
... ... @@ -42,7 +42,7 @@ public class ResUtil {
* @return Resources
* @brief 获得当前APP的Resource的方法
*/
private Resources getResource() {
public static Resources getResource() {
return ctx.getResources();
}
... ...
... ... @@ -18,7 +18,7 @@ import java.util.regex.Pattern;
* @brief 简要说明
* 详细说明,如果没有请删除
* @date 2017/10/12
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class StringUtils {
... ...
... ... @@ -12,7 +12,7 @@ import android.widget.TextView;
* @file UIUtils.java
* @brief 视图工具类
* @date 2017-6-10
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class UIUtils {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.util.regex;
* @file RegPattern.java
* @brief 正则表达式模型
* @date 2017/10/17
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class RegPattern {
... ...
... ... @@ -98,5 +98,4 @@ dependencies {
compile rootProject.ext.dependencies["dagger2"]
apt rootProject.ext.dependencies["dagger2-apt-compiler"]
compile 'com.rockerhieu.emojicon:library:1.3.1'
compile 'com.github.iwgang:simplifyspan:2.0'
}
... ...
... ... @@ -9,7 +9,7 @@ package com.xdy.home;
* @file com.xdy.home.application.TestApplication.java
* @brief
* @date 2017/3/15
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class TestApplication extends com.xdy.commonlibrary.core.BaseApplication {
... ...
/*
* SmartPlayerJni.java
* SmartPlayerJni
*
* Github: https://github.com/daniulive/SmarterStreaming
*
* Created by DaniuLive on 2015/09/26.
* Copyright © 2014~2016 DaniuLive. All rights reserved.
*/
package com.daniulive.smartplayer;
import com.eventhandle.SmartEventCallback;
public class SmartPlayerJni {
/**
* Initialize Player.
*
* @param ctx: get by this.getApplicationContext()
*
* <pre>This function must be called firstly.</pre>
*
* @return player handle if successful, if return 0, which means init failed.
*/
public native long SmartPlayerInit(Object ctx);
/**
* Set callback event
*
* @param callback function
*
* @return {0} if successful
*/
public native int SetSmartPlayerEventCallback(long handle, SmartEventCallback callback);
/**
* Set Video HW decoder, if support HW decoder, it will return 0
*
* @param isHWDecoder: 0: software decoder; 1: hardware decoder.
*
* @return {0} if successful
*/
public native int SetSmartPlayerVideoHWDecoder(long handle, int isHWDecoder);
/**
* Set Surface view.
*
* @param handle: return value from SmartPlayerInit()
*
* @param glSurface: surface view
*
* <pre> NOTE: if not set or set surface with null, it will playback audio only. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetSurface(long handle, Object surface);
/**
* Set External Render.
*
* @param handle: return value from SmartPlayerInit()
*
* @param external_render: External Render
*
* @return {0} if successful
*/
public native int SmartPlayerSetExternalRender(long handle, Object external_render);
/**
* Set AudioOutput Type
*
* @param handle: return value from SmartPlayerInit()
*
* @param use_audiotrack:
*
* <pre> NOTE: if use_audiotrack with 0: it will use auto-select output devices; if with 1: will use audiotrack mode. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetAudioOutputType(long handle, int use_audiotrack);
/**
* Set buffer
*
* @param handle: return value from SmartPlayerInit()
*
* @param buffer:
*
* <pre> NOTE: Unit is millisecond, range is 200-5000 ms </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerSetBuffer(long handle, int buffer);
/**
* Set mute or not
*
* @param is_mute: if with 1:mute, if with 0: does not mute
*
* @return {0} if successful
*/
public native int SmartPlayerSetMute(long handle, int is_mute);
/**
* It's only used when playback RTSP stream
*
* Default with UDP mode
*
* @param isUsingTCP: if with 1, it will via TCP mode, while 0 with UDP mode
*
* @return {0} if successful
*/
public native int SmartPlayerSetRTSPTcpMode(long handle, int is_using_tcp);
/**
* Set fast startup
*
* @param is_fast_startup: if with 1, it will second play back, if with 0: does not it
*
* @return {0} if successful
*/
public native int SmartPlayerSetFastStartup(long handle, int is_fast_startup);
/**
* Set playback orientation.
*
* @param handle: return value from SmartPlayerInit()
*
* @param surOrg: current orientation, PORTRAIT 1, LANDSCAPE with 2
*
* @return {0} if successful
*/
public native int SmartPlayerSetOrientation(long handle, int surOrg);
/**
* Start playback stream
*
* @param handle: return value from SmartPlayerInit()
*
* @param uri: playback uri
*
* @return {0} if successful
*/
public native int SmartPlayerStartPlayback(long handle, String uri);
/**
* Close player instance.
*
* @param handle: return value from SmartPlayerInit()
*
* <pre> NOTE: it could not use player handle after call this function. </pre>
*
* @return {0} if successful
*/
public native int SmartPlayerClose(long handle);
}
... ...
... ... @@ -16,7 +16,6 @@
package com.xdy.home.adapter;
import android.content.Context;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
... ... @@ -38,10 +37,6 @@ import org.kymjs.kjframe.utils.StringUtils;
import java.util.ArrayList;
import java.util.List;
import cn.iwgang.simplifyspan.SimplifySpanBuild;
import cn.iwgang.simplifyspan.other.SpecialGravity;
import cn.iwgang.simplifyspan.unit.SpecialLabelUnit;
/**
* @author kymjs (http://www.kymjs.com/) on 6/8/15.
*/
... ... @@ -114,13 +109,16 @@ public class ChatAdapter extends BaseAdapter {
holder.tv_chatcontent = (TextView) v.findViewById(R.id.chat_item_content_text);
holder.tv_date = (TextView) v.findViewById(R.id.chat_item_date);
holder.tv_name = (TextView) v.findViewById(R.id.chat_item_name);
holder.tv_teacher_bg= (TextView) v.findViewById(R.id.chat_item_taacher_bg);
v.setTag(holder);
} else {
holder = (ViewHolder) v.getTag();
}
if (data.getTime()!=null){
holder.tv_date.setText(StringUtils.getDataTime("HH:mm"));
holder.tv_date.setVisibility(View.VISIBLE);
}
holder.tv_date.setText(StringUtils.getDataTime("HH:mm"));
holder.tv_date.setVisibility(View.VISIBLE);
//如果是文本类型,则隐藏图片,如果是图片则隐藏文本
if (data.getType() == Message.MSG_TYPE_TEXT) {
... ... @@ -143,9 +141,9 @@ public class ChatAdapter extends BaseAdapter {
holder.layout_content.setBackgroundResource(android.R.color.transparent);
} else {
if (data.getIsSend()) {
holder.layout_content.setBackgroundResource(R.drawable.home_chat_send);
holder.layout_content.setBackgroundResource(R.drawable.chat_pop_send);
} else {
holder.layout_content.setBackgroundResource(R.drawable.home_chat_receive);
holder.layout_content.setBackgroundResource(R.drawable.chat_pop_receive);
}
}
... ... @@ -155,95 +153,87 @@ public class ChatAdapter extends BaseAdapter {
} else {
kjb.display(holder.img_avatar, data.getToUserAvatar());
}*/
if (data.getIsSend()){
switch (AccountUtils.getUser().getUserRole()){
if (data.getIsSend()) {
switch (AccountUtils.getUser().getUserRole()) {
case "normal"://普通角色/学生
if (!TextUtils.isEmpty(data.getFromUserName())){
if (!TextUtils.isEmpty(data.getFromUserName())) {
holder.tv_name.setText(data.getFromUserName());
}else {
} else {
holder.tv_name.setText("学生");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "host"://主持人/老师
if (TextUtils.isEmpty(data.getFromUserName())){
data.setFromUserName("主持人");
if (TextUtils.isEmpty(data.getFromUserName())) {
data.setFromUserName("老师");
}
holder.tv_name.setText(data.getFromUserName());
SimplifySpanBuild simplifySpanBuild11 = new SimplifySpanBuild();
simplifySpanBuild11.append(new SpecialLabelUnit("老师", Color.WHITE, sp2px(12),0xFFFFA500)
.setLabelBgRadius(5).setLabelBgSize(80,60).setGravity(SpecialGravity.CENTER))
.append(data.getFromUserName());
holder.img_avatar.setImageResource(R.mipmap.teacher);
holder.tv_name.setText(data.getFromUserName());
holder.tv_teacher_bg.setVisibility(View.VISIBLE);
break;
case "presenter"://主讲人
if (!TextUtils.isEmpty(data.getFromUserName())){
if (!TextUtils.isEmpty(data.getFromUserName())) {
holder.tv_name.setText(data.getFromUserName());
}else {
} else {
holder.tv_name.setText("主讲人");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "assistant"://助教
if (!TextUtils.isEmpty(data.getFromUserName())){
if (!TextUtils.isEmpty(data.getFromUserName())) {
holder.tv_name.setText(data.getFromUserName());
}else {
} else {
holder.tv_name.setText("助教");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "record":// 暂时没用
if (!TextUtils.isEmpty(data.getFromUserName())){
if (!TextUtils.isEmpty(data.getFromUserName())) {
holder.tv_name.setText(data.getFromUserName());
}else {
} else {
holder.tv_name.setText("学生");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
}
}else {
switch (data.getUserRole()){
} else {
switch (data.getUserRole()) {
case "normal"://普通角色/学生
if (!TextUtils.isEmpty(data.getToUserName())){
if (!TextUtils.isEmpty(data.getToUserName())) {
holder.tv_name.setText(data.getToUserName());
}else {
} else {
holder.tv_name.setText("学生");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "host"://主持人/老师
if (TextUtils.isEmpty(data.getToUserName())){
data.setFromUserName("主持人");
if (TextUtils.isEmpty(data.getToUserName())) {
data.setToUserName("老师");
}
holder.tv_name.setText(data.getToUserName());
SimplifySpanBuild simplifySpanBuild11 = new SimplifySpanBuild();
simplifySpanBuild11.append(new SpecialLabelUnit("老师", Color.WHITE, sp2px(12),0xFFFFA500)
.setLabelBgRadius(5).setLabelBgSize(80,60).setGravity(SpecialGravity.CENTER))
.append(data.getToUserName());
holder.tv_teacher_bg.setVisibility(View.VISIBLE);
holder.img_avatar.setImageResource(R.mipmap.teacher);
holder.tv_name.setText(data.getToUserName());
break;
case "presenter"://主讲人
if (!TextUtils.isEmpty(data.getToUserName())){
if (!TextUtils.isEmpty(data.getToUserName())) {
holder.tv_name.setText(data.getToUserName());
}else {
} else {
holder.tv_name.setText("主讲人");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "assistant"://助教
if (!TextUtils.isEmpty(data.getToUserName())){
if (!TextUtils.isEmpty(data.getToUserName())) {
holder.tv_name.setText(data.getToUserName());
}else {
} else {
holder.tv_name.setText("助教");
}
holder.img_avatar.setImageResource(R.mipmap.student);
break;
case "record":// 暂时没用
if (!TextUtils.isEmpty(data.getToUserName())){
if (!TextUtils.isEmpty(data.getToUserName())) {
holder.tv_name.setText(data.getToUserName());
}else {
} else {
holder.tv_name.setText("学生");
}
holder.img_avatar.setImageResource(R.mipmap.student);
... ... @@ -294,6 +284,7 @@ public class ChatAdapter extends BaseAdapter {
static class ViewHolder {
TextView tv_date;
TextView tv_name;
TextView tv_teacher_bg;
ImageView img_avatar;
TextView tv_chatcontent;
ImageView img_chatimage;
... ... @@ -301,6 +292,7 @@ public class ChatAdapter extends BaseAdapter {
ProgressBar progress;
RelativeLayout layout_content;
}
private float sp2px(float spValue) {
final float scale = cxt.getResources().getDisplayMetrics().scaledDensity;
return spValue * scale;
... ...
... ... @@ -33,15 +33,15 @@ import java.util.Collection;
*
* @author kymjs (http://www.kymjs.com/) on 6/8/15.
*/
public class EmojiAdapter extends KJAdapter<Emojicon> {
public class EmojiAdapter extends KJAdapter<String> {
public EmojiAdapter(AbsListView view, Collection<Emojicon> mDatas) {
public EmojiAdapter(AbsListView view, Collection<String> mDatas) {
super(view, mDatas, R.layout.home_chat_item_emoji);
}
@Override
public void convert(AdapterHolder adapterHolder, Emojicon emojicon, boolean b) {
public void convert(AdapterHolder adapterHolder, String emojicon, boolean b) {
TextView itemTvEmoji = adapterHolder.getView(R.id.itemEmoji);
itemTvEmoji.setText(emojicon.getValue());
itemTvEmoji.setText(emojicon);
}
}
... ...
... ... @@ -15,7 +15,7 @@ import me.yokeyword.fragmentation.SupportFragment;
* @file HomeAdapter.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class HomeAdapter extends FragmentStatePagerAdapter {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file ClassStatusEntity.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ClassStatusEntity {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file ErrorEvent.java
* @brief
* @date 2017/3/29 0029
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ErrorEvent {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file InitResponseEntity.java
* @brief
* @date 2017/3/24 0024
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class InitResponseEntity {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file JoinClassOkEntity.java
* @brief
* @date 2017/3/24 0024
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class JoinClassOkEntity {
... ...
... ... @@ -15,7 +15,7 @@ import java.util.Map;
* @file JsParams.java
* @brief js params
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class JsParams {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file PublishVideoPathEntity.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class PublishVideoPathEntity {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file ResponseEntity.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ResponseEntity {
... ...
... ... @@ -17,7 +17,7 @@ public class UpdateDoc {
public String curV; //文档垂直方向的滚动值
public String curH; ///文档水平方向的滚动值
public String scale; //文档的缩放百分比(默认值100的时候就是100%,无缩放)
public String visible; //文档是否显示
public boolean visible; //文档是否显示
public String action; //文档的操作类型
public String docId; //文档的位置资源标识
public String fileName; //文档名称
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file UserEntity.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class UserEntity {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.entity;
* @file VideoEntity.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class VideoEntity {
... ...
package com.xdy.home.entity;
import android.graphics.Bitmap;
/**
* @author Administrator
* @version 1.0
* @file WrapDocBitMapEntity.java
* @brief
* @date 2017/3/31 0031
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class WrapDocBitMapEntity {
/**
* 是否显示没有文档的图片
*/
private boolean noDoc;
private Bitmap bitmap;
public boolean showNoDoc() {
return noDoc;
}
public void setNoDoc(boolean doc) {
noDoc = doc;
}
public Bitmap getBitmap() {
return bitmap;
}
public void setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
}
}
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.event;
* @file ActionPushOrClose.java
* @brief 推流或者关闭推流
* @date 2017/3/26
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ActionPushOrClose {
... ...
... ... @@ -9,7 +9,7 @@ import com.xdy.util.LogUtil;
* @file EventHande.java
* @brief
* @date 2017/3/26
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class EventHande implements SmartEventCallback {
... ...
... ... @@ -8,7 +8,7 @@ import android.webkit.ValueCallback;
* @file DoNothingCallBack.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class DoNothingCallBack implements ValueCallback<String> {
... ...
... ... @@ -3,6 +3,8 @@ package com.xdy.home.ui;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.Selection;
import android.text.Spannable;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
... ... @@ -38,7 +40,7 @@ import java.util.List;
* @file ChatFragment.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class ChatFragment extends AppBaseFragment<LivePresenter> implements LiveContract.ChatView {
... ... @@ -104,12 +106,22 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void selectedEmoji(Emojicon emoji) {
box.getEditTextBox().append(emoji.getValue());
public void selectedEmoji(String emoji) {
if (!TextUtils.isEmpty(emoji)){
int start = box.getEditTextBox().getSelectionStart();
CharSequence content = box.getEditTextBox().getText().insert(start, emoji);
box.getEditTextBox().setText(content);
// 定位光标位置
CharSequence info = box.getEditTextBox().getText();
if (info instanceof Spannable) {
Spannable spanText = (Spannable) info;
Selection.setSelection(spanText, start + emoji.length());
}
}
}
@Override
public void selectedBackSpace(Emojicon back) {
public void selectedBackSpace(String back) {
DisplayRules.backspace(box.getEditTextBox());
}
... ... @@ -193,12 +205,11 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
@Override
public void renderChatMsg(ChatMsgEntity entity) {
if (entity != null && adapter != null) {
Message message;
if (entity.fromNodeId.equals(AccountUtils.getUser().getNodeId().toString())) {
message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole,
entity.fromName, "", "",
"", entity.message, true, true, new Date());
"", entity.message, true, true, replay?null:new Date());
datas.add(message);
adapter.refresh(datas);
mRealListView.setSelection(adapter.getCount() - 1);
... ... @@ -206,7 +217,7 @@ public class ChatFragment extends AppBaseFragment<LivePresenter> implements Live
LogUtil.i("返回的聊天内容===" + entity.message);
message = new Message(Message.MSG_TYPE_TEXT, Message.MSG_STATE_SUCCESS, entity.fromRole, "",
"", entity.fromName, "", entity.message, false,
true, new Date());
true, replay?null:new Date());
datas.add(message);
adapter.refresh(datas);
mRealListView.setSelection(adapter.getCount() - 1);
... ...
package com.xdy.home.ui;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.RelativeLayout;
import com.bumptech.glide.Glide;
import com.xdy.commonlibrary.core.AppBaseFragment;
import com.xdy.commonlibrary.core.di.AppComponent;
import com.xdy.home.R;
import com.xdy.home.entity.PointGroupEntity;
import com.xdy.home.entity.UpdateDoc;
import com.xdy.home.entity.WhiteboardUpdateEntity;
import com.xdy.home.entity.WrapDocBitMapEntity;
import com.xdy.home.vp.LiveContract;
import com.xdy.home.vp.LivePresenter;
import com.xdy.home.widget.CanvasView;
import com.xdy.util.LogUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import rx.Observable;
... ... @@ -37,7 +34,7 @@ import rx.schedulers.Schedulers;
* @file DocFragment.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveContract.DocView, View.OnClickListener {
... ... @@ -45,7 +42,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
int winWidth;
int winHeight;
CanvasView mCanvasView;
private RelativeLayout mShowNoDoc;
private UpdateDoc mUpdateDoc;
public void setPresenter(LivePresenter presenter) {
... ... @@ -67,7 +63,9 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
DisplayMetrics metric = new DisplayMetrics();
getWindowWith(metric);
mCanvasView = (CanvasView) v.findViewById(R.id.cv);
mShowNoDoc = (RelativeLayout) v.findViewById(R.id.iv_show_nodoc);
//展示没有文档图片
docUrlTransformBitmap(null);
}
private void getWindowWith(DisplayMetrics metric) {
... ... @@ -76,68 +74,6 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
winHeight = metric.heightPixels; // 屏幕高度(像素)
}
public List<PointGroupEntity> getData() {
List<PointGroupEntity> pointXies = new ArrayList<>();
PointGroupEntity xy = new PointGroupEntity();
xy.w = 127.0f;
xy.h = 377.0f;
pointXies.add(xy);
PointGroupEntity wh1 = new PointGroupEntity();
wh1.w = 145.40204f;
wh1.h = 386.0f;
pointXies.add(wh1);
PointGroupEntity wh2 = new PointGroupEntity();
wh2.w = 148.0f;
wh2.h = 386.0f;
pointXies.add(wh2);
PointGroupEntity wh3 = new PointGroupEntity();
wh3.w = 151.875f;
wh3.h = 386.0f;
pointXies.add(wh3);
PointGroupEntity wh4 = new PointGroupEntity();
wh4.w = 156.41933f;
wh4.h = 386.0f;
pointXies.add(wh4);
PointGroupEntity wh5 = new PointGroupEntity();
wh5.w = 163.03827f;
wh5.h = 386.0f;
pointXies.add(wh5);
PointGroupEntity wh6 = new PointGroupEntity();
wh6.w = 171.26802f;
wh6.h = 378.28864f;
pointXies.add(wh6);
PointGroupEntity wh7 = new PointGroupEntity();
wh7.w = 178.50021f;
wh7.h = 375.79993f;
pointXies.add(wh7);
PointGroupEntity wh8 = new PointGroupEntity();
wh8.w = 186.9014f;
wh8.h = 374.51642f;
pointXies.add(wh8);
PointGroupEntity wh9 = new PointGroupEntity();
wh9.w = 191.49982f;
wh9.h = 373.12506f;
pointXies.add(wh9);
PointGroupEntity wh0 = new PointGroupEntity();
wh0.w = 194.86517f;
wh0.h = 372.04492f;
pointXies.add(wh0);
PointGroupEntity wh11 = new PointGroupEntity();
wh11.w = 197.6098f;
wh11.h = 372.0f;
pointXies.add(wh11);
return pointXies;
}
@Override
protected void initData() {
}
... ... @@ -150,21 +86,19 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
@Override
public void onClick(View v) {
}
@Override
public void renderDocAddress(UpdateDoc updateDoc, String url) {
this.mUpdateDoc = updateDoc;
updateDocUrl(url);
docUrlTransformBitmap(url);
}
@Override
public void renderDeleteDocId(String itemIdx) {
//刪除文檔后
if (mUpdateDoc != null && !TextUtils.isEmpty(mUpdateDoc.itemIdx) && mUpdateDoc.itemIdx.equals(itemIdx)) {
mCanvasView.setVisibility(View.GONE);
mShowNoDoc.setVisibility(View.VISIBLE);
docUrlTransformBitmap(null);
}
}
... ... @@ -175,47 +109,47 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
public void renderUpdateAnnotation(WhiteboardUpdateEntity entity) {
if (entity != null) {
if (entity.isFresh) {
if (mCanvasView!=null){
if (mCanvasView != null) {
mCanvasView.clear();
}
}
if (entity.annotaionItems != null) {
for (int i = 0; i < entity.annotaionItems.size(); i++) {
try {
String color = entity.annotaionItems.get(i).color;
int c = Color.parseColor(color);
mCanvasView.drawLine(entity.annotaionItems.get(i).pointGroup, c);
} catch (Exception e) {
e.printStackTrace();
}
}
mCanvasView.drawLine(entity.annotaionItems);
}
}
}
private void updateDocUrl(final String url) {
LogUtil.i(TAG,url);
if (!TextUtils.isEmpty(url)) {
mShowNoDoc.setVisibility(View.GONE);
mCanvasView.setVisibility(View.VISIBLE);
@Override
public void clear() {
mCanvasView.clear();
docUrlTransformBitmap(null);
}
}
private void docUrlTransformBitmap(final String url) {
LogUtil.i(TAG, url != null ? url : "显示没有文档界面");
Observable.just(url)
.subscribeOn(Schedulers.io())
.map(new Func1<String, Bitmap>() {
.map(new Func1<String, WrapDocBitMapEntity>() {
@Override
public Bitmap call(String s) {
public WrapDocBitMapEntity call(String s) {
try {
Bitmap bitmap = Glide.with(getContext())
.load(s)
.asBitmap()
.into(winWidth, winWidth)
.get();
return bitmap;
WrapDocBitMapEntity wrapDocBitMapEntity = new WrapDocBitMapEntity();
if (s == null) {
wrapDocBitMapEntity.setNoDoc(true);
wrapDocBitMapEntity.setBitmap(getNoDocBitmap());
//直接使用无文档图片
} else {
Bitmap bitmap = Glide.with(getContext())
.load(s)
.asBitmap()
.into(winWidth, winWidth)
.get();
wrapDocBitMapEntity.setNoDoc(false);
wrapDocBitMapEntity.setBitmap(bitmap);
}
return wrapDocBitMapEntity;
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
... ... @@ -226,15 +160,24 @@ public class DocFragment extends AppBaseFragment<LivePresenter> implements LiveC
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Bitmap>() {
.subscribe(new Action1<WrapDocBitMapEntity>() {
@Override
public void call(Bitmap resource) {
if (resource == null) {
public void call(WrapDocBitMapEntity resource) {
if (resource.getBitmap() == null) {
showMessage("图片获取失败");
return;
Bitmap bitmap = getNoDocBitmap();
mCanvasView.setBitmap(bitmap, false);
} else {
mCanvasView.setBitmap(resource.getBitmap(), !resource.showNoDoc());
}
mCanvasView.setBitmap(resource);
}
});
}
private Bitmap getNoDocBitmap() {
Bitmap resource;
resource = BitmapFactory.decodeResource(getResources(), R.mipmap.no_doc);
return resource;
}
}
... ...
... ... @@ -25,7 +25,7 @@ import static android.view.View.GONE;
* @file HomeActivity.java
* @brief
* @date 2017/3/15
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class HomeActivity extends TitleBaseActivity<LivePresenter> {
... ...
... ... @@ -12,6 +12,7 @@ import android.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
... ... @@ -30,6 +31,7 @@ import com.pili.pldroid.player.AVOptions;
import com.pili.pldroid.player.PLMediaPlayer;
import com.pili.pldroid.player.widget.PLVideoTextureView;
import com.pili.pldroid.player.widget.PLVideoView;
import com.videoengine.NTRenderer;
import com.xdy.commonlibrary.core.AppBaseFragment;
import com.xdy.commonlibrary.core.di.AppComponent;
import com.xdy.commonlibrary.permission.PermissifyConstants;
... ... @@ -38,7 +40,6 @@ import com.xdy.home.R;
import com.xdy.home.adapter.HomeAdapter;
import com.xdy.home.entity.VideoEntity;
import com.xdy.home.util.Constants;
import com.xdy.home.util.MediaController;
import com.xdy.home.vp.DaggerLiveComponent;
import com.xdy.home.vp.LiveComponent;
import com.xdy.home.vp.LiveContract;
... ... @@ -59,17 +60,20 @@ import java.util.Random;
import me.yokeyword.fragmentation.SupportFragment;
import static com.pili.pldroid.player.AVOptions.KEY_DELAY_OPTIMIZATION;
/**
* @author Administrator
* @version 1.0
* @file LiveFragment.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class LiveFragment extends AppBaseFragment<LivePresenter> implements LiveContract.LiveView, BridgeWebView.OnReceivedErrorListener, PLMediaPlayer.OnErrorListener, PLMediaPlayer.OnInfoListener, NoScrollViewPager.OnRplayTouchListener {
static String REPLAY = "replay";
static String EXTRAL_CLASSID = "classId";
static String EXTRAL_PORTAL = "portal";
... ... @@ -104,12 +108,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private String role;
private String userId;
private RelativeLayout screen;
private MediaController mMediaController;
// private PLMediaPlayer mMediaPlayer;
private FrameLayout mMediaContainer;
private ImageButton mPauseButton;
private SeekBar mSeekBar;
private RelativeLayout mPauseContainer;
private TextView mClassName;
private SurfaceView mSurfaceView = null;
public static LiveFragment newInstance(boolean replay, @NonNull long classId, @NonNull String portal, String role, String userId) {
LiveFragment liveFragment = new LiveFragment();
... ... @@ -150,7 +155,11 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
slidingTab = (SlidingTabLayout) v.findViewById(R.id.stl_tab);
screen = (RelativeLayout) v.findViewById(R.id.rl_live);
mVideoView = (PLVideoTextureView) v.findViewById(R.id.plv);
mClassName = (TextView) v.findViewById(R.id.tv_classname);
mMediaContainer = (FrameLayout) v.findViewById(R.id.fl_media);
mMeadiaContrillerRight = (RelativeLayout) v.findViewById(R.id.rl_meadia_contriller_right);
mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play);
mPauseContainer = (RelativeLayout) v.findViewById(R.id.rl_operation_play);
mEndTime = (TextView) v.findViewById(R.id.tv_end_time);
... ... @@ -159,10 +168,20 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mSeekBar.setOnSeekBarChangeListener(mSeekListener);
videoContainer = (FrameLayout) v.findViewById(R.id.fl_videoview_container);
if (!replay) {
boolean create = createView();
if (create)
videoContainer.addView(mSurfaceView);
}
initPic = new ImageView(getContext());
initPic.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
initPic.setScaleType(ImageView.ScaleType.CENTER_CROP);
initPic.setImageResource(R.mipmap.no_video);
videoContainer.addView(initPic);
operation = (RelativeLayout) v.findViewById(R.id.rl_operation_video);
viewPager = (NoScrollViewPager) v.findViewById(R.id.home_vp);
viewPager.setOnRplayTouchListener(this);
initPic = (ImageView) v.findViewById(R.id.iv_init_pic);
operationIcon = (ImageView) v.findViewById(R.id.iv_operation_video);
mPauseContainer.setOnClickListener(new View.OnClickListener() {
... ... @@ -173,9 +192,13 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mPresenter.pauseAndStart(!pause);
}
});
mMediaContainer.setOnTouchListener(new View.OnTouchListener() {
mMeadiaContrillerRight.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mPauseContainer != null) {
mPauseContainer.requestLayout();
mPauseContainer.requestFocus();
}
showMediaContainer(TIME_OUT);
return true;
}
... ... @@ -199,6 +222,26 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
}
/* Create rendering */
private boolean createView() {
if (mSurfaceView == null) {
/*
* useOpenGLES2:
* If with true: Check if system supports openGLES, if supported, it will choose openGLES.
* If with false: it will set with default surfaceView;
*/
mSurfaceView = NTRenderer.CreateRenderer(mRootView.getContext(), true);
}
if (mSurfaceView == null) {
Log.i(TAG, "Create render failed..");
return false;
}
return true;
}
@Override
protected void initData() {
... ... @@ -247,7 +290,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
mVideoView.setOnInfoListener(this);
mVideoView.setOnErrorListener(this);
mVideoView.setOnSeekCompleteListener(mOnSeekCompleteListener);
mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_FIT_PARENT);
mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_PAVED_PARENT);
AVOptions options = new AVOptions();
// 解码方式:
... ... @@ -255,7 +298,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
// codec=AVOptions.MEDIA_CODEC_SW_DECODE, 软解
// codec=AVOptions.MEDIA_CODEC_AUTO, 硬解优先,失败后自动切换到软解
// 默认值是:MEDIA_CODEC_SW_DECODE
options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_AUTO);
options.setInteger(AVOptions.KEY_MEDIACODEC, AVOptions.MEDIA_CODEC_HW_DECODE);
// 准备超时时间,包括创建资源、建立连接、请求码流等,单位是 ms
// 默认值是:无
... ... @@ -266,24 +309,23 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
// 当前播放的是否为在线直播,如果是,则底层会有一些播放优化
// 默认值是:0
// 默认值是:0为关闭 1为是
if (!replay) {
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
// 是否开启"延时优化",只在在线直播流中有效
// 默认值是:0
options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
options.setInteger(KEY_DELAY_OPTIMIZATION, 1);
} else {
LogUtil.i(TAG, "回放设置AVOptions.KEY_LIVE_STREAMING, 0");
options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
}
// 默认的缓存大小,单位是 ms
// 默认值是:2000
options.setInteger(AVOptions.KEY_CACHE_BUFFER_DURATION, 2000);
options.setInteger(AVOptions.KEY_CACHE_BUFFER_DURATION, 300);
// 最大的缓存大小,单位是 ms
// 默认值是:4000
options.setInteger(AVOptions.KEY_MAX_CACHE_BUFFER_DURATION, 4000);
options.setInteger(AVOptions.KEY_MAX_CACHE_BUFFER_DURATION, 300);
// 是否自动启动播放,如果设置为 1,则在调用 `prepareAsync` 或者 `setVideoPath` 之后自动启动播放,无需调用 `start()`
// 默认值是:1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 1);
... ... @@ -291,6 +333,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
// 播放前最大探测流的字节数,单位是 byte
// 默认值是:128 * 1024
options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
options.setInteger(AVOptions.KEY_BUFFER_TIME, 100);
// 请在开始播放之前配置
mVideoView.setAVOptions(options);
... ... @@ -373,10 +416,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
@Override
public void addSurfaceView(SurfaceView surfaceview) {
ViewParent parent = surfaceview.getParent();
if (parent == null) {
videoContainer.addView(surfaceview);
public void addSurfaceView(SurfaceView surfaceview, boolean show) {
if (show) {
ViewParent parent = surfaceview.getParent();
if (parent == null) {
videoContainer.addView(surfaceview);
}
} else {
videoContainer.removeView(surfaceview);
}
}
... ... @@ -386,51 +433,70 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
initPic.setVisibility(View.VISIBLE);
operationIcon.setImageResource(R.mipmap.video_open);
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
}
if (!replay) {
mPresenter.start(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
} else {
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
mVideoView.start();
if (replay) {
mVideoView.seekTo(rtmpUrl.getSeek());
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
if (replay)
mVideoView.seekTo(rtmpUrl.getSeek());
mVideoView.start();
}
}
@Override
public void stopVideo() {
public void stopAudio() {
initPic.setImageResource(R.mipmap.no_video);
initPic.setVisibility(View.VISIBLE);
if (mVideoView != null)
mVideoView.stopPlayback();
operationIcon.setImageResource(R.mipmap.video_close);
if (!replay) {
mPresenter.close();
} else {
if (!mPresenter.isVideoMode() && mVideoView != null)
mVideoView.stopPlayback();
}
}
@Override
public void playVideo(VideoEntity rtmpUrl) {
public void stopVideo() {
initPic.setImageResource(R.mipmap.no_video);
operationIcon.setImageResource(R.mipmap.video_close);
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
initPic.setVisibility(View.VISIBLE);
if (!replay) {
// addSurfaceView(surfaceView, false);
mPresenter.close();
} else {
if (mPresenter.isVideoMode() && mVideoView != null)
mVideoView.stopPlayback();
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
mVideoView.start();
if (replay)
mVideoView.seekTo(rtmpUrl.getSeek());
}
@Override
public void stopAudio() {
public void playVideo(VideoEntity rtmpUrl) {
initPic.setImageResource(R.mipmap.no_video);
initPic.setVisibility(View.VISIBLE);
operationIcon.setImageResource(R.mipmap.video_close);
if (!replay) {
mPresenter.start(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
// SurfaceView surfaceView = mPresenter.getsSurfaceView();
// addSurfaceView(surfaceView, true);
} else {
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
}
mVideoView.setVideoPath(!replay ? rtmpUrl.getRtmpUrl() : rtmpUrl.getReplay());
mVideoView.start();
if (mVideoView != null)
mVideoView.stopPlayback();
if (replay)
mVideoView.seekTo(rtmpUrl.getSeek());
}
}
@Override
public void requestCameraAndAudio() {
getBaseActivity().getPermissifyManager().
... ... @@ -547,14 +613,14 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
public void onClick(DialogInterface dialogInterface, int i) {
mPresenter.leaveClass(replay);
if (replay)
pop();
quit();
}
})
.create();
alertDialog.show();
} else {
pop();
quit();
}
return true;
}
... ... @@ -566,6 +632,7 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
private TextView mEndTime, mCurrentTime;
private boolean mShowing;
private boolean mDragging;
private RelativeLayout mMeadiaContrillerRight;
@SuppressLint("HandlerLeak")
... ... @@ -649,6 +716,25 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
}
}
@Override
public void renderClassName(String className) {
mClassName.setText(className);
}
@Override
public void hideInitPic() {
getBaseActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initPic.setVisibility(View.INVISIBLE);
}
});
}
@Override
public SurfaceView getSurfaceView() {
return mSurfaceView;
}
private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
... ... @@ -688,8 +774,12 @@ public class LiveFragment extends AppBaseFragment<LivePresenter> implements Live
*/
public void showMediaContainer(int timeout) {
if (!mShowing) {
if (mPauseButton != null)
mPauseButton.requestFocus();
if (mPauseContainer != null) {
mPauseContainer.requestLayout();
mPauseContainer.requestFocus();
}
mShowing = true;
}
updatePausePlay();
... ...
... ... @@ -18,7 +18,7 @@ import com.xdy.home.vp.LivePresenter;
* @file SiteInputFragment.java
* @brief 站点输入界面
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class SiteInputFragment extends AppBaseFragment<LivePresenter> implements View.OnClickListener {
... ...
... ... @@ -14,7 +14,7 @@ import com.xdy.home.entity.UserEntity;
* @file AccountUtils.java
* @brief 账户管理工具类
* @date 2017-10-24
* Copyright (c) 2017, 上品折扣[]
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class AccountUtils {
... ... @@ -90,6 +90,7 @@ public class AccountUtils {
user.setRecordPlaybackMaxTime(userInfo.getRecordPlaybackMaxTime());
user.setClassTimestamp(userInfo.getClassTimestamp());
user.setClassId(userInfo.getClassId());
user.setClassName(userInfo.getClassName());
}
//保存到缓存
mCacheUtil.put(CacheKey.USERINFO, result);
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.util;
* @file CacheKey.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface CacheKey {
... ...
... ... @@ -6,7 +6,7 @@ package com.xdy.home.util;
* @file Constants.java
* @brief
* @date 2017/3/23 0023
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface Constants {
... ...
package com.xdy.home.util;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.media.AudioManager;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.TextView;
import com.pili.pldroid.player.IMediaController;
import com.xdy.home.R;
import java.util.Locale;
/**
* You can write a custom MediaController instead of this class
* A MediaController widget must implement all the interface defined by com.pili.pldroid.player.IMediaController
*/
public class MediaController extends FrameLayout implements IMediaController {
private static final String TAG = "PLMediaController";
private MediaPlayerControl mPlayer;
private Context mContext;
private PopupWindow mWindow;
private int mAnimStyle;
private View mAnchor;
private View mRoot;
private ProgressBar mProgress;
private TextView mEndTime, mCurrentTime;
private long mDuration;
private boolean mShowing;
private boolean mDragging;
private boolean mInstantSeeking = true;
private static int sDefaultTimeout = 3000;
private static final int SEEK_TO_POST_DELAY_MILLIS = 200;
private static final int FADE_OUT = 1;
private static final int SHOW_PROGRESS = 2;
private boolean mFromXml = false;
private ImageButton mPauseButton;
private ImageButton mFfwdButton;
private ImageButton mRewButton;
private ImageButton mNextButton;
private ImageButton mPrevButton;
private boolean mUseFastForward;
private static final int IC_MEDIA_PAUSE_ID = Resources.getSystem().getIdentifier("ic_media_pause", "drawable", "android");
private static final int IC_MEDIA_PLAY_ID = Resources.getSystem().getIdentifier("ic_media_play", "drawable", "android");
private static final int MEDIA_CONTROLLER_ID = Resources.getSystem().getIdentifier("media_controller", "layout", "android");
private static final int PRV_BUTTON_ID = Resources.getSystem().getIdentifier("prev", "id", "android");
private static final int FFWD_BUTTON_ID = Resources.getSystem().getIdentifier("ffwd", "id", "android");
private static final int NEXT_BUTTON_ID = Resources.getSystem().getIdentifier("next", "id", "android");
private static final int REW_BUTTON_ID = Resources.getSystem().getIdentifier("rew", "id", "android");
private static final int PAUSE_BUTTON_ID = Resources.getSystem().getIdentifier("pauseAndStart", "id", "android");
private static final int MEDIACONTROLLER_PROGRESS_ID = Resources.getSystem().getIdentifier("mediacontroller_progress", "id", "android");
private static final int END_TIME_ID = Resources.getSystem().getIdentifier("time", "id", "android");
private static final int CURRENT_TIME_ID = Resources.getSystem().getIdentifier("time_current", "id", "android");
private AudioManager mAM;
private Runnable mLastSeekBarRunnable;
private boolean mDisableProgress = false;
public MediaController(Context context, AttributeSet attrs) {
super(context, attrs);
mRoot = this;
mFromXml = true;
initController(context);
}
public MediaController(Context context) {
super(context);
if (!mFromXml && initController(context))
initFloatingWindow();
}
public MediaController(Context context, boolean useFastForward, boolean disableProgressBar) {
this(context);
mUseFastForward = useFastForward;
mDisableProgress = disableProgressBar;
}
public MediaController(Context context, boolean useFastForward) {
this(context);
mUseFastForward = useFastForward;
mContext = context.getApplicationContext();
mAM = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mRoot = this;
initFloatingWindow();
}
private boolean initController(Context context) {
mUseFastForward = true;
mContext = context.getApplicationContext();
mAM = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
return true;
}
@Override
public void onFinishInflate() {
if (mRoot != null)
initControllerView(mRoot);
super.onFinishInflate();
}
private void initFloatingWindow() {
mWindow = new PopupWindow(mContext);
mWindow.setFocusable(false);
mWindow.setBackgroundDrawable(null);
mWindow.setOutsideTouchable(true);
mAnimStyle = android.R.style.Animation;
}
/**
* Create the view that holds the widgets that control playback. Derived
* classes can override this to create their own.
* @return The controller view.
*/
protected View makeControllerView() {
return ((LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.home_media_controller, this);
}
private void initControllerView(View v) {
// By default these are hidden.
mPrevButton = (ImageButton) v.findViewById(PRV_BUTTON_ID);
if (mPrevButton != null) {
mPrevButton.setVisibility(View.GONE);
}
mNextButton = (ImageButton) v.findViewById(NEXT_BUTTON_ID);
if (mNextButton != null) {
mNextButton.setVisibility(View.GONE);
}
mFfwdButton = (ImageButton) v.findViewById(FFWD_BUTTON_ID);
if (mFfwdButton != null) {
mFfwdButton.setOnClickListener(mFfwdListener);
if (!mFromXml) {
mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
}
}
mRewButton = (ImageButton) v.findViewById(REW_BUTTON_ID);
if (mRewButton != null) {
mRewButton.setOnClickListener(mRewListener);
if (!mFromXml) {
mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE);
}
}
//自定义
mPauseButton = (ImageButton) v.findViewById(R.id.iv_operation_play);
if (mPauseButton != null) {
mPauseButton.requestFocus();
mPauseButton.setOnClickListener(mPauseListener);
}
//自定义
mProgress = (SeekBar) v.findViewById(R.id.sb_live);
if (mProgress != null) {
if (mProgress instanceof SeekBar) {
SeekBar seeker = (SeekBar) mProgress;
seeker.setOnSeekBarChangeListener(mSeekListener);
seeker.setThumbOffset(1);
}
mProgress.setMax(1000);
mProgress.setEnabled(!mDisableProgress);
}
mEndTime = (TextView) v.findViewById(R.id.tv_end_time);
mCurrentTime = (TextView) v.findViewById(R.id.tv_current_time);
}
/**
* Control the action when the seekbar dragged by user
* @param seekWhenDragging True the media will seek periodically
*/
public void setInstantSeeking(boolean seekWhenDragging) {
mInstantSeeking = seekWhenDragging;
}
private void disableUnsupportedButtons() {
try {
if (mPauseButton != null && !mPlayer.canPause())
mPauseButton.setEnabled(false);
} catch (IncompatibleClassChangeError ex) {
}
}
/**
* <p>
* Change the animation style resource for this controller.
* </p>
* <p>
* <p>
* If the controller is showing, calling this method will take effect only
* the next time the controller is shown.
* </p>
* @param animationStyle animation style to use when the controller appears and disappears.
* Set to -1 for the default animation, 0 for no animation,
* or a resource identifier for an explicit animation.
*/
public void setAnimationStyle(int animationStyle) {
mAnimStyle = animationStyle;
}
public interface OnShownListener {
public void onShown();
}
private OnShownListener mShownListener;
public void setOnShownListener(OnShownListener l) {
mShownListener = l;
}
public interface OnHiddenListener {
public void onHidden();
}
private OnHiddenListener mHiddenListener;
public void setOnHiddenListener(OnHiddenListener l) {
mHiddenListener = l;
}
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
long pos;
switch (msg.what) {
case FADE_OUT:
hide();
break;
case SHOW_PROGRESS:
pos = setProgress();
if (!mDragging && mShowing) {
msg = obtainMessage(SHOW_PROGRESS);
sendMessageDelayed(msg, 1000 - (pos % 1000));
updatePausePlay();
}
break;
}
}
};
private long setProgress() {
if (mPlayer == null || mDragging)
return 0;
long position = mPlayer.getCurrentPosition();
long duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
long pos = 1000L * position / duration;
mProgress.setProgress((int) pos);
}
int percent = mPlayer.getBufferPercentage();
mProgress.setSecondaryProgress(percent * 10);
}
mDuration = duration;
if (mEndTime != null)
mEndTime.setText(generateTime(mDuration));
if (mCurrentTime != null)
mCurrentTime.setText(generateTime(position));
return position;
}
private static String generateTime(long position) {
int totalSeconds = (int) (position / 1000);
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
if (hours > 0) {
return String.format(Locale.US, "%02d:%02d:%02d", hours, minutes,
seconds).toString();
} else {
return String.format(Locale.US, "%02d:%02d", minutes, seconds)
.toString();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
show(sDefaultTimeout);
return true;
}
@Override
public boolean onTrackballEvent(MotionEvent ev) {
show(sDefaultTimeout);
return false;
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
int keyCode = event.getKeyCode();
if (event.getRepeatCount() == 0
&& (keyCode == KeyEvent.KEYCODE_HEADSETHOOK
|| keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_SPACE)) {
doPauseResume();
show(sDefaultTimeout);
if (mPauseButton != null)
mPauseButton.requestFocus();
return true;
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP) {
if (mPlayer.isPlaying()) {
mPlayer.pause();
updatePausePlay();
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_BACK
|| keyCode == KeyEvent.KEYCODE_MENU) {
hide();
return true;
} else {
show(sDefaultTimeout);
}
return super.dispatchKeyEvent(event);
}
private OnClickListener mPauseListener = new OnClickListener() {
public void onClick(View v) {
doPauseResume();
show(sDefaultTimeout);
}
};
private void updatePausePlay() {
if (mRoot == null || mPauseButton == null)
return;
if (mPlayer.isPlaying())
mPauseButton.setImageResource(R.mipmap.stop);
else
mPauseButton.setImageResource(R.mipmap.play);
}
private void doPauseResume() {
if (mPlayer.isPlaying()) {
mPlayer.pause();
} else {
mPlayer.start();
}
updatePausePlay();
}
private SeekBar.OnSeekBarChangeListener mSeekListener = new SeekBar.OnSeekBarChangeListener() {
public void onStartTrackingTouch(SeekBar bar) {
mDragging = true;
show(3600000);
mHandler.removeMessages(SHOW_PROGRESS);
if (mInstantSeeking)
mAM.setStreamMute(AudioManager.STREAM_MUSIC, true);
}
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
if (!fromuser)
return;
final long newposition = (long) (mDuration * progress) / 1000;
String time = generateTime(newposition);
if (mInstantSeeking) {
mHandler.removeCallbacks(mLastSeekBarRunnable);
mLastSeekBarRunnable = new Runnable() {
@Override
public void run() {
mPlayer.seekTo(newposition);
}
};
mHandler.postDelayed(mLastSeekBarRunnable, SEEK_TO_POST_DELAY_MILLIS);
}
if (mCurrentTime != null)
mCurrentTime.setText(time);
}
public void onStopTrackingTouch(SeekBar bar) {
if (!mInstantSeeking)
mPlayer.seekTo(mDuration * bar.getProgress() / 1000);
show(sDefaultTimeout);
mHandler.removeMessages(SHOW_PROGRESS);
mAM.setStreamMute(AudioManager.STREAM_MUSIC, false);
mDragging = false;
mHandler.sendEmptyMessageDelayed(SHOW_PROGRESS, 1000);
}
};
private OnClickListener mRewListener = new OnClickListener() {
public void onClick(View v) {
long pos = mPlayer.getCurrentPosition();
pos -= 5000; // milliseconds
mPlayer.seekTo(pos);
setProgress();
show(sDefaultTimeout);
}
};
private OnClickListener mFfwdListener = new OnClickListener() {
public void onClick(View v) {
long pos = mPlayer.getCurrentPosition();
pos += 15000; // milliseconds
mPlayer.seekTo(pos);
setProgress();
show(sDefaultTimeout);
}
};
/**
* Set the view that acts as the anchor for the control view.
* <p>
* - This can for example be a VideoView, or your Activity's main view.
* - AudioPlayer has no anchor view, so the view parameter will be null.
* @param view The view to which to anchor the controller when it is visible.
*/
@Override
public void setAnchorView(View view) {
mAnchor = view;
if (mAnchor == null) {
sDefaultTimeout = 0; // showMediaContainer forever
}
if (!mFromXml) {
removeAllViews();
mRoot = makeControllerView();
mWindow.setContentView(mRoot);
mWindow.setWidth(LayoutParams.MATCH_PARENT);
mWindow.setHeight(LayoutParams.WRAP_CONTENT);
}
initControllerView(mRoot);
}
@Override
public void setMediaPlayer(MediaPlayerControl player) {
mPlayer = player;
updatePausePlay();
}
@Override
public void show() {
show(sDefaultTimeout);
}
/**
* Show the controller on screen. It will go away automatically after
* 'timeout' milliseconds of inactivity.
* @param timeout The timeout in milliseconds. Use 0 to showMediaContainer the controller until hideMediaContainer() is called.
*/
@Override
public void show(int timeout) {
if (!mShowing) {
if (mAnchor != null && mAnchor.getWindowToken() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
mAnchor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
if (mPauseButton != null)
mPauseButton.requestFocus();
disableUnsupportedButtons();
if (mFromXml) {
setVisibility(View.VISIBLE);
} else {
int[] location = new int[2];
if (mAnchor != null) {
mAnchor.getLocationOnScreen(location);
Rect anchorRect = new Rect(location[0], location[1],
location[0] + mAnchor.getWidth(), location[1]
+ mAnchor.getHeight());
mWindow.setAnimationStyle(mAnimStyle);
mWindow.showAtLocation(mAnchor, Gravity.BOTTOM,
anchorRect.left, 0);
} else {
Rect anchorRect = new Rect(location[0], location[1],
location[0] + mRoot.getWidth(), location[1]
+ mRoot.getHeight());
mWindow.setAnimationStyle(mAnimStyle);
mWindow.showAtLocation(mRoot, Gravity.BOTTOM,
anchorRect.left, 0);
}
}
mShowing = true;
if (mShownListener != null)
mShownListener.onShown();
}
updatePausePlay();
mHandler.sendEmptyMessage(SHOW_PROGRESS);
if (timeout != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(mHandler.obtainMessage(FADE_OUT),
timeout);
}
}
@Override
public boolean isShowing() {
return mShowing;
}
@Override
public void hide() {
if (mShowing) {
if (mAnchor != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
//mAnchor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
}
try {
mHandler.removeMessages(SHOW_PROGRESS);
if (mFromXml)
setVisibility(View.GONE);
else
mWindow.dismiss();
} catch (IllegalArgumentException ex) {
Log.d(TAG, "MediaController already removed");
}
mShowing = false;
if (mHiddenListener != null)
mHiddenListener.onHidden();
}
}
@Override
public void setEnabled(boolean enabled) {
if (mPauseButton != null) {
mPauseButton.setEnabled(enabled);
}
if (mFfwdButton != null) {
mFfwdButton.setEnabled(enabled);
}
if (mRewButton != null) {
mRewButton.setEnabled(enabled);
}
if (mProgress != null && !mDisableProgress)
mProgress.setEnabled(enabled);
disableUnsupportedButtons();
super.setEnabled(enabled);
}
}
... ... @@ -33,7 +33,7 @@ import com.xdy.home.model.DefaultPresenterCallBack;
* @file RefundContract.java
* @brief 直播契约类
* @date 2017/3/24
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public interface LiveContract {
... ... @@ -94,8 +94,9 @@ public interface LiveContract {
/**
* 添加surfaceview
* @param surfaceview
* @param show
*/
void addSurfaceView(SurfaceView surfaceview);
void addSurfaceView(SurfaceView surfaceview, boolean show);
/**
* 刷新按钮
... ... @@ -109,6 +110,20 @@ public interface LiveContract {
void seek(int keyFrameSeek);
void pauseOrStartEverything();
/**
* 显示课堂名称
* @param className
*/
void renderClassName(String className);
void hideInitPic();
/**
* 获取显示的界面
* @return
*/
SurfaceView getSurfaceView();
}
interface ChatView extends BaseView {
... ... @@ -126,6 +141,11 @@ public interface LiveContract {
//返回的更新标注
void renderUpdateAnnotation(WhiteboardUpdateEntity entity);
/**
* 清除文档界面
*/
void clear();
}
interface Model extends IModel {
... ...
... ... @@ -13,7 +13,7 @@ import dagger.Provides;
* @version 1.0
* @file RefundModule.java
* @date 2017/2/24
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
@Module
... ...
... ... @@ -7,7 +7,9 @@ import android.hardware.Camera;
import android.text.TextUtils;
import android.util.Log;
import com.daniulive.smartplayer.SmartPlayerJni;
import com.daniulive.smartplayer.SmartPublisherJni;
import com.eventhandle.SmartEventCallback;
import com.voiceengine.NTAudioRecord;
import com.xdy.commonlibrary.core.CommonAppLike;
import com.xdy.commonlibrary.di.scope.ActivityScope;
... ... @@ -25,7 +27,6 @@ import com.xdy.home.entity.UserEntity;
import com.xdy.home.entity.VideoEntity;
import com.xdy.home.entity.WhiteboardUpdateEntity;
import com.xdy.home.event.ActionPushOrClose;
import com.xdy.home.event.EventHande;
import com.xdy.home.model.DefaultPresenterCallBack;
import com.xdy.home.util.AccountUtils;
import com.xdy.home.util.Constants;
... ... @@ -54,9 +55,12 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
static {
// 推流使用,做1对1放开 System.load("libSmartPublisher.so");
System.loadLibrary("SmartPlayer");
// System.load("libSmartPlayer.so");
}
private long playerHandle = 0;
private LiveContract.DocView docView;
private LiveContract.ChatView chatView;
... ... @@ -85,7 +89,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
* 退出标记
*/
private boolean quit;
/**
* 是否结束了
*/
private boolean isOver;
@Inject
public LivePresenter(LiveContract.Model model,
... ... @@ -94,8 +101,44 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
this.docView = docView;
this.chatView = chatView;
EventBus.getDefault().register(this);
libPlayer = new SmartPlayerJni();
}
public void close() {
if (isPlaybackViewStarted) {
int i = libPlayer.SmartPlayerClose(playerHandle);
playerHandle = 0;
isPlaybackViewStarted = false;
Log.i(TAG, "Stop playback stream--");
}
}
public void start(String playbackUrl) {
isPlaybackViewStarted = true;
playerHandle = libPlayer.SmartPlayerInit(mRootView.getContext());
if (playerHandle == 0) {
Log.e(TAG, "surfaceHandle with nil..");
return;
}
libPlayer.SetSmartPlayerEventCallback(playerHandle, new EventHande());
libPlayer.SmartPlayerSetSurface(playerHandle, mRootView.getSurfaceView()); //if set the second param with null, it means it will playback audio
libPlayer.SmartPlayerSetAudioOutputType(playerHandle, 0);
libPlayer.SmartPlayerSetBuffer(playerHandle, 200);
int iPlaybackRet = libPlayer.SmartPlayerStartPlayback(playerHandle, playbackUrl);
if (iPlaybackRet != 0) {
LogUtil.e(TAG, "StartPlayback strem failed..");
return;
}
}
/**
* 初始化课堂
... ... @@ -200,6 +243,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
if (user != null) {
AccountUtils.saveUser(user);
recordPlaybackMaxTime = user.getRecordPlaybackMaxTime();
String className = user.getClassName();
mRootView.renderClassName(className);
mRootView.renderLogin(false, false);
} else {
mRootView.quit();
... ... @@ -218,7 +263,8 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
case Constants.DOCUMENT_UPDATE:
UpdateDoc updateDoc = GsonUtil.json2Bean(pa, UpdateDoc.class);
// // 获取文档的图片地址
getDocAddress(updateDoc, updateDoc.relativeUrl, updateDoc.fileType, updateDoc.pageNum, updateDoc.curPageNo);
if (updateDoc.visible)
getDocAddress(updateDoc, updateDoc.relativeUrl, updateDoc.fileType, updateDoc.pageNum, updateDoc.curPageNo);
break;
case Constants.DOCUMENT_DELETE:
try {
... ... @@ -256,12 +302,15 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
switch (status) {
case Constants.RECORD_READY:
pause = true;
isOver = false;
break;
case Constants.RECORD_PLAYING:
pause = false;
isOver = false;
mRootView.pauseOrStartEverything();
break;
case Constants.RECORD_SEEK:
isOver = false;
pause = false;
int keyFrameSeek = jsonObject.optInt("keyFrameSeekTime");
mRootView.seek(keyFrameSeek);
... ... @@ -269,12 +318,18 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
case Constants.RECORD_STOP:
pause = true;
//停止后 录制回放要进行初始化
if (!quit) {
if (!quit) {//回放结束了
isOver = true;
if (currentTime < recordPlaybackMaxTime)
currentTime++;
int classId = AccountUtils.getUser().getClassId();
mModel.initRecordPlayback(classId, portal, userRole, userId);
//停止视频
mRootView.stopVideo();
}
break;
case Constants.RECORD_PAUSE:
isOver = false;
pause = true;
mRootView.pauseOrStartEverything();
break;
... ... @@ -359,7 +414,6 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
@Override
public void loadSuccess(String s) {
LogUtil.i(TAG,s);
try {
String replace = s.replace("\\", "");
String substring = replace.substring(1, replace.length() - 1);
... ... @@ -368,7 +422,7 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
s = jsonArray.getString(page - 1);
} catch (JSONException e) {
e.printStackTrace();
LogUtil.i(TAG,"文档解析失败");
LogUtil.i(TAG, "文档解析失败");
}
docView.renderDocAddress(updateDoc, s);
... ... @@ -417,6 +471,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
}
//----------------------------- 1 对 1 使用 接口
private SmartPlayerJni libPlayer = null;
private boolean isPlaybackViewStarted = false;
private String playbackUrl = null;
private boolean isMute = false;
/**
* 消息动作类型 0 (没有动作); 1(开启摄像头推流) ;2(停止推流关闭摄像头)
... ... @@ -705,10 +763,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
@Override
public void onDestroy() {
// if (playerHandle != 0) {
// libPlayer.SmartPlayerClose(playerHandle);
// playerHandle = 0;
// }
if (playerHandle != 0) {
libPlayer.SmartPlayerClose(playerHandle);
playerHandle = 0;
}
EventBus.getDefault().unregister(this);
super.onDestroy();
}
... ... @@ -719,6 +777,10 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
if (b)
mModel.pauseRecordPlayback();
else {
if (isOver) {
docView.clear();
chatView.clearChatHistory();
}
mModel.startRecordPlayback();
}
}
... ... @@ -747,4 +809,38 @@ public class LivePresenter extends BasePresenter<LiveContract.Model, LiveContrac
public void setCurrentTime(int currentTime) {
this.currentTime = currentTime;
}
class EventHande implements SmartEventCallback {
@Override
public void onCallback(int code, long param1, long param2, String param3, String param4, Object param5) {
switch (code) {
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_STARTED:
Log.i(TAG, "开始。。");
if (videoMode)
mRootView.hideInitPic();
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTING:
Log.i(TAG, "连接中。。");
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTION_FAILED:
Log.i(TAG, "连接失败。。");
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_CONNECTED:
Log.i(TAG, "连接成功。。");
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_DISCONNECTED:
Log.i(TAG, "连接断开。。");
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_STOP:
Log.i(TAG, "关闭。。");
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_RESOLUTION_INFO:
Log.i(TAG, "分辨率信息: width: " + param1 + ", height: " + param2);
break;
case EVENTID.EVENT_DANIULIVE_ERC_PLAYER_NO_MEDIADATA_RECEIVED:
Log.i(TAG, "收不到媒体数据,可能是url错误。。");
}
}
}
}
... ...
... ... @@ -16,10 +16,13 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import com.xdy.home.R;
import com.xdy.home.entity.AnnotaionEntity;
import com.xdy.home.entity.PointGroupEntity;
import com.xdy.home.entity.PointXY;
import com.xdy.util.DisplayUtil;
import com.xdy.util.LogUtil;
import com.xdy.util.ResUtil;
import java.util.ArrayList;
import java.util.Iterator;
... ... @@ -55,6 +58,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
private Bitmap mBitmap;
private int screenWidth;
private int currentTop;
private boolean adjust;
private void initRect() {
mCurrentMaxScale = Math.max(
... ... @@ -112,50 +116,63 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
finalWidth = w = mSurfaceWidth;
finalHeight = h = (int) (mImageHeight * scaleRatio);
if (finalHeight < mSurfaceHeight && mImageHeight != 0) {
//比surfaceview高度要小,则放到中间显示
int top = 0;
if ((top = (int) ((mSurfaceHeight - finalHeight) / 2 + 0.5f)) != currentTop) {//重新设置path坐标
currentTop = top;
pathLists.clear();
this.historyPointer = 0;
for (List<PointGroupEntity> pointGroupEntities : originPoint) {
pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));
this.historyPointer++;
for (int j = 0; j < pointGroupEntities.size(); j++) {
PointGroupEntity pointGroupEntity = pointGroupEntities.get(j);
Path path = this.getCurrentPath();
path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
if (adjust) {
if (finalHeight < mSurfaceHeight && mImageHeight != 0) {
//比surfaceview高度要小,则放到中间显示
int top = 0;
if ((top = (int) ((mSurfaceHeight - finalHeight) / 2 + 0.5f)) != currentTop) {//重新设置path坐标
currentTop = top;
pathLists.clear();
this.historyPointer = 0;
for (List<PointGroupEntity> pointGroupEntities : originPoint) {
pathLists.add(createPath(pointGroupEntities.get(0).w / 100 * finalWidth, pointGroupEntities.get(0).h / 100 * finalWidth + currentTop));
this.historyPointer++;
for (int j = 0; j < pointGroupEntities.size(); j++) {
PointGroupEntity pointGroupEntity = pointGroupEntities.get(j);
Path path = this.getCurrentPath();
path.lineTo(pointGroupEntity.w / 100 * finalWidth, pointGroupEntity.h / 100 * finalWidth + currentTop);
}
}
}
mRectDes.left = 0;
mRectDes.top = currentTop;
mRectDes.right = w;
mRectDes.bottom = h + currentTop;
} else {
mRectDes.left = 0;
mRectDes.top = 0;
mRectDes.right = w;
mRectDes.bottom = h;
}
mRectDes.left = 0;
mRectDes.top = currentTop;
mRectDes.right = w;
mRectDes.bottom = h + currentTop;
} else {
mRectDes.left = 0;
mRectDes.top = 0;
mRectDes.right = w;
mRectDes.bottom = h;
}
mCenterX = w / 2;
mCenterY = h / 2;
mCenterX = w / 2;
mCenterY = h / 2;
mRectSrc.left = 0;
mRectSrc.top = 0;
mRectSrc.right = mImageWidth;
mRectSrc.bottom = mImageHeight;
mRectSrc.left = 0;
mRectSrc.top = 0;
mRectSrc.right = mImageWidth;
mRectSrc.bottom = mImageHeight;
} else {
mRectSrc.left = 0;
mRectSrc.top = 0;
mRectSrc.right = mImageWidth;
mRectSrc.bottom = mImageHeight;
mRectDes.left = (mSurfaceWidth - mImageWidth) / 2;
mRectDes.top = (mSurfaceHeight - mImageHeight) / 2;
mRectDes.right = (mSurfaceWidth - mImageWidth) / 2 + mImageWidth;
mRectDes.bottom = (mSurfaceHeight - mImageHeight) / 2 + mImageHeight;
}
}
public void setMaxZoom(float value) {
mCurrentMaxScale = value;
}
public void setBitmap(Bitmap b) {
public void setBitmap(Bitmap b, boolean adjust) {
this.adjust = adjust;
if (b == null) {
return;
}
... ... @@ -183,26 +200,28 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
mCenterX -= offsetX;
mCenterY -= offsetY;
if (finalHeight > mSurfaceHeight) {
int tempTop = mRectDes.top + offsetY;
int deltaTop = 0;
if (tempTop < mSurfaceHeight - finalHeight) {//过头了
deltaTop = Math.abs(tempTop) - Math.abs(mSurfaceHeight - finalHeight);//超过的范围,用正整数表达易于理解
mRectDes.top += (offsetY + deltaTop);
mRectDes.bottom += (offsetY + deltaTop);
adjustPath(offsetY + deltaTop);
} else if (tempTop > 0) {
mRectDes.top += (offsetY - tempTop);
mRectDes.bottom += (offsetY - tempTop);
adjustPath(offsetY - tempTop);
} else {
mRectDes.top += offsetY;
mRectDes.bottom += offsetY;
adjustPath(offsetY);
if (adjust) {
if (finalHeight > mSurfaceHeight) {
int tempTop = mRectDes.top + offsetY;
int deltaTop = 0;
if (tempTop < mSurfaceHeight - finalHeight) {//过头了
deltaTop = Math.abs(tempTop) - Math.abs(mSurfaceHeight - finalHeight);//超过的范围,用正整数表达易于理解
mRectDes.top += (offsetY + deltaTop);
mRectDes.bottom += (offsetY + deltaTop);
adjustPath(offsetY + deltaTop);
} else if (tempTop > 0) {
mRectDes.top += (offsetY - tempTop);
mRectDes.bottom += (offsetY - tempTop);
adjustPath(offsetY - tempTop);
} else {
mRectDes.top += offsetY;
mRectDes.bottom += offsetY;
adjustPath(offsetY);
}
}
drawSurface();
}
drawSurface();
}
}
... ... @@ -417,6 +436,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
this.setOnTouchListener(this);
// 设置背景为透明 否则是黑色
this.setZOrderOnTop(true);
this.setZOrderMediaOverlay(true);
this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
// this.pathLists.add(new Path());
... ... @@ -483,22 +503,26 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
this.drawer = drawer;
}
/**
* 知道想x,yd的坐标绘制线
* @param pointXies
* @param annotations
*/
public void drawLine(List<PointGroupEntity> pointXies, int color) {
setPaintFillColor(color);
copyArr(pointXies);
operatePoints.add(pointXies);
pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));
paintLists.add(this.createPaint(color));
this.historyPointer++;
for (int i = 0; i < pointXies.size(); i++) {
Path path = this.getCurrentPath();
path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop);
public void drawLine(List<AnnotaionEntity> annotations) {
for (AnnotaionEntity annotation : annotations) {
List<PointGroupEntity> pointXies = annotation.pointGroup;
int color = Color.parseColor(annotation.color);
setPaintFillColor(color);
copyArr(pointXies);
operatePoints.add(pointXies);
pathLists.add(createPath(pointXies.get(0).w / 100 * finalWidth, pointXies.get(0).h / 100 * finalWidth + currentTop));
paintLists.add(this.createPaint(color));
this.historyPointer++;
for (int i = 0; i < pointXies.size(); i++) {
Path path = this.getCurrentPath();
path.lineTo(pointXies.get(i).w / 100 * finalWidth, pointXies.get(i).h / 100 * finalWidth + currentTop);
}
}
drawSurface();//获取到一个坐标就刷新下界面
}
... ... @@ -536,7 +560,7 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
//draw bitmap
if (canvas != null && mBitmap != null) {
canvas.drawColor(Color.WHITE);
canvas.drawColor(ResUtil.get().getColor(R.color.home_background));
canvas.drawBitmap(mBitmap, mRectSrc, mRectDes, null);
for (int i = 0; i < this.historyPointer; i++) {
Path path = this.pathLists.get(i);
... ... @@ -570,8 +594,6 @@ public class CanvasView extends SurfaceView implements SurfaceHolder.Callback, V
this.pathLists.clear();
this.paintLists.clear();
historyPointer = 0;
drawSurface();
}
/**
... ...
... ... @@ -30,9 +30,9 @@ public interface OnOperationListener {
void selectedFace(Faceicon content);
void selectedEmoji(Emojicon content);
void selectedEmoji(String content);
void selectedBackSpace(Emojicon back);
void selectedBackSpace(String back);
void selectedFunction(int index);
}
... ...
... ... @@ -18,7 +18,7 @@ import me.yokeyword.fragmentation.SupportFragment;
* @file LoginDialog.java
* @brief
* @date 2017/3/25
* Copyright (c) 2017, 上品折扣
* Copyright (c) 2017, 学点云
* All rights reserved.
*/
public class LoginDialog extends BaseDialog {
... ...
... ... @@ -113,6 +113,14 @@ public enum DisplayRules {
}
}
public static boolean isCustomDeleteEmojicon(String emoji) {
if (emoji != null) {
return (emoji.equals("[img:shanchu]"));
} else {
return false;
}
}
public static List<Emojicon> getAllByType() {
List<Emojicon> datas = new ArrayList<Emojicon>(values().length);
for (DisplayRules data : values()) {
... ...
... ... @@ -57,7 +57,7 @@ public class EmojiPageFragment extends SupportFragment {
private RadioButton[] pointViews;
private OnOperationListener listener;
private List<Emojicon> datas;
private List<String> datas;
@Override
protected View inflaterView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
... ... @@ -69,7 +69,8 @@ public class EmojiPageFragment extends SupportFragment {
@Override
protected void initData() {
super.initData();
datas = DisplayRules.getAllByType();
datas=EmojiconHandler.mEmoticons;
// datas = DisplayRules.getAllByType();
}
... ... @@ -89,7 +90,7 @@ public class EmojiPageFragment extends SupportFragment {
int start = x * ITEM_PAGE_COUNT;
int end = (start + ITEM_PAGE_COUNT) > total ? total
: (start + ITEM_PAGE_COUNT);
final List<Emojicon> itemDatas = datas.subList(start, end);
final List<String> itemDatas = datas.subList(start, end);
GridView view = new GridView(aty);
EmojiAdapter faceAdapter = new EmojiAdapter(view, itemDatas);
... ... @@ -112,8 +113,8 @@ public class EmojiPageFragment extends SupportFragment {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (listener != null) {
Emojicon emoji = itemDatas.get(position);
if (DisplayRules.isDeleteEmojicon(emoji)) {
String emoji = itemDatas.get(position);
if (EmojiconHandler.isCustomDeleteEmojicon(emoji)) {
listener.selectedBackSpace(emoji);
} else {
listener.selectedEmoji(emoji);
... ...
package com.xdy.home.widget.emoji;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import com.xdy.commonlibrary.core.CommonAppLike;
import com.xdy.home.R;
import com.xdy.util.ResUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Admin on 2017/3/29.
... ... @@ -70,8 +81,11 @@ public class EmojiconHandler {
mEmoticons.add("[img:liuhan]");
mEmoticonsId.put("[img:hanxiao]", R.drawable.hanxiao);
mEmoticons.add("[img:hanxiao]");
mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
mEmoticons.add("[img:shanchu]");
mEmoticonsId.put("[img:hanxiao]", R.drawable.hanxiao);
mEmoticons.add("[img:hanxiao]");
//orca_emoji_backspace_back_normal
mEmoticonsId.put("[img:dabing]", R.drawable.dabing);
mEmoticons.add("[img:dabing]");
mEmoticonsId.put("[img:fendou]", R.drawable.fendou);
... ... @@ -126,8 +140,12 @@ public class EmojiconHandler {
mEmoticons.add("[img:kafei]");
mEmoticonsId.put("[img:hua]", R.drawable.hua);
mEmoticons.add("[img:hua]");
mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
mEmoticons.add("[img:shanchu]");
mEmoticonsId.put("[img:tiaoxie]", R.drawable.tiaoxie);
mEmoticons.add("[img:tiaoxie]");
mEmoticonsId.put("[img:xin]", R.drawable.xin);
mEmoticons.add("[img:xin]");
mEmoticonsId.put("[img:dangao]", R.drawable.dangao);
... ... @@ -143,8 +161,17 @@ public class EmojiconHandler {
mEmoticonsId.put("[img:woshou]", R.drawable.woshou);
mEmoticons.add("[img:woshou]");
mEmoticonsId.put("[img:baoquan]", R.drawable.baoquan);
mEmoticons.add("[img:baoquan ]");
mEmoticons.add("[img:baoquan]");
mEmoticonsId.put("[img:zancheng]", R.drawable.zancheng);
mEmoticons.add("[img:zancheng]");
mEmoticonsId.put("[img:shanchu]", R.drawable.orca_emoji_backspace_back_normal);
mEmoticons.add("[img:shanchu]");
}
public static boolean isCustomDeleteEmojicon(String emoji) {
if (emoji != null) {
return (emoji.equals("[img:shanchu]"));
} else {
return false;
}
}
}
... ...
... ... @@ -44,7 +44,7 @@ public class EmoticonsEditText extends EditText {
mUseSystemDefault = a.getBoolean(com.rockerhieu.emojicon.R.styleable.Emojicon_emojiconUseSystemDefault, false);
a.recycle();
mEmojiconTextSize = (int) getTextSize();
setText(getText());
//setText(getText());
}
@Override
... ... @@ -92,28 +92,4 @@ public class EmoticonsEditText extends EditText {
}
}
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
updateText();
}
/**
* Set the size of emojicon in pixels.
*/
public void setEmojiconSize(int pixels) {
mEmojiconSize = pixels;
updateText();
}
private void updateText() {
com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), getText(), mEmojiconSize, mEmojiconTextSize, mUseSystemDefault);
}
/**
* Set whether to use system default emojicon
*/
public void setUseSystemDefault(boolean useSystemDefault) {
mUseSystemDefault = useSystemDefault;
}
}
... ...
... ... @@ -56,9 +56,9 @@ public class EmoticonsTextView extends TextView {
@Override
public void setText(CharSequence text, BufferType type) {
if (!TextUtils.isEmpty(text)) {
SpannableStringBuilder builder = new SpannableStringBuilder(text);
com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mEmojiconTextSize, mTextStart, mTextLength, mUseSystemDefault);
text = builder;
// SpannableStringBuilder builder = new SpannableStringBuilder(text);
// com.rockerhieu.emojicon.EmojiconHandler.addEmojis(getContext(), builder, mEmojiconSize, mEmojiconTextSize, mTextStart, mTextLength, mUseSystemDefault);
// text = builder;
super.setText(replace(text), type);
} else {
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 | 宽: | 高:

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