Commit bdf2c2035f1534e31ab06256a544262ddd08e42a

Authored by 吴奎庆
2 parents 5ca52b5b 0812c7f1

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/res/values/styles.xml
Showing 69 changed files with 1909 additions and 293 deletions
app/libs/libcnlivelive.jar
No preview for this file type
app/libs/libcnliveshortvideo.jar
No preview for this file type
app/src/main/AndroidManifest.xml
... ... @@ -113,9 +113,25 @@
113 113 android:name="io.rong.imlib.HeartbeatReceiver"
114 114 android:process=":ipc" />
115 115  
116   - <activity android:name=".shortvideo.activity.MyVideoActivity" />
117   - <activity android:name=".shortvideo.activity.ShortVideoActivity" />
118   - <activity android:name=".shortvideo.activity.EditActivity" />
  116 + <activity
  117 + android:name=".shortvideo.activity.MyVideoActivity"
  118 + android:configChanges="orientation|keyboardHidden|screenSize"
  119 + android:screenOrientation="portrait"
  120 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
  121 + <activity
  122 + android:name=".shortvideo.activity.ShortVideoActivity"
  123 + android:configChanges="orientation|keyboardHidden|screenSize"
  124 + android:screenOrientation="portrait"
  125 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
  126 + <activity
  127 + android:name=".shortvideo.activity.EditActivity"
  128 + android:configChanges="orientation|keyboardHidden|screenSize"
  129 + android:screenOrientation="portrait"
  130 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
  131 + <activity android:name=".shortvideo.activity.ShortVideoPlayActivity"
  132 + android:configChanges="orientation|keyboardHidden|screenSize"
  133 + android:screenOrientation="portrait"
  134 + android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
119 135 </application>
120 136  
121 137 </manifest>
122 138 \ No newline at end of file
... ...
app/src/main/java/com/cnlive/gundam/data/network/ApiService.java
... ... @@ -3,6 +3,7 @@ package com.cnlive.gundam.data.network;
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.shortvideo.model.ShortVideoDataModel;
6 7 import com.cnlive.gundam.stream.model.ChannelInfoModel;
7 8  
8 9 import java.util.Map;
... ... @@ -33,4 +34,8 @@ public interface ApiService {
33 34 //主播信息接口
34 35 @GET("live_epg/channel/info4App")
35 36 Call<ChannelInfoModel> getChannelInfo(@QueryMap Map<String, String> params);
  37 +
  38 + //获取SP下的短视频列表
  39 + @GET("vod_epg/sp/shortVideoList4APP")
  40 + Call<ShortVideoDataModel> getShortVideoList(@QueryMap Map<String, String> params);
36 41 }
... ...
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
... ... @@ -69,7 +69,7 @@ public class ConfigFragment extends Fragment implements View.OnClickListener {
69 69 if (uid != 0) {
70 70 //进入个人中心页面
71 71 Intent intent = new Intent(getActivity(), UserPersonalActivity.class);
72   - intent.putExtra("isEdit",false);
  72 + intent.putExtra("isEdit", false);
73 73 startActivity(intent);
74 74 } else {
75 75 //进入登录页面
... ... @@ -81,7 +81,13 @@ public class ConfigFragment extends Fragment implements View.OnClickListener {
81 81 startActivity(new Intent(getActivity(), CommentActivity.class));
82 82 break;
83 83 case R.id.my_video:
84   - startActivity(new Intent(getActivity(), MyVideoActivity.class));
  84 + int userId = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid();
  85 + if (userId != 0) {
  86 + startActivity(new Intent(getActivity(), MyVideoActivity.class));
  87 +
  88 + } else {
  89 + startActivity(new Intent(getActivity(), LoginActivity.class));
  90 + }
85 91 break;
86 92  
87 93 }
... ... @@ -99,11 +105,11 @@ public class ConfigFragment extends Fragment implements View.OnClickListener {
99 105 }
100 106  
101 107 private void notifyUI(boolean isLogin) {
102   - if(isLogin){
  108 + if (isLogin) {
103 109 User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo();
104 110 Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg);
105 111 binding.tvNickname.setText(activeAccountInfo.getNickname());
106   - }else{
  112 + } else {
107 113 Glide.with(getActivity()).load(R.drawable.cnlive_user_header).into(binding.headImg);
108 114 binding.tvNickname.setText(getString(R.string.click_login));
109 115 }
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/activity/EditActivity.java
... ... @@ -11,15 +11,11 @@ import android.graphics.Bitmap;
11 11 import android.graphics.BitmapFactory;
12 12 import android.graphics.Color;
13 13 import android.graphics.Paint;
14   -import android.opengl.GLSurfaceView;
15 14 import android.os.Bundle;
16 15 import android.os.Handler;
17 16 import android.support.v4.app.ActivityCompat;
18 17 import android.support.v7.app.AppCompatActivity;
19   -import android.support.v7.widget.AppCompatSeekBar;
20   -import android.support.v7.widget.AppCompatSpinner;
21 18 import android.support.v7.widget.LinearLayoutManager;
22   -import android.support.v7.widget.RecyclerView;
23 19 import android.text.Editable;
24 20 import android.text.TextPaint;
25 21 import android.text.TextUtils;
... ... @@ -38,7 +34,7 @@ import android.view.WindowManager;
38 34 import android.view.inputmethod.InputMethodManager;
39 35 import android.widget.AdapterView;
40 36 import android.widget.ArrayAdapter;
41   -import android.widget.CheckBox;
  37 +import android.widget.Button;
42 38 import android.widget.CompoundButton;
43 39 import android.widget.EditText;
44 40 import android.widget.ImageView;
... ... @@ -51,18 +47,18 @@ import android.widget.Toast;
51 47  
52 48 import com.cnlive.gundam.R;
53 49 import com.cnlive.gundam.databinding.ActivityEditBinding;
54   -import com.cnlive.gundam.shortvideo.dialog.ShortVideoConfigDialog;
55 50 import com.cnlive.gundam.shortvideo.sticker.StickerAdapter;
56 51 import com.cnlive.gundam.shortvideo.util.ColorPicker;
  52 +import com.cnlive.gundam.shortvideo.util.FileUtils;
57 53 import com.cnlive.gundam.shortvideo.videorange.HorizontalListView;
58 54 import com.cnlive.gundam.shortvideo.videorange.VideoRangeSeekBar;
59 55 import com.cnlive.gundam.shortvideo.videorange.VideoThumbnailAdapter;
60 56 import com.cnlive.gundam.shortvideo.videorange.VideoThumbnailInfo;
  57 +import com.cnlive.gundam.user.auth.UserService;
61 58 import com.cnlive.lib.upload.listener.CNPutObjectResponseListener;
62 59 import com.cnlive.lib.upload.model.UploadError;
63 60 import com.cnlive.libs.shortvideo.kit.CNEditKit;
64 61 import com.cnlive.libs.shortvideo.utils.base.ShortVideoConstants;
65   -import com.cnlive.libs.shortvideo.view.CNStickerView;
66 62 import com.cnlive.libs.shortvideo.view.CNTextView;
67 63 import com.cnlive.libs.shortvideo.view.base.ICNTextView;
68 64 import com.cnlive.libs.shortvideo.view.info.CNStickerHelpBoxInfo;
... ... @@ -75,12 +71,14 @@ import com.cnlive.libs.util.Config;
75 71 import com.cnlive.libs.video.video.MediaPlayer;
76 72 import com.cnlive.libs.video.video.base.IDataSource;
77 73 import com.cnlive.libs.video.video.base.IMediaPlayer;
  74 +import com.googlecode.mp4parser.authoring.Edit;
78 75  
79 76 import org.apache.http.Header;
80 77  
81 78 import java.io.File;
82 79 import java.io.IOException;
83 80 import java.io.InputStream;
  81 +import java.util.ArrayList;
84 82 import java.util.HashMap;
85 83 import java.util.LinkedList;
86 84 import java.util.List;
... ... @@ -127,6 +125,14 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
127 125 private SeekBarChangedObserver mSeekBarChangedObserver;
128 126  
129 127 public final static String SRC_URL = "srcurl";
  128 + public final static String DURATION = "duration";
  129 + public final static String FRAME_RATE = "framerate";
  130 + public final static String VIDEO_BITRATE = "video_bitrate";
  131 + public final static String AUDIO_BITRATE = "audio_bitrate";
  132 + public final static String VIDEO_RESOLUTION = "video_resolution";
  133 + public final static String ENCODE_TYPE = "encode_type";
  134 + public final static String ENCODE_METHOD = "encode_method";
  135 + public final static String ENCODE_PROFILE = "encode_profile";
130 136  
131 137 private String mLogoPath = "assets://Logo/cnlive_logo.png";
132 138 private String mBgmPath = "/sdcard/uncle.mp3";
... ... @@ -153,13 +159,32 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
153 159  
154 160 // private ImageView screenShot;
155 161  
  162 + private int duration;
  163 + private int frameRate;
  164 + private int videoBitrate;
  165 + private int audioBitrate;
  166 + private int videoResolution;
  167 + private int encode_type;
  168 + private int encode_method;
  169 + private int encodeProfile;
156 170 private ActivityEditBinding binding;
157 171  
158   - public static void startActivity(Context context, String srcUrl) {
  172 + public static void startActivity(Context context, String srcUrl, int duration, int frameRate,
  173 + int videoBitrate, int audioBitrate,
  174 + int videoResolution,
  175 + int encodeType, int encodeMethod, int encodeProfile) {
159 176 Intent intent = new Intent(context, EditActivity.class);
160 177 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
161 178  
162 179 intent.putExtra(SRC_URL, srcUrl);
  180 + intent.putExtra(DURATION, duration);
  181 + intent.putExtra(FRAME_RATE, frameRate);
  182 + intent.putExtra(VIDEO_BITRATE, videoBitrate);
  183 + intent.putExtra(AUDIO_BITRATE, audioBitrate);
  184 + intent.putExtra(VIDEO_RESOLUTION, videoResolution);
  185 + intent.putExtra(ENCODE_TYPE, encodeType);
  186 + intent.putExtra(ENCODE_METHOD, encodeMethod);
  187 + intent.putExtra(ENCODE_PROFILE, encodeProfile);
163 188 context.startActivity(intent);
164 189 }
165 190  
... ... @@ -174,8 +199,8 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
174 199 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
175 200  
176 201 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
177   - initView();
178 202 initEditKit();
  203 + initView();
179 204 mInputMethodManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
180 205 }
181 206  
... ... @@ -236,6 +261,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
236 261  
237 262 binding.clickToPause.getDrawable().setLevel(2);
238 263  
  264 + binding.hint.setText("上传视频最大长度为 " + duration + "s");
239 265 binding.editBarBottom.clickToFilter.setActivated(true);
240 266 binding.editBarBottom.beautyChoose.getRoot().setVisibility(View.VISIBLE);
241 267 BottomViewInfo filterView = new BottomViewInfo(binding.editBarBottom.clickToFilter, binding.editBarBottom.beautyChoose.getRoot());
... ... @@ -321,6 +347,14 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
321 347 private void initData() {
322 348 Bundle bundle = getIntent().getExtras();
323 349 String url = bundle.getString(SRC_URL);
  350 + duration = bundle.getInt(DURATION, 0);
  351 + frameRate = bundle.getInt(FRAME_RATE, 0);
  352 + videoBitrate = bundle.getInt(VIDEO_BITRATE, 0);
  353 + audioBitrate = bundle.getInt(AUDIO_BITRATE, 0);
  354 + videoResolution = bundle.getInt(VIDEO_RESOLUTION, 0);
  355 + encode_type = bundle.getInt(ENCODE_TYPE);
  356 + encode_method = bundle.getInt(ENCODE_METHOD);
  357 + encodeProfile = bundle.getInt(ENCODE_PROFILE);
324 358 if (!TextUtils.isEmpty(url)) {
325 359 mEditKit.setEditPreviewUrl(url);
326 360 }
... ... @@ -547,43 +581,28 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
547 581  
548 582 private void onNextClick() {
549 583 //配置合成参数
550   - final ShortVideoConfigDialog configDialog = new ShortVideoConfigDialog(this,
551   - ShortVideoConfigDialog
552   - .SHORTVIDEOCONFIG_TYPE_COMPOSE);
553   - configDialog.setCancelable(false);
554   - configDialog.show();
555   - configDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
556   - @Override
557   - public void onDismiss(DialogInterface dialogInterface) {
558   - ShortVideoConfigDialog.ShortVideoConfig config = configDialog.getShortVideoConfig();
559   - if (config != null) {
560   - //配置合成参数
561   - mEditKit.setTargetResolution(config.resolution);
562   - mEditKit.setVideoFps(config.fps);
563   - mEditKit.setVideoCodecId(config.encodeType);
564   - mEditKit.setVideoEncodeProfile(config.encodeProfile);
565   - mEditKit.setAudioKBitrate(config.audioBitrate);
566   - mEditKit.setVideoKBitrate(config.videoBitrate);
567   - //关闭上一次合成窗口
568   - if (mComposeAlertDialog != null) {
569   - mComposeAlertDialog.closeDialog();
570   - }
  584 + mEditKit.setTargetResolution(videoResolution);
  585 + mEditKit.setVideoFps(frameRate);
  586 + mEditKit.setVideoCodecId(encode_type);
  587 + mEditKit.setVideoEncodeProfile(encodeProfile);
  588 + mEditKit.setAudioKBitrate(audioBitrate);
  589 + mEditKit.setVideoKBitrate(videoBitrate);
  590 + //关闭上一次合成窗口
  591 + if (mComposeAlertDialog != null) {
  592 + mComposeAlertDialog.closeDialog();
  593 + }
571 594  
572   - mComposeAlertDialog = new ComposeAlertDialog(EditActivity.this, R.style.dialog);
573   - //设置合成路径
  595 + mComposeAlertDialog = new ComposeAlertDialog(EditActivity.this, R.style.dialog);
  596 + //设置合成路径
574 597  
575   - String fileFolder = "/sdcard/cn_sv_compose_test";
576   - File file = new File(fileFolder);
577   - if (!file.exists()) {
578   - file.mkdir();
579   - }
580   - String composeUrl = fileFolder + "/" + System.currentTimeMillis() + ".mp4";
581   - Log.d(TAG, "compose Url:" + composeUrl);
582   - mEditKit.startCompose("test.mp4", "", composeUrl);
583   - }
584   -
585   - }
586   - });
  598 + String fileFolder = "/sdcard/cn_sv_compose_test";
  599 + File file = new File(fileFolder);
  600 + if (!file.exists()) {
  601 + file.mkdir();
  602 + }
  603 + String composeUrl = fileFolder + "/" + System.currentTimeMillis() + ".mp4";
  604 + Log.d(TAG, "compose Url:" + composeUrl);
  605 + mEditKit.startCompose(composeUrl);
587 606  
588 607 }
589 608  
... ... @@ -803,7 +822,6 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
803 822 }
804 823 };
805 824  
806   -
807 825 private CNEditKit.OnInfoListener mOnInfoListener = new CNEditKit.OnInfoListener() {
808 826 @Override
809 827 public Object onInfo(int type, Bitmap bitmap, final String... strings) {
... ... @@ -828,11 +846,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
828 846 Log.e(TAG, bitmap + " : " + strings[0]);
829 847 binding.editBarBottom.audioChoose.originAudioReverb.setSelection(0);
830 848 binding.editBarBottom.audioChoose.originAudioEffect.setSelection(0);
831   - if (mComposeAlertDialog != null) {
832   - mComposeAlertDialog.composeFinished(strings[0]);
833   - mComposeFinished = true;
834   - }
835   - mEditKit.getUploadInfo(3, strings[0], mPutObjectResponseListener);
  849 + showVideoDialog(bitmap, strings[0]);
836 850 }
837 851 case ShortVideoConstants.SHORTVIDEO_COMPOSE_ABORTED:
838 852 break;
... ... @@ -850,6 +864,58 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
850 864 }
851 865 };
852 866  
  867 + private AlertDialog uploadVideoMessageDialog;
  868 +
  869 + public void showVideoDialog(final Bitmap bitmap, final String fileUrl) {
  870 + final String userId = String.valueOf(UserService.getInstance(this).getActiveAccountInfo().getUid());
  871 + Log.e("Lynntest", userId);
  872 + LayoutInflater layoutInflater = LayoutInflater.from(this);
  873 + View videoMesDialog = layoutInflater.inflate(R.layout.upload_video_dialog, null);
  874 +
  875 + ImageView imageView = videoMesDialog.findViewById(R.id.cover_img);
  876 + imageView.setImageBitmap(bitmap);
  877 + final EditText title = videoMesDialog.findViewById(R.id.video_title_edit);
  878 + final EditText des = videoMesDialog.findViewById(R.id.video_des_edit);
  879 + Button cancelBtn = videoMesDialog.findViewById(R.id.cancel_btn);
  880 + Button configBtn = videoMesDialog.findViewById(R.id.config_btn);
  881 +
  882 +
  883 + uploadVideoMessageDialog = new AlertDialog.Builder(EditActivity.this)
  884 + .setView(videoMesDialog)
  885 + .setCancelable(false)
  886 + .show();
  887 +
  888 + cancelBtn.setOnClickListener(new View.OnClickListener() {
  889 + @Override
  890 + public void onClick(View view) {
  891 + mComposeAlertDialog.closeDialog();
  892 + resumeEditPreview();
  893 + uploadVideoMessageDialog.dismiss();
  894 + }
  895 + });
  896 +
  897 + configBtn.setOnClickListener(new View.OnClickListener() {
  898 + @Override
  899 + public void onClick(View view) {
  900 + String titleStr = title.getText().toString();
  901 + String desStr = des.getText().toString();
  902 +
  903 + if (titleStr != null && !titleStr.equals("")) {
  904 + if (mComposeAlertDialog != null) {
  905 + mComposeAlertDialog.composeFinished(fileUrl);
  906 + mComposeFinished = true;
  907 + }
  908 + mEditKit.getUploadInfo(userId, fileUrl, titleStr.concat(".mp4"), desStr, new File(FileUtils.saveBitmap(EditActivity.this, bitmap)), null, mPutObjectResponseListener);
  909 + uploadVideoMessageDialog.dismiss();
  910 + } else {
  911 + Toast.makeText(EditActivity.this, "标题不能为空哦~", Toast.LENGTH_SHORT).show();
  912 + }
  913 + }
  914 + });
  915 +
  916 +
  917 + }
  918 +
