Commit ab52175179a98e96aa5eab0c1066a7b96152ac08

Authored by 陈硕
2 parents 68d7d1ae 05ffc32d

合并代码

Showing 72 changed files with 1343 additions and 213 deletions
.gitignore
... ... @@ -5,6 +5,7 @@
5 5 /.idea/libraries
6 6 /.idea/gradle.xml
7 7 /.idea/misc.xml
  8 +/.idea/dictionaries
8 9 .DS_Store
9 10 /build
10 11 /captures
... ...
.idea/inspectionProfiles/Project_Default.xml
... ... @@ -2,7 +2,6 @@
2 2 <profile version="1.0">
3 3 <option name="myName" value="Project Default" />
4 4 <inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
5   - <inspection_tool class="AndroidLintSetTextI18n" enabled="false" level="WARNING" enabled_by_default="false" />
6 5 <inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
7 6 <option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
8 7 <option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
... ...
app/build.gradle
... ... @@ -31,8 +31,13 @@ dependencies {
31 31 compile 'com.github.bumptech.glide:glide:3.7.0'
32 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 41 compile project(':user')
37 42  
38 43 }
... ...
app/src/main/AndroidManifest.xml
... ... @@ -33,14 +33,17 @@
33 33 tools:ignore="ProtectedPermissions" />
34 34  
35 35 <application
36   - android:name=".main.application.CNLiveApplication"
  36 + android:name=".application.CNLiveApplication"
37 37 android:allowBackup="true"
38 38 android:icon="@mipmap/ic_launcher"
39 39 android:label="@string/app_name"
40 40 android:roundIcon="@mipmap/ic_launcher_round"
41 41 android:supportsRtl="true"
42 42 android:theme="@style/Theme.AppCompat.Light.NoActionBar">
43   - <activity android:name=".main.ui.activity.MainActivity">
  43 + <activity
  44 + android:name=".main.ui.activity.MainActivity"
  45 + android:label="@string/app_name"
  46 + android:configChanges="keyboardHidden|screenSize|orientation">
44 47 <intent-filter>
45 48 <action android:name="android.intent.action.MAIN" />
46 49  
... ... @@ -90,15 +93,29 @@
90 93 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
91 94  
92 95 <service
  96 + android:name=".user.auth.UserAccountService"
  97 + tools:ignore="ExportedService">
  98 + <intent-filter>
  99 + <action android:name="android.accounts.AccountAuthenticator" />
  100 + </intent-filter>
  101 +
  102 + <meta-data
  103 + android:name="android.accounts.AccountAuthenticator"
  104 + android:resource="@xml/authenticator" />
  105 + </service>
  106 +
  107 + <service
93 108 android:name="io.rong.imlib.ipc.RongService"
94 109 android:exported="true"
95 110 android:process=":ipc" />
96 111  
97   - <service android:name="io.rong.imlib.ReConnectService"
98   - android:exported="true"/>
  112 + <service
  113 + android:name="io.rong.imlib.ReConnectService"
  114 + android:exported="true" />
99 115  
100   - <receiver android:name="io.rong.imlib.ConnectChangeReceiver"
101   - android:exported="true"/>
  116 + <receiver
  117 + android:name="io.rong.imlib.ConnectChangeReceiver"
  118 + android:exported="true" />
102 119  
103 120 <receiver
104 121 android:name="io.rong.imlib.HeartbeatReceiver"
... ...
app/src/main/java/com/cnlive/gundam/main/application/CNLiveApplication.java renamed to app/src/main/java/com/cnlive/gundam/application/CNLiveApplication.java
1   -package com.cnlive.gundam.main.application;
  1 +package com.cnlive.gundam.application;
2 2  
3 3 import android.app.Application;
4 4  
... ... @@ -10,11 +10,11 @@ import com.cnlive.libs.util.Config;
10 10  
11 11 public class CNLiveApplication extends Application {
12 12  
  13 + public static final String secret = "c2faeb120f0ea2e2d47020d4b03cb8a93bed2585897a94";
  14 +
13 15 @Override
14 16 public void onCreate() {
15 17 super.onCreate();
16   - //TODO 测试ID 在正式与测试环境均可通过,正式ID则不行~!
17   -// Config.init(getApplicationContext(), "60_j4fc7dsm83", "4c8658abc5d66f270f9bf5dcd1ef11e3597fab4c4e0af9",true);
18   - Config.init(getApplicationContext(), "60_j4faozoq85", "7b6da5a6e2955aaf7f73a06b5bdc6d50e6d5bfda3da86b");
  18 + Config.init(getApplicationContext(), "60_j4fc7dsm83", "4c8658abc5d66f270f9bf5dcd1ef11e3597fab4c4e0af9", true);//测试信息
19 19 }
20 20 }
... ...
app/src/main/java/com/cnlive/gundam/main/network/ApiService.java renamed to app/src/main/java/com/cnlive/gundam/data/network/ApiService.java
1   -package com.cnlive.gundam.main.network;
  1 +package com.cnlive.gundam.data.network;
2 2  
3 3 import com.cnlive.gundam.main.model.ActiveListModel;
4 4 import com.cnlive.gundam.main.model.ActivePlayInfo;
5 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 8 import java.util.Map;
9 9  
10 10 import retrofit2.Call;
11 11 import retrofit2.http.GET;
  12 +import retrofit2.http.POST;
12 13 import retrofit2.http.QueryMap;
13 14  
14 15 /**
... ... @@ -26,7 +27,7 @@ public interface ApiService {
26 27 Call<ActivePlayInfo> getActivityPlayInfo(@QueryMap Map<String, String> options);
27 28  
28 29 //判断活动的状态
29   - @GET("vod_epg/getVodInfo4App")
  30 + @POST("vod_epg/getVodListInfo4App")
30 31 Call<VodListPage> getVodInfoList(@QueryMap Map<String, String> options);
31 32  
32 33 //主播信息接口
... ...
app/src/main/java/com/cnlive/gundam/main/network/RetrofitUtil.java renamed to app/src/main/java/com/cnlive/gundam/data/network/RetrofitUtil.java
1   -package com.cnlive.gundam.main.network;
  1 +package com.cnlive.gundam.data.network;
  2 +
  3 +
  4 +import com.cnlive.libs.util.Config;
2 5  
3 6 import okhttp3.OkHttpClient;
  7 +import okhttp3.logging.HttpLoggingInterceptor;
4 8 import retrofit2.Retrofit;
5 9 import retrofit2.converter.gson.GsonConverterFactory;
6 10  
... ... @@ -10,14 +14,25 @@ import retrofit2.converter.gson.GsonConverterFactory;
10 14  
11 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 25 Retrofit retrofit = new Retrofit.Builder()
17   - .baseUrl(BASE_URL)
  26 + .baseUrl(Config.debug ? BASE_URL_DEBUG : BASE_URL_RELEASE)
18 27 .addConverterFactory(GsonConverterFactory.create())
19   - .client(new OkHttpClient())
  28 + .client(getNewClient())
20 29 .build();
21 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/network/util/SHA1.java renamed to app/src/main/java/com/cnlive/gundam/data/network/util/SHA1.java
1   -package com.cnlive.gundam.main.network.util;
  1 +package com.cnlive.gundam.data.network.util;
2 2  
3 3 import java.io.UnsupportedEncodingException;
4 4 import java.math.BigInteger;
... ...
app/src/main/java/com/cnlive/gundam/main/network/util/SignUtil.java renamed to app/src/main/java/com/cnlive/gundam/data/network/util/SignUtil.java
1   -package com.cnlive.gundam.main.network.util;
  1 +package com.cnlive.gundam.data.network.util;
2 2  
3 3 import android.content.Context;
4 4 import android.util.Log;
... ...
app/src/main/java/com/cnlive/gundam/main/model/ActiveExInfo.java 0 → 100644
  1 +package com.cnlive.gundam.main.model;
  2 +
  3 +/**
  4 + * Created by gujun on 2017/6/29.
  5 + */
  6 +
  7 +public class ActiveExInfo {
  8 +
  9 + private String name ;
  10 + private String iconUrl;
  11 +
  12 + public ActiveExInfo(String name, String iconUrl) {
  13 + this.name = name;
  14 + this.iconUrl = iconUrl;
  15 + }
  16 +
  17 + public String getName() {
  18 + return name;
  19 + }
  20 +
  21 + public void setName(String name) {
  22 + this.name = name;
  23 + }
  24 +
  25 + public String getIconUrl() {
  26 + return iconUrl;
  27 + }
  28 +
  29 + public void setIconUrl(String iconUrl) {
  30 + this.iconUrl = iconUrl;
  31 + }
  32 +
  33 + @Override
  34 + public String toString() {
  35 + return "ActiveExInfo{" +
  36 + "name='" + name + '\'' +
  37 + ", iconUrl='" + iconUrl + '\'' +
  38 + '}';
  39 + }
  40 +}
