Commit 01643e3d682f6498d5c73e13b01be6a94fa36cc1
1 parent
ce07866a
区分接口地址
Showing
17 changed files
with
109 additions
and
84 deletions
app/build.gradle
| @@ -31,8 +31,13 @@ dependencies { | @@ -31,8 +31,13 @@ dependencies { | ||
| 31 | compile 'com.github.bumptech.glide:glide:3.7.0' | 31 | compile 'com.github.bumptech.glide:glide:3.7.0' |
| 32 | compile 'org.greenrobot:eventbus:3.0.0' | 32 | compile 'org.greenrobot:eventbus:3.0.0' |
| 33 | 33 | ||
| 34 | - compile 'com.squareup.retrofit2:retrofit:2.3.0' | ||
| 35 | - compile 'com.squareup.retrofit2:converter-gson:2.3.0' | 34 | + //Retrofit |
| 35 | + compile 'com.squareup.retrofit2:retrofit:2.0.2' | ||
| 36 | + compile 'com.squareup.retrofit2:converter-gson:2.0.2' | ||
| 37 | + //OKhttp | ||
| 38 | + compile 'com.squareup.okhttp3:okhttp:3.2.0' | ||
| 39 | + compile 'com.squareup.okhttp3:okhttp-ws:3.2.0' | ||
| 40 | + compile 'com.squareup.okhttp3:logging-interceptor:3.2.0' | ||
| 36 | compile project(':user') | 41 | compile project(':user') |
| 37 | 42 | ||
| 38 | } | 43 | } |
app/src/main/java/com/cnlive/gundam/main/application/CNLiveApplication.java
| @@ -13,8 +13,6 @@ public class CNLiveApplication extends Application { | @@ -13,8 +13,6 @@ public class CNLiveApplication extends Application { | ||
| 13 | @Override | 13 | @Override |
| 14 | public void onCreate() { | 14 | public void onCreate() { |
| 15 | super.onCreate(); | 15 | super.onCreate(); |
| 16 | - //TODO 测试ID 在正式与测试环境均可通过,正式ID则不行~! | ||
| 17 | -// Config.init(getApplicationContext(), "60_j4fc7dsm83", "4c8658abc5d66f270f9bf5dcd1ef11e3597fab4c4e0af9",true); | ||
| 18 | - Config.init(getApplicationContext(), "60_j4faozoq85", "7b6da5a6e2955aaf7f73a06b5bdc6d50e6d5bfda3da86b"); | 16 | + Config.init(getApplicationContext(), "60_j4fc7dsm83", "4c8658abc5d66f270f9bf5dcd1ef11e3597fab4c4e0af9", true);//测试信息 |
| 19 | } | 17 | } |
| 20 | } | 18 | } |
app/src/main/java/com/cnlive/gundam/main/network/ApiService.java
| @@ -3,7 +3,7 @@ package com.cnlive.gundam.main.network; | @@ -3,7 +3,7 @@ package com.cnlive.gundam.main.network; | ||
| 3 | import com.cnlive.gundam.main.model.ActiveListModel; | 3 | import com.cnlive.gundam.main.model.ActiveListModel; |
| 4 | import com.cnlive.gundam.main.model.ActivePlayInfo; | 4 | import com.cnlive.gundam.main.model.ActivePlayInfo; |
| 5 | import com.cnlive.gundam.main.model.VodListPage; | 5 | import com.cnlive.gundam.main.model.VodListPage; |
| 6 | -import com.cnlive.gundam.user.model.ChannelInfoModel; | 6 | +import com.cnlive.gundam.stream.model.ChannelInfoModel; |
| 7 | 7 | ||
| 8 | import java.util.Map; | 8 | import java.util.Map; |
| 9 | 9 |
app/src/main/java/com/cnlive/gundam/main/network/RetrofitUtil.java
| 1 | package com.cnlive.gundam.main.network; | 1 | package com.cnlive.gundam.main.network; |
| 2 | 2 | ||
| 3 | + | ||
| 4 | +import com.cnlive.libs.util.Config; | ||
| 5 | + | ||
| 3 | import okhttp3.OkHttpClient; | 6 | import okhttp3.OkHttpClient; |
| 7 | +import okhttp3.logging.HttpLoggingInterceptor; | ||
| 4 | import retrofit2.Retrofit; | 8 | import retrofit2.Retrofit; |
| 5 | import retrofit2.converter.gson.GsonConverterFactory; | 9 | import retrofit2.converter.gson.GsonConverterFactory; |
| 6 | 10 | ||
| @@ -10,14 +14,25 @@ import retrofit2.converter.gson.GsonConverterFactory; | @@ -10,14 +14,25 @@ import retrofit2.converter.gson.GsonConverterFactory; | ||
| 10 | 14 | ||
| 11 | public class RetrofitUtil { | 15 | public class RetrofitUtil { |
| 12 | 16 | ||
| 13 | - private static final String BASE_URL = "http://test.open.cnlive.com/openapi/api2/"; | ||
| 14 | 17 | ||
| 15 | - public static ApiService getApiService(){ | 18 | + private static final String BASE_URL_DEBUG = "http://test.open.cnlive.com/openapi/api2/"; |
| 19 | + | ||
| 20 | + private static final String BASE_URL_RELEASE = "https://api.cnlive.com/open/api2/"; | ||
| 21 | + | ||
| 22 | + public static ApiService getApiService() { | ||
| 23 | + | ||
| 24 | + | ||
| 16 | Retrofit retrofit = new Retrofit.Builder() | 25 | Retrofit retrofit = new Retrofit.Builder() |
| 17 | - .baseUrl(BASE_URL) | 26 | + .baseUrl(Config.debug ? BASE_URL_DEBUG : BASE_URL_RELEASE) |
| 18 | .addConverterFactory(GsonConverterFactory.create()) | 27 | .addConverterFactory(GsonConverterFactory.create()) |
| 19 | - .client(new OkHttpClient()) | 28 | + .client(getNewClient()) |
| 20 | .build(); | 29 | .build(); |
| 21 | return retrofit.create(ApiService.class); | 30 | return retrofit.create(ApiService.class); |
| 22 | } | 31 | } |
| 32 | + | ||
| 33 | + private static OkHttpClient getNewClient() { | ||
| 34 | + HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); | ||
| 35 | + httpLoggingInterceptor.setLevel(Config.debug ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE); | ||
| 36 | + return new OkHttpClient.Builder().addInterceptor(httpLoggingInterceptor).build(); | ||
| 37 | + } | ||
| 23 | } | 38 | } |
app/src/main/java/com/cnlive/gundam/main/presenter/AnchorInfoPresenter.java
| @@ -5,7 +5,7 @@ import android.content.Context; | @@ -5,7 +5,7 @@ import android.content.Context; | ||
| 5 | import com.cnlive.gundam.main.network.RetrofitUtil; | 5 | import com.cnlive.gundam.main.network.RetrofitUtil; |
| 6 | import com.cnlive.gundam.main.network.util.SignUtil; | 6 | import com.cnlive.gundam.main.network.util.SignUtil; |
| 7 | import com.cnlive.gundam.main.presenter.view.AnchorInfoView; | 7 | import com.cnlive.gundam.main.presenter.view.AnchorInfoView; |
| 8 | -import com.cnlive.gundam.user.model.ChannelInfoModel; | 8 | +import com.cnlive.gundam.stream.model.ChannelInfoModel; |
| 9 | import com.cnlive.libs.util.Config; | 9 | import com.cnlive.libs.util.Config; |
| 10 | 10 | ||
| 11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
app/src/main/java/com/cnlive/gundam/main/presenter/view/AnchorInfoView.java
| 1 | package com.cnlive.gundam.main.presenter.view; | 1 | package com.cnlive.gundam.main.presenter.view; |
| 2 | 2 | ||
| 3 | -import com.cnlive.gundam.user.model.ChannelInfoModel; | 3 | +import com.cnlive.gundam.stream.model.ChannelInfoModel; |
| 4 | 4 | ||
| 5 | public interface AnchorInfoView { | 5 | public interface AnchorInfoView { |
| 6 | + /** | ||
| 7 | + * 获取主播信息成功 | ||
| 8 | + * | ||
| 9 | + * @param channelInfo 主播信息 | ||
| 10 | + */ | ||
| 6 | void onAnchorInfo(ChannelInfoModel channelInfo); | 11 | void onAnchorInfo(ChannelInfoModel channelInfo); |
| 7 | 12 | ||
| 13 | + /** | ||
| 14 | + * 获取主播信息失败 | ||
| 15 | + */ | ||
| 8 | void getAnchorFailure(); | 16 | void getAnchorFailure(); |
| 9 | } | 17 | } |
| 10 | \ No newline at end of file | 18 | \ No newline at end of file |
app/src/main/java/com/cnlive/gundam/main/ui/activity/MainActivity.java
| 1 | package com.cnlive.gundam.main.ui.activity; | 1 | package com.cnlive.gundam.main.ui.activity; |
| 2 | 2 | ||
| 3 | import android.app.AlertDialog; | 3 | import android.app.AlertDialog; |
| 4 | -import android.app.Dialog; | ||
| 5 | import android.content.DialogInterface; | 4 | import android.content.DialogInterface; |
| 6 | import android.content.Intent; | 5 | import android.content.Intent; |
| 7 | import android.databinding.DataBindingUtil; | 6 | import android.databinding.DataBindingUtil; |
| @@ -18,10 +17,10 @@ import com.cnlive.gundam.main.ui.fragment.HomeFragment; | @@ -18,10 +17,10 @@ import com.cnlive.gundam.main.ui.fragment.HomeFragment; | ||
| 18 | import com.cnlive.gundam.main.ui.fragment.LiveFragment; | 17 | import com.cnlive.gundam.main.ui.fragment.LiveFragment; |
| 19 | import com.cnlive.gundam.main.ui.fragment.UGCListFragment; | 18 | import com.cnlive.gundam.main.ui.fragment.UGCListFragment; |
| 20 | import com.cnlive.gundam.main.ui.widget.FragmentTabHost; | 19 | import com.cnlive.gundam.main.ui.widget.FragmentTabHost; |
| 20 | +import com.cnlive.gundam.stream.model.ChannelInfoModel; | ||
| 21 | import com.cnlive.gundam.stream.ui.activity.StreamActivity; | 21 | import com.cnlive.gundam.stream.ui.activity.StreamActivity; |
| 22 | import com.cnlive.gundam.user.activity.LoginActivity; | 22 | import com.cnlive.gundam.user.activity.LoginActivity; |
| 23 | import com.cnlive.gundam.user.auth.UserService; | 23 | import com.cnlive.gundam.user.auth.UserService; |
| 24 | -import com.cnlive.gundam.user.model.ChannelInfoModel; | ||
| 25 | import com.cnlive.gundam.user.model.User; | 24 | import com.cnlive.gundam.user.model.User; |
| 26 | import com.cnlive.libs.util.Config; | 25 | import com.cnlive.libs.util.Config; |
| 27 | 26 | ||
| @@ -33,8 +32,6 @@ import java.util.Arrays; | @@ -33,8 +32,6 @@ import java.util.Arrays; | ||
| 33 | 32 | ||
| 34 | public class MainActivity extends AppCompatActivity implements FragmentTabHost.OnSetCurrentTabListener, AnchorInfoView { | 33 | public class MainActivity extends AppCompatActivity implements FragmentTabHost.OnSetCurrentTabListener, AnchorInfoView { |
| 35 | 34 | ||
| 36 | - private Dialog verifiedDialog; | ||
| 37 | - | ||
| 38 | private AnchorInfoPresenter mAnchorInfoPresenter; | 35 | private AnchorInfoPresenter mAnchorInfoPresenter; |
| 39 | 36 | ||
| 40 | @Override | 37 | @Override |
| @@ -78,8 +75,8 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | @@ -78,8 +75,8 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | ||
| 78 | 75 | ||
| 79 | 76 | ||
| 80 | @Override | 77 | @Override |
| 81 | - public void onAnchorInfo(ChannelInfoModel model) { | ||
| 82 | - switch (model.getData().getStatus()) { | 78 | + public void onAnchorInfo(ChannelInfoModel info) { |
| 79 | + switch (info.getData().getStatus()) { | ||
| 83 | case -1: | 80 | case -1: |
| 84 | Toast.makeText(this, "主播不存在", Toast.LENGTH_SHORT).show(); | 81 | Toast.makeText(this, "主播不存在", Toast.LENGTH_SHORT).show(); |
| 85 | showVerifiedDialog(); | 82 | showVerifiedDialog(); |
| @@ -92,11 +89,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | @@ -92,11 +89,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | ||
| 92 | break; | 89 | break; |
| 93 | case 3: | 90 | case 3: |
| 94 | Toast.makeText(this, "开启直播", Toast.LENGTH_SHORT).show(); | 91 | Toast.makeText(this, "开启直播", Toast.LENGTH_SHORT).show(); |
| 95 | - String activityId = System.currentTimeMillis() + ""; | ||
| 96 | - String channelId = model.getData().getChannelId(); | ||
| 97 | - String channelName = model.getData().getChannelName(); | ||
| 98 | - String coverImgUrl = model.getData().getCoverImgUrl(); | ||
| 99 | - StreamActivity.start(this, activityId, channelId, channelName, coverImgUrl, false); | 92 | + startStreamActivity(info); |
| 100 | break; | 93 | break; |
| 101 | case 4: | 94 | case 4: |
| 102 | Toast.makeText(this, "主播被禁用", Toast.LENGTH_SHORT).show(); | 95 | Toast.makeText(this, "主播被禁用", Toast.LENGTH_SHORT).show(); |
| @@ -106,18 +99,33 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | @@ -106,18 +99,33 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | ||
| 106 | 99 | ||
| 107 | @Override | 100 | @Override |
| 108 | public void getAnchorFailure() { | 101 | public void getAnchorFailure() { |
| 109 | - Toast.makeText(this, getString(R.string.request_state_error), Toast.LENGTH_LONG).show(); | 102 | + Toast.makeText(this, "主播信息认证失败", Toast.LENGTH_LONG).show(); |
| 103 | + } | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 开启直播推流页面 | ||
| 107 | + * @param info 主播信息 | ||
| 108 | + */ | ||
| 109 | + private void startStreamActivity(ChannelInfoModel info) { | ||
| 110 | + String activityId = System.currentTimeMillis() + ""; | ||
| 111 | + String channelId = info.getData().getChannelId(); | ||
| 112 | + String channelName = info.getData().getChannelName(); | ||
| 113 | + String coverImgUrl = info.getData().getCoverImgUrl(); | ||
| 114 | + StreamActivity.start(this, activityId, channelId, channelName, coverImgUrl, false); | ||
| 110 | } | 115 | } |
| 111 | 116 | ||
| 117 | + /** | ||
| 118 | + * 显示主播申请页面 | ||
| 119 | + */ | ||
| 112 | private void showVerifiedDialog() { | 120 | private void showVerifiedDialog() { |
| 113 | - verifiedDialog = new AlertDialog.Builder(this) | 121 | + new AlertDialog.Builder(this) |
| 114 | .setMessage("亲,完成实名认证就可以开播啦,现在就去认证吧?") | 122 | .setMessage("亲,完成实名认证就可以开播啦,现在就去认证吧?") |
| 115 | .setPositiveButton("去认证", new DialogInterface.OnClickListener() { | 123 | .setPositiveButton("去认证", new DialogInterface.OnClickListener() { |
| 116 | @Override | 124 | @Override |
| 117 | public void onClick(DialogInterface dialogInterface, int i) { | 125 | public void onClick(DialogInterface dialogInterface, int i) { |
| 118 | - verifiedDialog.dismiss(); | 126 | + dialogInterface.dismiss(); |
| 119 | String channelId = UserService.getInstance(MainActivity.this).getActiveAccountInfo().getUid() + ""; | 127 | String channelId = UserService.getInstance(MainActivity.this).getActiveAccountInfo().getUid() + ""; |
| 120 | - String url = String.format(getString(R.string.verified_url), channelId, Config.getAppId()); | 128 | + String url = String.format(getString(Config.debug ? R.string.debug_verified_url : R.string.verified_url), channelId, Config.getAppId()); |
| 121 | Intent intent = new Intent(MainActivity.this, WebViewActivity.class); | 129 | Intent intent = new Intent(MainActivity.this, WebViewActivity.class); |
| 122 | intent.putExtra("url", url); | 130 | intent.putExtra("url", url); |
| 123 | intent.putExtra("title", "主播认证"); | 131 | intent.putExtra("title", "主播认证"); |
| @@ -127,9 +135,8 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | @@ -127,9 +135,8 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O | ||
| 127 | .setNegativeButton("取消", new DialogInterface.OnClickListener() { | 135 | .setNegativeButton("取消", new DialogInterface.OnClickListener() { |
| 128 | @Override | 136 | @Override |
| 129 | public void onClick(DialogInterface dialogInterface, int i) { | 137 | public void onClick(DialogInterface dialogInterface, int i) { |
| 130 | - verifiedDialog.dismiss(); | 138 | + dialogInterface.dismiss(); |
| 131 | } | 139 | } |
| 132 | - }) | ||
| 133 | - .show(); | 140 | + }).show(); |
| 134 | } | 141 | } |
| 135 | } | 142 | } |
| 136 | \ No newline at end of file | 143 | \ No newline at end of file |
app/src/main/java/com/cnlive/gundam/main/ui/widget/FragmentTabHost.java
| @@ -30,7 +30,6 @@ public class FragmentTabHost extends TabHost | @@ -30,7 +30,6 @@ public class FragmentTabHost extends TabHost | ||
| 30 | implements TabHost.OnTabChangeListener { | 30 | implements TabHost.OnTabChangeListener { |
| 31 | private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); | 31 | private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); |
| 32 | private FrameLayout mRealTabContent; | 32 | private FrameLayout mRealTabContent; |
| 33 | - private Context mContext; | ||
| 34 | private FragmentManager mFragmentManager; | 33 | private FragmentManager mFragmentManager; |
| 35 | private int mContainerId; | 34 | private int mContainerId; |
| 36 | private OnSetCurrentTabListener onSetCurrentTabListener; | 35 | private OnSetCurrentTabListener onSetCurrentTabListener; |
| @@ -45,7 +44,7 @@ public class FragmentTabHost extends TabHost | @@ -45,7 +44,7 @@ public class FragmentTabHost extends TabHost | ||
| 45 | boolean onSetCurrentTab(String tag); | 44 | boolean onSetCurrentTab(String tag); |
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | - public static final class TabItemInfo{ | 47 | + public static final class TabItemInfo { |
| 49 | private final String tag; | 48 | private final String tag; |
| 50 | private final int layoutId; | 49 | private final int layoutId; |
| 51 | private final Class<?> clss; | 50 | private final Class<?> clss; |
| @@ -145,14 +144,14 @@ public class FragmentTabHost extends TabHost | @@ -145,14 +144,14 @@ public class FragmentTabHost extends TabHost | ||
| 145 | a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.inflatedId}, 0, 0); | 144 | a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.inflatedId}, 0, 0); |
| 146 | try { | 145 | try { |
| 147 | mContainerId = a.getResourceId(0, 0); | 146 | mContainerId = a.getResourceId(0, 0); |
| 148 | - }finally { | 147 | + } finally { |
| 149 | a.recycle(); | 148 | a.recycle(); |
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | a = context.obtainStyledAttributes(attrs, R.styleable.FragmentTabHost); | 151 | a = context.obtainStyledAttributes(attrs, R.styleable.FragmentTabHost); |
| 153 | try { | 152 | try { |
| 154 | mDiciderDrawable = a.getDrawable(R.styleable.FragmentTabHost_dividerDrawable); | 153 | mDiciderDrawable = a.getDrawable(R.styleable.FragmentTabHost_dividerDrawable); |
| 155 | - }finally { | 154 | + } finally { |
| 156 | a.recycle(); | 155 | a.recycle(); |
| 157 | } | 156 | } |
| 158 | super.setOnTabChangedListener(this); | 157 | super.setOnTabChangedListener(this); |
| @@ -188,8 +187,8 @@ public class FragmentTabHost extends TabHost | @@ -188,8 +187,8 @@ public class FragmentTabHost extends TabHost | ||
| 188 | 187 | ||
| 189 | /** | 188 | /** |
| 190 | * @deprecated Don't call the original TabHost setup, you must instead | 189 | * @deprecated Don't call the original TabHost setup, you must instead |
| 191 | - * call {@link #setup(Context, FragmentManager)} or | ||
| 192 | - * {@link #setup(Context, FragmentManager, int)}. | 190 | + * call {@link #setup( FragmentManager)} or |
| 191 | + * {@link #setup( FragmentManager, int)}. | ||
| 193 | */ | 192 | */ |
| 194 | @Override | 193 | @Override |
| 195 | @Deprecated | 194 | @Deprecated |
| @@ -198,19 +197,17 @@ public class FragmentTabHost extends TabHost | @@ -198,19 +197,17 @@ public class FragmentTabHost extends TabHost | ||
| 198 | "Must call setup() that takes a Context and FragmentManager"); | 197 | "Must call setup() that takes a Context and FragmentManager"); |
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | - public void setup(Context context, FragmentManager manager) { | ||
| 202 | - ensureHierarchy(context); // Ensure views required by super.setup() | 200 | + public void setup(FragmentManager manager) { |
| 201 | + ensureHierarchy(getContext()); // Ensure views required by super.setup() | ||
| 203 | super.setup(); | 202 | super.setup(); |
| 204 | - mContext = context; | ||
| 205 | mFragmentManager = manager; | 203 | mFragmentManager = manager; |
| 206 | ensureContent(); | 204 | ensureContent(); |
| 207 | setDividerDrawable(mDiciderDrawable); | 205 | setDividerDrawable(mDiciderDrawable); |
| 208 | } | 206 | } |
| 209 | 207 | ||
| 210 | - public void setup(Context context, FragmentManager manager, int containerId) { | ||
| 211 | - ensureHierarchy(context); // Ensure views required by super.setup() | 208 | + public void setup(FragmentManager manager, int containerId) { |
| 209 | + ensureHierarchy(getContext()); // Ensure views required by super.setup() | ||
| 212 | super.setup(); | 210 | super.setup(); |
| 213 | - mContext = context; | ||
| 214 | mFragmentManager = manager; | 211 | mFragmentManager = manager; |
| 215 | mContainerId = containerId; | 212 | mContainerId = containerId; |
| 216 | ensureContent(); | 213 | ensureContent(); |
| @@ -226,15 +223,17 @@ public class FragmentTabHost extends TabHost | @@ -226,15 +223,17 @@ public class FragmentTabHost extends TabHost | ||
| 226 | 223 | ||
| 227 | /** | 224 | /** |
| 228 | * 设置内容ID并初始化 | 225 | * 设置内容ID并初始化 |
| 226 | + * | ||
| 229 | * @param contentId 展示内容的Layout ID | 227 | * @param contentId 展示内容的Layout ID |
| 230 | */ | 228 | */ |
| 231 | - public void setContentId(int contentId){ | ||
| 232 | - FragmentActivity activity = ((FragmentActivity)getContext()); | ||
| 233 | - setup(activity, activity.getSupportFragmentManager(), contentId); | 229 | + public void setContentId(int contentId) { |
| 230 | + FragmentActivity activity = ((FragmentActivity) getContext()); | ||
| 231 | + setup(activity.getSupportFragmentManager(), contentId); | ||
| 234 | } | 232 | } |
| 235 | 233 | ||
| 236 | /** | 234 | /** |
| 237 | * 添加标签内容信息 | 235 | * 添加标签内容信息 |
| 236 | + * | ||
| 238 | * @param list | 237 | * @param list |
| 239 | */ | 238 | */ |
| 240 | public void setTabItemList(List<TabItemInfo> list) { | 239 | public void setTabItemList(List<TabItemInfo> list) { |
| @@ -257,7 +256,7 @@ public class FragmentTabHost extends TabHost | @@ -257,7 +256,7 @@ public class FragmentTabHost extends TabHost | ||
| 257 | } | 256 | } |
| 258 | 257 | ||
| 259 | public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { | 258 | public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { |
| 260 | - tabSpec.setContent(new DummyTabFactory(mContext)); | 259 | + tabSpec.setContent(new DummyTabFactory(getContext())); |
| 261 | String tag = tabSpec.getTag(); | 260 | String tag = tabSpec.getTag(); |
| 262 | 261 | ||
| 263 | TabInfo info = new TabInfo(tag, clss, args); | 262 | TabInfo info = new TabInfo(tag, clss, args); |
| @@ -391,7 +390,7 @@ public class FragmentTabHost extends TabHost | @@ -391,7 +390,7 @@ public class FragmentTabHost extends TabHost | ||
| 391 | this.onSetCurrentTabListener = onSetCurrentTabListener; | 390 | this.onSetCurrentTabListener = onSetCurrentTabListener; |
| 392 | } | 391 | } |
| 393 | 392 | ||
| 394 | - public void setDividerDrawable(@Nullable Drawable drawable){ | 393 | + public void setDividerDrawable(@Nullable Drawable drawable) { |
| 395 | getTabWidget().setDividerDrawable(drawable); | 394 | getTabWidget().setDividerDrawable(drawable); |
| 396 | } | 395 | } |
| 397 | 396 | ||
| @@ -417,7 +416,7 @@ public class FragmentTabHost extends TabHost | @@ -417,7 +416,7 @@ public class FragmentTabHost extends TabHost | ||
| 417 | } | 416 | } |
| 418 | if (newTab != null) { | 417 | if (newTab != null) { |
| 419 | if (newTab.fragment == null) { | 418 | if (newTab.fragment == null) { |
| 420 | - newTab.fragment = Fragment.instantiate(mContext, | 419 | + newTab.fragment = Fragment.instantiate(getContext(), |
| 421 | newTab.clss.getName(), newTab.args); | 420 | newTab.clss.getName(), newTab.args); |
| 422 | ft.add(mContainerId, newTab.fragment, newTab.tag); | 421 | ft.add(mContainerId, newTab.fragment, newTab.tag); |
| 423 | } else { | 422 | } else { |
app/src/main/java/com/cnlive/gundam/user/model/ChannelInfoModel.java renamed to app/src/main/java/com/cnlive/gundam/stream/model/ChannelInfoModel.java
app/src/main/java/com/cnlive/gundam/video/adpter/CommonAdapter.java
| 1 | package com.cnlive.gundam.video.adpter; | 1 | package com.cnlive.gundam.video.adpter; |
| 2 | 2 | ||
| 3 | -import android.content.Context; | ||
| 4 | import android.databinding.DataBindingUtil; | 3 | import android.databinding.DataBindingUtil; |
| 5 | import android.databinding.ViewDataBinding; | 4 | import android.databinding.ViewDataBinding; |
| 6 | import android.view.LayoutInflater; | 5 | import android.view.LayoutInflater; |
| @@ -20,13 +19,11 @@ import java.util.List; | @@ -20,13 +19,11 @@ import java.util.List; | ||
| 20 | * @desc ${TODD} | 19 | * @desc ${TODD} |
| 21 | */ | 20 | */ |
| 22 | public class CommonAdapter<T> extends BaseAdapter { | 21 | public class CommonAdapter<T> extends BaseAdapter { |
| 23 | - private Context mContext; | ||
| 24 | private List<T> mDataList; | 22 | private List<T> mDataList; |
| 25 | private int layoutId; // 条目布局ID | 23 | private int layoutId; // 条目布局ID |
| 26 | private int variableId; // DataBinding的变量ID,可通过类似R文件的BR文件来获取 | 24 | private int variableId; // DataBinding的变量ID,可通过类似R文件的BR文件来获取 |
| 27 | 25 | ||
| 28 | - public CommonAdapter(Context context, List<T> dataList, int layoutId, int variableId) { | ||
| 29 | - this.mContext = context; | 26 | + public CommonAdapter(List<T> dataList, int layoutId, int variableId) { |
| 30 | this.mDataList = dataList; | 27 | this.mDataList = dataList; |
| 31 | this.layoutId = layoutId; | 28 | this.layoutId = layoutId; |
| 32 | this.variableId = variableId; | 29 | this.variableId = variableId; |
| @@ -52,7 +49,7 @@ public class CommonAdapter<T> extends BaseAdapter { | @@ -52,7 +49,7 @@ public class CommonAdapter<T> extends BaseAdapter { | ||
| 52 | 49 | ||
| 53 | ViewDataBinding binding; | 50 | ViewDataBinding binding; |
| 54 | if (convertView == null) { | 51 | if (convertView == null) { |
| 55 | - binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), layoutId, parent, false); | 52 | + binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), layoutId, parent, false); |
| 56 | } else { | 53 | } else { |
| 57 | binding = DataBindingUtil.getBinding(convertView); | 54 | binding = DataBindingUtil.getBinding(convertView); |
| 58 | } | 55 | } |
app/src/main/java/com/cnlive/gundam/video/adpter/GiftAdapter.java
| 1 | package com.cnlive.gundam.video.adpter; | 1 | package com.cnlive.gundam.video.adpter; |
| 2 | 2 | ||
| 3 | -import android.content.Context; | ||
| 4 | import android.databinding.DataBindingUtil; | 3 | import android.databinding.DataBindingUtil; |
| 5 | import android.databinding.ViewDataBinding; | 4 | import android.databinding.ViewDataBinding; |
| 6 | import android.support.v7.widget.RecyclerView; | 5 | import android.support.v7.widget.RecyclerView; |
| @@ -19,24 +18,20 @@ import java.util.List; | @@ -19,24 +18,20 @@ import java.util.List; | ||
| 19 | */ | 18 | */ |
| 20 | 19 | ||
| 21 | public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { | 20 | public class GiftAdapter extends RecyclerView.Adapter<GiftAdapter.RVHolder> { |
| 22 | - private Context mContext; | ||
| 23 | private List<GiftModle> mDataList; | 21 | private List<GiftModle> mDataList; |
| 24 | private int mLayoutId; // 条目布局文件ID | 22 | private int mLayoutId; // 条目布局文件ID |
| 25 | private int mVariableId; // DataBinding变量ID | 23 | private int mVariableId; // DataBinding变量ID |
| 26 | 24 | ||
| 27 | - public GiftAdapter(Context context, List<GiftModle> list, int layoutId, int variableId) { | ||
| 28 | - this.mContext = context; | 25 | + public GiftAdapter(List<GiftModle> list, int layoutId, int variableId) { |
| 29 | this.mDataList = list; | 26 | this.mDataList = list; |
| 30 | this.mLayoutId = layoutId; | 27 | this.mLayoutId = layoutId; |
| 31 | mVariableId = variableId; | 28 | mVariableId = variableId; |
| 32 | - | ||
| 33 | - | ||
| 34 | } | 29 | } |
| 35 | 30 | ||
| 36 | 31 | ||
| 37 | @Override | 32 | @Override |
| 38 | public RVHolder onCreateViewHolder(ViewGroup parent, int viewType) { | 33 | public RVHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
| 39 | - ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), mLayoutId, parent, false); | 34 | + ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), mLayoutId, parent, false); |
| 40 | RVHolder holder = new RVHolder(binding.getRoot()); | 35 | RVHolder holder = new RVHolder(binding.getRoot()); |
| 41 | holder.binding = binding; | 36 | holder.binding = binding; |
| 42 | return holder; | 37 | return holder; |
app/src/main/java/com/cnlive/gundam/video/fragment/chat/ChatRoomFragment.java
| @@ -88,6 +88,13 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | @@ -88,6 +88,13 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | ||
| 88 | initChat(); | 88 | initChat(); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | + @Override | ||
| 92 | + public void onDestroyView() { | ||
| 93 | + super.onDestroyView(); | ||
| 94 | + onSendMessageListener = null; | ||
| 95 | + onConnectListener = null; | ||
| 96 | + } | ||
| 97 | + | ||
| 91 | private void initDate() { | 98 | private void initDate() { |
| 92 | int[] imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, | 99 | int[] imaSource = new int[]{R.drawable.porsch_small80, R.drawable.fighter_small80, |
| 93 | R.drawable.plane_small80, | 100 | R.drawable.plane_small80, |
| @@ -112,7 +119,7 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | @@ -112,7 +119,7 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | ||
| 112 | private void initMessageAdapter() { | 119 | private void initMessageAdapter() { |
| 113 | messageContentArrayList = new ArrayList<>(); | 120 | messageContentArrayList = new ArrayList<>(); |
| 114 | if (messageContentCommonAdapter == null) | 121 | if (messageContentCommonAdapter == null) |
| 115 | - messageContentCommonAdapter = new CommonAdapter<>(getActivity(), messageContentArrayList, R.layout.item_list_right, BR.user); | 122 | + messageContentCommonAdapter = new CommonAdapter<>(messageContentArrayList, R.layout.item_list_right, BR.user); |
| 116 | } | 123 | } |
| 117 | 124 | ||
| 118 | private void initGiftAdapter() { | 125 | private void initGiftAdapter() { |
| @@ -120,7 +127,7 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | @@ -120,7 +127,7 @@ public class ChatRoomFragment extends Fragment implements View.OnClickListener { | ||
| 120 | GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2); | 127 | GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2); |
| 121 | gridLayoutManager.setOrientation(OrientationHelper.HORIZONTAL); | 128 | gridLayoutManager.setOrientation(OrientationHelper.HORIZONTAL); |
| 122 | fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager); | 129 | fragmentChatBinding.recyclerGift.setLayoutManager(gridLayoutManager); |
| 123 | - fragmentChatBinding.setGiftAdapter(new GiftAdapter(getActivity(), giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); | 130 | + fragmentChatBinding.setGiftAdapter(new GiftAdapter(giftArray, R.layout.fragment_gift_receycel, BR.dataBean)); |
| 124 | } | 131 | } |
| 125 | 132 | ||
| 126 | 133 |
app/src/main/java/com/cnlive/gundam/video/view/BaseVideoView.java
| @@ -30,7 +30,6 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -30,7 +30,6 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 30 | IMediaPlayer.OnBufferingUpdateListener, ISwitchVideoView.OnSwitchVideoPreparedListener, | 30 | IMediaPlayer.OnBufferingUpdateListener, ISwitchVideoView.OnSwitchVideoPreparedListener, |
| 31 | ISwitchVideoView.OnSwitchVideoErrorListener, ISwitchVideoView.OnSwitchVideoCompleteListener { | 31 | ISwitchVideoView.OnSwitchVideoErrorListener, ISwitchVideoView.OnSwitchVideoCompleteListener { |
| 32 | 32 | ||
| 33 | - protected Context mContext; | ||
| 34 | protected LayoutVideoViewBinding binding; | 33 | protected LayoutVideoViewBinding binding; |
| 35 | 34 | ||
| 36 | //记录当前视频播放状态 | 35 | //记录当前视频播放状态 |
| @@ -71,7 +70,6 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -71,7 +70,6 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 71 | 70 | ||
| 72 | public BaseVideoView(Context context, AttributeSet attrs, int defStyleAttr) { | 71 | public BaseVideoView(Context context, AttributeSet attrs, int defStyleAttr) { |
| 73 | super(context, attrs, defStyleAttr); | 72 | super(context, attrs, defStyleAttr); |
| 74 | - this.mContext = context; | ||
| 75 | init(); | 73 | init(); |
| 76 | } | 74 | } |
| 77 | 75 | ||
| @@ -81,7 +79,7 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -81,7 +79,7 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 81 | 79 | ||
| 82 | protected void init() { | 80 | protected void init() { |
| 83 | sharedPreferencesHelper = SharedPreferencesHelper.getInstance(getContext()); | 81 | sharedPreferencesHelper = SharedPreferencesHelper.getInstance(getContext()); |
| 84 | - binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.layout_video_view, this, true); | 82 | + binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.layout_video_view, this, true); |
| 85 | binding.videoView.setOnPreparedListener(this); | 83 | binding.videoView.setOnPreparedListener(this); |
| 86 | binding.videoView.setOnInfoListener(this); | 84 | binding.videoView.setOnInfoListener(this); |
| 87 | binding.videoView.setOnErrorListener(this); | 85 | binding.videoView.setOnErrorListener(this); |
| @@ -138,6 +136,7 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -138,6 +136,7 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 138 | } | 136 | } |
| 139 | 137 | ||
| 140 | public void onDestroy() { | 138 | public void onDestroy() { |
| 139 | + binding.videoView.releaseSwitchVideo(); | ||
| 141 | binding.videoView.release(); | 140 | binding.videoView.release(); |
| 142 | VideoStatusUtil.quit(); | 141 | VideoStatusUtil.quit(); |
| 143 | saveCurPlayPosition(); | 142 | saveCurPlayPosition(); |
| @@ -290,13 +289,13 @@ public abstract class BaseVideoView extends RelativeLayout implements | @@ -290,13 +289,13 @@ public abstract class BaseVideoView extends RelativeLayout implements | ||
| 290 | //主播暂时离开 | 289 | //主播暂时离开 |
| 291 | canPlay = false; | 290 | canPlay = false; |
| 292 | binding.videoView.stop(); | 291 | binding.videoView.stop(); |
| 293 | - binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, mContext.getString(R.string.player_status_leave)); | 292 | + binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_leave)); |
| 294 | break; | 293 | break; |
| 295 | case IVideoStatus.MEDIA_STATUS_END: | 294 | case IVideoStatus.MEDIA_STATUS_END: |
| 296 | //直播结束 | 295 | //直播结束 |
| 297 | canPlay = false; | 296 | canPlay = false; |
| 298 | binding.videoView.stop(); | 297 | binding.videoView.stop(); |
| 299 | - binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, mContext.getString(R.string.player_status_end)); | 298 | + binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_end)); |
| 300 | break; | 299 | break; |
| 301 | } | 300 | } |
| 302 | 301 |
app/src/main/java/com/cnlive/gundam/video/view/PlayerInfoView.java
| @@ -45,9 +45,6 @@ public class PlayerInfoView extends RelativeLayout { | @@ -45,9 +45,6 @@ public class PlayerInfoView extends RelativeLayout { | ||
| 45 | //展示手机网视图 | 45 | //展示手机网视图 |
| 46 | public static final int SHOW_MOBILE_NET = 0x2007; | 46 | public static final int SHOW_MOBILE_NET = 0x2007; |
| 47 | 47 | ||
| 48 | - private Context mContext; | ||
| 49 | - | ||
| 50 | - private ViewDataBinding binding; | ||
| 51 | 48 | ||
| 52 | //存储展示哪个视图 | 49 | //存储展示哪个视图 |
| 53 | private ObservableInt observableShowType; | 50 | private ObservableInt observableShowType; |
| @@ -76,7 +73,6 @@ public class PlayerInfoView extends RelativeLayout { | @@ -76,7 +73,6 @@ public class PlayerInfoView extends RelativeLayout { | ||
| 76 | 73 | ||
| 77 | public PlayerInfoView(Context context, AttributeSet attrs, int defStyleAttr) { | 74 | public PlayerInfoView(Context context, AttributeSet attrs, int defStyleAttr) { |
| 78 | super(context, attrs, defStyleAttr); | 75 | super(context, attrs, defStyleAttr); |
| 79 | - mContext = context; | ||
| 80 | init(); | 76 | init(); |
| 81 | } | 77 | } |
| 82 | 78 | ||
| @@ -96,7 +92,7 @@ public class PlayerInfoView extends RelativeLayout { | @@ -96,7 +92,7 @@ public class PlayerInfoView extends RelativeLayout { | ||
| 96 | public void setInfoViewLayout(int infoType) { | 92 | public void setInfoViewLayout(int infoType) { |
| 97 | switch (infoType) { | 93 | switch (infoType) { |
| 98 | case VIDEO_INFO_NORMAL: | 94 | case VIDEO_INFO_NORMAL: |
| 99 | - binding = DataBindingUtil.bind(getView(R.layout.layout_player_info)); | 95 | + ViewDataBinding binding = DataBindingUtil.bind(getView(R.layout.layout_player_info)); |
| 100 | binding.setVariable(BR.playerInfoView, this); | 96 | binding.setVariable(BR.playerInfoView, this); |
| 101 | binding.setVariable(BR.showType, observableShowType); | 97 | binding.setVariable(BR.showType, observableShowType); |
| 102 | binding.setVariable(BR.isNews, observableIsNews); | 98 | binding.setVariable(BR.isNews, observableIsNews); |
| @@ -122,7 +118,7 @@ public class PlayerInfoView extends RelativeLayout { | @@ -122,7 +118,7 @@ public class PlayerInfoView extends RelativeLayout { | ||
| 122 | 118 | ||
| 123 | //获取对应布局的视图 | 119 | //获取对应布局的视图 |
| 124 | private View getView(int layout) { | 120 | private View getView(int layout) { |
| 125 | - View view = LayoutInflater.from(mContext).inflate(layout, null, false); | 121 | + View view = LayoutInflater.from(getContext()).inflate(layout, null, false); |
| 126 | if (getChildCount() > 0) | 122 | if (getChildCount() > 0) |
| 127 | removeAllViews(); | 123 | removeAllViews(); |
| 128 | addView(view); | 124 | addView(view); |
| @@ -169,9 +165,9 @@ public class PlayerInfoView extends RelativeLayout { | @@ -169,9 +165,9 @@ public class PlayerInfoView extends RelativeLayout { | ||
| 169 | break; | 165 | break; |
| 170 | case R.id.back: | 166 | case R.id.back: |
| 171 | if (!PlayerUtils.isPortrait(getContext()) && !isUgc) { | 167 | if (!PlayerUtils.isPortrait(getContext()) && !isUgc) { |
| 172 | - ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | 168 | + ((Activity) getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| 173 | } else { | 169 | } else { |
| 174 | - ((Activity) mContext).onBackPressed(); | 170 | + ((Activity) getContext()).onBackPressed(); |
| 175 | } | 171 | } |
| 176 | break; | 172 | break; |
| 177 | case R.id.playByMobileNet: | 173 | case R.id.playByMobileNet: |
app/src/main/java/com/cnlive/gundam/video/view/PlayerTouchView.java
| @@ -29,7 +29,6 @@ import com.cnlive.gundam.video.utils.PlayerUtils; | @@ -29,7 +29,6 @@ import com.cnlive.gundam.video.utils.PlayerUtils; | ||
| 29 | 29 | ||
| 30 | public class PlayerTouchView extends RelativeLayout { | 30 | public class PlayerTouchView extends RelativeLayout { |
| 31 | private VideoTouchListener l; | 31 | private VideoTouchListener l; |
| 32 | - private static Context mContext; | ||
| 33 | 32 | ||
| 34 | //点下时的x坐标 | 33 | //点下时的x坐标 |
| 35 | private int downX; | 34 | private int downX; |
| @@ -76,7 +75,6 @@ public class PlayerTouchView extends RelativeLayout { | @@ -76,7 +75,6 @@ public class PlayerTouchView extends RelativeLayout { | ||
| 76 | 75 | ||
| 77 | public PlayerTouchView(Context context, AttributeSet attrs, int defStyle) { | 76 | public PlayerTouchView(Context context, AttributeSet attrs, int defStyle) { |
| 78 | super(context, attrs, defStyle); | 77 | super(context, attrs, defStyle); |
| 79 | - this.mContext = context; | ||
| 80 | audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); | 78 | audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); |
| 81 | binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.layout_player_touch, this, true); | 79 | binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.layout_player_touch, this, true); |
| 82 | binding.setLeftAreaMove(leftArea); | 80 | binding.setLeftAreaMove(leftArea); |
| @@ -104,11 +102,11 @@ public class PlayerTouchView extends RelativeLayout { | @@ -104,11 +102,11 @@ public class PlayerTouchView extends RelativeLayout { | ||
| 104 | if (downX < controlAreaWidth) { | 102 | if (downX < controlAreaWidth) { |
| 105 | if (preVolume == -1) | 103 | if (preVolume == -1) |
| 106 | preVolume = getSystemVolume(); | 104 | preVolume = getSystemVolume(); |
| 107 | - brightnessAndVolumeProgress.set(preVolume * DensityUtils.dp2px(mContext, 93) / getSystemMaxVolume()); | 105 | + brightnessAndVolumeProgress.set(preVolume * DensityUtils.dp2px(getContext(), 93) / getSystemMaxVolume()); |
| 108 | } else if (downX > getWidth() - controlAreaWidth) { | 106 | } else if (downX > getWidth() - controlAreaWidth) { |
| 109 | if (preBrightness == -1) | 107 | if (preBrightness == -1) |
| 110 | preBrightness = getSystemBrightness(); | 108 | preBrightness = getSystemBrightness(); |
| 111 | - brightnessAndVolumeProgress.set(preBrightness * DensityUtils.dp2px(mContext, 93) / 255); | 109 | + brightnessAndVolumeProgress.set(preBrightness * DensityUtils.dp2px(getContext(), 93) / 255); |
| 112 | } | 110 | } |
| 113 | curBrightnessProgress = -1; | 111 | curBrightnessProgress = -1; |
| 114 | curVolumeProgress = -1; | 112 | curVolumeProgress = -1; |
| @@ -190,7 +188,7 @@ public class PlayerTouchView extends RelativeLayout { | @@ -190,7 +188,7 @@ public class PlayerTouchView extends RelativeLayout { | ||
| 190 | int curBrightness = PlayerUtils.checkSize(preBrightness + moveY * 255 / getHeight(), 1, 255); | 188 | int curBrightness = PlayerUtils.checkSize(preBrightness + moveY * 255 / getHeight(), 1, 255); |
| 191 | if (curBrightnessProgress == curBrightness) return; | 189 | if (curBrightnessProgress == curBrightness) return; |
| 192 | 190 | ||
| 193 | - int progress = curBrightness * DensityUtils.dp2px(mContext, 93) / 255; | 191 | + int progress = curBrightness * DensityUtils.dp2px(getContext(), 93) / 255; |
| 194 | brightnessAndVolumeProgress.set(progress); | 192 | brightnessAndVolumeProgress.set(progress); |
| 195 | 193 | ||
| 196 | curBrightnessProgress = curBrightness; | 194 | curBrightnessProgress = curBrightness; |
| @@ -237,7 +235,7 @@ public class PlayerTouchView extends RelativeLayout { | @@ -237,7 +235,7 @@ public class PlayerTouchView extends RelativeLayout { | ||
| 237 | int curVolume = PlayerUtils.checkSize(preVolume + (moveY * getSystemMaxVolume() / getHeight()), 0, getSystemMaxVolume()); | 235 | int curVolume = PlayerUtils.checkSize(preVolume + (moveY * getSystemMaxVolume() / getHeight()), 0, getSystemMaxVolume()); |
| 238 | if (curVolumeProgress == curVolume) return; | 236 | if (curVolumeProgress == curVolume) return; |
| 239 | 237 | ||
| 240 | - int progress = curVolume * DensityUtils.dp2px(mContext, 93) / getSystemMaxVolume(); | 238 | + int progress = curVolume * DensityUtils.dp2px(getContext(), 93) / getSystemMaxVolume(); |
| 241 | brightnessAndVolumeProgress.set(progress); | 239 | brightnessAndVolumeProgress.set(progress); |
| 242 | 240 | ||
| 243 | curVolumeProgress = curVolume; | 241 | curVolumeProgress = curVolume; |
app/src/main/java/com/cnlive/gundam/video/view/VideoView.java
| @@ -109,7 +109,7 @@ public class VideoView extends BaseVideoView implements PlayerTouchView.VideoTou | @@ -109,7 +109,7 @@ public class VideoView extends BaseVideoView implements PlayerTouchView.VideoTou | ||
| 109 | observableIsUgc = new ObservableBoolean(); | 109 | observableIsUgc = new ObservableBoolean(); |
| 110 | observableVideoHeight = new ObservableInt(); | 110 | observableVideoHeight = new ObservableInt(); |
| 111 | observableVideoWidth = new ObservableInt(); | 111 | observableVideoWidth = new ObservableInt(); |
| 112 | - observableVideoHeight.set((int) mContext.getResources().getDimension(R.dimen.videoPortraitHeight)); | 112 | + observableVideoHeight.set((int) getContext().getResources().getDimension(R.dimen.videoPortraitHeight)); |
| 113 | observableVideoWidth.set(ViewGroup.LayoutParams.MATCH_PARENT); | 113 | observableVideoWidth.set(ViewGroup.LayoutParams.MATCH_PARENT); |
| 114 | observableIsPortrait.set(PlayerUtils.isPortrait(getContext())); | 114 | observableIsPortrait.set(PlayerUtils.isPortrait(getContext())); |
| 115 | binding.setVideoPortraitHeight(observableVideoHeight); | 115 | binding.setVideoPortraitHeight(observableVideoHeight); |
app/src/main/res/values/strings.xml
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | <string name="request_null">暂无数据</string> | 36 | <string name="request_null">暂无数据</string> |
| 37 | <string name="request_state_error">获取活动状态失败</string> | 37 | <string name="request_state_error">获取活动状态失败</string> |
| 38 | <string name="request_state_play_error">此活动状态无法播放</string> | 38 | <string name="request_state_play_error">此活动状态无法播放</string> |
| 39 | - <string name="verified_url" formatted="false">https://mobile.cnlive.com/CnliveMobile/web/review/review.jsp?sid=%s&plat=a&appId=%s </string> | ||
| 40 | 39 | ||
| 40 | + <string name="verified_url" formatted="false">https://mobile.cnlive.com/CnliveMobile/web/review/review.jsp?sid=%s&plat=a&appId=%s </string> | ||
| 41 | + <string name="debug_verified_url" formatted="false">https://mobile.cnlive.com/CnliveMobile/web/review/review.jsp?sid=%s&plat=a&appId=%s&type=0 </string> | ||
| 41 | </resources> | 42 | </resources> |