853 919  
854 920 private StickerAdapter.OnStickerItemClick mOnStickerItemClick = new StickerAdapter.OnStickerItemClick() {
855 921 @Override
... ... @@ -982,7 +1048,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On
982 1048 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
983 1049 TextView textView = ((TextView) parent.getChildAt(0));
984 1050 if (textView != null) {
985   - textView.setTextColor(getResources().getColor(R.color.colorAccent));
  1051 + textView.setTextColor(getResources().getColor(R.color.ffcc00));
986 1052 }
987 1053 switch (position) {
988 1054 case 0:
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/activity/ShortVideoActivity.java
... ... @@ -9,20 +9,27 @@ import android.content.Intent;
9 9 import android.content.pm.PackageManager;
10 10 import android.databinding.DataBindingUtil;
11 11 import android.hardware.Camera;
  12 +import android.media.MediaMetadataRetriever;
12 13 import android.net.Uri;
13 14 import android.os.Build;
14 15 import android.os.Environment;
15 16 import android.os.Handler;
  17 +import android.os.SystemClock;
  18 +import android.support.annotation.NonNull;
  19 +import android.support.annotation.Nullable;
16 20 import android.support.v4.app.ActivityCompat;
17 21 import android.support.v7.app.AppCompatActivity;
18 22 import android.os.Bundle;
19 23 import android.util.Log;
20 24 import android.util.SparseArray;
  25 +import android.view.DragEvent;
21 26 import android.view.KeyEvent;
22 27 import android.view.View;
  28 +import android.view.ViewGroup;
23 29 import android.view.WindowManager;
24 30 import android.widget.AdapterView;
25 31 import android.widget.ArrayAdapter;
  32 +import android.widget.Chronometer;
26 33 import android.widget.ImageView;
27 34 import android.widget.RelativeLayout;
28 35 import android.widget.SeekBar;
... ... @@ -31,6 +38,7 @@ import android.widget.Toast;
31 38  
32 39 import com.cnlive.gundam.R;
33 40 import com.cnlive.gundam.databinding.ActivityShortVideoBinding;
  41 +import com.cnlive.gundam.databinding.SpinnerItemLayoutBinding;
34 42 import com.cnlive.gundam.shortvideo.holder.BgmItemViewHolder;
35 43 import com.cnlive.gundam.shortvideo.model.BottomTitleViewInfo;
36 44 import com.cnlive.gundam.shortvideo.util.FaceUnityUtil;
... ... @@ -49,9 +57,11 @@ import com.cnlive.libs.stream.filter.CNAudioReverbFilter;
49 57 import com.cnlive.libs.stream.util.ImgFaceunityFilter;
50 58  
51 59 import java.io.File;
  60 +import java.util.ArrayList;
52 61 import java.util.LinkedList;
53 62 import java.util.List;
54 63  
  64 +import static android.view.View.inflate;
55 65 import static com.cnlive.libs.stream.model.Filters.BEAUTY_DISABLE;
56 66 import static com.cnlive.libs.stream.model.Filters.BEAUTY_ILLUSION;
57 67 import static com.cnlive.libs.stream.model.Filters.BEAUTY_PRO;
... ... @@ -65,7 +75,6 @@ import static com.cnlive.libs.stream.model.Filters.SKIN_WHITEN;
65 75 public class ShortVideoActivity extends AppCompatActivity {
66 76 private static final String TAG = "ShortVideoActivity";
67 77 private final static int PERMISSION_REQUEST_CAMERA_AUDIOREC = 1;
68   - public static final int MAX_DURATION = 1 * 60 * 1000;
69 78 public static final int MIN_DURATION = 3 * 1000;
70 79 private static final int REQUEST_CODE_MUSIC = 10010;
71 80 private static final int REQUEST_CODE_FILE = 6384;
... ... @@ -124,15 +133,74 @@ public class ShortVideoActivity extends AppCompatActivity {
124 133 private SeekBarChangedObserver mSeekBarChangedObserver;
125 134  
126 135 private Handler mMainHandler;
  136 + private Bundle bundle;
  137 + private static int duration;
  138 +
  139 + public final static String FRAME_RATE = "framerate";
  140 + public final static String VIDEO_BITRATE = "video_bitrate";
  141 + public final static String AUDIO_BITRATE = "audio_bitrate";
  142 + public final static String VIDEO_RESOLUTION = "video_resolution";
  143 + public final static String ENCODE_TYPE = "encode_type";
  144 + public final static String ENCODE_METHOD = "encode_method";
  145 + public final static String ENCODE_PROFILE = "encode_profile";
  146 + public final static String DURATION = "duration";
  147 +
  148 + private int frameRate;
  149 + private int videoBitrate;
  150 + private int audioBitrate;
  151 + private int videoResolution;
  152 + private int encode_type;
  153 + private int encode_method;
  154 + private int encodeProfile;
  155 +
  156 + private List<String> recordUrlList;
  157 + private long recordingTime = 0;//记录下来的总时间
  158 +
  159 + public static void startActivity(Context context, int frameRate,
  160 + int videoBitrate, int audioBitrate,
  161 + int videoResolution,
  162 + int encodeType, int encodeMethod, int encodeProfile, int duration) {
  163 + Intent intent = new Intent(context, ShortVideoActivity.class);
  164 + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  165 +
  166 + intent.putExtra(FRAME_RATE, frameRate);
  167 + intent.putExtra(VIDEO_BITRATE, videoBitrate);
  168 + intent.putExtra(AUDIO_BITRATE, audioBitrate);
  169 + intent.putExtra(VIDEO_RESOLUTION, videoResolution);
  170 + intent.putExtra(ENCODE_TYPE, encodeType);
  171 + intent.putExtra(ENCODE_METHOD, encodeMethod);
  172 + intent.putExtra(ENCODE_PROFILE, encodeProfile);
  173 + intent.putExtra(DURATION, duration);
  174 + context.startActivity(intent);
  175 + }
127 176  
128 177 @Override
129 178 protected void onCreate(Bundle savedInstanceState) {
130 179 super.onCreate(savedInstanceState);
131 180 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
132 181 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  182 + initData();
133 183 binding = DataBindingUtil.setContentView(this, R.layout.activity_short_video);
  184 + recordUrlList = new ArrayList<>();
134 185 initView();
135 186 initRecordKit();
  187 + Toast.makeText(this, "视频上传时长需要在3s - " + duration + "s之间", Toast.LENGTH_LONG).show();
  188 + }
  189 +
  190 + public static int getMaxDuration() {
  191 + return duration * 1000;
  192 + }
  193 +
  194 + private void initData() {
  195 + bundle = getIntent().getExtras();
  196 + duration = bundle.getInt(DURATION, 0);
  197 + frameRate = bundle.getInt(FRAME_RATE, 0);
  198 + videoBitrate = bundle.getInt(VIDEO_BITRATE, 0);
  199 + audioBitrate = bundle.getInt(AUDIO_BITRATE, 0);
  200 + videoResolution = bundle.getInt(VIDEO_RESOLUTION, 0);
  201 + encode_type = bundle.getInt(ENCODE_TYPE);
  202 + encode_method = bundle.getInt(ENCODE_METHOD);
  203 + encodeProfile = bundle.getInt(ENCODE_PROFILE);
136 204 }
137 205  
138 206 @Override
... ... @@ -164,6 +232,7 @@ public class ShortVideoActivity extends AppCompatActivity {
164 232 mRecordProgressCtl.release();
165 233 mRecordKit.setOnLogEventListener((IStreamer.OnLogEventListener) null);
166 234 mRecordKit.release();
  235 + recordUrlList.clear();
167 236 }
168 237  
169 238 private void initView() {
... ... @@ -236,26 +305,37 @@ public class ShortVideoActivity extends AppCompatActivity {
236 305 }
237 306 }
238 307  
  308 +
239 309 private void initRecordKit() {
240 310 mMainHandler = new Handler();
241 311 mRecordKit = new CNRecordKit(this);
242   - //设置预览编码帧率
243   - mRecordKit.setPreviewFps(20);
244   - //设置录制编码帧率
245   - mRecordKit.setTargetFps(20);
246   - //设置视频码率
247   - mRecordKit.setVideoKBitrate(1000);
248   - //设置音频编码码率
249   - mRecordKit.setAudioKBitrate(64);
250   - //设置预览分辨率
251   - mRecordKit.setPreviewResolution(IStreamer.VIDEO_RESOLUTION_540P);
252   - //设置录制分辨率
253   - mRecordKit.setTargetResolution(IStreamer.VIDEO_RESOLUTION_540P);
254   - //设置编码模式
255   - mRecordKit.setVideoEncodeMethod(IStreamer.ENCODE_METHOD_SOFTWARE);
256   - mRecordKit.setVideoEncodeProfile(IStreamer.ENCODE_PROFILE_BALANCE);
257   - //设置竖屏
258   - mRecordKit.setRotateDegrees(0);
  312 + if (bundle != null) {
  313 +
  314 + if (frameRate > 0) {
  315 + mRecordKit.setPreviewFps(frameRate);
  316 + mRecordKit.setTargetFps(frameRate);
  317 + }
  318 +
  319 +
  320 + if (videoBitrate > 0) {
  321 + mRecordKit.setVideoKBitrate(videoBitrate);
  322 + }
  323 +
  324 + if (audioBitrate > 0) {
  325 + mRecordKit.setAudioKBitrate(audioBitrate);
  326 + }
  327 +
  328 + mRecordKit.setPreviewResolution(videoResolution);
  329 + mRecordKit.setTargetResolution(videoResolution);
  330 +
  331 + mRecordKit.setVideoCodecId(encode_type);
  332 +
  333 + mRecordKit.setEncodeMethod(encode_method);
  334 +
  335 + mRecordKit.setVideoEncodeProfile(encodeProfile);
  336 +
  337 + mRecordKit.setRotateDegrees(0);
  338 + }
259 339 //设置预览view
260 340 mRecordKit.setDisplayPreview(binding.shortVideoPreview);
261 341 mRecordKit.setFilter(DENOISE.getFilter());
... ... @@ -268,6 +348,7 @@ public class ShortVideoActivity extends AppCompatActivity {
268 348 mRecordKit.setOnLogEventListener(mLogEventListener);
269 349 initBeautyUI();
270 350 initStickerUI();
  351 + initFaceunity();
271 352 initBgmUI();
272 353 initBottomTitleUI();
273 354  
... ... @@ -288,9 +369,8 @@ public class ShortVideoActivity extends AppCompatActivity {
288 369 break;
289 370 case IStreamer.cnstream_open_file_success:
290 371 Log.i(TAG, "cnstream_open_file_success");
291   - // TODO: 2017/7/10
292   -// mChronometer.setBase(SystemClock.elapsedRealtime());
293   -// mChronometer.start();
  372 + binding.chronometer.setBase(SystemClock.elapsedRealtime() - recordingTime);
  373 + binding.chronometer.start();
294 374 mRecordProgressCtl.startRecording();
295 375 break;
296 376 default:
... ... @@ -516,11 +596,10 @@ public class ShortVideoActivity extends AppCompatActivity {
516 596 break;
517 597 case R.id.short_video_record_right_img:
518 598 if (binding.shortVideoRecordBottomLayout.shortVideoRecordRightImg.getDrawable().getLevel() == 3) {
519   - Toast.makeText(ShortVideoActivity.this, "上传", Toast.LENGTH_SHORT).show();
  599 +// Toast.makeText(ShortVideoActivity.this, "上传", Toast.LENGTH_SHORT).show();
520 600 onNextClick();
521 601  
522 602 } else if (binding.shortVideoRecordBottomLayout.shortVideoRecordRightImg.getDrawable().getLevel() == 1) {
523   - // TODO: 2017/7/11 选择文件
524 603 importVideoFile();
525 604 }
526 605 break;
... ... @@ -897,12 +976,18 @@ public class ShortVideoActivity extends AppCompatActivity {
897 976 stopRecord(false);
898 977 }
899 978 //删除录制文件
  979 + long duration = Long.parseLong(FileUtils.getDuration(mRecordKit.getLastRecordedFiles()));
  980 + recordingTime = recordingTime - duration;
900 981 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftImg.getDrawable().setLevel(3);
  982 + recordUrlList.remove(mRecordKit.getLastRecordedFiles());
901 983 mRecordKit.deleteRecordFile(mRecordKit.getLastRecordedFiles());
902 984 mRecordProgressCtl.rollback();
903 985 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftImg.setEnabled(true);
  986 +
904 987 }
905 988 } else {
  989 + binding.chronometer.stop();
  990 + // TODO: 2017/7/12 记录时间
906 991 isFileRecording = false;
907 992 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftImg.getDrawable().setLevel(1);
908 993 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftTextView.setVisibility(View.VISIBLE);
... ... @@ -916,6 +1001,7 @@ public class ShortVideoActivity extends AppCompatActivity {
916 1001 * start recording to a local file
917 1002 */
918 1003 private void startRecord() {
  1004 + binding.chronometer.setVisibility(View.VISIBLE);
919 1005 binding.shortVideoRecordBottomLayout.shortVideoRecord.getDrawable().setLevel(2);
920 1006 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftTextView.setVisibility(View.GONE);
921 1007 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftImg.getDrawable().setLevel(2);
... ... @@ -927,6 +1013,7 @@ public class ShortVideoActivity extends AppCompatActivity {
927 1013 file.mkdir();
928 1014 }
929 1015 mRecordUrl = fileFolder + "/" + System.currentTimeMillis() + ".mp4";
  1016 + recordUrlList.add(mRecordUrl);
930 1017 float val = binding.shortVideoBgmLayout.bgmSelectLayout.recordMicAudioVolume.getProgress() / 100.f;
931 1018 mRecordKit.setVoiceVolume(val);
932 1019 mRecordKit.startRecord(mRecordUrl);
... ... @@ -941,6 +1028,7 @@ public class ShortVideoActivity extends AppCompatActivity {
941 1028 private void stopRecord(boolean finished) {
942 1029 //录制完成进入编辑页面
943 1030 //若录制文件大于1则需要出发文件合成
  1031 + binding.chronometer.setVisibility(View.GONE);
944 1032 binding.shortVideoRecordBottomLayout.shortVideoRecordLeftImg.getDrawable().setLevel(3);
945 1033 binding.shortVideoRecordBottomLayout.shortVideoRecord.getDrawable().setLevel(1);
946 1034 if (finished) {
... ... @@ -960,7 +1048,7 @@ public class ShortVideoActivity extends AppCompatActivity {
960 1048 dialog.dismiss();
961 1049 mRecordUrl = filePath;
962 1050 //合成结束启动编辑
963   - EditActivity.startActivity(getApplicationContext(), mRecordUrl);
  1051 + EditActivity.startActivity(getApplicationContext(), mRecordUrl, duration, frameRate, videoBitrate, audioBitrate, videoResolution, encode_type, encode_method, encodeProfile);
964 1052 }
965 1053 });
966 1054 }
... ... @@ -972,6 +1060,7 @@ public class ShortVideoActivity extends AppCompatActivity {
972 1060 mRecordProgressCtl.stopRecording();
973 1061 binding.shortVideoRecordBottomLayout.shortVideoRecord.getDrawable().setLevel(1);
974 1062 isFileRecording = false;
  1063 + stopChronometer(finished);
975 1064 }
976 1065  
977 1066  
... ... @@ -1007,7 +1096,9 @@ public class ShortVideoActivity extends AppCompatActivity {
1007 1096 .setPositiveButton("是", new DialogInterface.OnClickListener() {
1008 1097 @Override
1009 1098 public void onClick(DialogInterface dialogInterface, int i) {
1010   - mRecordKit.deleteRecordFile(mRecordUrl);
  1099 + for (int i1 = 0; i1 < recordUrlList.size(); i1++) {
  1100 + mRecordKit.deleteRecordFile(recordUrlList.get(i1));
  1101 + }
1011 1102 ShortVideoActivity.this.finish();
1012 1103 }
1013 1104 })
... ... @@ -1069,26 +1160,38 @@ public class ShortVideoActivity extends AppCompatActivity {
1069 1160 final Uri uri = data.getData();
1070 1161 Log.i(TAG, "File Uri = " + uri.toString());
1071 1162 final String path = FileUtils.getPath(this, uri);
1072   - EditActivity.startActivity(this, path);
  1163 + EditActivity.startActivity(this, path, duration, frameRate, videoBitrate, audioBitrate, videoResolution, encode_type, encode_method, encodeProfile);
1073 1164 }
1074 1165 }
1075 1166 }
1076 1167 super.onActivityResult(requestCode, resultCode, data);
1077 1168 }
1078 1169  
  1170 +
1079 1171 private void initBeautyUI() {
1080   - String[] items = new String[]{"DISABLE", "BEAUTY_SOFT", "SKIN_WHITEN", "BEAUTY_ILLUSION",
  1172 + final String[] items = new String[]{"DISABLE", "BEAUTY_SOFT", "SKIN_WHITEN", "BEAUTY_ILLUSION",
1081 1173 "BEAUTY_DENOISE", "BEAUTY_SMOOTH", "BEAUTY_SOFT_EXT", "BEAUTY_SOFT_SHARPEN", "BEAUTY_PRO"};
1082   - ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
1083   - android.R.layout.simple_spinner_item, items);
1084   - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  1174 + ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
  1175 + R.layout.spinner_checked_layout, items) {
  1176 + @Override
  1177 + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  1178 + View view = inflate(getContext(), R.layout.spinner_item_layout, null);
  1179 + TextView textView = view.findViewById(R.id.spinner_item_label);
  1180 + textView.setText(items[position]);
  1181 + if (binding.shortVideoBeautyLayout.recordBeautyChoose.beautySpin.getSelectedItemPosition() == position) {
  1182 + textView.setTextColor(getResources().getColor(R.color.ffcc00));
  1183 + }
  1184 + return view;
  1185 + }
  1186 + };
  1187 + adapter.setDropDownViewResource(R.layout.spinner_item_layout);
1085 1188 binding.shortVideoBeautyLayout.recordBeautyChoose.beautySpin.setAdapter(adapter);
1086 1189 binding.shortVideoBeautyLayout.recordBeautyChoose.beautySpin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
1087 1190 @Override
1088 1191 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
1089 1192 TextView textView = ((TextView) parent.getChildAt(0));
1090 1193 if (textView != null) {
1091   - textView.setTextColor(getResources().getColor(R.color.colorAccent));
  1194 + textView.setTextColor(getResources().getColor(R.color.ffcc00));
1092 1195 }
1093 1196 switch (position) {
1094 1197 case 0:
... ... @@ -1184,25 +1287,36 @@ public class ShortVideoActivity extends AppCompatActivity {
1184 1287 }
1185 1288  
1186 1289 private void initStickerUI() {
1187   - String[] items = new String[]{"DISABLE", "BEAGLEDOG", "COLORCROWN", "DEER",
  1290 + final String[] items = new String[]{"DISABLE", "BEAGLEDOG", "COLORCROWN", "DEER",
1188 1291 "HAPPYRABBI", "HARTSHORN", "ITEM0204", "ITEM0208",
1189 1292 "ITEM0210", "ITEM0501", "MOOD", "PRINCESSCROWN", "TIARA", "YELLOWEAR"};
1190   - ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
1191   - android.R.layout.simple_spinner_item, items);
1192   - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  1293 + ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_checked_layout, items) {
  1294 + @Override
  1295 + public View getDropDownView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
  1296 + View view = inflate(getContext(), R.layout.spinner_item_layout, null);
  1297 + TextView textView = view.findViewById(R.id.spinner_item_label);
  1298 + textView.setText(items[position]);
  1299 + if (binding.shortVideoBeautyLayout.recordStickerChoose.stickerSpin.getSelectedItemPosition() == position) {
  1300 + textView.setTextColor(getResources().getColor(R.color.ffcc00));
  1301 + }
  1302 + return view;
  1303 + }
  1304 + };
  1305 + adapter.setDropDownViewResource(R.layout.spinner_item_layout);
1193 1306 binding.shortVideoBeautyLayout.recordStickerChoose.stickerSpin.setAdapter(adapter);
1194 1307 binding.shortVideoBeautyLayout.recordStickerChoose.stickerSpin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
1195 1308 @Override
1196 1309 public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
1197 1310 TextView textView = ((TextView) parent.getChildAt(0));
1198 1311 if (textView != null) {
1199   - textView.setTextColor(getResources().getColor(R.color.colorAccent));
  1312 + textView.setTextColor(getResources().getColor(R.color.ffcc00));
1200 1313 }
1201 1314 if (position == 0) {
1202 1315 //disable
1203 1316 if (mImgFaceunityFilter != null) {
1204 1317 mImgFaceunityFilter.setPropType(-1);
1205 1318 }
  1319 +
1206 1320 } else {
1207 1321 mImgFaceunityFilter.setPropType(position - 1);
1208 1322 }
... ... @@ -1217,6 +1331,17 @@ public class ShortVideoActivity extends AppCompatActivity {
1217 1331 binding.shortVideoBeautyLayout.recordStickerChoose.stickerSpin.setSelection(0);
1218 1332 }
1219 1333  
  1334 + private void stopChronometer(boolean finished) {
  1335 + if (isFileRecording) {
  1336 + return;
  1337 + }
  1338 + if (finished) {
  1339 + binding.chronometer.setBase(SystemClock.elapsedRealtime());
  1340 + }
  1341 + binding.chronometer.stop();
  1342 + recordingTime = SystemClock.elapsedRealtime() - binding.chronometer.getBase();
  1343 + }
  1344 +
1220 1345 private class MegerFilesAlertDialog extends AlertDialog {
1221 1346  
1222 1347 protected MegerFilesAlertDialog(Context context, int themID) {
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/activity/ShortVideoPlayActivity.java 0 → 100644
  1 +package com.cnlive.gundam.shortvideo.activity;
  2 +
  3 +import android.content.Context;
  4 +import android.content.Intent;
  5 +import android.databinding.DataBindingUtil;
  6 +import android.os.Handler;
  7 +import android.os.Message;
  8 +import android.support.v7.app.AppCompatActivity;
  9 +import android.os.Bundle;
  10 +import android.util.Log;
  11 +import android.view.KeyEvent;
  12 +import android.view.MotionEvent;
  13 +import android.view.View;
  14 +import android.widget.ImageView;
  15 +import android.widget.LinearLayout;
  16 +import android.widget.RelativeLayout;
  17 +import android.widget.SeekBar;
  18 +import android.widget.TextView;
  19 +import android.widget.Toast;
  20 +
  21 +import com.cnlive.gundam.R;
  22 +import com.cnlive.gundam.databinding.ActivityShortVideoPlayBinding;
  23 +import com.cnlive.libs.util.Config;
  24 +import com.cnlive.libs.video.video.MediaPlayer;
  25 +import com.cnlive.libs.video.video.VideoView;
  26 +import com.cnlive.libs.video.video.base.IDataSource;
  27 +import com.cnlive.libs.video.video.base.IMediaPlayer;
  28 +
  29 +import java.text.DecimalFormat;
  30 +import java.text.NumberFormat;
  31 +import java.util.Locale;
  32 +
  33 +
  34 +public class ShortVideoPlayActivity extends AppCompatActivity {
  35 + private static final String TAG = "VideoPlayerActivity";
  36 +
  37 + public static final int UPDATE_SEEKBAR = 0;
  38 + public static final int HIDDEN_SEEKBAR = 1;
  39 +
  40 + private Context mContext;
  41 + private VideoView mVideoView;
  42 + private LinearLayout mPlayerPanel;
  43 + private ImageView mPlayerStartBtn;
  44 + private SeekBar mPlayerSeekbar;
  45 + private TextView mPlayerPosition;
  46 + private TextView mLoadText;
  47 +
  48 + private LinearLayout toppanel;
  49 +
  50 + private boolean mPlayerPanelShow = false;
  51 + private boolean mPause = false;
  52 +
  53 + private int mVideoWidth = 0;
  54 + private int mVideoHeight = 0;
  55 +
  56 + private Handler mHandler;
  57 +
  58 + private final static String VIDEO_ID = "videoId";
  59 + private final static String NAME = "name";
  60 + private final static String DES = "des";
  61 + private String videoId;
  62 + private String name;
  63 + private String des;
  64 + private ActivityShortVideoPlayBinding playBinding;
  65 +
  66 + public static void startActivity(Context context, String videoId, String name, String des) {
  67 + Intent intent = new Intent(context, ShortVideoPlayActivity.class);
  68 + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  69 + intent.putExtra(VIDEO_ID, videoId);
  70 + intent.putExtra(NAME, name);
  71 + intent.putExtra(DES, des);
  72 + context.startActivity(intent);
  73 + }
  74 +
  75 + @Override
  76 + protected void onCreate(Bundle savedInstanceState) {
  77 + super.onCreate(savedInstanceState);
  78 + mContext = this.getApplicationContext();
  79 + playBinding = DataBindingUtil.setContentView(this, R.layout.activity_short_video_play);
  80 + initData();
  81 + initView();
  82 + initVideoView();
  83 +
  84 + }
  85 +
  86 + private void initData() {
  87 + Bundle bundle = getIntent().getExtras();
  88 + videoId = bundle.getString(VIDEO_ID);
  89 + name = bundle.getString(NAME);
  90 + des = bundle.getString(DES);
  91 + }
  92 +
  93 + private void initVideoView() {
  94 + mHandler = new Handler() {
  95 + @Override
  96 + public void handleMessage(Message msg) {
  97 + super.handleMessage(msg);
  98 + switch (msg.what) {
  99 + case UPDATE_SEEKBAR:
  100 + setVideoProgress(0);
  101 + break;
  102 + case HIDDEN_SEEKBAR:
  103 + mPlayerPanelShow = false;
  104 + mPlayerPanel.setVisibility(View.GONE);
  105 + toppanel.setVisibility(View.GONE);
  106 + break;
  107 + }
  108 +
  109 + }
  110 + };
  111 + mVideoView.setOnPreparedListener(mOnPreparedListener);
  112 + mVideoView.setOnCompletionListener(mOnCompletionListener);
  113 + mVideoView.setOnErrorListener(mOnErrorListener);
  114 + mVideoView.setOnInfoListener(mOnInfoListener);
  115 + mVideoView.setOnPlayStateListener(mOnPlayStateListener);
  116 + mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
  117 + mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangeListener);
  118 + mVideoView.setOnTouchListener(mTouchListener);
  119 +
  120 + mVideoView.setDataSource(new IDataSource() {
  121 + @Override
  122 + public String getDataSourceId() {
  123 + return videoId;
  124 + }
  125 +
  126 + @Override
  127 + public String getDataSourceType() {
  128 + return Config.TYPE_VOD;
  129 + }
  130 +
  131 + @Override
  132 + public String getDataSourceRate() {
  133 + return Config.TYPE_PLAY_RATE_2;
  134 + }
  135 + });
  136 + }
  137 +
  138 + @Override
  139 + protected void onDestroy() {
  140 + super.onDestroy();
  141 + }
  142 +
  143 + @Override
  144 + protected void onPause() {
  145 + super.onPause();
  146 +
  147 + if (mVideoView != null) {
  148 + mVideoView.pause();
  149 + mPause = true;
  150 + }
  151 + }
  152 +
  153 + @Override
  154 + protected void onResume() {
  155 + super.onResume();
  156 + if (mVideoView != null) {
  157 + mVideoView.start();
  158 + mPause = false;
  159 + }
  160 + }
  161 +
  162 + @Override
  163 + public boolean onKeyDown(int keyCode, KeyEvent event) {
  164 + if (keyCode == KeyEvent.KEYCODE_BACK) {
  165 + videoPlayEnd();
  166 + }
  167 +
  168 + return super.onKeyDown(keyCode, event);
  169 + }
  170 +
  171 + private void initView() {
  172 + mVideoView = playBinding.videoView;
  173 + mPlayerPanel = playBinding.playerPanel;
  174 + mPlayerStartBtn = playBinding.playerStart;
  175 + mPlayerSeekbar = playBinding.playerSeekbar;
  176 + mPlayerPosition = playBinding.playerTime;
  177 + mLoadText = playBinding.loadingText;
  178 + toppanel = playBinding.topPlayerPanel;
  179 + playBinding.videoTitle.setText(name);
  180 + playBinding.videoDescription.setText(des);
  181 + mPlayerSeekbar.setOnSeekBarChangeListener(mSeekBarListener);
  182 + }
  183 +
  184 + private MediaPlayer.OnPreparedListener mOnPreparedListener = new MediaPlayer.OnPreparedListener() {
  185 + @Override
  186 + public void onPrepared(IMediaPlayer mediaplayer) {
  187 + mVideoWidth = mVideoView.getVideoWidth();
  188 + mVideoHeight = mVideoView.getVideoHeight();
  189 +
  190 + // Set Video Scaling Mode
  191 + mVideoView.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
  192 +
  193 + //start player
  194 + mVideoView.start();
  195 +
  196 + //set progress
  197 + setVideoProgress(0);
  198 +
  199 + mPlayerPosition.setVisibility(View.VISIBLE);
  200 + mLoadText.setVisibility(View.VISIBLE);
  201 +
  202 + mHandler.removeMessages(HIDDEN_SEEKBAR);
  203 + Message msg = new Message();
  204 + msg.what = HIDDEN_SEEKBAR;
  205 + mHandler.sendMessageDelayed(msg, 3000);
  206 + }
  207 + };
  208 +
  209 + private IMediaPlayer.OnBufferingUpdateListener mOnBufferingUpdateListener = new IMediaPlayer.OnBufferingUpdateListener() {
  210 + @Override
  211 + public void onBufferingUpdate(IMediaPlayer mp, int percent) {
  212 + long duration = mVideoView.getDuration();
  213 + long progress = duration * percent / 100;
  214 + mPlayerSeekbar.setSecondaryProgress((int) progress);
  215 + }
  216 + };
  217 +
  218 + private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangeListener = new IMediaPlayer.OnVideoSizeChangedListener() {
  219 + @Override
  220 + public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int sarNum, int sarDen) {
  221 + if (mVideoWidth > 0 && mVideoHeight > 0) {
  222 + if (width != mVideoWidth || height != mVideoHeight) {
  223 + mVideoWidth = mp.getVideoWidth();
  224 + mVideoHeight = mp.getVideoHeight();
  225 +
  226 + if (mVideoView != null)
  227 + mVideoView.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
  228 + }
  229 + }
  230 + }
  231 + };
  232 +
  233 + private IMediaPlayer.OnSeekCompleteListener mOnSeekCompletedListener = new IMediaPlayer.OnSeekCompleteListener() {
  234 + @Override
  235 + public void onSeekComplete(IMediaPlayer mp) {
  236 + Log.e(TAG, "onSeekComplete...............");
  237 + }
  238 + };
  239 +
  240 + private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() {
  241 + @Override
  242 + public void onCompletion(IMediaPlayer mp) {
  243 +// Toast.makeText(mContext, "OnCompletionListener, play complete.", Toast.LENGTH_LONG).show();
  244 + videoPlayEnd();
  245 + }
  246 + };
  247 +
  248 + private IMediaPlayer.OnErrorListener mOnErrorListener = new IMediaPlayer.OnErrorListener() {
  249 + @Override
  250 + public boolean onError(IMediaPlayer mp, int what, int extra) {
  251 + switch (what) {
  252 + case MediaPlayer.MEDIA_ERROR_UNKNOWN:
  253 + Log.e(TAG, "OnErrorListener, Error Unknown:" + what + ",extra:" + extra);
  254 + break;
  255 + default:
  256 + Log.e(TAG, "OnErrorListener, Error:" + what + ",extra:" + extra);
  257 + }
  258 +
  259 + videoPlayEnd();
  260 +
  261 + return false;
  262 + }
  263 + };
  264 +
  265 + public IMediaPlayer.OnInfoListener mOnInfoListener = new IMediaPlayer.OnInfoListener() {
  266 + @Override
  267 + public boolean onInfo(IMediaPlayer iMediaPlayer, int i, int i1) {
  268 + switch (i) {
  269 + case MediaPlayer.MEDIA_INFO_BUFFERING_START:
  270 + Log.d(TAG, "Buffering Start.");
  271 + break;
  272 + case MediaPlayer.MEDIA_INFO_BUFFERING_END:
  273 + Log.d(TAG, "Buffering End.");
  274 + break;
  275 + case MediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START:
  276 +// Toast.makeText(mContext, "Audio Rendering Start", Toast.LENGTH_SHORT).show();
  277 + break;
  278 + case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
  279 +// Toast.makeText(mContext, "Video Rendering Start", Toast.LENGTH_SHORT).show();
  280 + break;
  281 +// case MediaPlayer.MEDIA_INFO_SUGGEST_RELOAD:
  282 +// // Player find a new stream(video or audio), and we could reload the video.
  283 +// if (mVideoView != null)
  284 +// mVideoView.reload(mDataSource, false);
  285 +// break;
  286 + case MediaPlayer.MEDIA_INFO_RELOADED:
  287 +// Toast.makeText(mContext, "Succeed to reload video.", Toast.LENGTH_SHORT).show();
  288 + Log.d(TAG, "Succeed to reload video.");
  289 + return false;
  290 + }
  291 + return false;
  292 + }
  293 + };
  294 +
  295 + private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
  296 + @Override
  297 + public boolean onTouch(View v, MotionEvent event) {
  298 + dealTouchEvent(v, event);
  299 + return false;
  300 + }
  301 + };
  302 +
  303 + public IMediaPlayer.OnPlayStateListener mOnPlayStateListener = new IMediaPlayer.OnPlayStateListener() {
  304 + @Override
  305 + public void onPlayState(boolean played) {
  306 + mPlayerStartBtn.setBackgroundResource(played ? R.drawable.pause : R.drawable.play);
  307 + }
  308 + };
  309 +
  310 + private int mVideoProgress = 0;
  311 + private SeekBar.OnSeekBarChangeListener mSeekBarListener = new SeekBar.OnSeekBarChangeListener() {
  312 + @Override
  313 + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  314 + if (fromUser) {
  315 + mVideoProgress = progress;
  316 + mHandler.removeMessages(HIDDEN_SEEKBAR);
  317 + Message msg = new Message();
  318 + msg.what = HIDDEN_SEEKBAR;
  319 + mHandler.sendMessageDelayed(msg, 3000);
  320 + }
  321 + }
  322 +
  323 + @Override
  324 + public void onStartTrackingTouch(SeekBar seekBar) {
  325 +
  326 + }
  327 +
  328 + @Override
  329 + public void onStopTrackingTouch(SeekBar seekBar) {
  330 + mVideoView.seekTo(mVideoProgress);
  331 + setVideoProgress(mVideoProgress);
  332 + }
  333 + };
  334 +
  335 +
  336 + public int setVideoProgress(int currentProgress) {
  337 +
  338 + if (mVideoView == null)
  339 + return -1;
  340 +
  341 + long time = currentProgress > 0 ? currentProgress : mVideoView.getCurrentPosition();
  342 + long length = mVideoView.getDuration();
  343 +
  344 + // Update all view elements
  345 + mPlayerSeekbar.setMax((int) length);
  346 + mPlayerSeekbar.setProgress((int) time);
  347 +
  348 + if (time >= 0) {
  349 + String progress = millisToString(time, false) + "/" + millisToString(length, false);
  350 + mPlayerPosition.setText(progress);
  351 + }
  352 +
  353 + Message msg = new Message();
  354 + msg.what = UPDATE_SEEKBAR;
  355 +
  356 + if (mHandler != null)
  357 + mHandler.sendMessageDelayed(msg, 1000);
  358 + return (int) time;
  359 + }
  360 +
  361 + String millisToString(long millis, boolean text) {
  362 + boolean negative = millis < 0;
  363 + millis = Math.abs(millis);
  364 +
  365 + millis /= 1000;
  366 + int sec = (int) (millis % 60);
  367 + millis /= 60;
  368 + int min = (int) (millis % 60);
  369 + millis /= 60;
  370 + int hours = (int) millis;
  371 +
  372 + String time;
  373 + DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US);
  374 + format.applyPattern("00");
  375 + if (text) {
  376 + if (millis > 0)
  377 + time = (negative ? "-" : "") + hours + "h" + format.format(min) + "min";
  378 + else if (min > 0)
  379 + time = (negative ? "-" : "") + min + "min";
  380 + else
  381 + time = (negative ? "-" : "") + sec + "s";
  382 + } else {
  383 + if (millis > 0)
  384 + time = (negative ? "-" : "") + hours + ":" + format.format(min) + ":" + format.format(sec);
  385 + else
  386 + time = (negative ? "-" : "") + min + ":" + format.format(sec);
  387 + }
  388 + return time;
  389 + }
  390 +
  391 + private void videoPlayEnd() {
  392 + if (mVideoView != null) {
  393 + mVideoView.release();
  394 + mVideoView = null;
  395 + }
  396 +
  397 +
  398 + mHandler = null;
  399 +
  400 + finish();
  401 + }
  402 +
  403 + public void onClick(View view) {
  404 + mHandler.removeMessages(HIDDEN_SEEKBAR);
  405 + Message msg = new Message();
  406 + msg.what = HIDDEN_SEEKBAR;
  407 + mHandler.sendMessageDelayed(msg, 3000);
  408 + switch (view.getId()) {
  409 + case R.id.player_start:
  410 + onPlayBtnClick();
  411 + break;
  412 + case R.id.back:
  413 + videoPlayEnd();
  414 + break;
  415 + }
  416 + }
  417 +
  418 + private void onPlayBtnClick() {
  419 + mPause = !mPause;
  420 + mHandler.removeMessages(HIDDEN_SEEKBAR);
  421 + Message msg = new Message();
  422 + msg.what = HIDDEN_SEEKBAR;
  423 + mHandler.sendMessageDelayed(msg, 3000);
  424 + if (mPause) {
  425 + mVideoView.pause();
  426 + } else {
  427 + mVideoView.start();
  428 + }
  429 + }
  430 +
  431 + // Maybe we could support gesture detect
  432 + private void dealTouchEvent(View view, MotionEvent event) {
  433 + mPlayerPanelShow = !mPlayerPanelShow;
  434 +
  435 + if (mPlayerPanelShow) {
  436 + mPlayerPanel.setVisibility(View.VISIBLE);
  437 + toppanel.setVisibility(View.VISIBLE);
  438 +
  439 + Message msg = new Message();
  440 + msg.what = HIDDEN_SEEKBAR;
  441 + mHandler.sendMessageDelayed(msg, 3000);
  442 + } else {
  443 + mPlayerPanel.setVisibility(View.GONE);
  444 + toppanel.setVisibility(View.GONE);
  445 + mHandler.removeMessages(HIDDEN_SEEKBAR);
  446 + }
  447 + }
  448 +
  449 +}
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/dialog/ShortVideoConfigDialog.java
1 1 package com.cnlive.gundam.shortvideo.dialog;
2 2  
  3 +import android.app.Activity;
3 4 import android.app.Dialog;
4 5 import android.content.Context;
5 6 import android.os.Bundle;
... ... @@ -8,6 +9,8 @@ import android.text.InputType;
8 9 import android.text.TextUtils;
9 10 import android.view.KeyEvent;
10 11 import android.view.View;
  12 +import android.view.ViewGroup;
  13 +import android.view.WindowManager;
11 14 import android.widget.Button;
12 15 import android.widget.EditText;
13 16 import android.widget.RadioButton;
... ... @@ -15,6 +18,7 @@ import android.widget.RadioGroup;
15 18 import android.widget.TextView;
16 19  
17 20 import com.cnlive.gundam.R;
  21 +import com.cnlive.gundam.shortvideo.activity.ShortVideoActivity;
18 22 import com.cnlive.libs.stream.base.IStreamer;
19 23  
20 24 /**
... ... @@ -43,12 +47,15 @@ public class ShortVideoConfigDialog extends Dialog {
43 47 private EditText mAudioBitRateEditText;
44 48 private TextView mConfigTitle;
45 49  
  50 + private Context mContext;
  51 +
46 52 private ShortVideoConfig mShortVideoConfig;
47 53 private int mConfigType = SHORTVIDEOCONFIG_TYPE_RECORD;
48 54  
49   - public ShortVideoConfigDialog(@NonNull Context context, int type) {
50   - super(context);
  55 + public ShortVideoConfigDialog(@NonNull Context context, int type, int theme) {
  56 + super(context, theme);
51 57 this.mConfigType = type;
  58 + this.mContext = context;
52 59 }
53 60  
54 61 @Override
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/fragment/MyVideoFragment.java
1 1 package com.cnlive.gundam.shortvideo.fragment;
2 2  
  3 +import android.content.DialogInterface;
3 4 import android.content.Intent;
4   -import android.database.DatabaseUtils;
5 5 import android.databinding.DataBindingUtil;
6 6 import android.os.Bundle;
7 7 import android.os.Handler;
8 8 import android.support.annotation.Nullable;
9 9 import android.support.v4.app.Fragment;
  10 +import android.support.v4.widget.SwipeRefreshLayout;
  11 +import android.support.v7.widget.LinearLayoutManager;
  12 +import android.util.Log;
10 13 import android.view.LayoutInflater;
11 14 import android.view.View;
12 15 import android.view.ViewGroup;
  16 +import android.view.Window;
  17 +import android.view.WindowManager;
13 18 import android.widget.Toast;
14 19  
  20 +import com.cnlive.gundam.BR;
15 21 import com.cnlive.gundam.R;
  22 +import com.cnlive.gundam.data.network.RetrofitUtil;
  23 +import com.cnlive.gundam.data.network.util.SignUtil;
16 24 import com.cnlive.gundam.databinding.FragmentMyVideoBinding;
  25 +import com.cnlive.gundam.main.ui.adapter.DataBindingAdapter;
17 26 import com.cnlive.gundam.shortvideo.activity.ShortVideoActivity;
  27 +import com.cnlive.gundam.shortvideo.activity.ShortVideoPlayActivity;
  28 +import com.cnlive.gundam.shortvideo.dialog.ShortVideoConfigDialog;
  29 +import com.cnlive.gundam.shortvideo.model.ShortVideoDataModel;
  30 +import com.cnlive.gundam.shortvideo.model.ShortVideoInfo;
18 31 import com.cnlive.gundam.user.activity.LoginActivity;
19 32 import com.cnlive.gundam.user.auth.UserService;
20 33 import com.cnlive.gundam.user.model.User;
... ... @@ -23,14 +36,28 @@ import com.cnlive.libs.shortvideo.callback.Callback;
23 36 import com.cnlive.libs.shortvideo.callback.CheckAuthResultListener;
24 37 import com.cnlive.libs.shortvideo.network.model.ShortVideoAuth;
25 38 import com.cnlive.libs.shortvideo.utils.AuthInfoManager;
  39 +import com.cnlive.libs.util.Config;
26 40  
27   -import java.util.ArrayList;
28   -import java.util.List;
  41 +import java.util.HashMap;
  42 +import java.util.Map;
  43 +
  44 +import retrofit2.Call;
  45 +import retrofit2.Response;
  46 +
  47 +
  48 +public class MyVideoFragment extends Fragment implements View.OnClickListener,
  49 + SwipeRefreshLayout.OnRefreshListener,
  50 + DataBindingAdapter.OnAdapterViewClickListener<ShortVideoInfo>,
  51 + DataBindingAdapter.OnAdapterViewLoadMoreListener,
  52 + retrofit2.Callback<ShortVideoDataModel> {
29 53  
30   -public class MyVideoFragment extends Fragment implements View.OnClickListener {
31 54 private FragmentMyVideoBinding binding;
  55 + private DataBindingAdapter adapter;
32 56  
33 57 private Handler mMainHandler;
  58 + private int maxDuration;
  59 +
  60 + private String userId;
34 61  
35 62 public MyVideoFragment() {
36 63 // Required empty public constructor
... ... @@ -42,17 +69,41 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
42 69 }
43 70  
44 71 @Override
  72 + public void onCreate(@Nullable Bundle savedInstanceState) {
  73 + super.onCreate(savedInstanceState);
  74 + }
  75 +
  76 + @Override
45 77 public View onCreateView(LayoutInflater inflater, ViewGroup container,
46 78 Bundle savedInstanceState) {
47 79 binding = DataBindingUtil.inflate(inflater, R.layout.fragment_my_video, container, false);
  80 + binding.setListAdapter(adapter = new DataBindingAdapter(getActivity(), R.layout.layout_item_short_video, BR.shortVideoInfo));
  81 + adapter.setOnViewClickListener(this);
  82 + adapter.setOnLoadMoreListener(this);
  83 + binding.setLayoutManager(new LinearLayoutManager(getActivity()));
  84 + binding.contentView.setOnRefreshListener(this);
48 85 return binding.getRoot();
49 86 }
50 87  
51 88 @Override
52   - public void onActivityCreated(@Nullable Bundle savedInstanceState) {
53   - super.onActivityCreated(savedInstanceState);
  89 + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  90 + super.onViewCreated(view, savedInstanceState);
54 91 mMainHandler = new Handler();
55 92 initToolBar();
  93 + loadData();
  94 + }
  95 +
  96 + private void loadData() {
  97 + userId = String.valueOf(UserService.getInstance(getActivity()).getActiveAccountInfo().getUid());
  98 +
  99 + Map<String, String> params = new HashMap<>();
  100 + params.put("appId", Config.getAppId());
  101 + params.put("userId", userId);
  102 + params.put("page", "1");
  103 + params.put("pageSize", "15");
  104 + params.put("platform_id", Config.getContext().getPackageName());
  105 + params.put("timestamp", String.valueOf(System.currentTimeMillis()));
  106 + RetrofitUtil.getApiService().getShortVideoList(SignUtil.getSignParamM(getActivity(), params)).enqueue(this);
56 107 }
57 108  
58 109 @Override
... ... @@ -86,13 +137,8 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
86 137 getActivity().finish();
87 138 break;
88 139 case R.id.record:
  140 + onRecordClick();
89 141 onAuthClick();
90   - User user = UserService.getInstance(getActivity()).getActiveAccountInfo();
91   - if (user.getUid() == 0) {
92   - startActivity(new Intent(getActivity(), LoginActivity.class));
93   - } else {
94   - startActivity(new Intent(getActivity(), ShortVideoActivity.class));
95   - }
96 142 break;
97 143 }
98 144 }
... ... @@ -110,6 +156,9 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
110 156 ShortVideoAuth shortVideoAuth = (ShortVideoAuth) o;
111 157 final String authInfo = shortVideoAuth.getData().getAuthorization();
112 158 final String date = shortVideoAuth.getData().getX_amz_date();
  159 + String duration = shortVideoAuth.getData().getMaxDuration();
  160 + maxDuration = Integer.parseInt(duration);
  161 +
113 162 //初始化鉴权信息
114 163  
115 164 AuthInfoManager.getInstance().setAuthInfo(getActivity().getApplicationContext(),
... ... @@ -124,6 +173,32 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
124 173  
125 174 }
126 175  
  176 + private void onRecordClick() {
  177 +
  178 + final ShortVideoConfigDialog configDialog = new ShortVideoConfigDialog(getActivity(), ShortVideoConfigDialog.SHORTVIDEOCONFIG_TYPE_RECORD, R.style.RecordParamsDialog);
  179 + configDialog.setCancelable(false);
  180 + configDialog.show();
  181 +
  182 + Window win = configDialog.getWindow();
  183 + win.getDecorView().setPadding(0, 0, 0, 0);
  184 + WindowManager.LayoutParams lp = win.getAttributes();
  185 + lp.width = WindowManager.LayoutParams.FILL_PARENT;
  186 + lp.height = WindowManager.LayoutParams.FILL_PARENT;
  187 + win.setAttributes(lp);
  188 + configDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
  189 + @Override
  190 + public void onDismiss(DialogInterface dialogInterface) {
  191 + ShortVideoConfigDialog.ShortVideoConfig config = configDialog.getShortVideoConfig();
  192 + if (config != null) {
  193 + ShortVideoActivity.startActivity(getActivity().getApplicationContext(), config.fps,
  194 + config.videoBitrate, config.audioBitrate,
  195 + config.resolution, config.encodeType,
  196 + config.encodeMethod, config.encodeProfile, maxDuration);
  197 + }
  198 + }
  199 + });
  200 + }
  201 +
127 202 private CheckAuthResultListener mCheckAuthResultListener = new CheckAuthResultListener() {
128 203 @Override
129 204 public void onAuthResult(int i) {
... ... @@ -132,7 +207,7 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
132 207 public void run() {
133 208 AuthInfoManager.getInstance().removeAuthResultListener(mCheckAuthResultListener);
134 209 if (AuthInfoManager.getInstance().getAuthState()) {
135   - Toast.makeText(getActivity(), "Auth Success", Toast.LENGTH_SHORT).show();
  210 +// Toast.makeText(getActivity(), "Auth Success", Toast.LENGTH_SHORT).show();
136 211 } else {
137 212 Toast.makeText(getActivity(), "Auth Failed", Toast.LENGTH_SHORT).show();
138 213 }
... ... @@ -141,5 +216,49 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener {
141 216 }
142 217 };
143 218  
  219 + @Override
  220 + public void onRefresh() {
  221 + loadData();
  222 + }
  223 +
  224 + @Override
  225 + public void onViewClick(View v, ShortVideoInfo program) {
  226 + String videoId = program.getVideoId();
  227 + String name = program.getName();
  228 + String des = program.getDescription();
  229 + if (v.getId() == R.id.item_short_video) {
  230 + ShortVideoPlayActivity.startActivity(getActivity(), videoId, name, des);
  231 + }
  232 + }
  233 +
  234 + @Override
  235 + public void onLoadMore() {
  236 + }
144 237  
  238 + @Override
  239 + public void onResponse(Call<ShortVideoDataModel> call, Response<ShortVideoDataModel> response) {
  240 + binding.contentView.setRefreshing(false);
  241 + if (response.isSuccessful()) {
  242 + ShortVideoDataModel model = response.body();
  243 + if (model != null && "0".equals(model.getCode())) {
  244 + if (model.getData() == null) {
  245 + Toast.makeText(getActivity(), "暂无数据", Toast.LENGTH_SHORT).show();
  246 + binding.recyclerView.setVisibility(View.GONE);
  247 + binding.emptyView.setVisibility(View.VISIBLE);
  248 + } else {
  249 + adapter.updateItems(model.getData().getList());
  250 + }
  251 + } else {
  252 + Toast.makeText(getActivity(), "获取数据失败1 " + model.getCode() + " : " + model.getMessage(), Toast.LENGTH_SHORT).show();
  253 + }
  254 + } else {
  255 + Toast.makeText(getActivity(), "获取数据失败2", Toast.LENGTH_SHORT).show();
  256 + }
  257 + }
  258 +
  259 + @Override
  260 + public void onFailure(Call<ShortVideoDataModel> call, Throwable t) {
  261 + binding.contentView.setRefreshing(false);
  262 + Toast.makeText(getActivity(), "获取数据失败3", Toast.LENGTH_SHORT).show();
  263 + }
145 264 }
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/model/ShortVideoDataModel.java 0 → 100644
  1 +package com.cnlive.gundam.shortvideo.model;
  2 +
  3 +import com.cnlive.gundam.main.model.ErrorMessage;
  4 +
  5 +import java.io.Serializable;
  6 +
  7 +/**
  8 + * Created by Lynn on 2017/7/13.
  9 + */
  10 +
  11 +public class ShortVideoDataModel extends ErrorMessage implements Serializable {
  12 +
  13 + private ShortVideoList data;
  14 +
  15 + public ShortVideoList getData() {
  16 + return data;
  17 + }
  18 +
  19 + public void setData(ShortVideoList data) {
  20 + this.data = data;
  21 + }
  22 +
  23 + @Override
  24 + public String toString() {
  25 + return "ShortVideoDataModel{" +
  26 + "data=" + data +
  27 + '}';
  28 + }
  29 +}
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/model/ShortVideoInfo.java 0 → 100644
  1 +package com.cnlive.gundam.shortvideo.model;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * Created by Lynn on 2017/7/14.
  7 + */
  8 +
  9 +public class ShortVideoInfo implements Serializable {
  10 +// private String appId;
  11 +// private String createTime;
  12 + private String description;
  13 +// private String id;
  14 +// private String md5;
  15 + private String name;
  16 + private String picKey;
  17 +// private String path;
  18 +// private String spId;
  19 + private String status;
  20 +// private String updateTime;
  21 + private String videoId;
  22 +
  23 +// public String getAppId() {
  24 +// return appId;
  25 +// }
  26 +//
  27 +// public void setAppId(String appId) {
  28 +// this.appId = appId;
  29 +// }
  30 +//
  31 +// public String getCreateTime() {
  32 +// if (createTime != null) {
  33 +// return DateUtils.getDateToString(Long.parseLong(createTime));
  34 +// }else {
  35 +// return "";
  36 +// }
  37 +// }
  38 +//
  39 +// public void setCreateTime(String createTime) {
  40 +// this.createTime = createTime;
  41 +// }
  42 +
  43 + public String getDescription() {
  44 + return description;
  45 + }
  46 +
  47 + public void setDescription(String description) {
  48 + this.description = description;
  49 + }
  50 +
  51 +// public String getId() {
  52 +// return id;
  53 +// }
  54 +//
  55 +// public void setId(String id) {
  56 +// this.id = id;
  57 +// }
  58 +//
  59 +// public String getMd5() {
  60 +// return md5;
  61 +// }
  62 +//
  63 +// public void setMd5(String md5) {
  64 +// this.md5 = md5;
  65 +// }
  66 +
  67 + public String getName() {
  68 + return name;
  69 + }
  70 +
  71 + public void setName(String name) {
  72 + this.name = name;
  73 + }
  74 +
  75 + public String getPicKey() {
  76 + return picKey;
  77 + }
  78 +
  79 + public void setPicKey(String picKey) {
  80 + this.picKey = picKey;
  81 + }
  82 +
  83 + // public String getPath() {
  84 +// return path;
  85 +// }
  86 +//
  87 +// public void setPath(String path) {
  88 +// this.path = path;
  89 +// }
  90 +//
  91 +// public String getSpId() {
  92 +// return spId;
  93 +// }
  94 +//
  95 +// public void setSpId(String spId) {
  96 +// this.spId = spId;
  97 +// }
  98 +
  99 + public String getStatus() {
  100 + return status;
  101 + }
  102 +
  103 + public void setStatus(String status) {
  104 + this.status = status;
  105 + }
  106 +
  107 +// public String getUpdateTime() {
  108 +// return updateTime;
  109 +// }
  110 +//
  111 +// public void setUpdateTime(String updateTime) {
  112 +// this.updateTime = updateTime;
  113 +// }
  114 +
  115 + public String getVideoId() {
  116 + return videoId;
  117 + }
  118 +
  119 + public void setVideoId(String videoId) {
  120 + this.videoId = videoId;
  121 + }
  122 +
  123 + @Override
  124 + public String toString() {
  125 + return "ShortVideoInfo{" +
  126 + "description='" + description + '\'' +
  127 + ", name='" + name + '\'' +
  128 + ", picKey='" + picKey + '\'' +
  129 + ", status='" + status + '\'' +
  130 + ", videoId='" + videoId + '\'' +
  131 + '}';
  132 + }
  133 +}
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/model/ShortVideoList.java 0 → 100644
  1 +package com.cnlive.gundam.shortvideo.model;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * Created by Lynn on 2017/7/14.
  8 + */
  9 +
  10 +public class ShortVideoList implements Serializable {
  11 + List<ShortVideoInfo> list;
  12 +
  13 + public List<ShortVideoInfo> getList() {
  14 + return list;
  15 + }
  16 +
  17 + public void setList(List<ShortVideoInfo> list) {
  18 + this.list = list;
  19 + }
  20 +
  21 + @Override
  22 + public String toString() {
  23 + return "ShortVideoList{" +
  24 + "list=" + list +
  25 + '}';
  26 + }
  27 +}
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/util/DateUtils.java 0 → 100644
  1 +package com.cnlive.gundam.shortvideo.util;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + * Created by Lynn on 2017/7/14.
  8 + */
  9 +
  10 +public class DateUtils {
  11 + private static SimpleDateFormat sf;
  12 +
  13 + /*时间戳转换成字符串*/
  14 + public static String getDateToString(long time) {
  15 + Date d = new Date(time);
  16 + sf = new SimpleDateFormat("yyyy-MM-dd");
  17 + return sf.format(d);
  18 + }
  19 +}
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/util/FileUtils.java
... ... @@ -5,6 +5,8 @@ import android.content.Context;
5 5 import android.content.Intent;
6 6 import android.database.Cursor;
7 7 import android.database.DatabaseUtils;
  8 +import android.graphics.Bitmap;
  9 +import android.media.MediaMetadataRetriever;
8 10 import android.net.Uri;
9 11 import android.os.Build;
10 12 import android.os.Environment;
... ... @@ -14,6 +16,9 @@ import android.util.Log;
14 16 import android.webkit.MimeTypeMap;
15 17  
16 18 import java.io.File;
  19 +import java.io.FileOutputStream;
  20 +import java.io.IOException;
  21 +import java.util.UUID;
17 22  
18 23 /**
19 24 * Created by Lynn on 6/28/2017.
... ... @@ -289,4 +294,72 @@ public class FileUtils {
289 294 return "";
290 295 }
291 296 }
  297 +
  298 + public static String getDuration(String uri) {
  299 + String duration = null;
  300 + MediaMetadataRetriever mmr = new MediaMetadataRetriever();
  301 + try {
  302 + if (uri != null) {
  303 + mmr.setDataSource(uri);
  304 + duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
  305 + } else {
  306 + Log.d("getUploadInfo", "path should not null");
  307 + }
  308 + } catch (IllegalArgumentException e) {
  309 + e.printStackTrace();
  310 + } catch (IllegalStateException e) {
  311 + e.printStackTrace();
  312 + }
  313 + return duration;
  314 + }
  315 +
  316 +
  317 + private static final String SD_PATH = "/sdcard/cn_sv_cover_img";
  318 + private static final String IN_PATH = "/dskqxt/pic/";
  319 +
  320 + /**
  321 + * 随机生产文件名
  322 + *
  323 + * @return
  324 + */
  325 + private static String generateFileName() {
  326 + return UUID.randomUUID().toString();
  327 + }
  328 +
  329 + /**
  330 + * 保存bitmap到本地
  331 + *
  332 + * @param context
  333 + * @param mBitmap
  334 + * @return
  335 + */
  336 + public static String saveBitmap(Context context, Bitmap mBitmap) {
  337 + String savePath;
  338 + File filePic;
  339 + if (Environment.getExternalStorageState().equals(
  340 + Environment.MEDIA_MOUNTED)) {
  341 + savePath = SD_PATH;
  342 + } else {
  343 + savePath = context.getApplicationContext().getFilesDir()
  344 + .getAbsolutePath()
  345 + + IN_PATH;
  346 + }
  347 + try {
  348 + filePic = new File(savePath + generateFileName() + ".png");
  349 + if (!filePic.exists()) {
  350 + filePic.getParentFile().mkdirs();
  351 + filePic.createNewFile();
  352 + }
  353 + FileOutputStream fos = new FileOutputStream(filePic);
  354 + mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
  355 + fos.flush();
  356 + fos.close();
  357 + } catch (IOException e) {
  358 + // TODO Auto-generated catch block
  359 + e.printStackTrace();
  360 + return null;
  361 + }
  362 +
  363 + return filePic.getAbsolutePath();
  364 + }
292 365 }
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/view/RecordProgressController.java
... ... @@ -186,7 +186,7 @@ public class RecordProgressController {
186 186 * @return
187 187 */
188 188 public int getRecordedTime() {
189   - return mProgressView.mTotalWidth * ShortVideoActivity.MAX_DURATION / mProgressView
  189 + return mProgressView.mTotalWidth * ShortVideoActivity.getMaxDuration() / mProgressView
190 190 .mScreenWidth;
191 191 }
192 192  
... ...
app/src/main/java/com/cnlive/gundam/shortvideo/view/RecordProgressView.java
... ... @@ -90,7 +90,7 @@ public class RecordProgressView extends View implements RecordProgressController
90 90 mScreenWidth = getScreenWidthPixels(getContext());
91 91 mMinPoint = mScreenWidth
92 92 * ShortVideoActivity.MIN_DURATION
93   - / ShortVideoActivity.MAX_DURATION;
  93 + / ShortVideoActivity.getMaxDuration();
94 94 mHandler.postDelayed(mCursorRunnable, 500);
95 95 }
96 96  
... ... @@ -104,7 +104,7 @@ public class RecordProgressView extends View implements RecordProgressController
104 104 int totalWidth = 0;
105 105 for (RecordClipModel clip : mProgressClipList) {
106 106 long newWidth = totalWidth + (clip.timeInterval * mScreenWidth)
107   - / ShortVideoActivity.MAX_DURATION;
  107 + / ShortVideoActivity.getMaxDuration();
108 108 switch (clip.state) {
109 109 case 0: // recording
110 110 canvas.drawRect(totalWidth, paddingTop, newWidth,
... ... @@ -168,7 +168,7 @@ public class RecordProgressView extends View implements RecordProgressController
168 168 int totalWidth = 0;
169 169 for (RecordClipModel clip : mProgressClipList) {
170 170 long newWidth = totalWidth + (clip.timeInterval * mScreenWidth)
171   - / ShortVideoActivity.MAX_DURATION;
  171 + / ShortVideoActivity.getMaxDuration();
172 172 totalWidth = (int) newWidth;
173 173 }
174 174 if (totalWidth >= mMinPoint) {
... ...
app/src/main/res/drawable-hdpi/default_pic.png 0 → 100644

1.22 KB

app/src/main/res/drawable-hdpi/ic_short_video_back.png

2.39 KB | W: | H:

2.08 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-hdpi/ic_short_video_back_recording.png

3.06 KB | W: | H:

2.74 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-hdpi/ic_short_video_next.png

3.08 KB | W: | H:

2.78 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-hdpi/ic_short_video_next_recording.png

2.96 KB | W: | H:

2.71 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-mdpi/default_pic.png 0 → 100644

1003 Bytes

app/src/main/res/drawable-mdpi/ic_short_video_back.png

1.28 KB | W: | H:

1.15 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-mdpi/ic_short_video_back_recording.png

1.64 KB | W: | H:

1.54 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-mdpi/ic_short_video_next.png

1.72 KB | W: | H:

1.57 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-mdpi/ic_short_video_next_recording.png

1.65 KB | W: | H:

1.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/default_pic.png 0 → 100644

1.9 KB

app/src/main/res/drawable-xhdpi/ic_short_video_back.png

3.03 KB | W: | H:

2.76 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/ic_short_video_back_recording.png

3.63 KB | W: | H:

3.5 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/ic_short_video_next.png

3.81 KB | W: | H:

3.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/ic_short_video_next_recording.png

3.65 KB | W: | H:

3.41 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xhdpi/test.png 0 → 100644

646 KB

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

2.82 KB

app/src/main/res/drawable-xxhdpi/ic_short_video_back.png

5.34 KB | W: | H:

5.18 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxhdpi/ic_short_video_back_recording.png

6.47 KB | W: | H:

6.55 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxhdpi/ic_short_video_next.png

6.79 KB | W: | H:

6.53 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxhdpi/ic_short_video_next_recording.png

6.54 KB | W: | H:

6.39 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxxhdpi/default_pic.png 0 → 100644

4.33 KB

app/src/main/res/drawable-xxxhdpi/ic_short_video_back.png

6.41 KB | W: | H:

6.92 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxxhdpi/ic_short_video_back_recording.png

7.51 KB | W: | H:

8.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxxhdpi/ic_short_video_next.png

7.85 KB | W: | H:

8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable-xxxhdpi/ic_short_video_next_recording.png

7.57 KB | W: | H:

7.85 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/drawable/background_radio.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:padding="10dp"
  4 + android:shape="rectangle">
  5 + <solid android:color="#ffcc00" />
  6 + <stroke
  7 + android:width="1dip"
  8 + android:color="#ffcc00" />
  9 +</shape>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/edit_cursor_color.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:shape="rectangle" >
  4 +
  5 + <size android:width="2dp" />
  6 +
  7 + <solid android:color="#ff7200" />
  8 +
  9 +</shape>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/edit_text_line.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
  3 +
  4 + <item>
  5 + <shape android:shape="rectangle" >
  6 + <gradient
  7 + android:endColor="#ff7200"
  8 + android:startColor="#ff7200" />
  9 + </shape>
  10 + </item>
  11 + <item android:bottom="2dp">
  12 + <shape android:shape="rectangle" >
  13 + <gradient
  14 + android:endColor="#eeeeee"
  15 + android:startColor="#eeeeee" />
  16 + </shape>
  17 + </item>
  18 +
  19 +</layer-list>
0 20 \ No newline at end of file
... ...
app/src/main/res/drawable/edit_title_choose.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <selector xmlns:android="http://schemas.android.com/apk/res/android">
3   - <item android:state_activated="true" android:color="#02d4e1"/>
4   - <item android:color="@android:color/white"/>
  3 + <item android:color="#ffcc00" android:state_activated="true" />
  4 + <item android:color="#EEE8AA" />
5 5 </selector>
6 6 \ No newline at end of file
... ...
app/src/main/res/drawable/edittext_background.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:padding="10dp"
  4 + android:shape="rectangle">
  5 + <solid android:color="#FFFFFF" />
  6 + <stroke
  7 + android:width="1dip"
  8 + android:color="#ffcc00" />
  9 +</shape>
0 10 \ No newline at end of file
... ...
app/src/main/res/drawable/radiobutton_selector.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <item android:drawable="@drawable/edittext_background" android:state_checked="false" />
  4 + <item android:drawable="@drawable/background_radio" android:state_checked="true" />
  5 +</selector>
0 6 \ No newline at end of file
... ...
app/src/main/res/drawable/text_color_selector.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 + <item android:color="#ffcc00" android:state_checked="false" />
  4 + <item android:color="#ffffff" android:state_checked="true" />
  5 +</selector>
0 6 \ No newline at end of file
... ...
app/src/main/res/layout/activity_edit.xml
... ... @@ -18,6 +18,16 @@
18 18 android:layout_alignParentBottom="true"
19 19 android:layout_alignParentTop="true" />
20 20  
  21 + <TextView
  22 + android:id="@+id/hint"
  23 + android:layout_width="wrap_content"
  24 + android:layout_height="wrap_content"
  25 + android:layout_alignParentTop="true"
  26 + android:layout_centerHorizontal="true"
  27 + android:layout_marginTop="5dp"
  28 + android:textColor="@color/ff4e51"
  29 + android:textSize="14sp" />
  30 +
21 31 <com.cnlive.libs.shortvideo.view.CNStickerView
22 32 android:id="@+id/sticker_panel"
23 33 android:layout_width="fill_parent"
... ...
app/src/main/res/layout/activity_short_video.xml
... ... @@ -16,6 +16,19 @@
16 16 android:id="@+id/short_video_record_top_layout"
17 17 layout="@layout/short_video_record_top_view" />
18 18  
  19 + <Chronometer
  20 + android:id="@+id/chronometer"
  21 + android:layout_width="wrap_content"
  22 + android:layout_height="wrap_content"
  23 + android:layout_alignParentTop="true"
  24 + android:layout_centerHorizontal="true"
  25 + android:layout_marginTop="50dp"
  26 + android:format="%s"
  27 + android:gravity="center"
  28 + android:textColor="@color/ff4e51"
  29 + android:textSize="40px"
  30 + android:visibility="gone" />
  31 +
19 32 <include
20 33 android:id="@+id/short_video_record_bottom_layout"
21 34 layout="@layout/short_video_record_bottom_view" />
... ...
app/src/main/res/layout/activity_short_video_play.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  4 + xmlns:tools="http://schemas.android.com/tools">
  5 +
  6 + <RelativeLayout
  7 + android:layout_width="match_parent"
  8 + android:layout_height="match_parent"
  9 + android:background="#000000">
  10 +
  11 + <com.cnlive.libs.video.video.VideoView
  12 + android:id="@+id/video_view"
  13 + android:layout_width="match_parent"
  14 + android:layout_height="match_parent"
  15 + android:layout_centerInParent="true" />
  16 +
  17 + <TextureView
  18 + android:id="@+id/player_texture"
  19 + android:layout_width="match_parent"
  20 + android:layout_height="match_parent"
  21 + android:layout_centerInParent="true"
  22 + android:visibility="gone"
  23 + tools:targetApi="ice_cream_sandwich" />
  24 +
  25 + <TextView
  26 + android:id="@+id/loading_text"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="wrap_content"
  29 + android:layout_centerInParent="true"
  30 + android:textColor="#FFCC00" />
  31 +
  32 + <LinearLayout
  33 + android:id="@+id/top_player_panel"
  34 + android:layout_width="match_parent"
  35 + android:layout_height="48dp"
  36 + android:background="@color/transparent2"
  37 + android:orientation="horizontal">
  38 +
  39 + <ImageView
  40 + android:id="@+id/back"
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:layout_gravity="center_vertical"
  44 + android:layout_marginLeft="10dp"
  45 + android:onClick="onClick"
  46 + android:src="@drawable/player_back" />
  47 +
  48 + <TextView
  49 + android:id="@+id/video_title"
  50 + android:layout_width="wrap_content"
  51 + android:layout_height="wrap_content"
  52 + android:layout_gravity="center"
  53 + android:textColor="@color/text_white_color" />
  54 + </LinearLayout>
  55 +
  56 + <LinearLayout
  57 + android:layout_width="match_parent"
  58 + android:layout_height="wrap_content"
  59 + android:layout_alignParentBottom="true"
  60 + android:background="@color/transparent2"
  61 + android:orientation="vertical">
  62 +
  63 + <TextView
  64 + android:id="@+id/video_description"
  65 + android:layout_width="match_parent"
  66 + android:layout_height="wrap_content"
  67 + android:layout_alignParentBottom="true"
  68 + android:ellipsize="end"
  69 + android:padding="10dp"
  70 + android:singleLine="true"
  71 + android:textColor="@color/text_white_color" />
  72 +
  73 + <LinearLayout
  74 + android:id="@+id/player_panel"
  75 + android:layout_width="match_parent"
  76 + android:layout_height="50dp">
  77 +
  78 + <ImageView
  79 + android:id="@+id/player_start"
  80 + android:layout_width="40dp"
  81 + android:layout_height="40dp"
  82 + android:layout_marginTop="10dp"
  83 + android:background="@drawable/play_state"
  84 + android:onClick="onClick" />
  85 +
  86 + <RelativeLayout
  87 + android:layout_width="match_parent"
  88 + android:layout_height="wrap_content"
  89 + android:layout_marginTop="10dp">
  90 +
  91 +
  92 + <TextView
  93 + android:id="@+id/player_time"
  94 + android:layout_width="wrap_content"
  95 + android:layout_height="wrap_content"
  96 + android:layout_alignParentLeft="true"
  97 + android:text="00:00/00:00" />
  98 +
  99 + <SeekBar
  100 + android:id="@+id/player_seekbar"
  101 + android:layout_width="match_parent"
  102 + android:layout_height="wrap_content"
  103 + android:layout_below="@+id/player_time"
  104 + android:focusable="true" />
  105 +
  106 + </RelativeLayout>
  107 +
  108 + </LinearLayout>
  109 + </LinearLayout>
  110 + </RelativeLayout>
  111 +</layout>
0 112 \ No newline at end of file
... ...
app/src/main/res/layout/beauty_choose.xml
... ... @@ -21,7 +21,7 @@
21 21 android:layout_height="wrap_content"
22 22 android:layout_gravity="center"
23 23 android:text="美颜类型:"
24   - android:textColor="@color/colorAccent"
  24 + android:textColor="@color/ffcc00"
25 25 android:textSize="16sp" />
26 26  
27 27 <android.support.v7.widget.AppCompatSpinner
... ... @@ -48,7 +48,7 @@
48 48 android:layout_height="wrap_content"
49 49 android:gravity="center"
50 50 android:text="磨皮"
51   - android:textColor="@color/colorAccent"
  51 + android:textColor="@color/ffcc00"
52 52 android:textSize="14sp" />
53 53  
54 54 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -72,7 +72,7 @@
72 72 android:layout_height="wrap_content"
73 73 android:gravity="center"
74 74 android:text="美白"
75   - android:textColor="@color/colorAccent"
  75 + android:textColor="@color/ffcc00"
76 76 android:textSize="14sp" />
77 77  
78 78 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -97,7 +97,7 @@
97 97 android:layout_height="wrap_content"
98 98 android:gravity="center"
99 99 android:text="红润"
100   - android:textColor="@color/colorAccent"
  100 + android:textColor="@color/ffcc00"
101 101 android:textSize="14sp" />
102 102  
103 103 <android.support.v7.widget.AppCompatSeekBar
... ...
app/src/main/res/layout/edit_audio.xml
... ... @@ -20,7 +20,7 @@
20 20 android:layout_height="wrap_content"
21 21 android:gravity="center"
22 22 android:text="原音"
23   - android:textColor="@color/colorAccent"
  23 + android:textColor="@color/ffcc00"
24 24 android:textSize="14sp" />
25 25  
26 26 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -43,7 +43,7 @@
43 43 android:layout_height="wrap_content"
44 44 android:gravity="center"
45 45 android:text="配乐"
46   - android:textColor="@color/colorAccent"
  46 + android:textColor="@color/ffcc00"
47 47 android:textSize="14sp" />
48 48  
49 49 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -65,7 +65,7 @@
65 65 android:layout_height="wrap_content"
66 66 android:gravity="center"
67 67 android:text="原音变声"
68   - android:textColor="@color/colorAccent"
  68 + android:textColor="@color/ffcc00"
69 69 android:textSize="14sp" />
70 70  
71 71 <android.support.v7.widget.AppCompatSpinner
... ... @@ -90,7 +90,7 @@
90 90 android:layout_height="wrap_content"
91 91 android:gravity="center"
92 92 android:text="原音混响"
93   - android:textColor="@color/colorAccent"
  93 + android:textColor="@color/ffcc00"
94 94 android:textSize="14sp" />
95 95  
96 96 <android.support.v7.widget.AppCompatSpinner
... ...
app/src/main/res/layout/edit_bottombar.xml
... ... @@ -4,7 +4,7 @@
4 4 <RelativeLayout
5 5 android:layout_width="match_parent"
6 6 android:layout_height="match_parent"
7   - android:background="#616060">
  7 + android:background="@color/white">
8 8  
9 9 <RelativeLayout
10 10 android:id="@+id/edit_layout"
... ... @@ -106,7 +106,7 @@
106 106 android:layout_width="match_parent"
107 107 android:layout_height="2px"
108 108 android:layout_below="@+id/edit_layout"
109   - android:background="#FF000000" />
  109 + android:background="@color/ffcc00" />
110 110  
111 111 <FrameLayout
112 112 android:layout_width="match_parent"
... ...
app/src/main/res/layout/edit_caption.xml
... ... @@ -21,8 +21,8 @@
21 21 android:layout_weight="1"
22 22 android:hint="input text ..."
23 23 android:paddingLeft="8dp"
24   - android:textColor="#ffffff"
25   - android:textColorHint="#ffffff" />
  24 + android:textColor="#ffcc00"
  25 + android:textColorHint="#f0f0f0" />
26 26  
27 27 <ImageView
28 28 android:id="@+id/text_color"
... ... @@ -30,7 +30,7 @@
30 30 android:layout_height="25dp"
31 31 android:layout_gravity="center_vertical"
32 32 android:layout_margin="10dp"
33   - android:background="#ffffff"
  33 + android:background="#ffcc00"
34 34 android:onClick="onClick" />
35 35  
36 36 </LinearLayout>
... ...
app/src/main/res/layout/fragment_my_video.xml
1   -<layout xmlns:android="http://schemas.android.com/apk/res/android">
  1 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:app="http://schemas.android.com/apk/res-auto">
  3 +
  4 + <data>
  5 +
  6 + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter" />
  7 +
  8 + <import type="android.support.v7.widget.LinearLayoutManager" />
  9 +
  10 + <variable
  11 + name="layoutManager"
  12 + type="LinearLayoutManager" />
  13 +
  14 + <variable
  15 + name="listAdapter"
  16 + type="DataBindingAdapter" />
  17 + </data>
  18 +
2 19 <RelativeLayout
3 20 android:layout_width="match_parent"
4 21 android:layout_height="match_parent">
5 22  
6   - <LinearLayout
  23 + <android.support.v4.widget.SwipeRefreshLayout
  24 + android:id="@+id/contentView"
7 25 android:layout_width="match_parent"
8   - android:layout_height="wrap_content"
9   - android:orientation="vertical">
  26 + android:layout_height="match_parent">
  27 +
  28 + <LinearLayout
  29 + android:layout_width="match_parent"
  30 + android:layout_height="wrap_content"
  31 + android:orientation="vertical">
  32 +
  33 + <include
  34 + android:id="@+id/myVideoIncludLayout"
  35 + layout="@layout/toolbar_my_video" />
  36 +
  37 + <include layout="@layout/user_divider_head_line" />
10 38  
11   - <include
12   - android:id="@+id/myVideoIncludLayout"
13   - layout="@layout/toolbar_my_video" />
  39 + <android.support.v7.widget.RecyclerView
  40 + android:id="@+id/recycler_view"
  41 + android:layout_width="match_parent"
  42 + android:layout_height="match_parent"
  43 + app:adapter="@{listAdapter}"
  44 + app:layoutManager="@{layoutManager}" />
14 45  
15   - <include layout="@layout/user_divider_head_line" />
  46 + <TextView
  47 + android:id="@+id/empty_view"
  48 + android:layout_width="match_parent"
  49 + android:layout_height="match_parent"
  50 + android:layout_gravity="center"
  51 + android:gravity="center"
  52 + android:text="您还没有录制过视频\n\n快去录制吧⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾*"
  53 + android:textSize="20sp"
  54 + android:visibility="gone" />
16 55  
17   - </LinearLayout>
  56 + </LinearLayout>
  57 + </android.support.v4.widget.SwipeRefreshLayout>
18 58 </RelativeLayout>
19 59  
20 60  
... ...
app/src/main/res/layout/layout_item_short_video.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
  4 +
  5 + <data>
  6 +
  7 + <import type="com.cnlive.gundam.shortvideo.model.ShortVideoInfo" />
  8 +
  9 + <import type="android.view.View" />
  10 +
  11 + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener" />
  12 +
  13 + <variable
  14 + name="shortVideoInfo"
  15 + type="ShortVideoInfo" />
  16 +
  17 + <variable
  18 + name="viewClickListner"
  19 + type="OnAdapterViewClickListener&lt;ShortVideoInfo>" />
  20 + </data>
  21 +
  22 + <LinearLayout
  23 + android:id="@+id/item_short_video"
  24 + android:layout_width="match_parent"
  25 + android:layout_height="wrap_content"
  26 +
  27 + android:onClick="@{(view)->viewClickListner.onViewClick(view, shortVideoInfo)}"
  28 + android:orientation="vertical">
  29 +
  30 + <LinearLayout
  31 + android:layout_width="match_parent"
  32 + android:layout_height="wrap_content"
  33 + android:orientation="horizontal">
  34 +
  35 + <ImageView
  36 + android:id="@+id/cover_image"
  37 + android:layout_width="90dp"
  38 + android:layout_height="90dp"
  39 + android:padding="2dp"
  40 + app:error="@{@drawable/default_pic}"
  41 + app:imageUrl="@{shortVideoInfo.picKey}" />
  42 +
  43 + <LinearLayout
  44 + android:layout_width="match_parent"
  45 + android:layout_height="90dp"
  46 + android:layout_marginLeft="10dp"
  47 + android:gravity="center_vertical"
  48 + android:orientation="vertical">
  49 +
  50 + <TextView
  51 + android:id="@+id/video_name"
  52 + android:layout_width="wrap_content"
  53 + android:layout_height="wrap_content"
  54 + android:text="@{shortVideoInfo.name}"
  55 + android:textColor="@color/black"
  56 + android:textSize="18sp" />
  57 +
  58 + <!--<TextView-->
  59 + <!--android:id="@+id/video_time"-->
  60 + <!--android:layout_width="wrap_content"-->
  61 + <!--android:layout_height="wrap_content"-->
  62 + <!--android:layout_marginLeft="10dp"-->
  63 + <!--android:layout_marginTop="10dp"-->
  64 + <!--android:text="@{shortVideoInfo.createTime}"-->
  65 + <!--android:textSize="14sp" />-->
  66 +
  67 + <TextView
  68 + android:id="@+id/video_description"
  69 + android:layout_width="wrap_content"
  70 + android:layout_height="wrap_content"
  71 + android:layout_marginLeft="10dp"
  72 + android:layout_marginTop="3dp"
  73 + android:text="@{shortVideoInfo.description}"
  74 + android:textSize="14sp" />
  75 +
  76 + </LinearLayout>
  77 +
  78 + </LinearLayout>
  79 +
  80 + <View
  81 + android:layout_width="match_parent"
  82 + android:layout_height="1dp"
  83 + android:background="@color/gray_line_color" />
  84 +
  85 + </LinearLayout>
  86 +</layout>
0 87 \ No newline at end of file
... ...
app/src/main/res/layout/layout_record_params_dialog.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3   - android:layout_width="wrap_content"
4   - android:layout_height="wrap_content"
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
5 5 android:background="@android:color/white"
6 6 android:orientation="vertical">
7 7  
8   - <TextView
9   - android:id="@+id/config_title"
10   - android:layout_width="wrap_content"
11   - android:layout_height="wrap_content"
12   - android:layout_gravity="center"
13   - android:textSize="20dp" />
14   -
15   - <RadioGroup
16   - android:id="@+id/resolution_group"
  8 + <LinearLayout
17 9 android:layout_width="wrap_content"
18 10 android:layout_height="wrap_content"
19   - android:layout_marginTop="10dp"
20   - android:orientation="horizontal">
  11 + android:layout_centerInParent="true"
  12 + android:orientation="vertical">
21 13  
22   - <RadioButton
23   - android:id="@+id/r360p"
  14 + <TextView
  15 + android:id="@+id/config_title"
24 16 android:layout_width="wrap_content"
25 17 android:layout_height="wrap_content"
26   - android:text="360P" />
  18 + android:layout_gravity="center"
  19 + android:textColor="#ffcc00"
  20 + android:textSize="20dp" />
27 21  
28   - <RadioButton
29   - android:id="@+id/r480p"
  22 + <RadioGroup
  23 + android:id="@+id/resolution_group"
30 24 android:layout_width="wrap_content"
31 25 android:layout_height="wrap_content"
32   - android:checked="true"
33   - android:text="480P" />
  26 + android:layout_marginTop="10dp"
  27 + android:orientation="horizontal">
34 28  
35   - <RadioButton
36   - android:id="@+id/r540p"
37   - android:layout_width="wrap_content"
38   - android:layout_height="wrap_content"
39   - android:checked="false"
40   - android:text="540P" />
  29 + <RadioButton
  30 + android:id="@+id/r360p"
  31 + android:layout_width="wrap_content"
  32 + android:layout_height="wrap_content"
  33 + android:background="@drawable/radiobutton_selector"
  34 + android:button="@null"
  35 + android:padding="10dp"
  36 + android:text="360P"
  37 + android:textColor="@drawable/text_color_selector" />
41 38  
42   - <RadioButton
43   - android:id="@+id/r720p"
44   - android:layout_width="wrap_content"
45   - android:layout_height="wrap_content"
46   - android:checked="false"
47   - android:text="720P" />
48   - </RadioGroup>
  39 + <RadioButton
  40 + android:id="@+id/r480p"
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:background="@drawable/radiobutton_selector"
  44 + android:button="@null"
  45 + android:checked="true"
  46 + android:padding="10dp"
  47 + android:text="480P"
  48 + android:textColor="@drawable/text_color_selector" />
49 49  
50   - <RadioGroup
51   - android:id="@+id/encode_type"
52   - android:layout_width="wrap_content"
53   - android:layout_height="wrap_content"
54   - android:layout_below="@id/resolution_group"
55   - android:layout_marginTop="5dp"
56   - android:orientation="horizontal">
  50 + <RadioButton
  51 + android:id="@+id/r540p"
  52 + android:layout_width="wrap_content"
  53 + android:layout_height="wrap_content"
  54 + android:background="@drawable/radiobutton_selector"
  55 + android:button="@null"
  56 + android:checked="false"
  57 + android:padding="10dp"
  58 + android:text="540P"
  59 + android:textColor="@drawable/text_color_selector" />
57 60  
58   - <RadioButton
59   - android:id="@+id/encode_h264"
60   - android:layout_width="wrap_content"
61   - android:layout_height="wrap_content"
62   - android:checked="true"
63   - android:text="H264" />
  61 + <RadioButton
  62 + android:id="@+id/r720p"
  63 + android:layout_width="wrap_content"
  64 + android:layout_height="wrap_content"
  65 + android:background="@drawable/radiobutton_selector"
  66 + android:button="@null"
  67 + android:checked="false"
  68 + android:padding="10dp"
  69 + android:text="720P"
  70 + android:textColor="@drawable/text_color_selector" />
  71 + </RadioGroup>
64 72  
65   - <RadioButton
66   - android:id="@+id/encode_h265"
  73 + <RadioGroup
  74 + android:id="@+id/encode_type"
67 75 android:layout_width="wrap_content"
68 76 android:layout_height="wrap_content"
69   - android:checked="false"
70   - android:text="H265" />
71   - </RadioGroup>
  77 + android:layout_below="@id/resolution_group"
  78 + android:layout_marginTop="5dp"
  79 + android:orientation="horizontal">
72 80  
73   - <RadioGroup
74   - android:id="@+id/encode_group"
75   - android:layout_width="wrap_content"
76   - android:layout_height="wrap_content"
77   - android:layout_below="@id/encode_type"
78   - android:layout_marginTop="5dp"
79   - android:orientation="horizontal">
  81 + <RadioButton
  82 + android:id="@+id/encode_h264"
  83 + android:layout_width="wrap_content"
  84 + android:layout_height="wrap_content"
  85 + android:background="@drawable/radiobutton_selector"
  86 + android:button="@null"
  87 + android:checked="true"
  88 + android:padding="10dp"
  89 + android:text="H264"
  90 + android:textColor="@drawable/text_color_selector" />
80 91  
81   - <RadioButton
82   - android:id="@+id/encode_hw"
83   - android:layout_width="wrap_content"
84   - android:layout_height="wrap_content"
85   - android:checked="false"
86   - android:text="硬编" />
  92 + <RadioButton
  93 + android:id="@+id/encode_h265"
  94 + android:layout_width="wrap_content"
  95 + android:layout_height="wrap_content"
  96 + android:background="@drawable/radiobutton_selector"
  97 + android:button="@null"
  98 + android:checked="false"
  99 + android:padding="10dp"
  100 + android:text="H265"
  101 + android:textColor="@drawable/text_color_selector" />
  102 + </RadioGroup>
87 103  
88   - <RadioButton
89   - android:id="@+id/encode_sw"
  104 + <RadioGroup
  105 + android:id="@+id/encode_group"
90 106 android:layout_width="wrap_content"
91 107 android:layout_height="wrap_content"
92   - android:checked="true"
93   - android:text="软编" />
94   - </RadioGroup>
  108 + android:layout_below="@id/encode_type"
  109 + android:layout_marginTop="5dp"
  110 + android:orientation="horizontal">
95 111  
96   - <RadioGroup
97   - android:id="@+id/encode_profile"
98   - android:layout_width="wrap_content"
99   - android:layout_height="wrap_content"
100   - android:layout_below="@id/encode_group"
101   - android:layout_marginTop="5dp"
102   - android:orientation="horizontal">
  112 + <RadioButton
  113 + android:id="@+id/encode_hw"
  114 + android:layout_width="wrap_content"
  115 + android:layout_height="wrap_content"
  116 + android:background="@drawable/radiobutton_selector"
  117 + android:button="@null"
  118 + android:checked="false"
  119 + android:padding="10dp"
  120 + android:text="硬编"
  121 + android:textColor="@drawable/text_color_selector" />
103 122  
104   - <RadioButton
105   - android:id="@+id/encode_profile_low_power"
106   - android:layout_width="wrap_content"
107   - android:layout_height="wrap_content"
108   - android:checked="false"
109   - android:text="低功耗" />
  123 + <RadioButton
  124 + android:id="@+id/encode_sw"
  125 + android:layout_width="wrap_content"
  126 + android:layout_height="wrap_content"
  127 + android:background="@drawable/radiobutton_selector"
  128 + android:button="@null"
  129 + android:checked="true"
  130 + android:padding="10dp"
  131 + android:text="软编"
  132 + android:textColor="@drawable/text_color_selector" />
  133 + </RadioGroup>
110 134  
111   - <RadioButton
112   - android:id="@+id/encode_profile_balance"
  135 + <RadioGroup
  136 + android:id="@+id/encode_profile"
113 137 android:layout_width="wrap_content"
114 138 android:layout_height="wrap_content"
115   - android:checked="true"
116   - android:text="平衡" />
  139 + android:layout_below="@id/encode_group"
  140 + android:layout_marginTop="5dp"
  141 + android:orientation="horizontal">
117 142  
118   - <RadioButton
119   - android:id="@+id/encode_profile_high_perf"
120   - android:layout_width="wrap_content"
121   - android:layout_height="wrap_content"
122   - android:checked="false"
123   - android:text="高性能" />
124   - </RadioGroup>
  143 + <RadioButton
  144 + android:id="@+id/encode_profile_low_power"
  145 + android:layout_width="wrap_content"
  146 + android:layout_height="wrap_content"
  147 + android:background="@drawable/radiobutton_selector"
  148 + android:button="@null"
  149 + android:checked="false"
  150 + android:padding="10dp"
  151 + android:text="低功耗"
  152 + android:textColor="@drawable/text_color_selector" />
125 153  
126   - <LinearLayout
127   - android:id="@+id/frameRate"
128   - android:layout_width="match_parent"
129   - android:layout_height="wrap_content"
130   - android:layout_below="@id/encode_group">
  154 + <RadioButton
  155 + android:id="@+id/encode_profile_balance"
  156 + android:layout_width="wrap_content"
  157 + android:layout_height="wrap_content"
  158 + android:background="@drawable/radiobutton_selector"
  159 + android:button="@null"
  160 + android:checked="true"
  161 + android:padding="10dp"
  162 + android:text="平衡"
  163 + android:textColor="@drawable/text_color_selector" />
131 164  
132   - <TextView
133   - android:layout_width="wrap_content"
134   - android:layout_height="wrap_content"
135   - android:text="采集帧率"
136   - android:textSize="16sp" />
  165 + <RadioButton
  166 + android:id="@+id/encode_profile_high_perf"
  167 + android:layout_width="wrap_content"
  168 + android:layout_height="wrap_content"
  169 + android:background="@drawable/radiobutton_selector"
  170 + android:button="@null"
  171 + android:checked="false"
  172 + android:padding="10dp"
  173 + android:text="高性能"
  174 + android:textColor="@drawable/text_color_selector" />
  175 + </RadioGroup>
137 176  
138   - <EditText
139   - android:id="@+id/frameRatePicker"
140   - android:layout_width="wrap_content"
  177 + <LinearLayout
  178 + android:id="@+id/frameRate"
  179 + android:layout_width="match_parent"
141 180 android:layout_height="wrap_content"
142   - android:text="20" />
143   - </LinearLayout>
  181 + android:layout_below="@id/encode_group"
  182 + android:layout_marginTop="10dp">
144 183  
145   - <LinearLayout
146   - android:id="@+id/videoBitrate"
147   - android:layout_width="match_parent"
148   - android:layout_height="wrap_content"
149   - android:layout_below="@id/frameRate"
150   - android:orientation="horizontal">
  184 + <TextView
  185 + android:layout_width="wrap_content"
  186 + android:layout_height="wrap_content"
  187 + android:text="采集帧率"
  188 + android:textColor="@color/black"
  189 + android:textSize="16sp" />
151 190  
152   - <TextView
153   - android:layout_width="wrap_content"
154   - android:layout_height="wrap_content"
155   - android:text="视频码率"
156   - android:textSize="16sp" />
  191 + <EditText
  192 + android:id="@+id/frameRatePicker"
  193 + android:layout_width="wrap_content"
  194 + android:layout_height="wrap_content"
  195 + android:layout_marginLeft="5dp"
  196 + android:background="@drawable/edittext_background"
  197 + android:paddingBottom="5dp"
  198 + android:paddingLeft="10dp"
  199 + android:paddingRight="10dp"
  200 + android:paddingTop="5dp"
  201 + android:text="20"
  202 + android:textColor="#ffcc00"
  203 + android:textCursorDrawable="@drawable/edit_cursor_color" />
  204 + </LinearLayout>
157 205  
158   - <EditText
159   - android:id="@+id/videoBitratePicker"
160   - android:layout_width="wrap_content"
  206 + <LinearLayout
  207 + android:id="@+id/videoBitrate"
  208 + android:layout_width="match_parent"
161 209 android:layout_height="wrap_content"
162   - android:text="1000" />
163   - </LinearLayout>
  210 + android:layout_below="@id/frameRate"
  211 + android:layout_marginTop="10dp"
  212 + android:orientation="horizontal">
164 213  
165   - <LinearLayout
166   - android:id="@+id/audioBitrate"
167   - android:layout_width="match_parent"
168   - android:layout_height="wrap_content"
169   - android:layout_below="@id/videoBitrate"
170   - android:orientation="horizontal">
  214 + <TextView
  215 + android:layout_width="wrap_content"
  216 + android:layout_height="wrap_content"
  217 + android:text="视频码率"
  218 + android:textColor="@color/black"
  219 + android:textSize="16sp" />
171 220  
172   - <TextView
173   - android:layout_width="wrap_content"
174   - android:layout_height="wrap_content"
175   - android:text="音频码率"
176   - android:textSize="16sp" />
  221 + <EditText
  222 + android:id="@+id/videoBitratePicker"
  223 + android:layout_width="wrap_content"
  224 + android:layout_height="wrap_content"
  225 + android:layout_marginLeft="5dp"
  226 + android:background="@drawable/edittext_background"
  227 + android:paddingBottom="5dp"
  228 + android:paddingLeft="10dp"
  229 + android:paddingRight="10dp"
  230 + android:paddingTop="5dp"
  231 + android:text="1000"
  232 + android:textColor="#ffcc00"
  233 + android:textCursorDrawable="@drawable/edit_cursor_color" />
  234 + </LinearLayout>
177 235  
178   - <EditText
179   - android:id="@+id/audioBitratePicker"
180   - android:layout_width="wrap_content"
  236 + <LinearLayout
  237 + android:id="@+id/audioBitrate"
  238 + android:layout_width="match_parent"
181 239 android:layout_height="wrap_content"
182   - android:text="64" />
183   - </LinearLayout>
  240 + android:layout_below="@id/videoBitrate"
  241 + android:layout_marginTop="10dp"
  242 + android:orientation="horizontal">
  243 +
  244 + <TextView
  245 + android:layout_width="wrap_content"
  246 + android:layout_height="wrap_content"
  247 + android:text="音频码率"
  248 + android:textColor="@color/black"
  249 + android:textSize="16sp" />
184 250  
  251 + <EditText
  252 + android:id="@+id/audioBitratePicker"
  253 + android:layout_width="wrap_content"
  254 + android:layout_height="wrap_content"
  255 + android:layout_marginLeft="5dp"
  256 + android:background="@drawable/edittext_background"
  257 + android:paddingBottom="5dp"
  258 + android:paddingLeft="10dp"
  259 + android:paddingRight="10dp"
  260 + android:paddingTop="5dp"
  261 + android:text="64"
  262 + android:textColor="#ffcc00"
  263 + android:textCursorDrawable="@drawable/edit_cursor_color" />
  264 + </LinearLayout>
185 265  
186   - <Button
187   - android:id="@+id/preview_params_confim"
188   - android:layout_width="100dp"
189   - android:layout_height="50dp"
190   - android:layout_gravity="center"
191   - android:text="确定" />
192   -</LinearLayout>
193 266 \ No newline at end of file
  267 +
  268 + <Button
  269 + android:id="@+id/preview_params_confim"
  270 + android:layout_width="match_parent"
  271 + android:layout_height="50dp"
  272 + android:layout_gravity="center"
  273 + android:layout_marginTop="10dp"
  274 + android:background="#ffcc00"
  275 + android:text="确定"
  276 + android:textColor="#ffffff" />
  277 +
  278 + </LinearLayout>
  279 +</RelativeLayout>
194 280 \ No newline at end of file
... ...
app/src/main/res/layout/short_video_beauty_choose.xml
... ... @@ -21,7 +21,7 @@
21 21 android:layout_height="wrap_content"
22 22 android:layout_gravity="center"
23 23 android:text="美颜类型:"
24   - android:textColor="@color/colorAccent"
  24 + android:textColor="@color/ffcc00"
25 25 android:textSize="16sp" />
26 26  
27 27 <android.support.v7.widget.AppCompatSpinner
... ... @@ -48,7 +48,7 @@
48 48 android:layout_height="wrap_content"
49 49 android:gravity="center"
50 50 android:text="磨皮"
51   - android:textColor="@color/colorAccent"
  51 + android:textColor="@color/ffcc00"
52 52 android:textSize="14sp" />
53 53  
54 54 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -72,7 +72,7 @@
72 72 android:layout_height="wrap_content"
73 73 android:gravity="center"
74 74 android:text="美白"
75   - android:textColor="@color/colorAccent"
  75 + android:textColor="@color/ffcc00"
76 76 android:textSize="14sp" />
77 77  
78 78 <android.support.v7.widget.AppCompatSeekBar
... ... @@ -97,7 +97,7 @@
97 97 android:layout_height="wrap_content"
98 98 android:gravity="center"
99 99 android:text="红润"
100   - android:textColor="@color/colorAccent"
  100 + android:textColor="@color/ffcc00"
101 101 android:textSize="14sp" />
102 102  
103 103 <android.support.v7.widget.AppCompatSeekBar
... ...
app/src/main/res/layout/short_video_bgm_item_layout.xml
... ... @@ -150,7 +150,7 @@
150 150 android:layout_gravity="center"
151 151 android:layout_marginLeft="50dp"
152 152 android:text="0"
153   - android:textColor="@color/colorAccent"
  153 + android:textColor="@color/ffcc00"
154 154 android:textSize="16sp" />
155 155  
156 156 <ImageView
... ...
app/src/main/res/layout/short_video_sticker_choose.xml
... ... @@ -21,7 +21,7 @@
21 21 android:layout_height="wrap_content"
22 22 android:layout_gravity="center"
23 23 android:text="贴纸类型:"
24   - android:textColor="@color/colorAccent"
  24 + android:textColor="@color/ffcc00"
25 25 android:textSize="16sp" />
26 26  
27 27 <android.support.v7.widget.AppCompatSpinner
... ...
app/src/main/res/layout/spinner_checked_layout.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@android:id/text1"
  4 + android:layout_width="match_parent"
  5 + android:layout_height="40dp"
  6 + android:gravity="center_vertical"
  7 + android:singleLine="true"
  8 + android:textColor="@color/ffcc00"
  9 + android:textSize="16sp">
  10 +
  11 +</CheckedTextView>
0 12 \ No newline at end of file
... ...
app/src/main/res/layout/spinner_item_layout.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <LinearLayout
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + android:orientation="vertical"
  8 + android:padding="10dp">
  9 +
  10 + <TextView
  11 + android:id="@+id/spinner_item_label"
  12 + android:layout_width="wrap_content"
  13 + android:layout_height="wrap_content"
  14 + android:layout_gravity="center"
  15 + android:gravity="center"
  16 + android:textSize="16sp" />
  17 +
  18 + </LinearLayout>
  19 +</layout>
0 20 \ No newline at end of file
... ...
app/src/main/res/layout/toolbar_my_video.xml
... ... @@ -24,7 +24,8 @@
24 24 android:singleLine="true"
25 25 android:text="there is a title"
26 26 android:textColor="@color/black"
27   - android:textSize="20sp" />
  27 + android:textSize="20sp"
  28 + android:onClick="onClick"/>
28 29  
29 30 <ImageView
30 31 android:id="@+id/record"
... ...
app/src/main/res/layout/upload_video_dialog.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="wrap_content"
  5 + android:orientation="vertical">
  6 +
  7 + <TextView
  8 + android:layout_width="wrap_content"
  9 + android:layout_height="wrap_content"
  10 + android:layout_gravity="center_horizontal"
  11 + android:layout_marginTop="10dp"
  12 + android:text="录入视频信息"
  13 + android:textColor="#ffcc00"
  14 + android:textSize="22sp" />
  15 +
  16 + <ImageView
  17 + android:id="@+id/cover_img"
  18 + android:layout_width="90dp"
  19 + android:layout_height="120dp"
  20 + android:layout_gravity="center_horizontal"
  21 + android:layout_marginTop="10dp" />
  22 +
  23 + <LinearLayout
  24 + android:layout_width="match_parent"
  25 + android:layout_height="wrap_content"
  26 + android:layout_marginTop="10dp"
  27 + android:orientation="horizontal"
  28 + android:padding="10dp">
  29 +
  30 + <TextView
  31 + android:id="@+id/video_title"
  32 + android:layout_width="wrap_content"
  33 + android:layout_height="wrap_content"
  34 + android:text="标题"
  35 + android:textColor="@color/black"
  36 + android:textSize="14sp" />
  37 +
  38 + <EditText
  39 + android:id="@+id/video_title_edit"
  40 + android:layout_width="match_parent"
  41 + android:layout_height="wrap_content"
  42 + android:layout_marginLeft="5dp"
  43 + android:background="@drawable/edittext_background"
  44 + android:hint="视频标题"
  45 + android:padding="5dp" />
  46 + </LinearLayout>
  47 +
  48 + <LinearLayout
  49 + android:layout_width="match_parent"
  50 + android:layout_height="wrap_content"
  51 + android:orientation="horizontal"
  52 + android:padding="10dp">
  53 +
  54 + <TextView
  55 + android:id="@+id/video_des"
  56 + android:layout_width="wrap_content"
  57 + android:layout_height="wrap_content"
  58 + android:text="描述"
  59 + android:textColor="@color/black"
  60 + android:textSize="14sp" />
  61 +
  62 + <EditText
  63 + android:id="@+id/video_des_edit"
  64 + android:layout_width="match_parent"
  65 + android:layout_height="wrap_content"
  66 + android:layout_marginLeft="5dp"
  67 + android:background="@drawable/edittext_background"
  68 + android:hint="视频描述"
  69 + android:padding="5dp" />
  70 + </LinearLayout>
  71 +
  72 + <LinearLayout
  73 + android:layout_width="match_parent"
  74 + android:layout_height="wrap_content"
  75 + android:layout_marginTop="15dp"
  76 + android:orientation="horizontal">
  77 +
  78 + <Button
  79 + android:id="@+id/cancel_btn"
  80 + android:layout_width="0dp"
  81 + android:layout_height="wrap_content"
  82 + android:layout_weight="1"
  83 + android:background="@drawable/edittext_background"
  84 + android:text="取消"
  85 + android:textColor="#ffcc00"
  86 + android:textSize="16sp" />
  87 +
  88 + <Button
  89 + android:id="@+id/config_btn"
  90 + android:layout_width="0dp"
  91 + android:layout_height="wrap_content"
  92 + android:layout_weight="1"
  93 + android:background="#ffcc00"
  94 + android:text="上传"
  95 + android:textColor="@color/text_white_color"
  96 + android:textSize="16sp" />
  97 + </LinearLayout>
  98 +</LinearLayout>
0 99 \ No newline at end of file
... ...
app/src/main/res/values/colors.xml
... ... @@ -16,7 +16,7 @@
16 16  
17 17 <color name="transparent">#00000000</color>
18 18 <color name="transparent1">#7fffffff</color><!--透明白色 -->
19   - <color name="transparent2">#616060</color><!--透明白色 -->
  19 + <color name="transparent2">#7f616060</color><!--透明白色 -->
20 20 <color name="record_progress_black">#2c2c2c</color>
21 21 <color name="record_progress_bg">#2c2c2c</color>
22 22 <color name="record_progress_blue">#368ca8</color>
... ... @@ -24,6 +24,7 @@
24 24 <color name="record_progress_red">#e85932</color>
25 25 <color name="record_title_bg_default">#919191</color>
26 26 <color name="record_title_bg_selected">#616060</color>
  27 + <color name="ffcc00">#ffcc00</color>
27 28 <color name="white">#ffffff</color>
28 29 <color name="color_text_normal_999">#999</color>
29 30 <color name="color_cutline_ececec">#ececec</color>
... ...
app/src/main/res/values/styles.xml
... ... @@ -21,6 +21,16 @@
21 21 <item name="android:backgroundDimEnabled">false</item><!--模糊-->
22 22 </style>
23 23  
  24 + <style name="RecordParamsDialog" parent="@android:style/Theme.DeviceDefault.Dialog">
  25 + <item name="android:windowFrame">@null</item><!--边框-->
  26 + <item name="android:windowIsFloating">true</item><!--是否浮现在activity之上-->
  27 + <item name="android:windowIsTranslucent">true</item><!--半透明-->
  28 + <item name="android:windowNoTitle">true</item><!--无标题-->
  29 + <item name="android:windowFullscreen">true</item>
  30 + <item name="android:windowBackground">@color/transparent</item><!--背景透明-->
  31 + <item name="android:backgroundDimEnabled">false</item><!--模糊-->
  32 + </style>
  33 +
24 34 <!--礼物弹出框的动画的style-->
25 35 <style name="gift_popwindow_anim_style">
26 36 <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
... ...