... ...
app/src/main/java/com/cnlive/gundam/main/model/ActiveInfo.java
... ... @@ -21,13 +21,13 @@ public class ActiveInfo implements Serializable {
21 21 private String endTime;
22 22 private String coverImgUrl;
23 23 private String activityCategory;
24   - private Object extensions;
  24 + private ActiveExInfo extensions;
25 25 private String rates;
26 26  
27 27 public ActiveInfo() {
28 28 }
29 29  
30   - public ActiveInfo(int totalCount, int nextCursor, int preCursor, String activityId, String activityName, int activityStatus, int isHorizontalScreen, String channelId, String createTime, String startTime, String endTime, String coverImgUrl, String activityCategory, Object extensions, String rates) {
  30 + public ActiveInfo(int totalCount, int nextCursor, int preCursor, String activityId, String activityName, int activityStatus, int isHorizontalScreen, String channelId, String createTime, String startTime, String endTime, String coverImgUrl, String activityCategory, ActiveExInfo extensions, String rates) {
31 31 this.totalCount = totalCount;
32 32 this.nextCursor = nextCursor;
33 33 this.preCursor = preCursor;
... ... @@ -149,11 +149,11 @@ public class ActiveInfo implements Serializable {
149 149 this.activityCategory = activityCategory;
150 150 }
151 151  
152   - public Object getExtensions() {
  152 + public ActiveExInfo getExtensions() {
153 153 return extensions;
154 154 }
155 155  
156   - public void setExtensions(Object extensions) {
  156 + public void setExtensions(ActiveExInfo extensions) {
157 157 this.extensions = extensions;
158 158 }
159 159  
... ... @@ -185,4 +185,12 @@ public class ActiveInfo implements Serializable {
185 185 ", rates='" + rates + '\'' +
186 186 '}';
187 187 }
  188 +
  189 + public String getExUrl() {
  190 + return extensions != null ? extensions.getIconUrl() : "";
  191 + }
  192 +
  193 + public String getExNick() {
  194 + return extensions != null ? extensions.getName() : "";
  195 + }
188 196 }
... ...
app/src/main/java/com/cnlive/gundam/main/model/ActivePlayInfo.java
... ... @@ -35,9 +35,9 @@ public class ActivePlayInfo extends ErrorMessage {
35 35 private String endTime;
36 36 private String coverImgUrl;
37 37 private String activityCategory;
38   - private String extensions;
39 38 private String rates;
40 39 private String extViews;
  40 + private ActiveExInfo extensions;
41 41  
42 42 public ActiveModel() {
43 43 }
... ... @@ -122,14 +122,6 @@ public class ActivePlayInfo extends ErrorMessage {
122 122 this.activityCategory = activityCategory;
123 123 }
124 124  
125   - public String getExtensions() {
126   - return extensions;
127   - }
128   -
129   - public void setExtensions(String extensions) {
130   - this.extensions = extensions;
131   - }
132   -
133 125 public String getRates() {
134 126 return rates;
135 127 }
... ... @@ -146,6 +138,14 @@ public class ActivePlayInfo extends ErrorMessage {
146 138 this.extViews = extViews;
147 139 }
148 140  
  141 + public ActiveExInfo getExtensions() {
  142 + return extensions;
  143 + }
  144 +
  145 + public void setExtensions(ActiveExInfo extensions) {
  146 + this.extensions = extensions;
  147 + }
  148 +
149 149 @Override
150 150 public String toString() {
151 151 return "ActiveModel{" +
... ... @@ -159,7 +159,6 @@ public class ActivePlayInfo extends ErrorMessage {
159 159 ", endTime='" + endTime + '\'' +
160 160 ", coverImgUrl='" + coverImgUrl + '\'' +
161 161 ", activityCategory='" + activityCategory + '\'' +
162   - ", extensions='" + extensions + '\'' +
163 162 ", rates='" + rates + '\'' +
164 163 ", extViews='" + extViews + '\'' +
165 164 '}';
... ...
app/src/main/java/com/cnlive/gundam/main/model/VideoListProgram.java
... ... @@ -18,18 +18,20 @@ public class VideoListProgram implements Serializable {
18 18 private String rates;
19 19 private String type;
20 20 private String category;//点播用
  21 + private int isHorizontalScreen = 1;//屏幕方向,0:垂直即竖屏 /1:水平即横屏 ,默认为1 |
21 22  
22 23 public VideoListProgram() {
23 24 }
24 25  
25 26 //ugc点播使用
26   - public VideoListProgram(String vId, String title, String img, String subTitle, String rates, String type) {
  27 + public VideoListProgram(String vId, String title, String img, String subTitle, String rates, String type, int isHorizontalScreen) {
27 28 this.vId = vId;
28 29 this.title = title;
29 30 this.subTitle = subTitle;
30 31 this.img = img;
31 32 this.rates = rates;
32 33 this.type = type;
  34 + this.isHorizontalScreen = isHorizontalScreen;
33 35 }
34 36  
35 37 //直播使用
... ... @@ -41,6 +43,16 @@ public class VideoListProgram implements Serializable {
41 43 this.type = type;
42 44 }
43 45  
  46 + //ugc直播使用
  47 + public VideoListProgram(String channelId, String title, String img, String docID, String type, int isHorizontalScreen) {
  48 + this.channelId = channelId;
  49 + this.title = title;
  50 + this.img = img;
  51 + this.docID = docID;
  52 + this.type = type;
  53 + this.isHorizontalScreen = isHorizontalScreen;
  54 + }
  55 +
44 56 public String getvId() {
45 57 return vId;
46 58 }
... ... @@ -104,4 +116,20 @@ public class VideoListProgram implements Serializable {
104 116 public void setType(String type) {
105 117 this.type = type;
106 118 }
  119 +
  120 + public String getCategory() {
  121 + return category;
  122 + }
  123 +
  124 + public void setCategory(String category) {
  125 + this.category = category;
  126 + }
  127 +
  128 + public int getIsHorizontalScreen() {
  129 + return isHorizontalScreen;
  130 + }
  131 +
  132 + public void setIsHorizontalScreen(int isHorizontalScreen) {
  133 + this.isHorizontalScreen = isHorizontalScreen;
  134 + }
107 135 }
... ...
app/src/main/java/com/cnlive/gundam/main/presenter/AnchorInfoPresenter.java
... ... @@ -2,12 +2,13 @@ package com.cnlive.gundam.main.presenter;
2 2  
3 3 import android.content.Context;
4 4  
5   -import com.cnlive.gundam.main.network.RetrofitUtil;
6   -import com.cnlive.gundam.main.network.util.SignUtil;
  5 +import com.cnlive.gundam.data.network.RetrofitUtil;
  6 +import com.cnlive.gundam.data.network.util.SignUtil;
7 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 9 import com.cnlive.libs.util.Config;
10 10  
  11 +import java.lang.ref.WeakReference;
11 12 import java.util.HashMap;
12 13 import java.util.Map;
13 14  
... ... @@ -21,12 +22,15 @@ import retrofit2.Response;
21 22  
22 23 public class AnchorInfoPresenter {
23 24  
24   - private AnchorInfoView mView;
  25 + private WeakReference<AnchorInfoView> viewRef;
25 26  
26 27 public AnchorInfoPresenter(AnchorInfoView view) {
27   - this.mView = view;
  28 + viewRef = new WeakReference<>(view);
28 29 }
29 30  
  31 + private AnchorInfoView getView(){
  32 + return viewRef == null ? null : viewRef.get();
  33 + }
30 34 /**
31 35 * 查询主播信息
32 36 *
... ... @@ -43,16 +47,16 @@ public class AnchorInfoPresenter {
43 47 if (response.isSuccessful()) {
44 48 ChannelInfoModel info = response.body();
45 49 if (info != null && "0".equals(info.getErrorCode())) {
46   - if (mView != null) mView.onAnchorInfo(info);
  50 + if (getView() != null) getView().onAnchorInfo(info);
47 51 } else {
48   - if (mView != null) mView.getAnchorFailure();
  52 + if (getView() != null) getView().getAnchorFailure();
49 53 }
50 54 }
51 55 }
52 56  
53 57 @Override
54 58 public void onFailure(Call<ChannelInfoModel> call, Throwable t) {
55   - if (mView != null) mView.getAnchorFailure();
  59 + if (getView() != null) getView().getAnchorFailure();
56 60 }
57 61 });
58 62 }
... ...
app/src/main/java/com/cnlive/gundam/main/presenter/view/AnchorInfoView.java
1 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 5 public interface AnchorInfoView {
  6 + /**
  7 + * 获取主播信息成功
  8 + *
  9 + * @param channelInfo 主播信息
  10 + */
6 11 void onAnchorInfo(ChannelInfoModel channelInfo);
7 12  
  13 + /**
  14 + * 获取主播信息失败
  15 + */
8 16 void getAnchorFailure();
9 17 }
10 18 \ No newline at end of file
... ...
app/src/main/java/com/cnlive/gundam/main/ui/activity/BackBaseActivity.java
... ... @@ -22,7 +22,7 @@ public class BackBaseActivity extends AppCompatActivity {
22 22 TextView toolbarTitle = (TextView) findViewById(R.id.toolbarTitle);
23 23 toolbarTitle.setText(title);
24 24 toolbar.setVisibility(View.VISIBLE);
25   - toolbar.setNavigationIcon(R.drawable.btn_cancel);
  25 + toolbar.setNavigationIcon(R.drawable.page_back);
26 26 setSupportActionBar(toolbar);
27 27  
28 28 }
... ...
app/src/main/java/com/cnlive/gundam/main/ui/activity/MainActivity.java
1 1 package com.cnlive.gundam.main.ui.activity;
2 2  
3 3 import android.app.AlertDialog;
4   -import android.app.Dialog;
5 4 import android.content.DialogInterface;
6 5 import android.content.Intent;
7 6 import android.databinding.DataBindingUtil;
... ... @@ -18,11 +17,13 @@ import com.cnlive.gundam.main.ui.fragment.HomeFragment;
18 17 import com.cnlive.gundam.main.ui.fragment.LiveFragment;
19 18 import com.cnlive.gundam.main.ui.fragment.UGCListFragment;
20 19 import com.cnlive.gundam.main.ui.widget.FragmentTabHost;
  20 +import com.cnlive.gundam.main.utils.SharedPreferencesHelper;
  21 +import com.cnlive.gundam.stream.model.ChannelInfoModel;
21 22 import com.cnlive.gundam.stream.ui.activity.StreamActivity;
22 23 import com.cnlive.gundam.user.activity.LoginActivity;
23 24 import com.cnlive.gundam.user.auth.UserService;
24   -import com.cnlive.gundam.user.model.ChannelInfoModel;
25 25 import com.cnlive.gundam.user.model.User;
  26 +import com.cnlive.gundam.video.view.VideoView;
26 27 import com.cnlive.libs.util.Config;
27 28  
28 29 import java.util.Arrays;
... ... @@ -33,8 +34,6 @@ import java.util.Arrays;
33 34  
34 35 public class MainActivity extends AppCompatActivity implements FragmentTabHost.OnSetCurrentTabListener, AnchorInfoView {
35 36  
36   - private Dialog verifiedDialog;
37   -
38 37 private AnchorInfoPresenter mAnchorInfoPresenter;
39 38  
40 39 @Override
... ... @@ -78,8 +77,8 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
78 77  
79 78  
80 79 @Override
81   - public void onAnchorInfo(ChannelInfoModel model) {
82   - switch (model.getData().getStatus()) {
  80 + public void onAnchorInfo(ChannelInfoModel info) {
  81 + switch (info.getData().getStatus()) {
83 82 case -1:
84 83 Toast.makeText(this, "主播不存在", Toast.LENGTH_SHORT).show();
85 84 showVerifiedDialog();
... ... @@ -92,11 +91,7 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
92 91 break;
93 92 case 3:
94 93 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);
  94 + startStreamActivity(info);
100 95 break;
101 96 case 4:
102 97 Toast.makeText(this, "主播被禁用", Toast.LENGTH_SHORT).show();
... ... @@ -106,18 +101,33 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
106 101  
107 102 @Override
108 103 public void getAnchorFailure() {
109   - Toast.makeText(this, getString(R.string.request_state_error), Toast.LENGTH_LONG).show();
  104 + Toast.makeText(this, "主播信息认证失败", Toast.LENGTH_LONG).show();
  105 + }
  106 +
  107 + /**
  108 + * 开启直播推流页面
  109 + * @param info 主播信息
  110 + */
  111 + private void startStreamActivity(ChannelInfoModel info) {
  112 + String activityId = System.currentTimeMillis() + "";
  113 + String channelId = info.getData().getChannelId();
  114 + String channelName = info.getData().getChannelName();
  115 + String coverImgUrl = info.getData().getCoverImgUrl();
  116 + StreamActivity.start(this, activityId, channelId, channelName, coverImgUrl, false);
110 117 }
111 118  
  119 + /**
  120 + * 显示主播申请页面
  121 + */
112 122 private void showVerifiedDialog() {
113   - verifiedDialog = new AlertDialog.Builder(this)
  123 + new AlertDialog.Builder(this)
114 124 .setMessage("亲,完成实名认证就可以开播啦,现在就去认证吧?")
115 125 .setPositiveButton("去认证", new DialogInterface.OnClickListener() {
116 126 @Override
117 127 public void onClick(DialogInterface dialogInterface, int i) {
118   - verifiedDialog.dismiss();
  128 + dialogInterface.dismiss();
119 129 String channelId = UserService.getInstance(MainActivity.this).getActiveAccountInfo().getUid() + "";
120   - String url = String.format(getString(R.string.verified_url), channelId, Config.getAppId());
  130 + String url = String.format(getString(Config.debug ? R.string.debug_verified_url : R.string.verified_url), channelId, Config.getAppId());
121 131 Intent intent = new Intent(MainActivity.this, WebViewActivity.class);
122 132 intent.putExtra("url", url);
123 133 intent.putExtra("title", "主播认证");
... ... @@ -127,9 +137,14 @@ public class MainActivity extends AppCompatActivity implements FragmentTabHost.O
127 137 .setNegativeButton("取消", new DialogInterface.OnClickListener() {
128 138 @Override
129 139 public void onClick(DialogInterface dialogInterface, int i) {
130   - verifiedDialog.dismiss();
  140 + dialogInterface.dismiss();
131 141 }
132   - })
133   - .show();
  142 + }).show();
  143 + }
  144 +
  145 + @Override
  146 + protected void onDestroy() {
  147 + super.onDestroy();
  148 + SharedPreferencesHelper.getInstance(this).setValue(VideoView.CAN_MOBILE_NET_PLAY, false);
134 149 }
135 150 }
136 151 \ No newline at end of file
... ...
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
... ... @@ -79,12 +79,17 @@ public class ConfigFragment extends Fragment implements View.OnClickListener {
79 79 @Override
80 80 public void onResume() {
81 81 super.onResume();
82   - if (UserService.getInstance(getActivity()).getActiveAccountInfo().getUid() != 0) notifyUI();
  82 + notifyUI(UserService.getInstance(getActivity()).getActiveAccountInfo().getUid() != 0);
83 83 }
84 84  
85   - private void notifyUI() {
86   - User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo();
87   - Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg);
88   - binding.tvNickname.setText(activeAccountInfo.getNickname());
  85 + private void notifyUI(boolean isLogin) {
  86 + if(isLogin){
  87 + User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo();
  88 + Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg);
  89 + binding.tvNickname.setText(activeAccountInfo.getNickname());
  90 + }else{
  91 + Glide.with(getActivity()).load(R.drawable.cnlive_user_header).into(binding.headImg);
  92 + binding.tvNickname.setText(getString(R.string.click_login));
  93 + }
89 94 }
90 95 }
... ...
app/src/main/java/com/cnlive/gundam/main/ui/fragment/HomeFragment.java
... ... @@ -16,8 +16,8 @@ import com.cnlive.gundam.R;
16 16 import com.cnlive.gundam.databinding.FragmentActiveListBinding;
17 17 import com.cnlive.gundam.main.model.VideoListProgram;
18 18 import com.cnlive.gundam.main.model.VodListPage;
19   -import com.cnlive.gundam.main.network.RetrofitUtil;
20   -import com.cnlive.gundam.main.network.util.SignUtil;
  19 +import com.cnlive.gundam.data.network.RetrofitUtil;
  20 +import com.cnlive.gundam.data.network.util.SignUtil;
21 21 import com.cnlive.gundam.main.ui.adapter.DataBindingAdapter;
22 22 import com.cnlive.gundam.main.utils.ActivityJumpUtil;
23 23 import com.cnlive.libs.util.Config;
... ... @@ -94,7 +94,7 @@ public class HomeFragment extends Fragment implements SwipeRefreshLayout.OnRefre
94 94 if (response.isSuccessful()) {
95 95 VodListPage model = response.body();
96 96 if (model != null && "0".equals(model.getCode())) {
97   - if (model.getData() == null) {
  97 + if (model.getData() == null || model.getData().size() <= 0) {
98 98 Toast.makeText(getActivity(), getString(R.string.request_null), Toast.LENGTH_LONG).show();
99 99 } else {
100 100 adapter.updateItems(model.getData());
... ...
app/src/main/java/com/cnlive/gundam/main/ui/fragment/UGCListFragment.java
... ... @@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
6 6 import android.support.v4.app.Fragment;
7 7 import android.support.v4.widget.SwipeRefreshLayout;
8 8 import android.support.v7.widget.LinearLayoutManager;
  9 +import android.util.Log;
9 10 import android.view.LayoutInflater;
10 11 import android.view.View;
11 12 import android.view.ViewGroup;
... ... @@ -16,8 +17,8 @@ import com.cnlive.gundam.R;
16 17 import com.cnlive.gundam.databinding.FragmentActiveListBinding;
17 18 import com.cnlive.gundam.main.model.ActiveInfo;
18 19 import com.cnlive.gundam.main.model.ActiveListModel;
19   -import com.cnlive.gundam.main.network.RetrofitUtil;
20   -import com.cnlive.gundam.main.network.util.SignUtil;
  20 +import com.cnlive.gundam.data.network.RetrofitUtil;
  21 +import com.cnlive.gundam.data.network.util.SignUtil;
21 22 import com.cnlive.gundam.main.ui.adapter.DataBindingAdapter;
22 23 import com.cnlive.gundam.main.utils.ActivityJumpUtil;
23 24 import com.cnlive.libs.util.Config;
... ... @@ -65,9 +66,8 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe
65 66  
66 67 private void loadData() {
67 68 Map<String, String> params = new HashMap<>();
68   - //TODO 传多个播放状态
69 69 params.put("appId", Config.getAppId());
70   - params.put("activityStatus", "2");
  70 + params.put("activityStatus", "1,2");
71 71 params.put("pageNo", "1");
72 72 params.put("pageSize", "15");
73 73 RetrofitUtil.getApiService().getSpActivityList(SignUtil.getSignParamM(getActivity(), params)).enqueue(this);
... ... @@ -92,6 +92,7 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe
92 92  
93 93 @Override
94 94 public void onResponse(Call<ActiveListModel> call, Response<ActiveListModel> response) {
  95 + Log.e("11111111111111", "onResponse: "+call.request().toString() );
95 96 binding.contentView.setRefreshing(false);
96 97 if (response.isSuccessful()) {
97 98 ActiveListModel model = response.body();
... ...
app/src/main/java/com/cnlive/gundam/main/ui/widget/FragmentTabHost.java
... ... @@ -30,7 +30,6 @@ public class FragmentTabHost extends TabHost
30 30 implements TabHost.OnTabChangeListener {
31 31 private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
32 32 private FrameLayout mRealTabContent;
33   - private Context mContext;
34 33 private FragmentManager mFragmentManager;
35 34 private int mContainerId;
36 35 private OnSetCurrentTabListener onSetCurrentTabListener;
... ... @@ -45,7 +44,7 @@ public class FragmentTabHost extends TabHost
45 44 boolean onSetCurrentTab(String tag);
46 45 }
47 46  
48   - public static final class TabItemInfo{
  47 + public static final class TabItemInfo {
49 48 private final String tag;
50 49 private final int layoutId;
51 50 private final Class<?> clss;
... ... @@ -145,14 +144,14 @@ public class FragmentTabHost extends TabHost
145 144 a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.inflatedId}, 0, 0);
146 145 try {
147 146 mContainerId = a.getResourceId(0, 0);
148   - }finally {
  147 + } finally {
149 148 a.recycle();
150 149 }
151 150  
152 151 a = context.obtainStyledAttributes(attrs, R.styleable.FragmentTabHost);
153 152 try {
154 153 mDiciderDrawable = a.getDrawable(R.styleable.FragmentTabHost_dividerDrawable);
155   - }finally {
  154 + } finally {
156 155 a.recycle();
157 156 }
158 157 super.setOnTabChangedListener(this);
... ... @@ -188,8 +187,8 @@ public class FragmentTabHost extends TabHost
188 187  
189 188 /**
190 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 193 @Override
195 194 @Deprecated
... ... @@ -198,19 +197,17 @@ public class FragmentTabHost extends TabHost
198 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 202 super.setup();
204   - mContext = context;
205 203 mFragmentManager = manager;
206 204 ensureContent();
207 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 210 super.setup();
213   - mContext = context;
214 211 mFragmentManager = manager;
215 212 mContainerId = containerId;
216 213 ensureContent();
... ... @@ -226,15 +223,17 @@ public class FragmentTabHost extends TabHost
226 223  
227 224 /**
228 225 * 设置内容ID并初始化
  226 + *
229 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 237 * @param list
239 238 */
240 239 public void setTabItemList(List<TabItemInfo> list) {
... ... @@ -243,7 +242,7 @@ public class FragmentTabHost extends TabHost
243 242  
244 243 private void ensureContent() {
245 244 if (mRealTabContent == null) {
246   - mRealTabContent = (FrameLayout) findViewById(mContainerId);
  245 + mRealTabContent = findViewById(mContainerId);
247 246 if (mRealTabContent == null) {
248 247 throw new IllegalStateException(
249 248 "No tab content FrameLayout found for id " + mContainerId);
... ... @@ -257,7 +256,7 @@ public class FragmentTabHost extends TabHost
257 256 }
258 257  
259 258 public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
260   - tabSpec.setContent(new DummyTabFactory(mContext));
  259 + tabSpec.setContent(new DummyTabFactory(getContext()));
261 260 String tag = tabSpec.getTag();
262 261  
263 262 TabInfo info = new TabInfo(tag, clss, args);
... ... @@ -391,7 +390,7 @@ public class FragmentTabHost extends TabHost
391 390 this.onSetCurrentTabListener = onSetCurrentTabListener;
392 391 }
393 392  
394   - public void setDividerDrawable(@Nullable Drawable drawable){
  393 + public void setDividerDrawable(@Nullable Drawable drawable) {
395 394 getTabWidget().setDividerDrawable(drawable);
396 395 }
397 396  
... ... @@ -417,7 +416,7 @@ public class FragmentTabHost extends TabHost
417 416 }
418 417 if (newTab != null) {
419 418 if (newTab.fragment == null) {
420   - newTab.fragment = Fragment.instantiate(mContext,
  419 + newTab.fragment = Fragment.instantiate(getContext(),
421 420 newTab.clss.getName(), newTab.args);
422 421 ft.add(mContainerId, newTab.fragment, newTab.tag);
423 422 } else {
... ...
app/src/main/java/com/cnlive/gundam/main/utils/ActivityJumpUtil.java
... ... @@ -8,8 +8,8 @@ import com.cnlive.gundam.R;
8 8 import com.cnlive.gundam.main.model.ActiveInfo;
9 9 import com.cnlive.gundam.main.model.ActivePlayInfo;
10 10 import com.cnlive.gundam.main.model.VideoListProgram;
11   -import com.cnlive.gundam.main.network.RetrofitUtil;
12   -import com.cnlive.gundam.main.network.util.SignUtil;
  11 +import com.cnlive.gundam.data.network.RetrofitUtil;
  12 +import com.cnlive.gundam.data.network.util.SignUtil;
13 13 import com.cnlive.gundam.video.activity.PlayerActivity;
14 14 import com.cnlive.gundam.video.view.VideoView;
15 15 import com.cnlive.libs.util.Config;
... ... @@ -57,9 +57,9 @@ public class ActivityJumpUtil {
57 57 private static void jumpByStatus(Context context, ActivePlayInfo.ActiveModel model) {
58 58 if (model == null) return;
59 59 if (model.getActivityStatus() == 1) {//直播中
60   - jumpByProgramType(context, new VideoListProgram(model.getChannelId(), model.getActivityName(), model.getCoverImgUrl(), model.getRates(), VideoView.TYPE_UGC_LIVE));
61   - } else if (model.getActivityStatus() == 3) {//已结束
62   - jumpByProgramType(context, new VideoListProgram(model.getActivityId(), model.getActivityName(), model.getCoverImgUrl(), model.getActivityName(), model.getRates(), VideoView.TYPE_UGC_VOD));
  60 + jumpByProgramType(context, new VideoListProgram(model.getChannelId(), model.getActivityName(), model.getCoverImgUrl(), model.getRates(), VideoView.TYPE_UGC_LIVE, model.getIsHorizontalScreen()));
  61 + } else if (model.getActivityStatus() == 4) {//回放状态
  62 + jumpByProgramType(context, new VideoListProgram(model.getActivityId(), model.getActivityName(), model.getCoverImgUrl(), model.getActivityName(), model.getRates(), VideoView.TYPE_UGC_VOD, model.getIsHorizontalScreen()));
63 63 } else {
64 64 Toast.makeText(context, context.getString(R.string.request_state_play_error), Toast.LENGTH_LONG).show();
65 65 }
... ...
app/src/main/java/com/cnlive/gundam/main/utils/SharedPreferencesHelper.java
... ... @@ -9,14 +9,11 @@ import java.util.Set;
9 9 public class SharedPreferencesHelper {
10 10  
11 11 private static final String APP_NAME = "com.cnlive.granzon";
12   - public static SharedPreferencesHelper instance;
13   - protected Context mContext;
14   - protected SharedPreferences sharedPreferences;
15   -
  12 + private static SharedPreferencesHelper instance;
  13 + private SharedPreferences sharedPreferences;
16 14  
17 15 private SharedPreferencesHelper(Context context) {
18   - mContext = context;
19   - sharedPreferences = mContext.getSharedPreferences(APP_NAME, 0);
  16 + sharedPreferences = context.getSharedPreferences(APP_NAME, 0);
20 17 }
21 18  
22 19 /**
... ... @@ -43,8 +40,8 @@ public class SharedPreferencesHelper {
43 40 return sharedPreferences.getBoolean(key, defaultValue);
44 41 }
45 42  
46   - public Long getLong(String key){
47   - return sharedPreferences.getLong(key,0);
  43 + public Long getLong(String key) {
  44 + return sharedPreferences.getLong(key, 0);
48 45 }
49 46  
50 47 public int getIntValue(String key) {
... ... @@ -95,7 +92,7 @@ public class SharedPreferencesHelper {
95 92 return sharedPreferences.getAll().keySet();
96 93 }
97 94  
98   - public boolean contains(String key){
  95 + public boolean contains(String key) {
99 96 return sharedPreferences.contains(key);
100 97 }
101 98 }
... ...
app/src/main/java/com/cnlive/gundam/user/model/ChannelInfoModel.java renamed to app/src/main/java/com/cnlive/gundam/stream/model/ChannelInfoModel.java
1   -package com.cnlive.gundam.user.model;
  1 +package com.cnlive.gundam.stream.model;
2 2  
3 3  
4 4 import com.cnlive.gundam.user.model.base.ErrorMessage;
... ...
app/src/main/java/com/cnlive/gundam/user/activity/LoginActivity.java
... ... @@ -3,12 +3,12 @@ package com.cnlive.gundam.user.activity;
3 3 import android.content.Context;
4 4 import android.databinding.DataBindingUtil;
5 5 import android.os.Bundle;
6   -import android.support.v7.app.AppCompatActivity;
7 6 import android.view.MotionEvent;
8 7 import android.view.View;
9 8 import android.view.inputmethod.InputMethodManager;
10 9  
11 10 import com.cnlive.gundam.R;
  11 +import com.cnlive.gundam.user.auth.AccountAuthenticatorActivity;
12 12 import com.cnlive.gundam.user.fragment.LoginFragment;
13 13 import com.cnlive.gundam.user.util.DevilUtil;
14 14  
... ... @@ -17,7 +17,7 @@ import com.cnlive.gundam.user.util.DevilUtil;
17 17 * Created by luxiaoman on 2017/6/2.
18 18 */
19 19  
20   -public class LoginActivity extends AppCompatActivity {
  20 +public class LoginActivity extends AccountAuthenticatorActivity {
21 21  
22 22 @Override
23 23 protected void onCreate(Bundle savedInstanceState) {
... ...
app/src/main/java/com/cnlive/gundam/user/adapter/PersonalAdapter.java
... ... @@ -30,6 +30,11 @@ public class PersonalAdapter extends DataBindingAdapter&lt;PersonalData&gt;{
30 30 DataBindingViewHolder viewHolder = new DataBindingViewHolder(binding.getRoot());
31 31 viewHolder.setBinding(binding);
32 32 return viewHolder;
  33 + }else if(viewType == PersonalData.TYPE_LOGOUT){
  34 + ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.layout_personal_logout_item, parent, false);
  35 + DataBindingViewHolder viewHolder = new DataBindingViewHolder(binding.getRoot());
  36 + viewHolder.setBinding(binding);
  37 + return viewHolder;
33 38 }else{
34 39 return super.onCreateViewHolder(parent, viewType);
35 40 }
... ... @@ -43,6 +48,12 @@ public class PersonalAdapter extends DataBindingAdapter&lt;PersonalData&gt;{
43 48 if (l != null)
44 49 videoListViewHolder.getBinding().setVariable(BR.viewClickListner, l);
45 50 videoListViewHolder.getBinding().executePendingBindings();
  51 + }else if(getItem(position).getItemType() == PersonalData.TYPE_LOGOUT){
  52 + DataBindingViewHolder videoListViewHolder = (DataBindingViewHolder) holder;
  53 + videoListViewHolder.getBinding().setVariable(itemBRId, getItem(position));
  54 + if (l != null)
  55 + videoListViewHolder.getBinding().setVariable(BR.viewClickListner, l);
  56 + videoListViewHolder.getBinding().executePendingBindings();
46 57 }else{
47 58 super.onBindViewHolder(holder, position);
48 59 }
... ...
app/src/main/java/com/cnlive/gundam/user/auth/AccountAuthenticatorActivity.java 0 → 100644
  1 +/*
  2 + * Copyright (C) 2009 The Android Open Source Project
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +package com.cnlive.gundam.user.auth;
  18 +
  19 +import android.accounts.AccountAuthenticatorResponse;
  20 +import android.accounts.AccountManager;
  21 +import android.os.Bundle;
  22 +import android.support.v7.app.AppCompatActivity;
  23 +
  24 +/**
  25 + * Base class for implementing an Activity that is used to help implement an
  26 + * AbstractAccountAuthenticator. If the AbstractAccountAuthenticator needs to use an activity
  27 + * to handle the request then it can have the activity extend AccountAuthenticatorActivity.
  28 + * The AbstractAccountAuthenticator passes in the response to the intent using the following:
  29 + * <pre>
  30 + * intent.putExtra({@link AccountManager#KEY_ACCOUNT_AUTHENTICATOR_RESPONSE}, response);
  31 + * </pre>
  32 + * The activity then sets the result that is to be handed to the response via
  33 + * {@link #setAccountAuthenticatorResult(Bundle)}.
  34 + * This result will be sent as the result of the request when the activity finishes. If this
  35 + * is never set or if it is set to null then error {@link AccountManager#ERROR_CODE_CANCELED}
  36 + * will be called on the response.
  37 + */
  38 +public class AccountAuthenticatorActivity extends AppCompatActivity {
  39 + private AccountAuthenticatorResponse mAccountAuthenticatorResponse = null;
  40 + private Bundle mResultBundle = null;
  41 +
  42 + /**
  43 + * Set the result that is to be sent as the result of the request that caused this
  44 + * Activity to be launched. If result is null or this method is never called then
  45 + * the request will be canceled.
  46 + *
  47 + * @param result this is returned as the result of the AbstractAccountAuthenticator request
  48 + */
  49 + public final void setAccountAuthenticatorResult(Bundle result) {
  50 + mResultBundle = result;
  51 + }
  52 +
  53 + /**
  54 + * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the
  55 + * icicle is non-zero.
  56 + *
  57 + * @param icicle the save instance data of this Activity, may be null
  58 + */
  59 + protected void onCreate(Bundle icicle) {
  60 + super.onCreate(icicle);
  61 +
  62 + mAccountAuthenticatorResponse =
  63 + getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);
  64 +
  65 + if (mAccountAuthenticatorResponse != null) {
  66 + mAccountAuthenticatorResponse.onRequestContinued();
  67 + }
  68 + }
  69 +
  70 + /**
  71 + * Sends the result or a Constants.ERROR_CODE_CANCELED error if a result isn't present.
  72 + */
  73 + public void finish() {
  74 + if (mAccountAuthenticatorResponse != null) {
  75 + // send the result bundle back if set, otherwise send an error.
  76 + if (mResultBundle != null) {
  77 + mAccountAuthenticatorResponse.onResult(mResultBundle);
  78 + } else {
  79 + mAccountAuthenticatorResponse.onError(AccountManager.ERROR_CODE_CANCELED,
  80 + "canceled");
  81 + }
  82 + mAccountAuthenticatorResponse = null;
  83 + }
  84 + super.finish();
  85 + }
  86 +}
... ...
app/src/main/java/com/cnlive/gundam/user/auth/UserAccountAuthenticator.java 0 → 100644
  1 +package com.cnlive.gundam.user.auth;
  2 +
  3 +import android.accounts.AbstractAccountAuthenticator;
  4 +import android.accounts.Account;
  5 +import android.accounts.AccountAuthenticatorResponse;
  6 +import android.accounts.AccountManager;
  7 +import android.accounts.NetworkErrorException;
  8 +import android.content.Context;
  9 +import android.content.Intent;
  10 +import android.os.Bundle;
  11 +import android.util.Log;
  12 +
  13 +import com.cnlive.gundam.user.activity.LoginActivity;
  14 +
  15 +
  16 +public class UserAccountAuthenticator extends AbstractAccountAuthenticator {
  17 + private String _tag = "UserAccountAuthenticator";
  18 + private Context _context;
  19 +
  20 + public UserAccountAuthenticator(Context context) {
  21 + super(context);
  22 + _context = context;
  23 + }
  24 +
  25 + public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options)
  26 + throws NetworkErrorException {
  27 + Log.e("UserAccount", accountType + " - " + authTokenType);
  28 + Bundle ret = new Bundle();
  29 +
  30 + Intent intent = new Intent(_context, LoginActivity.class);
  31 + intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
  32 +
  33 + ret.putParcelable(AccountManager.KEY_INTENT, intent);
  34 + return ret;
  35 + }
  36 +
  37 +
  38 + @Override
  39 + public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) {
  40 + Log.e("UserAccount",".confirmCredentials");
  41 + return null;
  42 + }
  43 +
  44 +
  45 + @Override
  46 + public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
  47 + Log.e("UserAccount",".editProperties");
  48 + return null;
  49 + }
  50 +
  51 +
  52 + @Override
  53 + public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) throws NetworkErrorException {
  54 + Log.e("UserAccount",".getAuthToken");
  55 + return null;
  56 + }
  57 +
  58 +
  59 + @Override
  60 + public String getAuthTokenLabel(String authTokenType) {
  61 + Log.e("UserAccount",".getAuthTokenLabel");
  62 + return null;
  63 + }
  64 +
  65 +
  66 + @Override
  67 + public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException {
  68 + Log.e("UserAccount",".hasFeatures");
  69 + return null;
  70 + }
  71 +
  72 +
  73 + @Override
  74 + public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) {
  75 + Log.e("UserAccount",".updateCredentials");
  76 + return null;
  77 + }
  78 +
  79 +}
... ...
app/src/main/java/com/cnlive/gundam/user/auth/UserAccountService.java 0 → 100644
  1 +package com.cnlive.gundam.user.auth;
  2 +
  3 +import android.app.Service;
  4 +import android.content.Intent;
  5 +import android.os.IBinder;
  6 +
  7 +/**
  8 + * Created by vclub on 14-8-8.
  9 + */
  10 +public class UserAccountService extends Service {
  11 + private UserAccountAuthenticator _saa;
  12 +
  13 + @Override
  14 + public IBinder onBind(Intent intent) {
  15 + IBinder ret = null;
  16 + if (intent.getAction().equals(android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT))
  17 + ret = getMovieAuthenticator().getIBinder();
  18 + return ret;
  19 + }
  20 +
  21 + private UserAccountAuthenticator getMovieAuthenticator() {
  22 + if (_saa == null)
  23 + _saa = new UserAccountAuthenticator(this);
  24 + return _saa;
  25 + }
  26 +}
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/LoginFragment.java
... ... @@ -31,7 +31,7 @@ public class LoginFragment extends Fragment implements View.OnClickListener {
31 31 private FragmentLoginBinding binding;
32 32  
33 33 //用户数据信息
34   - public static DataEntity data;
  34 + public DataEntity data;
35 35  
36 36 private Account account;//密码登录的account
37 37  
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/QuickLoginFragment.java
... ... @@ -33,7 +33,7 @@ public class QuickLoginFragment extends Fragment implements View.OnClickListener
33 33 private FragmentQuickLoginBinding binding;
34 34  
35 35 //用户数据信息
36   - public static DataEntity data;
  36 + public DataEntity data;
37 37  
38 38 //跳转页面的对话框
39 39 private ProgressDialog dialog;
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/RegisterFragment.java
... ... @@ -34,7 +34,7 @@ public class RegisterFragment extends Fragment implements View.OnClickListener {
34 34 private UserFragmentRegisterBinding binding;
35 35  
36 36 //用户数据信息
37   - public static DataEntity data;
  37 + public DataEntity data;
38 38  
39 39 //跳转页面的对话框
40 40 private ProgressDialog dialog;
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/UserFindPasswardFragment.java
... ... @@ -17,7 +17,6 @@ import com.cnlive.gundam.user.util.SystemTools;
17 17 import com.cnlive.gundam.user.util.ToastUtil;
18 18 import com.cnlive.libs.user.IUserService;
19 19 import com.cnlive.libs.user.UserUtil;
20   -import com.cnlive.libs.user.model.DataEntity;
21 20 import com.cnlive.libs.util.data.network.Callback;
22 21  
23 22  
... ... @@ -28,9 +27,6 @@ import com.cnlive.libs.util.data.network.Callback;
28 27 public class UserFindPasswardFragment extends Fragment implements View.OnClickListener{
29 28 private UserFragmentFindPasswordBinding binding;
30 29  
31   - //用户数据信息
32   - public static DataEntity data;
33   -
34 30 //跳转页面的对话框
35 31 private ProgressDialog dialog;
36 32  
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/UserPersonalEditFragment.java
... ... @@ -16,6 +16,7 @@ import com.cnlive.gundam.user.auth.UserService;
16 16 import com.cnlive.gundam.user.model.User;
17 17 import com.cnlive.libs.user.IUserService;
18 18 import com.cnlive.libs.user.UserUtil;
  19 +import com.cnlive.libs.user.model.UserData;
19 20 import com.cnlive.libs.util.data.network.Callback;
20 21  
21 22 /**
... ... @@ -88,7 +89,7 @@ public class UserPersonalEditFragment extends Fragment implements Callback, View
88 89 title = "修改地址";
89 90 break;
90 91 }
91   - ((UserPersonalActivity)getActivity()).setTitle(title);
  92 + ((UserPersonalActivity) getActivity()).setTitle(title);
92 93 }
93 94  
94 95 @Override
... ... @@ -109,7 +110,6 @@ public class UserPersonalEditFragment extends Fragment implements Callback, View
109 110 break;
110 111 }
111 112 } else if (v.getId() == R.id.get_verify) {
112   - //TODO 获取验证码
113 113 UserUtil.sendMessage(IUserService.REGISTER_OR_MODIFY_MOBILE, binding.includeMobileLayout.edtLoginNumber.getText().toString(), new Callback() {
114 114 @Override
115 115 public void onState(int i, String s, Object o) {
... ... @@ -127,11 +127,23 @@ public class UserPersonalEditFragment extends Fragment implements Callback, View
127 127 @Override
128 128 public void onState(int i, String s, Object o) {
129 129 if (i == IUserService.SUCCESS) {
  130 + updateUserInfo();
130 131 Toast.makeText(getActivity(), "提交成功", Toast.LENGTH_LONG).show();
131 132 } else {
132 133 Toast.makeText(getActivity(), "提交失败" + s, Toast.LENGTH_LONG).show();
133 134 }
  135 + }
134 136  
135   - //TODO 更新一下本地数据
  137 + private void updateUserInfo() {
  138 + UserUtil.queryUserInfo(String.valueOf(user.getUid()), String.valueOf(user.getUid()), new Callback() {
  139 + @Override
  140 + public void onState(int i, String s, Object obj) {
  141 + if (i == IUserService.SUCCESS) {
  142 + UserData userData = (UserData) obj;
  143 + UserService userService = UserService.getInstance(getActivity());
  144 + userService.setActiveAccountInfo(userData.getData());
  145 + }
  146 + }
  147 + });
136 148 }
137 149 }
... ...
app/src/main/java/com/cnlive/gundam/user/fragment/UserPersonalFragment.java
1 1 package com.cnlive.gundam.user.fragment;
2 2  
  3 +import android.Manifest;
  4 +import android.app.Activity;
3 5 import android.content.Intent;
  6 +import android.content.pm.PackageManager;
4 7 import android.databinding.DataBindingUtil;
  8 +import android.net.Uri;
  9 +import android.os.Build;
5 10 import android.os.Bundle;
  11 +import android.provider.MediaStore;
6 12 import android.support.annotation.Nullable;
7 13 import android.support.v4.app.Fragment;
  14 +import android.support.v4.content.ContextCompat;
8 15 import android.support.v7.widget.LinearLayoutManager;
  16 +import android.text.TextUtils;
  17 +import android.view.Gravity;
9 18 import android.view.LayoutInflater;
10 19 import android.view.View;
11 20 import android.view.ViewGroup;
... ... @@ -14,13 +23,21 @@ import android.widget.Toast;
14 23 import com.cnlive.gundam.BR;
15 24 import com.cnlive.gundam.R;
16 25 import com.cnlive.gundam.databinding.FragmentUserPersonalBinding;
  26 +import com.cnlive.gundam.main.application.CNLiveApplication;
17 27 import com.cnlive.gundam.main.ui.adapter.DataBindingAdapter;
18 28 import com.cnlive.gundam.user.activity.UserPersonalActivity;
19 29 import com.cnlive.gundam.user.adapter.PersonalAdapter;
20 30 import com.cnlive.gundam.user.auth.UserService;
21 31 import com.cnlive.gundam.user.model.PersonalData;
22 32 import com.cnlive.gundam.user.model.User;
  33 +import com.cnlive.gundam.user.util.PictureUtil;
  34 +import com.cnlive.gundam.user.view.SelectPopupWindow;
  35 +import com.cnlive.libs.user.IUserService;
  36 +import com.cnlive.libs.user.UserUtil;
  37 +import com.cnlive.libs.user.model.UserData;
  38 +import com.cnlive.libs.util.data.network.Callback;
23 39  
  40 +import java.io.File;
24 41 import java.util.ArrayList;
25 42 import java.util.List;
26 43  
... ... @@ -30,7 +47,15 @@ import java.util.List;
30 47 * @time 2017/6/28 13:06
31 48 * @desc ${TODD}
32 49 */
33   -public class UserPersonalFragment extends Fragment implements DataBindingAdapter.OnAdapterViewClickListener<PersonalData> {
  50 +public class UserPersonalFragment extends Fragment implements DataBindingAdapter.OnAdapterViewClickListener<PersonalData>, Callback {
  51 +
  52 + public static final int IMG_FROM_PICTURE = 0x1001;
  53 + public static final int IMG_FROM_CAMERA = 0x1002;
  54 + public static final int PICTURE_REQUEST_CODE = 0x1003;
  55 + public static final int CAMERA_REQUEST_CODE = 0x1004;
  56 +
  57 + //从相机获取的图片地址
  58 + private String cameraImagePath = "";
34 59  
35 60 private FragmentUserPersonalBinding binding;
36 61  
... ... @@ -38,6 +63,11 @@ public class UserPersonalFragment extends Fragment implements DataBindingAdapter
38 63  
39 64 private List<PersonalData> personalData;
40 65  
  66 + //上传头像和修改性别的PopupWindow
  67 + private SelectPopupWindow menuWindow;
  68 +
  69 + private User user;
  70 +
41 71 public static UserPersonalFragment newInstance() {
42 72  
43 73 Bundle args = new Bundle();
... ... @@ -57,27 +87,34 @@ public class UserPersonalFragment extends Fragment implements DataBindingAdapter
57 87 @Override
58 88 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
59 89 super.onViewCreated(view, savedInstanceState);
60   - initData();
61 90 init();
62 91 }
63 92  
  93 + @Override
  94 + public void onResume() {
  95 + super.onResume();
  96 + initData();
  97 + }
  98 +
64 99 private void initData() {
65 100 UserService userService = UserService.getInstance(getActivity());
66   - User user = userService.getActiveAccountInfo();
  101 + user = userService.getActiveAccountInfo();
  102 + String gender = user.getGender().equals("f") ? "女" : (user.getGender().equals("m") ? "男" : "未知");
67 103 personalData = new ArrayList<>();
68 104 personalData.add(new PersonalData("头像", user.getFaceurl(), PersonalData.TYPE_HEADER));
69 105 personalData.add(new PersonalData("昵称", user.getNickname(), PersonalData.TYPE_NICK));
70   - personalData.add(new PersonalData("性别", user.getGender(), PersonalData.TYPE_GENDER));
  106 + personalData.add(new PersonalData("性别", gender, PersonalData.TYPE_GENDER));
71 107 personalData.add(new PersonalData("手机号", user.getMobile(), PersonalData.TYPE_MOBILE));
72 108 personalData.add(new PersonalData("邮箱", user.getEmail(), PersonalData.TYPE_EMAIL));
73 109 personalData.add(new PersonalData("联系地址", user.getLocation(), PersonalData.TYPE_ADDRESS));
  110 + personalData.add(new PersonalData("", "退出", PersonalData.TYPE_LOGOUT));
  111 + adapter.updateItems(personalData);
74 112 }
75 113  
76 114 private void init() {
77   - ((UserPersonalActivity)getActivity()).setTitle("个人资料");
  115 + ((UserPersonalActivity) getActivity()).setTitle("个人资料");
78 116 binding.setListAdapter(adapter = new PersonalAdapter(getActivity(), R.layout.layout_personal_item, BR.data));
79 117 binding.setLayoutManager(new LinearLayoutManager(getActivity()));
80   - adapter.updateItems(personalData);
81 118 adapter.setOnViewClickListener(this);
82 119 }
83 120  
... ... @@ -87,36 +124,200 @@ public class UserPersonalFragment extends Fragment implements DataBindingAdapter
87 124 Intent intent = null;
88 125 switch (program.getItemType()) {
89 126 case PersonalData.TYPE_HEADER:
90   - Toast.makeText(getActivity(), "头像点击", Toast.LENGTH_LONG).show();
  127 + showTakePhoto();
91 128 break;
92 129 case PersonalData.TYPE_NICK:
93 130 intent = new Intent(getActivity(), UserPersonalActivity.class);
94   - intent.putExtra("isEdit",true);
  131 + intent.putExtra("isEdit", true);
95 132 intent.putExtra("type", UserPersonalEditFragment.TYPE_NICK);
96 133 startActivity(intent);
97 134 break;
98 135 case PersonalData.TYPE_GENDER:
99   - Toast.makeText(getActivity(), "性别点击", Toast.LENGTH_LONG).show();
  136 + showSelectGender();
100 137 break;
101 138 case PersonalData.TYPE_MOBILE:
102 139 intent = new Intent(getActivity(), UserPersonalActivity.class);
103   - intent.putExtra("isEdit",true);
  140 + intent.putExtra("isEdit", true);
104 141 intent.putExtra("type", UserPersonalEditFragment.TYPE_MOBILE);
105 142 startActivity(intent);
106 143 break;
107 144 case PersonalData.TYPE_EMAIL:
108 145 intent = new Intent(getActivity(), UserPersonalActivity.class);
109   - intent.putExtra("isEdit",true);
  146 + intent.putExtra("isEdit", true);
110 147 intent.putExtra("type", UserPersonalEditFragment.TYPE_EMAIL);
111 148 startActivity(intent);
112 149 break;
113 150 case PersonalData.TYPE_ADDRESS:
114 151 intent = new Intent(getActivity(), UserPersonalActivity.class);
115   - intent.putExtra("isEdit",true);
  152 + intent.putExtra("isEdit", true);
116 153 intent.putExtra("type", UserPersonalEditFragment.TYPE_ADDRESS);
117 154 startActivity(intent);
118 155 break;
119 156 }
  157 + } else if (v.getId() == R.id.logout) {
  158 + UserService userService = UserService.getInstance(getActivity());
  159 + userService.clearUser();
  160 + getActivity().finish();
  161 + }
  162 + }
  163 +
  164 + /**
  165 + * 底部弹出上传头像的PopupWindow
  166 + */
  167 + public void showTakePhoto() {
  168 + menuWindow = new SelectPopupWindow(getActivity(), R.layout.pop_take_photo);
  169 + menuWindow.showAtLocation(getView().findViewById(R.id.layout), Gravity.BOTTOM, 0, 0);
  170 + menuWindow.getContentView().findViewById(R.id.ll_pick_photo).setOnClickListener(itemsOnClick);
  171 + menuWindow.getContentView().findViewById(R.id.ll_take_photo).setOnClickListener(itemsOnClick);
  172 + }
  173 +
  174 + /**
  175 + * 底部弹出修改性别的PopupWindow
  176 + */
  177 + public void showSelectGender() {
  178 + menuWindow = new SelectPopupWindow(getActivity(), R.layout.pop_modify_gender);
  179 + menuWindow.showAtLocation(getView().findViewById(R.id.layout), Gravity.BOTTOM, 0, 0);
  180 + menuWindow.getContentView().findViewById(R.id.boy).setOnClickListener(itemsOnClick);
  181 + menuWindow.getContentView().findViewById(R.id.girl).setOnClickListener(itemsOnClick);
  182 + }
  183 +
  184 + //为弹出窗口实现监听类
  185 + private View.OnClickListener itemsOnClick = new View.OnClickListener() {
  186 +
  187 + public void onClick(View v) {
  188 + if (menuWindow != null && menuWindow.isShowing()) {
  189 + menuWindow.dismiss();
  190 + }
  191 + switch (v.getId()) {
  192 + case R.id.ll_take_photo:
  193 + fromCamera();
  194 + break;
  195 + case R.id.ll_pick_photo:
  196 + fromPicture();
  197 + break;
  198 + case R.id.girl:
  199 + UserUtil.modifyUserInfo(String.valueOf(user.getUid()), "gender", "f", UserPersonalFragment.this);
  200 + break;
  201 + case R.id.boy:
  202 + UserUtil.modifyUserInfo(String.valueOf(user.getUid()), "gender", "m", UserPersonalFragment.this);
  203 + break;
  204 + default:
  205 + break;
  206 + }
  207 + }
  208 + };
  209 +
  210 + public void fromPicture() {
  211 + if (Build.VERSION.SDK_INT >= 23) {
  212 + int checkCallPhonePermission = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE);
  213 + if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) {
  214 + requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PICTURE_REQUEST_CODE);
  215 + return;
  216 + } else {
  217 + toIntentPicture();
  218 + }
  219 + } else {
  220 + toIntentPicture();
  221 + }
  222 + }
  223 +
  224 + private void toIntentPicture() {
  225 + Intent intent = new Intent();
  226 + intent.setType("image/*");
  227 + intent.setAction(Intent.ACTION_GET_CONTENT);
  228 + startActivityForResult(intent, IMG_FROM_PICTURE);
  229 + }
  230 +
  231 + public void fromCamera() {
  232 + if (Build.VERSION.SDK_INT >= 23) {
  233 + int checkCallPhonePermissionStorage = ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA);
  234 + if (checkCallPhonePermissionStorage != PackageManager.PERMISSION_GRANTED) {
  235 + requestPermissions(new String[]{Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE);
  236 + } else {
  237 + toIntentCamera();
  238 + }
  239 + } else {
  240 + toIntentCamera();
  241 + }
  242 + }
  243 +
  244 + private void toIntentCamera() {
  245 + cameraImagePath = PictureUtil.getImagePath(getActivity());
  246 + if (!TextUtils.isEmpty(cameraImagePath)) {
  247 + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  248 + File tmpFile = new File(cameraImagePath);
  249 + intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tmpFile));
  250 + startActivityForResult(intent, IMG_FROM_CAMERA);
  251 + }
  252 + }
  253 +
  254 +
  255 + @Override
  256 + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
  257 + super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  258 + switch (requestCode) {
  259 + case PICTURE_REQUEST_CODE:
  260 + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
  261 + toIntentPicture();
  262 + } else {
  263 + Toast.makeText(getActivity(), "权限已被禁止,请打开,再使用此功能", Toast.LENGTH_LONG).show();
  264 + }
  265 + break;
  266 + case CAMERA_REQUEST_CODE:
  267 + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
  268 + toIntentCamera();
  269 + } else {
  270 + Toast.makeText(getActivity(), "权限已被禁止,请打开,再使用此功能", Toast.LENGTH_LONG).show();
  271 + }
  272 + break;
  273 + }
  274 + }
  275 +
  276 + @Override
  277 + public void onState(int i, String s, Object o) {
  278 + if (i == IUserService.SUCCESS) {
  279 + updateUserInfo();
  280 + Toast.makeText(getActivity(), "提交成功", Toast.LENGTH_LONG).show();
  281 + } else {
  282 + Toast.makeText(getActivity(), "提交失败" + s, Toast.LENGTH_LONG).show();
  283 + }
  284 + }
  285 +
  286 + private void updateUserInfo() {
  287 + UserUtil.queryUserInfo(String.valueOf(user.getUid()), String.valueOf(user.getUid()), new Callback() {
  288 + @Override
  289 + public void onState(int i, String s, Object obj) {
  290 +
  291 + if (i == IUserService.SUCCESS) {
  292 + UserData userData = (UserData) obj;
  293 + UserService userService = UserService.getInstance(getActivity());
  294 + userService.setActiveAccountInfo(userData.getData());
  295 + initData();
  296 + } else {
  297 + Toast.makeText(getActivity(), "提交失败1111" + s, Toast.LENGTH_LONG).show();
  298 + }
  299 + }
  300 + });
  301 + }
  302 +
  303 + @Override
  304 + public void onActivityResult(int requestCode, int resultCode, Intent data) {
  305 + super.onActivityResult(requestCode, resultCode, data);
  306 + if (resultCode == Activity.RESULT_OK) {
  307 + File file = null;
  308 + switch (requestCode) {
  309 + case IMG_FROM_CAMERA:
  310 + file = new File(cameraImagePath);
  311 + UserUtil.uploadFace(String.valueOf(user.getUid()), CNLiveApplication.secret, file, this);
  312 + break;
  313 + case IMG_FROM_PICTURE:
  314 + Uri uri = data.getData();
  315 + file = new File(PictureUtil.getPath(getActivity(), uri));
  316 + UserUtil.uploadFace(String.valueOf(user.getUid()), CNLiveApplication.secret, file, this);
  317 + break;
  318 + default:
  319 + break;
  320 + }
120 321 }
121 322 }
122 323 }
... ...
app/src/main/java/com/cnlive/gundam/user/model/PersonalData.java
... ... @@ -17,6 +17,7 @@ public class PersonalData {
17 17 public static final int TYPE_MOBILE = 0x1004;
18 18 public static final int TYPE_EMAIL = 0x1005;
19 19 public static final int TYPE_ADDRESS = 0x1006;
  20 + public static final int TYPE_LOGOUT = 0x1007;
20 21  
21 22 public PersonalData(String itemName, String itemMessage, int itemType) {
22 23 this.itemName = itemName;
... ...
app/src/main/java/com/cnlive/gundam/user/model/User.java
... ... @@ -6,7 +6,7 @@ import com.cnlive.gundam.user.model.base.ErrorMessage;
6 6 import java.io.Serializable;
7 7  
8 8 public class User extends ErrorMessage implements Serializable {
9   - public static final String ACCOUNT_TYPE="com.cnlive.libs.AccountType";
  9 + public static final String ACCOUNT_TYPE="com.cnlive.gundam.AccountType";
10 10  
11 11 /**
12 12 * uid : 201601211717200000000000002308
... ...
app/src/main/java/com/cnlive/gundam/user/util/DevilUtil.java
... ... @@ -24,14 +24,8 @@ public class DevilUtil {
24 24 v.getLocationInWindow(l);
25 25 int left=l[0],top=l[1],bottom=top+v.getHeight(),right=left
26 26 +v.getWidth();
27   - if(event.getX()>left&&event.getX()<right
28   - &&event.getY()>top&&event.getY()<bottom){
29   - // 点击EditText的事件,忽略它。
30   - return false;
31   - }else{
32   - // hideSoftInput(v.getWindowToken());
33   - return true;
34   - }
  27 + return !(event.getX() > left && event.getX() < right
  28 + && event.getY() > top && event.getY() < bottom);
35 29 }
36 30 // 如果焦点不是EditText则忽略,这个发生在视图刚绘制完,第一个焦点不在EditView上,和用户用轨迹球选择其他的焦点
37 31 return false;
... ...
app/src/main/java/com/cnlive/gundam/user/util/DownTimer.java
... ... @@ -132,9 +132,9 @@ public class DownTimer {
132 132 }
133 133  
134 134 public interface TimeListener {
135   - public void onFinish();
  135 + void onFinish();
136 136  
137   - public void onInterval(long remainTime);
  137 + void onInterval(long remainTime);
138 138 }
139 139  
140 140 public void setTimerLiener(TimeListener listener) {
... ...
app/src/main/java/com/cnlive/gundam/user/util/PictureUtil.java 0 → 100644
  1 +package com.cnlive.gundam.user.util;
  2 +
  3 +import android.annotation.TargetApi;
  4 +import android.content.ContentUris;
  5 +import android.content.Context;
  6 +import android.database.Cursor;
  7 +import android.net.Uri;
  8 +import android.os.Build;
  9 +import android.os.Environment;
  10 +import android.provider.DocumentsContract;
  11 +import android.provider.MediaStore;
  12 +import android.widget.Toast;
  13 +
  14 +import java.io.File;
  15 +
  16 +/**
  17 + * Created by gujun on 2017/6/29.
  18 + */
  19 +
  20 +public class PictureUtil {
  21 + private static final String IMAGE_PATH = "/com.cnlive.gundam/image/";
  22 +
  23 + public static String getImagePath(Context context){
  24 + String status = Environment.getExternalStorageState();
  25 + String path = "";
  26 + if (status.equals(Environment.MEDIA_MOUNTED)) {
  27 + String rootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + IMAGE_PATH;
  28 + File file = new File(rootPath);
  29 + if(!file.exists()){
  30 + file.mkdirs();
  31 + }
  32 + path = rootPath + System.currentTimeMillis() + ".png";
  33 + }else {
  34 + Toast.makeText(context,"未插入SD卡",Toast.LENGTH_LONG).show();
  35 + }
  36 + return path;
  37 +
  38 + }
  39 +
  40 + @TargetApi(Build.VERSION_CODES.KITKAT)
  41 + public static String getPath(final Context context, final Uri uri) {
  42 +
  43 + final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
  44 +
  45 + // DocumentProvider
  46 + if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
  47 + // ExternalStorageProvider
  48 + if (isExternalStorageDocument(uri)) {
  49 + final String docId = DocumentsContract.getDocumentId(uri);
  50 + final String[] split = docId.split(":");
  51 + final String type = split[0];
  52 +
  53 + if ("primary".equalsIgnoreCase(type)) {
  54 + return Environment.getExternalStorageDirectory() + "/" + split[1];
  55 + }
  56 +
  57 + // TODO handle non-primary volumes
  58 + }
  59 + // DownloadsProvider
  60 + else if (isDownloadsDocument(uri)) {
  61 +
  62 + final String id = DocumentsContract.getDocumentId(uri);
  63 + final Uri contentUri = ContentUris.withAppendedId(
  64 + Uri.parse("content://downloads/public_downloads"), Long.parseLong(id));
  65 +
  66 + return getDataColumn(context, contentUri, null, null);
  67 + }
  68 + // MediaProvider
  69 + else if (isMediaDocument(uri)) {
  70 + final String docId = DocumentsContract.getDocumentId(uri);
  71 + final String[] split = docId.split(":");
  72 + final String type = split[0];
  73 +
  74 + Uri contentUri = null;
  75 + if ("image".equals(type)) {
  76 + contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
  77 + } else if ("video".equals(type)) {
  78 + contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
  79 + } else if ("audio".equals(type)) {
  80 + contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
  81 + }
  82 +
  83 + final String selection = "_id=?";
  84 + final String[] selectionArgs = new String[]{
  85 + split[1]
  86 + };
  87 +
  88 + return getDataColumn(context, contentUri, selection, selectionArgs);
  89 + }
  90 + }
  91 + // MediaStore (and general)
  92 + else if ("content".equalsIgnoreCase(uri.getScheme())) {
  93 +
  94 + // Return the remote address
  95 + if (isGooglePhotosUri(uri))
  96 + return uri.getLastPathSegment();
  97 +
  98 + return getDataColumn(context, uri, null, null);
  99 + }
  100 + // File
  101 + else if ("file".equalsIgnoreCase(uri.getScheme())) {
  102 + return uri.getPath();
  103 + }
  104 +
  105 + return null;
  106 + }
  107 +
  108 + /**
  109 + * Get the value of the data column for this Uri. This is useful for
  110 + * MediaStore Uris, and other file-based ContentProviders.
  111 + *
  112 + * @param context The context.
  113 + * @param uri The Uri to query.
  114 + * @param selection (Optional) Filter used in the query.
  115 + * @param selectionArgs (Optional) Selection arguments used in the query.
  116 + * @return The value of the _data column, which is typically a file path.
  117 + */
  118 + public static String getDataColumn(Context context, Uri uri, String selection,
  119 + String[] selectionArgs) {
  120 +
  121 + Cursor cursor = null;
  122 + final String column = "_data";
  123 + final String[] projection = {
  124 + column
  125 + };
  126 +
  127 + try {
  128 + cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
  129 + null);
  130 + if (cursor != null && cursor.moveToFirst()) {
  131 + final int index = cursor.getColumnIndexOrThrow(column);
  132 + return cursor.getString(index);
  133 + }
  134 + } finally {
  135 + if (cursor != null)
  136 + cursor.close();
  137 + }
  138 + return null;
  139 + }
  140 +
  141 + /**
  142 + * @param uri The Uri to check.
  143 + * @return Whether the Uri authority is ExternalStorageProvider.
  144 + */
  145 + public static boolean isExternalStorageDocument(Uri uri) {
  146 + return "com.android.externalstorage.documents".equals(uri.getAuthority());
  147 + }
  148 +
  149 + /**
  150 + * @param uri The Uri to check.
  151 + * @return Whether the Uri authority is DownloadsProvider.
  152 + */
  153 + public static boolean isDownloadsDocument(Uri uri) {
  154 + return "com.android.providers.downloads.documents".equals(uri.getAuthority());
  155 + }
  156 +
  157 + /**
  158 + * @param uri The Uri to check.
  159 + * @return Whether the Uri authority is MediaProvider.
  160 + */
  161 + public static boolean isMediaDocument(Uri uri) {
  162 + return "com.android.providers.media.documents".equals(uri.getAuthority());
  163 + }
  164 +
  165 + /**
  166 + * @param uri The Uri to check.
  167 + * @return Whether the Uri authority is Google Photos.
  168 + */
  169 + public static boolean isGooglePhotosUri(Uri uri) {
  170 + return "com.google.android.apps.photos.content".equals(uri.getAuthority());
  171 + }
  172 +}
... ...
app/src/main/java/com/cnlive/gundam/user/util/ToastUtil.java
... ... @@ -39,8 +39,8 @@ public class ToastUtil {
39 39 show_msg = msg;
40 40 toast = new Toast(context);
41 41 View view = LayoutInflater.from(context).inflate(TOAST_LAYOUT_ID, null, false);
42   - ImageView imageView = (ImageView) view.findViewById(R.id.image);
43   - TextView textView = (TextView) view.findViewById(R.id.text);
  42 + ImageView imageView = view.findViewById(R.id.image);
  43 + TextView textView = view.findViewById(R.id.text);
44 44 imageView.setVisibility(View.GONE);
45 45  
46 46 textView.setText(msg);
... ...
app/src/main/java/com/cnlive/gundam/user/view/SelectPopupWindow.java 0 → 100644
  1 +package com.cnlive.gundam.user.view;
  2 +
  3 +import android.content.Context;
  4 +import android.graphics.drawable.ColorDrawable;
  5 +import android.view.LayoutInflater;
  6 +import android.view.MotionEvent;
  7 +import android.view.View;
  8 +import android.widget.PopupWindow;
  9 +import android.widget.RelativeLayout;
  10 +
  11 +import com.cnlive.gundam.R;
  12 +
  13 +
  14 +public class SelectPopupWindow extends PopupWindow {
  15 +
  16 + private View view;
  17 + private View tv_cancel;
  18 +
  19 + public SelectPopupWindow(Context mContext, int layout) {
  20 +
  21 + this.view = LayoutInflater.from(mContext).inflate(layout, null);
  22 +
  23 + tv_cancel = view.findViewById(R.id.tv_cancel);
  24 +
  25 + tv_cancel.setOnClickListener(new View.OnClickListener() {
  26 +
  27 + public void onClick(View v) {
  28 + dismiss();
  29 + }
  30 + });
  31 +
  32 + this.setOutsideTouchable(true);
  33 + this.view.setOnTouchListener(new View.OnTouchListener() {
  34 +
  35 + public boolean onTouch(View v, MotionEvent event) {
  36 + int height = view.findViewById(R.id.pop_layout).getTop();
  37 + int y = (int) event.getY();
  38 + if (event.getAction() == MotionEvent.ACTION_UP) {
  39 + if (y < height) {
  40 + dismiss();
  41 + }
  42 + }
  43 + return true;
  44 + }
  45 + });
  46 +
  47 + /* 设置弹出窗口特征 */
  48 + // 设置视图
  49 + this.setContentView(this.view);
  50 + // 设置弹出窗体的宽和高
  51 + this.setHeight(RelativeLayout.LayoutParams.MATCH_PARENT);
  52 + this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
  53 + // 设置弹出窗体可点击
  54 + this.setFocusable(true);
  55 + // 实例化一个ColorDrawable颜色为透明
  56 + ColorDrawable dw = new ColorDrawable(0x30000000);
  57 + // 设置弹出窗体的背景
  58 + this.setBackgroundDrawable(dw);
  59 + // 设置弹出窗体显示时的动画,从底部向上弹出
  60 + this.setAnimationStyle(R.style.take_photo_anim);
  61 + }
  62 +}
... ...
app/src/main/java/com/cnlive/gundam/video/activity/PlayerActivity.java
... ... @@ -22,14 +22,11 @@ import com.cnlive.gundam.video.utils.PlayerUtils;
22 22 */
23 23  
24 24 public class PlayerActivity extends AppCompatActivity {
25   - private final String SCREEN_DIRECT_P = "0";
26   - private final String SCREEN_DIRECT_L = "1";
27 25  
28 26 private Fragment fragment;
29 27 private VideoListProgram program;
30 28 //默认横屏
31   - private String screenDirect = SCREEN_DIRECT_L;
32   - private String screenDirectName = "screenDirect";
  29 + private int screenDirect = 1;
33 30  
34 31 @Override
35 32 protected void onCreate(@Nullable Bundle savedInstanceState) {
... ... @@ -69,10 +66,9 @@ public class PlayerActivity extends AppCompatActivity {
69 66 }
70 67  
71 68 if (fragment instanceof PlayerUgcLiveFragment || fragment instanceof PlayerUgcVodFragment) {
72   - if (intent.hasExtra(screenDirectName)) {
73   - screenDirect = intent.getStringExtra(screenDirectName);
74   - }
75   - if (SCREEN_DIRECT_P.equals(screenDirect)) {
  69 + PlayerUtils.setStatusBarVisibility(this, false);
  70 + screenDirect = program.getIsHorizontalScreen();
  71 + if (screenDirect == 0) {
76 72 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
77 73 } else {
78 74 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
... ...
app/src/main/java/com/cnlive/gundam/video/fragment/PlayerUgcLiveFragment.java
1 1 package com.cnlive.gundam.video.fragment;
2 2  
  3 +import android.Manifest;
  4 +import android.content.pm.PackageManager;
3 5 import android.content.res.Configuration;
4 6 import android.databinding.DataBindingUtil;
5 7 import android.os.Bundle;
  8 +import android.support.annotation.NonNull;
6 9 import android.support.annotation.Nullable;
7 10 import android.support.v4.app.Fragment;
8 11 import android.view.LayoutInflater;
9 12 import android.view.View;
10 13 import android.view.ViewGroup;
  14 +import android.widget.Toast;
11 15  
12 16 import com.cnlive.gundam.R;
13   -import com.cnlive.gundam.databinding.FragmentPlayerUgcVodBinding;
  17 +import com.cnlive.gundam.databinding.FragmentPlayerUgcLiveBinding;
14 18 import com.cnlive.gundam.main.model.VideoListProgram;
15 19 import com.cnlive.gundam.video.fragment.chat.UgcLiveChatFragment;
16 20 import com.cnlive.gundam.video.model.VideoModel;
17 21 import com.cnlive.gundam.video.utils.PlayerUtils;
  22 +import com.cnlive.gundam.video.view.BaseVideoView;
18 23 import com.cnlive.gundam.video.view.VideoView;
19 24  
20 25 /**
21 26 * Created by gujun on 2017/4/5.
22 27 */
23 28  
24   -public class PlayerUgcLiveFragment extends Fragment {
25   - private FragmentPlayerUgcVodBinding binding;
  29 +public class PlayerUgcLiveFragment extends Fragment implements BaseVideoView.OnUgcLiveStatusPermissionListener{
  30 + private final int PERMISSION_REQUEST_CODE = 0x1001;
  31 + private FragmentPlayerUgcLiveBinding binding;
26 32  
27 33 private VideoListProgram program;
28 34 private String title;
... ... @@ -59,6 +65,7 @@ public class PlayerUgcLiveFragment extends Fragment {
59 65 @Override
60 66 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
61 67 super.onViewCreated(view, savedInstanceState);
  68 + binding.videoView.setUgcLiveStatusPermissionListener(this);//必须在设置播放数据前调用
62 69 binding.videoView.setVideoInfo(new VideoModel(title, id, VideoView.TYPE_UGC_LIVE, rates));
63 70 }
64 71  
... ... @@ -87,4 +94,21 @@ public class PlayerUgcLiveFragment extends Fragment {
87 94 super.onDestroyView();
88 95 }
89 96  
  97 + @Override
  98 + public void onShouldRequestPermission() {
  99 + requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, PERMISSION_REQUEST_CODE);
  100 + }
  101 +
  102 + @Override
  103 + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
  104 + super.onRequestPermissionsResult(requestCode, permissions, grantResults);
  105 + if(requestCode == PERMISSION_REQUEST_CODE){
  106 + if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
  107 + if(binding != null && binding.videoView != null)
  108 + binding.videoView.addUgcLiveStatus();
  109 + } else {
  110 + Toast.makeText(getActivity(), "权限已被禁止,您将接收不到直播状态", Toast.LENGTH_LONG).show();
  111 + }
  112 + }
  113 + }
90 114 }
... ...
app/src/main/java/com/cnlive/gundam/video/utils/NetworkChangeReceive.java
... ... @@ -17,7 +17,7 @@ import org.greenrobot.eventbus.EventBus;
17 17 public class NetworkChangeReceive extends BroadcastReceiver {
18 18 @Override
19 19 public void onReceive(Context context, Intent intent) {
20   - ConnectivityManager manager = (ConnectivityManager) context.getSystemService(context.CONNECTIVITY_SERVICE);
  20 + ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
21 21 NetworkInfo networkInfo = manager.getActiveNetworkInfo();
22 22 if (networkInfo != null && networkInfo.isAvailable()) {
23 23 NetworkInfo.State mobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState();
... ...
app/src/main/java/com/cnlive/gundam/video/view/BaseVideoView.java
1 1 package com.cnlive.gundam.video.view;
2 2  
  3 +import android.Manifest;
3 4 import android.content.Context;
  5 +import android.content.pm.PackageManager;
4 6 import android.databinding.DataBindingUtil;
  7 +import android.os.Build;
  8 +import android.support.v4.content.ContextCompat;
5 9 import android.util.AttributeSet;
6 10 import android.util.Log;
7 11 import android.view.LayoutInflater;
... ... @@ -30,7 +34,6 @@ public abstract class BaseVideoView extends RelativeLayout implements
30 34 IMediaPlayer.OnBufferingUpdateListener, ISwitchVideoView.OnSwitchVideoPreparedListener,
31 35 ISwitchVideoView.OnSwitchVideoErrorListener, ISwitchVideoView.OnSwitchVideoCompleteListener {
32 36  
33   - protected Context mContext;
34 37 protected LayoutVideoViewBinding binding;
35 38  
36 39 //记录当前视频播放状态
... ... @@ -59,8 +62,12 @@ public abstract class BaseVideoView extends RelativeLayout implements
59 62  
60 63 private DataSource curDataSource;
61 64  
  65 + //播放器播放状态的监听
62 66 private OnVideoViewPlayStatusListener l;
63 67  
  68 + //ugclive需要权限监听
  69 + private OnUgcLiveStatusPermissionListener ugcLivePermissionListener;
  70 +
64 71 public BaseVideoView(Context context) {
65 72 this(context, null);
66 73 }
... ... @@ -71,7 +78,6 @@ public abstract class BaseVideoView extends RelativeLayout implements
71 78  
72 79 public BaseVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
73 80 super(context, attrs, defStyleAttr);
74   - this.mContext = context;
75 81 init();
76 82 }
77 83  
... ... @@ -81,7 +87,7 @@ public abstract class BaseVideoView extends RelativeLayout implements
81 87  
82 88 protected void init() {
83 89 sharedPreferencesHelper = SharedPreferencesHelper.getInstance(getContext());
84   - binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.layout_video_view, this, true);
  90 + binding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.layout_video_view, this, true);
85 91 binding.videoView.setOnPreparedListener(this);
86 92 binding.videoView.setOnInfoListener(this);
87 93 binding.videoView.setOnErrorListener(this);
... ... @@ -99,8 +105,17 @@ public abstract class BaseVideoView extends RelativeLayout implements
99 105 public void setDataSource() {
100 106 //只有ugcLive视频才有状态监听
101 107 if (videoModel.getType().equals(VideoView.TYPE_UGC_LIVE)) {
102   - VideoStatusUtil.setOnVideoPlayStatusCallback(mOnVideoStatusCallback);
103   - VideoStatusUtil.init(videoModel.getId());
  108 + if (Build.VERSION.SDK_INT >= 23) {
  109 + int checkCallPhonePermission = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_PHONE_STATE);
  110 + if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) {
  111 + if(ugcLivePermissionListener != null)
  112 + ugcLivePermissionListener.onShouldRequestPermission();
  113 + } else {
  114 + addUgcLiveStatus();
  115 + }
  116 + } else {
  117 + addUgcLiveStatus();
  118 + }
104 119 }
105 120  
106 121 if (isLive) {
... ... @@ -113,7 +128,21 @@ public abstract class BaseVideoView extends RelativeLayout implements
113 128  
114 129 preRate = Config.TYPE_PLAY_RATE_2;
115 130  
  131 + }
  132 +
  133 + /**
  134 + * 设置UGC LIVE的直播状态监听
  135 + */
  136 + public void setUgcLiveStatusPermissionListener(OnUgcLiveStatusPermissionListener l){
  137 + ugcLivePermissionListener = l;
  138 + }
116 139  
  140 + /**
  141 + * 添加UGC LIVE的直播状态监听
  142 + */
  143 + public void addUgcLiveStatus(){
  144 + VideoStatusUtil.setOnVideoPlayStatusCallback(mOnVideoStatusCallback);
  145 + VideoStatusUtil.init(videoModel.getId());
117 146 }
118 147  
119 148 /**
... ... @@ -138,6 +167,7 @@ public abstract class BaseVideoView extends RelativeLayout implements
138 167 }
139 168  
140 169 public void onDestroy() {
  170 + binding.videoView.releaseSwitchVideo();
141 171 binding.videoView.release();
142 172 VideoStatusUtil.quit();
143 173 saveCurPlayPosition();
... ... @@ -290,13 +320,13 @@ public abstract class BaseVideoView extends RelativeLayout implements
290 320 //主播暂时离开
291 321 canPlay = false;
292 322 binding.videoView.stop();
293   - binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, mContext.getString(R.string.player_status_leave));
  323 + binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_leave));
294 324 break;
295 325 case IVideoStatus.MEDIA_STATUS_END:
296 326 //直播结束
297 327 canPlay = false;
298 328 binding.videoView.stop();
299   - binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, mContext.getString(R.string.player_status_end));
  329 + binding.infoView.show(PlayerInfoView.SHOW_UGC_LIVE_STATUS, getContext().getString(R.string.player_status_end));
300 330 break;
301 331 }
302 332  
... ... @@ -312,4 +342,9 @@ public abstract class BaseVideoView extends RelativeLayout implements
312 342 public interface OnVideoViewPlayStatusListener {
313 343 void onVideoViewPlayStatus(boolean isPlay);
314 344 }
  345 +
  346 + //ugc live 监听直播状态得需要android.permission.READ_PHONE_STATE
  347 + public interface OnUgcLiveStatusPermissionListener{
  348 + void onShouldRequestPermission();
  349 + }
315 350 }
... ...
app/src/main/java/com/cnlive/gundam/video/view/PlayerAccelerometerSensor.java
... ... @@ -23,7 +23,7 @@ public class PlayerAccelerometerSensor {
23 23 private double boundaryValue;
24 24  
25 25 public interface ScreenOrientationListener {
26   - public void onOrientationChange(int orientation);
  26 + void onOrientationChange(int orientation);
27 27 }
28 28  
29 29 public PlayerAccelerometerSensor(Context context) {
... ...
app/src/main/java/com/cnlive/gundam/video/view/PlayerInfoView.java
... ... @@ -45,9 +45,6 @@ public class PlayerInfoView extends RelativeLayout {
45 45 //展示手机网视图
46 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 50 private ObservableInt observableShowType;
... ... @@ -64,7 +61,7 @@ public class PlayerInfoView extends RelativeLayout {
64 61 //记录当前视频是否是ugc
65 62 private boolean isUgc = false;
66 63  
67   - private static VideoInfoListener l;
  64 + private VideoInfoListener l;
68 65  
69 66 public PlayerInfoView(Context context) {
70 67 this(context, null);
... ... @@ -76,7 +73,6 @@ public class PlayerInfoView extends RelativeLayout {
76 73  
77 74 public PlayerInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
78 75 super(context, attrs, defStyleAttr);
79   - mContext = context;
80 76 init();
81 77 }
82 78  
... ... @@ -96,7 +92,7 @@ public class PlayerInfoView extends RelativeLayout {
96 92 public void setInfoViewLayout(int infoType) {
97 93 switch (infoType) {
98 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 96 binding.setVariable(BR.playerInfoView, this);
101 97 binding.setVariable(BR.showType, observableShowType);
102 98 binding.setVariable(BR.isNews, observableIsNews);
... ... @@ -122,7 +118,7 @@ public class PlayerInfoView extends RelativeLayout {
122 118  
123 119 //获取对应布局的视图
124 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 122 if (getChildCount() > 0)
127 123 removeAllViews();
128 124 addView(view);
... ... @@ -169,9 +165,9 @@ public class PlayerInfoView extends RelativeLayout {
169 165 break;
170 166 case R.id.back:
171 167 if (!PlayerUtils.isPortrait(getContext()) && !isUgc) {
172   - ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  168 + ((Activity) getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
173 169 } else {
174   - ((Activity) mContext).onBackPressed();
  170 + ((Activity) getContext()).onBackPressed();
175 171 }
176 172 break;
177 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 29  
30 30 public class PlayerTouchView extends RelativeLayout {
31 31 private VideoTouchListener l;
32   - private static Context mContext;
33 32  
34 33 //点下时的x坐标
35 34 private int downX;
... ... @@ -76,7 +75,6 @@ public class PlayerTouchView extends RelativeLayout {
76 75  
77 76 public PlayerTouchView(Context context, AttributeSet attrs, int defStyle) {
78 77 super(context, attrs, defStyle);
79   - this.mContext = context;
80 78 audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
81 79 binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.layout_player_touch, this, true);
82 80 binding.setLeftAreaMove(leftArea);
... ... @@ -104,11 +102,11 @@ public class PlayerTouchView extends RelativeLayout {
104 102 if (downX < controlAreaWidth) {
105 103 if (preVolume == -1)
106 104 preVolume = getSystemVolume();
107   - brightnessAndVolumeProgress.set(preVolume * DensityUtils.dp2px(mContext, 93) / getSystemMaxVolume());
  105 + brightnessAndVolumeProgress.set(preVolume * DensityUtils.dp2px(getContext(), 93) / getSystemMaxVolume());
108 106 } else if (downX > getWidth() - controlAreaWidth) {
109 107 if (preBrightness == -1)
110 108 preBrightness = getSystemBrightness();
111   - brightnessAndVolumeProgress.set(preBrightness * DensityUtils.dp2px(mContext, 93) / 255);
  109 + brightnessAndVolumeProgress.set(preBrightness * DensityUtils.dp2px(getContext(), 93) / 255);
112 110 }
113 111 curBrightnessProgress = -1;
114 112 curVolumeProgress = -1;
... ... @@ -190,7 +188,7 @@ public class PlayerTouchView extends RelativeLayout {
190 188 int curBrightness = PlayerUtils.checkSize(preBrightness + moveY * 255 / getHeight(), 1, 255);
191 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 192 brightnessAndVolumeProgress.set(progress);
195 193  
196 194 curBrightnessProgress = curBrightness;
... ... @@ -237,7 +235,7 @@ public class PlayerTouchView extends RelativeLayout {
237 235 int curVolume = PlayerUtils.checkSize(preVolume + (moveY * getSystemMaxVolume() / getHeight()), 0, getSystemMaxVolume());
238 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 239 brightnessAndVolumeProgress.set(progress);
242 240  
243 241 curVolumeProgress = curVolume;
... ...
app/src/main/java/com/cnlive/gundam/video/view/VideoView.java
... ... @@ -50,13 +50,13 @@ public class VideoView extends BaseVideoView implements PlayerTouchView.VideoTou
50 50 //拖动结束或拖拽进度条时需要seekTo的位置
51 51 private long touchSeekToPosition = 0;
52 52 //记录当前是否是竖屏
53   - private static ObservableBoolean observableIsPortrait;
  53 + private ObservableBoolean observableIsPortrait;
54 54 //记录当前是否是ugc节目
55   - private static ObservableBoolean observableIsUgc;
  55 + private ObservableBoolean observableIsUgc;
56 56 //记录当前视频高度
57   - private static ObservableInt observableVideoHeight;
  57 + private ObservableInt observableVideoHeight;
58 58 //记录当前视频宽度
59   - private static ObservableInt observableVideoWidth;
  59 + private ObservableInt observableVideoWidth;
60 60 //记录当前视频是否已经onError
61 61 private boolean isPlayerError = false;
62 62 //设置touchView 是否拦截touch事件
... ... @@ -109,7 +109,7 @@ public class VideoView extends BaseVideoView implements PlayerTouchView.VideoTou
109 109 observableIsUgc = new ObservableBoolean();
110 110 observableVideoHeight = new ObservableInt();
111 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 113 observableVideoWidth.set(ViewGroup.LayoutParams.MATCH_PARENT);
114 114 observableIsPortrait.set(PlayerUtils.isPortrait(getContext()));
115 115 binding.setVideoPortraitHeight(observableVideoHeight);
... ... @@ -343,7 +343,7 @@ public class VideoView extends BaseVideoView implements PlayerTouchView.VideoTou
343 343  
344 344 @Override
345 345 public boolean canTouch() {
346   - return videoInfoViewIsShow() ? false : canTouch;
  346 + return !videoInfoViewIsShow() && canTouch;
347 347 }
348 348 // --------------------- touch 相关回调 end-------------------------
349 349  
... ...
app/src/main/res/drawable-hdpi/page_back.png 0 → 100644

489 Bytes

app/src/main/res/drawable-hdpi/user_list_arrows.png 0 → 100644

343 Bytes

app/src/main/res/drawable-mdpi/page_back.png 0 → 100644

364 Bytes

app/src/main/res/drawable-xhdpi/page_back.png 0 → 100644

832 Bytes

app/src/main/res/drawable-xhdpi/user_list_arrows.png 0 → 100644

509 Bytes

app/src/main/res/drawable-xxhdpi/page_back.png 0 → 100644

1.33 KB

app/src/main/res/drawable-xxhdpi/user_list_arrows.png 0 → 100644

1 KB

app/src/main/res/drawable-xxxhdpi/page_back.png 0 → 100644

2.26 KB

app/src/main/res/drawable-xxxhdpi/user_list_arrows.png 0 → 100644

1.62 KB

app/src/main/res/layout/fragment_personal_edit.xml
... ... @@ -13,25 +13,40 @@
13 13  
14 14 <RelativeLayout
15 15 android:layout_width="match_parent"
16   - android:layout_height="match_parent">
  16 + android:layout_height="match_parent"
  17 + android:background="@color/gray_bg"
  18 + android:paddingTop="10dp">
17 19  
18   - <EditText
19   - android:id="@+id/editText"
  20 + <LinearLayout
20 21 android:layout_width="match_parent"
21   - android:layout_height="50dp"
22   - android:visibility="gone"/>
  22 + android:layout_height="wrap_content"
  23 + android:orientation="vertical"
  24 + android:background="@android:color/white">
  25 +
  26 + <EditText
  27 + android:id="@+id/editText"
  28 + style="@style/LoginContentStyle"
  29 + android:layout_width="match_parent"
  30 + android:layout_height="50dp"
  31 + android:layout_marginLeft="11dp"
  32 + android:layout_marginRight="11dp"
  33 + android:visibility="gone" />
  34 +
  35 + <include
  36 + android:id="@+id/includeMobileLayout"
  37 + layout="@layout/mobile_keycode_layout" />
23 38  
24   - <include
25   - android:id="@+id/includeMobileLayout"
26   - layout="@layout/mobile_keycode_layout"/>
  39 + </LinearLayout>
27 40  
28 41 <Button
29 42 android:id="@+id/submit"
  43 + style="@style/LoginButtonStyle"
30 44 android:layout_width="match_parent"
31 45 android:layout_height="50dp"
32 46 android:layout_alignParentBottom="true"
33 47 android:layout_marginBottom="200dp"
34 48 android:onClick="@{userPersonalEditFragment.onClick}"
  49 + android:background="@drawable/user_btn_login"
35 50 android:text="提交" />
36 51  
37 52 </RelativeLayout>
... ...
app/src/main/res/layout/fragment_player_ugc_live.xml
... ... @@ -23,9 +23,8 @@
23 23  
24 24 <RelativeLayout
25 25 android:id="@+id/contentLayout"
26   - android:background="@android:color/black"
27 26 android:layout_width="match_parent"
28   - android:layout_height="400dp"
  27 + android:layout_height="match_parent"
29 28 android:layout_alignParentBottom="true">
30 29  
31 30 </RelativeLayout>
... ...
app/src/main/res/layout/fragment_user_personal.xml
... ... @@ -17,6 +17,7 @@
17 17 </data>
18 18  
19 19 <RelativeLayout
  20 + android:id="@+id/layout"
20 21 android:layout_width="match_parent"
21 22 android:layout_height="match_parent">
22 23  
... ... @@ -27,7 +28,7 @@
27 28 android:clipToPadding="true"
28 29 android:clipChildren="true"
29 30 android:paddingTop="5dp"
30   - android:background="@color/list_divider"
  31 + android:background="@color/gray_bg"
31 32 app:adapter="@{listAdapter}"
32 33 app:layoutManager="@{layoutManager}"/>
33 34  
... ...
app/src/main/res/layout/layout_actionbar_back.xml
... ... @@ -8,6 +8,7 @@
8 8 android:layout_height="?attr/actionBarSize"
9 9 android:theme="@style/ThemeOverlay.AppCompat.Light"
10 10 app:contentInsetEnd="?attr/actionBarSize"
  11 + android:background="@android:color/white"
11 12 android:visibility="gone"
12 13 tools:visibility="visible">
13 14  
... ...
app/src/main/res/layout/layout_item_active_video_list.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <layout xmlns:android="http://schemas.android.com/apk/res/android"
3   - xmlns:app="http://schemas.android.com/apk/res-auto">
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + xmlns:tools="http://schemas.android.com/tools">
4 5  
5 6 <data>
6 7  
7 8 <import type="com.cnlive.gundam.main.model.ActiveInfo" />
8   - <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener"/>
  9 + <import type="android.view.View"/>
  10 + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener" />
9 11  
10 12 <variable
11 13 name="activeInfo"
... ... @@ -13,7 +15,7 @@
13 15  
14 16 <variable
15 17 name="viewClickListner"
16   - type="OnAdapterViewClickListener&lt;ActiveInfo>"/>
  18 + type="OnAdapterViewClickListener&lt;ActiveInfo>" />
17 19  
18 20 </data>
19 21  
... ... @@ -26,25 +28,61 @@
26 28 <ImageView
27 29 android:id="@+id/image"
28 30 android:layout_width="match_parent"
29   - android:layout_height="200dp"
  31 + android:layout_height="300dp"
30 32 android:scaleType="centerCrop"
31 33 app:error="@{@drawable/image_error}"
32 34 app:imageUrl="@{activeInfo.getCoverImgUrl()}" />
33 35  
34 36 <TextView
  37 + android:layout_width="wrap_content"
  38 + android:layout_height="wrap_content"
  39 + android:layout_alignParentRight="true"
  40 + android:background="#60494747"
  41 + android:padding="3dp"
  42 + android:text="@{activeInfo.getActivityStatus() == 1 ? @string/ugc_live : @string/ugc_vod}"
  43 + android:textColor="@{activeInfo.getActivityStatus() == 1 ? @android:color/holo_red_light : @android:color/white}"
  44 + tools:text="直播" />
  45 +
  46 + <TextView
35 47 android:id="@+id/title"
36 48 android:layout_width="match_parent"
37 49 android:layout_height="wrap_content"
38   - android:layout_below="@+id/image"
  50 + android:layout_alignBottom="@+id/image"
  51 + android:background="#60494747"
39 52 android:padding="10dp"
40 53 android:text="@{activeInfo.getActivityName()}"
41   - android:textColor="@android:color/black"
42   - android:textSize="16sp"/>
  54 + android:textColor="@android:color/white"
  55 + android:textSize="16sp"
  56 + tools:text="title" />
  57 +
  58 + <LinearLayout
  59 + android:id="@+id/exLayout"
  60 + android:layout_width="match_parent"
  61 + android:layout_height="wrap_content"
  62 + android:layout_below="@+id/image"
  63 + android:visibility="@{activeInfo.getExtensions() != null ? View.VISIBLE : View.GONE}">
  64 +
  65 + <ImageView
  66 + android:id="@+id/header"
  67 + android:layout_width="30dp"
  68 + android:layout_height="30dp"
  69 + android:layout_margin="5dp"
  70 + app:error="@{@drawable/image_error}"
  71 + app:imageUrl="@{activeInfo.getExUrl()}"/>
  72 +
  73 + <TextView
  74 + android:layout_width="wrap_content"
  75 + android:layout_height="wrap_content"
  76 + android:layout_gravity="center_vertical"
  77 + android:textColor="@android:color/black"
  78 + android:text="@{activeInfo.getExNick()}"
  79 + tools:text="nick" />
  80 + </LinearLayout>
43 81  
44 82 <View
45 83 android:layout_width="match_parent"
46 84 android:layout_height="8dp"
47   - android:layout_below="@+id/title"
  85 + android:layout_below="@+id/exLayout"
48 86 android:background="@color/list_divider" />
49 87  
50 88 </RelativeLayout>
... ...
app/src/main/res/layout/layout_personal_header_item.xml
... ... @@ -38,6 +38,7 @@
38 38 android:text="@{data.getItemName()}"
39 39 android:textColor="@color/black"
40 40 android:textSize="18sp"
  41 + android:layout_marginLeft="10dp"
41 42 tools:text="nick" />
42 43  
43 44 <ImageView
... ...
app/src/main/res/layout/layout_personal_item.xml
... ... @@ -37,6 +37,7 @@
37 37 android:text="@{data.getItemName()}"
38 38 android:textColor="@color/black"
39 39 android:textSize="18sp"
  40 + android:layout_marginLeft="10dp"
40 41 tools:text="nick" />
41 42  
42 43 <TextView
... ... @@ -48,7 +49,7 @@
48 49 android:layout_toRightOf="@+id/itemName"
49 50 android:gravity="center_vertical|right"
50 51 android:text="@{data.getItemMessage()}"
51   - android:textColor="@color/black"
  52 + android:textColor="@color/gray"
52 53 android:textSize="18sp"
53 54 tools:text="haha" />
54 55  
... ... @@ -56,7 +57,9 @@
56 57 android:layout_width="wrap_content"
57 58 android:layout_height="wrap_content"
58 59 android:layout_alignParentRight="true"
59   - android:layout_centerVertical="true"/>
  60 + android:layout_centerVertical="true"
  61 + android:src="@drawable/user_list_arrows"
  62 + android:layout_marginRight="10dp"/>
60 63  
61 64 </RelativeLayout>
62 65  
... ...
app/src/main/res/layout/layout_personal_logout_item.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <data>
  5 +
  6 + <import type="com.cnlive.gundam.user.model.PersonalData" />
  7 + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener"/>
  8 +
  9 + <variable
  10 + name="data"
  11 + type="PersonalData"/>
  12 +
  13 + <variable
  14 + name="viewClickListner"
  15 + type="OnAdapterViewClickListener&lt;PersonalData>"/>
  16 +
  17 + </data>
  18 +
  19 + <RelativeLayout
  20 + android:id="@+id/itemLayout"
  21 + android:layout_width="match_parent"
  22 + android:layout_height="wrap_content">
  23 +
  24 + <Button
  25 + android:id="@+id/logout"
  26 + style="@style/LoginButtonStyle"
  27 + android:layout_width="match_parent"
  28 + android:layout_height="50dp"
  29 + android:background="@drawable/user_btn_login"
  30 + android:layout_marginTop="50dp"
  31 + android:onClick="@{(view)->viewClickListner.onViewClick(view,data)}"
  32 + android:text="退出" />
  33 +
  34 + </RelativeLayout>
  35 +
  36 +</layout>
0 37 \ No newline at end of file
... ...
app/src/main/res/layout/pop_modify_gender.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="fill_parent"
  4 + android:layout_height="wrap_content"
  5 + android:gravity="center_horizontal"
  6 + android:orientation="vertical">
  7 +
  8 + <RelativeLayout
  9 + android:id="@+id/pop_layout"
  10 + android:layout_width="fill_parent"
  11 + android:layout_height="wrap_content">
  12 +
  13 + <TextView
  14 + android:id="@+id/tv_cancel"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="58dp"
  17 + android:layout_alignParentBottom="true"
  18 + android:background="#ffffff"
  19 + android:gravity="center"
  20 + android:text="取消"
  21 + android:textColor="#FF6633"
  22 + android:textSize="16sp" />
  23 +
  24 + <LinearLayout
  25 + android:id="@+id/boy"
  26 + android:layout_width="match_parent"
  27 + android:layout_height="58dp"
  28 + android:layout_above="@id/tv_cancel"
  29 + android:background="#ffffff"
  30 + android:orientation="vertical">
  31 +
  32 + <TextView
  33 + android:layout_width="match_parent"
  34 + android:layout_height="50dp"
  35 + android:layout_alignParentBottom="true"
  36 + android:gravity="center"
  37 + android:text="男"
  38 + android:textColor="#333333"
  39 + android:textSize="16sp" />
  40 +
  41 + <View
  42 + android:layout_width="match_parent"
  43 + android:layout_height="10dp"
  44 + android:background="#D8D8D8" />
  45 + </LinearLayout>
  46 +
  47 +
  48 + <LinearLayout
  49 + android:id="@+id/girl"
  50 + android:layout_width="match_parent"
  51 + android:layout_height="58dp"
  52 + android:layout_above="@id/boy"
  53 + android:background="#ffffff"
  54 + android:orientation="vertical">
  55 +
  56 + <TextView
  57 + android:layout_width="match_parent"
  58 + android:layout_height="50dp"
  59 + android:layout_alignParentBottom="true"
  60 + android:gravity="center"
  61 + android:text="女"
  62 + android:textColor="#333333"
  63 + android:textSize="16sp" />
  64 +
  65 + <View
  66 + android:layout_width="match_parent"
  67 + android:layout_height="1dp"
  68 + android:background="#D8D8D8" />
  69 + </LinearLayout>
  70 +
  71 +
  72 + <LinearLayout
  73 + android:id="@+id/ll_changeHead"
  74 + android:layout_width="match_parent"
  75 + android:layout_height="51dp"
  76 + android:layout_above="@id/girl"
  77 + android:background="#ffffff"
  78 + android:orientation="vertical">
  79 +
  80 + <TextView
  81 + android:id="@+id/changeTitleTag"
  82 + android:layout_width="match_parent"
  83 + android:layout_height="50dp"
  84 + android:layout_alignParentBottom="true"
  85 + android:gravity="center"
  86 + android:text="性别修改"
  87 + android:textColor="@color/black"
  88 + android:textSize="18sp" />
  89 +
  90 + <View
  91 + android:layout_width="match_parent"
  92 + android:layout_height="1dp"
  93 + android:background="@color/color_list_bg" />
  94 +
  95 + </LinearLayout>
  96 +
  97 + </RelativeLayout>
  98 +
  99 +</RelativeLayout>
0 100 \ No newline at end of file
... ...
app/src/main/res/layout/pop_take_photo.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="fill_parent"
  4 + android:layout_height="wrap_content"
  5 + android:gravity="center_horizontal"
  6 + android:orientation="vertical">
  7 +
  8 + <RelativeLayout
  9 + android:id="@+id/pop_layout"
  10 + android:layout_width="fill_parent"
  11 + android:layout_height="wrap_content">
  12 +
  13 + <TextView
  14 + android:id="@+id/tv_cancel"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="58dp"
  17 + android:layout_alignParentBottom="true"
  18 + android:background="#ffffff"
  19 + android:gravity="center"
  20 + android:text="取消"
  21 + android:textColor="#FF6633"
  22 + android:textSize="16sp" />
  23 +
  24 + <LinearLayout
  25 + android:id="@+id/ll_pick_photo"
  26 + android:layout_width="match_parent"
  27 + android:layout_height="58dp"
  28 + android:layout_above="@id/tv_cancel"
  29 + android:background="#ffffff"
  30 + android:orientation="vertical">
  31 +
  32 + <TextView
  33 + android:layout_width="match_parent"
  34 + android:layout_height="50dp"
  35 + android:layout_alignParentBottom="true"
  36 + android:gravity="center"
  37 + android:text="从手机相册中选取"
  38 + android:textColor="#333333"
  39 + android:textSize="16sp" />
  40 +
  41 + <View
  42 + android:layout_width="match_parent"
  43 + android:layout_height="10dp"
  44 + android:background="#D8D8D8" />
  45 + </LinearLayout>
  46 +
  47 +
  48 + <LinearLayout
  49 + android:id="@+id/ll_take_photo"
  50 + android:layout_width="match_parent"
  51 + android:layout_height="58dp"
  52 + android:layout_above="@id/ll_pick_photo"
  53 + android:background="#ffffff"
  54 + android:orientation="vertical">
  55 +
  56 + <TextView
  57 + android:layout_width="match_parent"
  58 + android:layout_height="50dp"
  59 + android:layout_alignParentBottom="true"
  60 + android:gravity="center"
  61 + android:text="拍照"
  62 + android:textColor="#333333"
  63 + android:textSize="16sp" />
  64 +
  65 + <View
  66 + android:layout_width="match_parent"
  67 + android:layout_height="1dp"
  68 + android:background="#D8D8D8" />
  69 + </LinearLayout>
  70 +
  71 +
  72 + <LinearLayout
  73 + android:id="@+id/ll_changeHead"
  74 + android:layout_width="match_parent"
  75 + android:layout_height="51dp"
  76 + android:layout_above="@id/ll_take_photo"
  77 + android:background="#ffffff"
  78 + android:orientation="vertical">
  79 +
  80 + <TextView
  81 + android:id="@+id/changeTitleTag"
  82 + android:layout_width="match_parent"
  83 + android:layout_height="50dp"
  84 + android:layout_alignParentBottom="true"
  85 + android:gravity="center"
  86 + android:text="头像修改"
  87 + android:textColor="@color/black"
  88 + android:textSize="18sp" />
  89 +
  90 + <View
  91 + android:layout_width="match_parent"
  92 + android:layout_height="1dp"
  93 + android:background="@color/color_list_bg" />
  94 +
  95 + </LinearLayout>
  96 +
  97 + </RelativeLayout>
  98 +
  99 +</RelativeLayout>
0 100 \ No newline at end of file
... ...
app/src/main/res/values/colors.xml
... ... @@ -8,4 +8,7 @@
8 8  
9 9 <color name="rate_sel">#ff0000</color>
10 10 <color name="rate_nor">#ffffff</color>
  11 +
  12 + <color name="gray">#9e9e9e</color>
  13 + <color name="gray_bg">#dedbdb</color>
11 14 </resources>
... ...
app/src/main/res/values/strings.xml
... ... @@ -36,6 +36,10 @@
36 36 <string name="request_null">暂无数据</string>
37 37 <string name="request_state_error">获取活动状态失败</string>
38 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&amp;plat=a&amp;appId=%s </string>
40 39  
  40 + <string name="ugc_live">直播</string>
  41 + <string name="ugc_vod">回放</string>
  42 +
  43 + <string name="verified_url" formatted="false">https://mobile.cnlive.com/CnliveMobile/web/review/review.jsp?sid=%s&amp;plat=a&amp;appId=%s </string>
  44 + <string name="debug_verified_url" formatted="false">https://mobile.cnlive.com/CnliveMobile/web/review/review.jsp?sid=%s&amp;plat=a&amp;appId=%s&amp;type=0 </string>
41 45 </resources>
... ...
user/src/main/res/values/strings.xml
... ... @@ -36,7 +36,7 @@
36 36 <string name="find_password_hint">请确认密码:6&#8211;20位字母或数字</string>
37 37 <string name="save_btn">保存</string>
38 38  
39   - <string name="ACCOUNT_TYPE">com.cnlive.libs.AccountType</string>
  39 + <string name="ACCOUNT_TYPE">com.cnlive.gundam.AccountType</string>
40 40 <string name="ACCOUNT_LABEL">@string/app_name</string>
41 41  
42 42  
... ...