Commit 8fdbf84becbadc6439242f1edd3758435c4bfa79
1 parent
dd835253
添加短视频编辑页面,添加视频列表接口及短视频播放页面
Showing
65 changed files
with
1800 additions
and
270 deletions
app/libs/libcnliveshortvideo.jar
No preview for this file type
app/src/main/AndroidManifest.xml
| ... | ... | @@ -113,9 +113,22 @@ |
| 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"></activity> | |
| 119 | 132 | </application> |
| 120 | 133 | |
| 121 | 134 | </manifest> |
| 122 | 135 | \ 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/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,7 +47,6 @@ 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; |
| 57 | 52 | import com.cnlive.gundam.shortvideo.videorange.HorizontalListView; |
| ... | ... | @@ -62,7 +57,6 @@ import com.cnlive.lib.upload.listener.CNPutObjectResponseListener; |
| 62 | 57 | import com.cnlive.lib.upload.model.UploadError; |
| 63 | 58 | import com.cnlive.libs.shortvideo.kit.CNEditKit; |
| 64 | 59 | import com.cnlive.libs.shortvideo.utils.base.ShortVideoConstants; |
| 65 | -import com.cnlive.libs.shortvideo.view.CNStickerView; | |
| 66 | 60 | import com.cnlive.libs.shortvideo.view.CNTextView; |
| 67 | 61 | import com.cnlive.libs.shortvideo.view.base.ICNTextView; |
| 68 | 62 | import com.cnlive.libs.shortvideo.view.info.CNStickerHelpBoxInfo; |
| ... | ... | @@ -75,12 +69,14 @@ import com.cnlive.libs.util.Config; |
| 75 | 69 | import com.cnlive.libs.video.video.MediaPlayer; |
| 76 | 70 | import com.cnlive.libs.video.video.base.IDataSource; |
| 77 | 71 | import com.cnlive.libs.video.video.base.IMediaPlayer; |
| 72 | +import com.googlecode.mp4parser.authoring.Edit; | |
| 78 | 73 | |
| 79 | 74 | import org.apache.http.Header; |
| 80 | 75 | |
| 81 | 76 | import java.io.File; |
| 82 | 77 | import java.io.IOException; |
| 83 | 78 | import java.io.InputStream; |
| 79 | +import java.util.ArrayList; | |
| 84 | 80 | import java.util.HashMap; |
| 85 | 81 | import java.util.LinkedList; |
| 86 | 82 | import java.util.List; |
| ... | ... | @@ -127,6 +123,14 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 127 | 123 | private SeekBarChangedObserver mSeekBarChangedObserver; |
| 128 | 124 | |
| 129 | 125 | public final static String SRC_URL = "srcurl"; |
| 126 | + public final static String DURATION = "duration"; | |
| 127 | + public final static String FRAME_RATE = "framerate"; | |
| 128 | + public final static String VIDEO_BITRATE = "video_bitrate"; | |
| 129 | + public final static String AUDIO_BITRATE = "audio_bitrate"; | |
| 130 | + public final static String VIDEO_RESOLUTION = "video_resolution"; | |
| 131 | + public final static String ENCODE_TYPE = "encode_type"; | |
| 132 | + public final static String ENCODE_METHOD = "encode_method"; | |
| 133 | + public final static String ENCODE_PROFILE = "encode_profile"; | |
| 130 | 134 | |
| 131 | 135 | private String mLogoPath = "assets://Logo/cnlive_logo.png"; |
| 132 | 136 | private String mBgmPath = "/sdcard/uncle.mp3"; |
| ... | ... | @@ -153,13 +157,32 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 153 | 157 | |
| 154 | 158 | // private ImageView screenShot; |
| 155 | 159 | |
| 160 | + private int duration; | |
| 161 | + private int frameRate; | |
| 162 | + private int videoBitrate; | |
| 163 | + private int audioBitrate; | |
| 164 | + private int videoResolution; | |
| 165 | + private int encode_type; | |
| 166 | + private int encode_method; | |
| 167 | + private int encodeProfile; | |
| 156 | 168 | private ActivityEditBinding binding; |
| 157 | 169 | |
| 158 | - public static void startActivity(Context context, String srcUrl) { | |
| 170 | + public static void startActivity(Context context, String srcUrl, int duration, int frameRate, | |
| 171 | + int videoBitrate, int audioBitrate, | |
| 172 | + int videoResolution, | |
| 173 | + int encodeType, int encodeMethod, int encodeProfile) { | |
| 159 | 174 | Intent intent = new Intent(context, EditActivity.class); |
| 160 | 175 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 161 | 176 | |
| 162 | 177 | intent.putExtra(SRC_URL, srcUrl); |
| 178 | + intent.putExtra(DURATION, duration); | |
| 179 | + intent.putExtra(FRAME_RATE, frameRate); | |
| 180 | + intent.putExtra(VIDEO_BITRATE, videoBitrate); | |
| 181 | + intent.putExtra(AUDIO_BITRATE, audioBitrate); | |
| 182 | + intent.putExtra(VIDEO_RESOLUTION, videoResolution); | |
| 183 | + intent.putExtra(ENCODE_TYPE, encodeType); | |
| 184 | + intent.putExtra(ENCODE_METHOD, encodeMethod); | |
| 185 | + intent.putExtra(ENCODE_PROFILE, encodeProfile); | |
| 163 | 186 | context.startActivity(intent); |
| 164 | 187 | } |
| 165 | 188 | |
| ... | ... | @@ -174,8 +197,8 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 174 | 197 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
| 175 | 198 | |
| 176 | 199 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
| 177 | - initView(); | |
| 178 | 200 | initEditKit(); |
| 201 | + initView(); | |
| 179 | 202 | mInputMethodManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); |
| 180 | 203 | } |
| 181 | 204 | |
| ... | ... | @@ -236,6 +259,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 236 | 259 | |
| 237 | 260 | binding.clickToPause.getDrawable().setLevel(2); |
| 238 | 261 | |
| 262 | + binding.hint.setText("上传视频最大长度为 " + duration + "s"); | |
| 239 | 263 | binding.editBarBottom.clickToFilter.setActivated(true); |
| 240 | 264 | binding.editBarBottom.beautyChoose.getRoot().setVisibility(View.VISIBLE); |
| 241 | 265 | BottomViewInfo filterView = new BottomViewInfo(binding.editBarBottom.clickToFilter, binding.editBarBottom.beautyChoose.getRoot()); |
| ... | ... | @@ -321,6 +345,14 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 321 | 345 | private void initData() { |
| 322 | 346 | Bundle bundle = getIntent().getExtras(); |
| 323 | 347 | String url = bundle.getString(SRC_URL); |
| 348 | + duration = bundle.getInt(DURATION, 0); | |
| 349 | + frameRate = bundle.getInt(FRAME_RATE, 0); | |
| 350 | + videoBitrate = bundle.getInt(VIDEO_BITRATE, 0); | |
| 351 | + audioBitrate = bundle.getInt(AUDIO_BITRATE, 0); | |
| 352 | + videoResolution = bundle.getInt(VIDEO_RESOLUTION, 0); | |
| 353 | + encode_type = bundle.getInt(ENCODE_TYPE); | |
| 354 | + encode_method = bundle.getInt(ENCODE_METHOD); | |
| 355 | + encodeProfile = bundle.getInt(ENCODE_PROFILE); | |
| 324 | 356 | if (!TextUtils.isEmpty(url)) { |
| 325 | 357 | mEditKit.setEditPreviewUrl(url); |
| 326 | 358 | } |
| ... | ... | @@ -547,43 +579,28 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 547 | 579 | |
| 548 | 580 | private void onNextClick() { |
| 549 | 581 | //配置合成参数 |
| 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 | - } | |
| 582 | + mEditKit.setTargetResolution(videoResolution); | |
| 583 | + mEditKit.setVideoFps(frameRate); | |
| 584 | + mEditKit.setVideoCodecId(encode_type); | |
| 585 | + mEditKit.setVideoEncodeProfile(encodeProfile); | |
| 586 | + mEditKit.setAudioKBitrate(audioBitrate); | |
| 587 | + mEditKit.setVideoKBitrate(videoBitrate); | |
| 588 | + //关闭上一次合成窗口 | |
| 589 | + if (mComposeAlertDialog != null) { | |
| 590 | + mComposeAlertDialog.closeDialog(); | |
| 591 | + } | |
| 571 | 592 | |
| 572 | - mComposeAlertDialog = new ComposeAlertDialog(EditActivity.this, R.style.dialog); | |
| 573 | - //设置合成路径 | |
| 593 | + mComposeAlertDialog = new ComposeAlertDialog(EditActivity.this, R.style.dialog); | |
| 594 | + //设置合成路径 | |
| 574 | 595 | |
| 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 | - }); | |
| 596 | + String fileFolder = "/sdcard/cn_sv_compose_test"; | |
| 597 | + File file = new File(fileFolder); | |
| 598 | + if (!file.exists()) { | |
| 599 | + file.mkdir(); | |
| 600 | + } | |
| 601 | + String composeUrl = fileFolder + "/" + System.currentTimeMillis() + ".mp4"; | |
| 602 | + Log.d(TAG, "compose Url:" + composeUrl); | |
| 603 | + mEditKit.startCompose(composeUrl); | |
| 587 | 604 | |
| 588 | 605 | } |
| 589 | 606 | |
| ... | ... | @@ -803,7 +820,6 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 803 | 820 | } |
| 804 | 821 | }; |
| 805 | 822 | |
| 806 | - | |
| 807 | 823 | private CNEditKit.OnInfoListener mOnInfoListener = new CNEditKit.OnInfoListener() { |
| 808 | 824 | @Override |
| 809 | 825 | public Object onInfo(int type, Bitmap bitmap, final String... strings) { |
| ... | ... | @@ -828,11 +844,12 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 828 | 844 | Log.e(TAG, bitmap + " : " + strings[0]); |
| 829 | 845 | binding.editBarBottom.audioChoose.originAudioReverb.setSelection(0); |
| 830 | 846 | 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); | |
| 847 | +// if (mComposeAlertDialog != null) { | |
| 848 | +// mComposeAlertDialog.composeFinished(strings[0]); | |
| 849 | +// mComposeFinished = true; | |
| 850 | +// } | |
| 851 | +// mEditKit.getUploadInfo(strings[0], "test.mp4", "", mPutObjectResponseListener); | |
| 852 | + showVideoDialog(bitmap, strings[0]); | |
| 836 | 853 | } |
| 837 | 854 | case ShortVideoConstants.SHORTVIDEO_COMPOSE_ABORTED: |
| 838 | 855 | break; |
| ... | ... | @@ -850,6 +867,56 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 850 | 867 | } |
| 851 | 868 | }; |
| 852 | 869 | |
| 870 | + private AlertDialog uploadVideoMessageDialog; | |
| 871 | + | |
| 872 | + public void showVideoDialog(Bitmap bitmap, final String fileUrl) { | |
| 873 | + LayoutInflater layoutInflater = LayoutInflater.from(this); | |
| 874 | + View videoMesDialog = layoutInflater.inflate(R.layout.upload_video_dialog, null); | |
| 875 | + | |
| 876 | + ImageView imageView = videoMesDialog.findViewById(R.id.cover_img); | |
| 877 | + imageView.setImageBitmap(bitmap); | |
| 878 | + final EditText title = videoMesDialog.findViewById(R.id.video_title_edit); | |
| 879 | + final EditText des = videoMesDialog.findViewById(R.id.video_des_edit); | |
| 880 | + Button cancelBtn = videoMesDialog.findViewById(R.id.cancel_btn); | |
| 881 | + Button configBtn = videoMesDialog.findViewById(R.id.config_btn); | |
| 882 | + | |
| 883 | + | |
| 884 | + uploadVideoMessageDialog = new AlertDialog.Builder(EditActivity.this) | |
| 885 | + .setView(videoMesDialog) | |
| 886 | + .setCancelable(false) | |
| 887 | + .show(); | |
| 888 | + | |
| 889 | + cancelBtn.setOnClickListener(new View.OnClickListener() { | |
| 890 | + @Override | |
| 891 | + public void onClick(View view) { | |
| 892 | + mComposeAlertDialog.closeDialog(); | |
| 893 | + resumeEditPreview(); | |
| 894 | + uploadVideoMessageDialog.dismiss(); | |
| 895 | + } | |
| 896 | + }); | |
| 897 | + | |
| 898 | + configBtn.setOnClickListener(new View.OnClickListener() { | |
| 899 | + @Override | |
| 900 | + public void onClick(View view) { | |
| 901 | + String titleStr = title.getText().toString(); | |
| 902 | + String desStr = des.getText().toString(); | |
| 903 | + | |
| 904 | + if (titleStr != null && !titleStr.equals("")) { | |
| 905 | + if (mComposeAlertDialog != null) { | |
| 906 | + mComposeAlertDialog.composeFinished(fileUrl); | |
| 907 | + mComposeFinished = true; | |
| 908 | + } | |
| 909 | + mEditKit.getUploadInfo(fileUrl, titleStr.concat(".mp4"), desStr, mPutObjectResponseListener); | |
| 910 | + uploadVideoMessageDialog.dismiss(); | |
| 911 | + } else { | |
| 912 | + Toast.makeText(EditActivity.this, "标题不能为空哦~", Toast.LENGTH_SHORT).show(); | |
| 913 | + } | |
| 914 | + } | |
| 915 | + }); | |
| 916 | + | |
| 917 | + | |
| 918 | + } | |
| 919 | + | |
| 853 | 920 | |
| 854 | 921 | private StickerAdapter.OnStickerItemClick mOnStickerItemClick = new StickerAdapter.OnStickerItemClick() { |
| 855 | 922 | @Override |
| ... | ... | @@ -982,7 +1049,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 982 | 1049 | public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
| 983 | 1050 | TextView textView = ((TextView) parent.getChildAt(0)); |
| 984 | 1051 | if (textView != null) { |
| 985 | - textView.setTextColor(getResources().getColor(R.color.colorAccent)); | |
| 1052 | + textView.setTextColor(getResources().getColor(R.color.ffcc00)); | |
| 986 | 1053 | } |
| 987 | 1054 | switch (position) { |
| 988 | 1055 | 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: |
| ... | ... | @@ -520,7 +600,6 @@ public class ShortVideoActivity extends AppCompatActivity { |
| 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 | + } | |
| 182 | + | |
| 183 | + private MediaPlayer.OnPreparedListener mOnPreparedListener = new MediaPlayer.OnPreparedListener() { | |
| 184 | + @Override | |
| 185 | + public void onPrepared(IMediaPlayer mediaplayer) { | |
| 186 | + mVideoWidth = mVideoView.getVideoWidth(); | |
| 187 | + mVideoHeight = mVideoView.getVideoHeight(); | |
| 188 | + | |
| 189 | + // Set Video Scaling Mode | |
| 190 | + mVideoView.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); | |
| 191 | + | |
| 192 | + //start player | |
| 193 | + mVideoView.start(); | |
| 194 | + | |
| 195 | + //set progress | |
| 196 | + setVideoProgress(0); | |
| 197 | + | |
| 198 | + mPlayerPosition.setVisibility(View.VISIBLE); | |
| 199 | + mLoadText.setVisibility(View.VISIBLE); | |
| 200 | + | |
| 201 | + mHandler.removeMessages(HIDDEN_SEEKBAR); | |
| 202 | + Message msg = new Message(); | |
| 203 | + msg.what = HIDDEN_SEEKBAR; | |
| 204 | + mHandler.sendMessageDelayed(msg, 3000); | |
| 205 | + } | |
| 206 | + }; | |
| 207 | + | |
| 208 | + private IMediaPlayer.OnBufferingUpdateListener mOnBufferingUpdateListener = new IMediaPlayer.OnBufferingUpdateListener() { | |
| 209 | + @Override | |
| 210 | + public void onBufferingUpdate(IMediaPlayer mp, int percent) { | |
| 211 | + long duration = mVideoView.getDuration(); | |
| 212 | + long progress = duration * percent / 100; | |
| 213 | + mPlayerSeekbar.setSecondaryProgress((int) progress); | |
| 214 | + } | |
| 215 | + }; | |
| 216 | + | |
| 217 | + private IMediaPlayer.OnVideoSizeChangedListener mOnVideoSizeChangeListener = new IMediaPlayer.OnVideoSizeChangedListener() { | |
| 218 | + @Override | |
| 219 | + public void onVideoSizeChanged(IMediaPlayer mp, int width, int height, int sarNum, int sarDen) { | |
| 220 | + if (mVideoWidth > 0 && mVideoHeight > 0) { | |
| 221 | + if (width != mVideoWidth || height != mVideoHeight) { | |
| 222 | + mVideoWidth = mp.getVideoWidth(); | |
| 223 | + mVideoHeight = mp.getVideoHeight(); | |
| 224 | + | |
| 225 | + if (mVideoView != null) | |
| 226 | + mVideoView.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING); | |
| 227 | + } | |
| 228 | + } | |
| 229 | + } | |
| 230 | + }; | |
| 231 | + | |
| 232 | + private IMediaPlayer.OnSeekCompleteListener mOnSeekCompletedListener = new IMediaPlayer.OnSeekCompleteListener() { | |
| 233 | + @Override | |
| 234 | + public void onSeekComplete(IMediaPlayer mp) { | |
| 235 | + Log.e(TAG, "onSeekComplete..............."); | |
| 236 | + } | |
| 237 | + }; | |
| 238 | + | |
| 239 | + private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() { | |
| 240 | + @Override | |
| 241 | + public void onCompletion(IMediaPlayer mp) { | |
| 242 | + Toast.makeText(mContext, "OnCompletionListener, play complete.", Toast.LENGTH_LONG).show(); | |
| 243 | + videoPlayEnd(); | |
| 244 | + } | |
| 245 | + }; | |
| 246 | + | |
| 247 | + private IMediaPlayer.OnErrorListener mOnErrorListener = new IMediaPlayer.OnErrorListener() { | |
| 248 | + @Override | |
| 249 | + public boolean onError(IMediaPlayer mp, int what, int extra) { | |
| 250 | + switch (what) { | |
| 251 | + case MediaPlayer.MEDIA_ERROR_UNKNOWN: | |
| 252 | + Log.e(TAG, "OnErrorListener, Error Unknown:" + what + ",extra:" + extra); | |
| 253 | + break; | |
| 254 | + default: | |
| 255 | + Log.e(TAG, "OnErrorListener, Error:" + what + ",extra:" + extra); | |
| 256 | + } | |
| 257 | + | |
| 258 | + videoPlayEnd(); | |
| 259 | + | |
| 260 | + return false; | |
| 261 | + } | |
| 262 | + }; | |
| 263 | + | |
| 264 | + public IMediaPlayer.OnInfoListener mOnInfoListener = new IMediaPlayer.OnInfoListener() { | |
| 265 | + @Override | |
| 266 | + public boolean onInfo(IMediaPlayer iMediaPlayer, int i, int i1) { | |
| 267 | + switch (i) { | |
| 268 | + case MediaPlayer.MEDIA_INFO_BUFFERING_START: | |
| 269 | + Log.d(TAG, "Buffering Start."); | |
| 270 | + break; | |
| 271 | + case MediaPlayer.MEDIA_INFO_BUFFERING_END: | |
| 272 | + Log.d(TAG, "Buffering End."); | |
| 273 | + break; | |
| 274 | + case MediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START: | |
| 275 | + Toast.makeText(mContext, "Audio Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 276 | + break; | |
| 277 | + case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: | |
| 278 | + Toast.makeText(mContext, "Video Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 279 | + break; | |
| 280 | +// case MediaPlayer.MEDIA_INFO_SUGGEST_RELOAD: | |
| 281 | +// // Player find a new stream(video or audio), and we could reload the video. | |
| 282 | +// if (mVideoView != null) | |
| 283 | +// mVideoView.reload(mDataSource, false); | |
| 284 | +// break; | |
| 285 | + case MediaPlayer.MEDIA_INFO_RELOADED: | |
| 286 | + Toast.makeText(mContext, "Succeed to reload video.", Toast.LENGTH_SHORT).show(); | |
| 287 | + Log.d(TAG, "Succeed to reload video."); | |
| 288 | + return false; | |
| 289 | + } | |
| 290 | + return false; | |
| 291 | + } | |
| 292 | + }; | |
| 293 | + | |
| 294 | + private View.OnTouchListener mTouchListener = new View.OnTouchListener() { | |
| 295 | + @Override | |
| 296 | + public boolean onTouch(View v, MotionEvent event) { | |
| 297 | + dealTouchEvent(v, event); | |
| 298 | + return false; | |
| 299 | + } | |
| 300 | + }; | |
| 301 | + | |
| 302 | + public IMediaPlayer.OnPlayStateListener mOnPlayStateListener = new IMediaPlayer.OnPlayStateListener() { | |
| 303 | + @Override | |
| 304 | + public void onPlayState(boolean played) { | |
| 305 | + mPlayerStartBtn.setBackgroundResource(played ? R.drawable.pause : R.drawable.play); | |
| 306 | + } | |
| 307 | + }; | |
| 308 | + | |
| 309 | + private int mVideoProgress = 0; | |
| 310 | + private SeekBar.OnSeekBarChangeListener mSeekBarListener = new SeekBar.OnSeekBarChangeListener() { | |
| 311 | + @Override | |
| 312 | + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { | |
| 313 | + if (fromUser) { | |
| 314 | + mVideoProgress = progress; | |
| 315 | + mHandler.removeMessages(HIDDEN_SEEKBAR); | |
| 316 | + Message msg = new Message(); | |
| 317 | + msg.what = HIDDEN_SEEKBAR; | |
| 318 | + mHandler.sendMessageDelayed(msg, 3000); | |
| 319 | + } | |
| 320 | + } | |
| 321 | + | |
| 322 | + @Override | |
| 323 | + public void onStartTrackingTouch(SeekBar seekBar) { | |
| 324 | + | |
| 325 | + } | |
| 326 | + | |
| 327 | + @Override | |
| 328 | + public void onStopTrackingTouch(SeekBar seekBar) { | |
| 329 | + mVideoView.seekTo(mVideoProgress); | |
| 330 | + setVideoProgress(mVideoProgress); | |
| 331 | + } | |
| 332 | + }; | |
| 333 | + | |
| 334 | + | |
| 335 | + public int setVideoProgress(int currentProgress) { | |
| 336 | + | |
| 337 | + if (mVideoView == null) | |
| 338 | + return -1; | |
| 339 | + | |
| 340 | + long time = currentProgress > 0 ? currentProgress : mVideoView.getCurrentPosition(); | |
| 341 | + long length = mVideoView.getDuration(); | |
| 342 | + | |
| 343 | + // Update all view elements | |
| 344 | + mPlayerSeekbar.setMax((int) length); | |
| 345 | + mPlayerSeekbar.setProgress((int) time); | |
| 346 | + | |
| 347 | + if (time >= 0) { | |
| 348 | + String progress = millisToString(time, false) + "/" + millisToString(length, false); | |
| 349 | + mPlayerPosition.setText(progress); | |
| 350 | + } | |
| 351 | + | |
| 352 | + Message msg = new Message(); | |
| 353 | + msg.what = UPDATE_SEEKBAR; | |
| 354 | + | |
| 355 | + if (mHandler != null) | |
| 356 | + mHandler.sendMessageDelayed(msg, 1000); | |
| 357 | + return (int) time; | |
| 358 | + } | |
| 359 | + | |
| 360 | + String millisToString(long millis, boolean text) { | |
| 361 | + boolean negative = millis < 0; | |
| 362 | + millis = Math.abs(millis); | |
| 363 | + | |
| 364 | + millis /= 1000; | |
| 365 | + int sec = (int) (millis % 60); | |
| 366 | + millis /= 60; | |
| 367 | + int min = (int) (millis % 60); | |
| 368 | + millis /= 60; | |
| 369 | + int hours = (int) millis; | |
| 370 | + | |
| 371 | + String time; | |
| 372 | + DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(Locale.US); | |
| 373 | + format.applyPattern("00"); | |
| 374 | + if (text) { | |
| 375 | + if (millis > 0) | |
| 376 | + time = (negative ? "-" : "") + hours + "h" + format.format(min) + "min"; | |
| 377 | + else if (min > 0) | |
| 378 | + time = (negative ? "-" : "") + min + "min"; | |
| 379 | + else | |
| 380 | + time = (negative ? "-" : "") + sec + "s"; | |
| 381 | + } else { | |
| 382 | + if (millis > 0) | |
| 383 | + time = (negative ? "-" : "") + hours + ":" + format.format(min) + ":" + format.format(sec); | |
| 384 | + else | |
| 385 | + time = (negative ? "-" : "") + min + ":" + format.format(sec); | |
| 386 | + } | |
| 387 | + return time; | |
| 388 | + } | |
| 389 | + | |
| 390 | + private void videoPlayEnd() { | |
| 391 | + if (mVideoView != null) { | |
| 392 | + mVideoView.release(); | |
| 393 | + mVideoView = null; | |
| 394 | + } | |
| 395 | + | |
| 396 | + | |
| 397 | + mHandler = null; | |
| 398 | + | |
| 399 | + finish(); | |
| 400 | + } | |
| 401 | + | |
| 402 | + public void onClick(View view) { | |
| 403 | + mHandler.removeMessages(HIDDEN_SEEKBAR); | |
| 404 | + Message msg = new Message(); | |
| 405 | + msg.what = HIDDEN_SEEKBAR; | |
| 406 | + mHandler.sendMessageDelayed(msg, 3000); | |
| 407 | + switch (view.getId()) { | |
| 408 | + case R.id.player_start: | |
| 409 | + onPlayBtnClick(); | |
| 410 | + break; | |
| 411 | + } | |
| 412 | + } | |
| 413 | + | |
| 414 | + private void onPlayBtnClick() { | |
| 415 | + mPause = !mPause; | |
| 416 | + mHandler.removeMessages(HIDDEN_SEEKBAR); | |
| 417 | + Message msg = new Message(); | |
| 418 | + msg.what = HIDDEN_SEEKBAR; | |
| 419 | + mHandler.sendMessageDelayed(msg, 3000); | |
| 420 | + if (mPause) { | |
| 421 | + mVideoView.pause(); | |
| 422 | + } else { | |
| 423 | + mVideoView.start(); | |
| 424 | + } | |
| 425 | + } | |
| 426 | + | |
| 427 | + // Maybe we could support gesture detect | |
| 428 | + private void dealTouchEvent(View view, MotionEvent event) { | |
| 429 | + mPlayerPanelShow = !mPlayerPanelShow; | |
| 430 | + | |
| 431 | + if (mPlayerPanelShow) { | |
| 432 | + mPlayerPanel.setVisibility(View.VISIBLE); | |
| 433 | + toppanel.setVisibility(View.VISIBLE); | |
| 434 | + | |
| 435 | + Message msg = new Message(); | |
| 436 | + msg.what = HIDDEN_SEEKBAR; | |
| 437 | + mHandler.sendMessageDelayed(msg, 3000); | |
| 438 | + } else { | |
| 439 | + mPlayerPanel.setVisibility(View.GONE); | |
| 440 | + toppanel.setVisibility(View.GONE); | |
| 441 | + mHandler.removeMessages(HIDDEN_SEEKBAR); | |
| 442 | + } | |
| 443 | + } | |
| 444 | + | |
| 445 | +} | ... | ... |
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,26 @@ 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; | |
| 34 | 59 | |
| 35 | 60 | public MyVideoFragment() { |
| 36 | 61 | // Required empty public constructor |
| ... | ... | @@ -42,17 +67,38 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener { |
| 42 | 67 | } |
| 43 | 68 | |
| 44 | 69 | @Override |
| 70 | + public void onCreate(@Nullable Bundle savedInstanceState) { | |
| 71 | + super.onCreate(savedInstanceState); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 45 | 75 | public View onCreateView(LayoutInflater inflater, ViewGroup container, |
| 46 | 76 | Bundle savedInstanceState) { |
| 47 | 77 | binding = DataBindingUtil.inflate(inflater, R.layout.fragment_my_video, container, false); |
| 78 | + binding.setListAdapter(adapter = new DataBindingAdapter(getActivity(), R.layout.layout_item_short_video, BR.shortVideoInfo)); | |
| 79 | + adapter.setOnViewClickListener(this); | |
| 80 | + adapter.setOnLoadMoreListener(this); | |
| 81 | + binding.setLayoutManager(new LinearLayoutManager(getActivity())); | |
| 82 | + binding.contentView.setOnRefreshListener(this); | |
| 48 | 83 | return binding.getRoot(); |
| 49 | 84 | } |
| 50 | 85 | |
| 51 | 86 | @Override |
| 52 | - public void onActivityCreated(@Nullable Bundle savedInstanceState) { | |
| 53 | - super.onActivityCreated(savedInstanceState); | |
| 87 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 88 | + super.onViewCreated(view, savedInstanceState); | |
| 54 | 89 | mMainHandler = new Handler(); |
| 55 | 90 | initToolBar(); |
| 91 | + loadData(); | |
| 92 | + } | |
| 93 | + | |
| 94 | + private void loadData() { | |
| 95 | + Map<String, String> params = new HashMap<>(); | |
| 96 | + params.put("appId", Config.getAppId()); | |
| 97 | + params.put("page", "1"); | |
| 98 | + params.put("pageSize", "15"); | |
| 99 | + params.put("platform_id", Config.getContext().getPackageName()); | |
| 100 | + params.put("timestamp", String.valueOf(System.currentTimeMillis())); | |
| 101 | + RetrofitUtil.getApiService().getShortVideoList(SignUtil.getSignParamM(getActivity(), params)).enqueue(this); | |
| 56 | 102 | } |
| 57 | 103 | |
| 58 | 104 | @Override |
| ... | ... | @@ -86,12 +132,12 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener { |
| 86 | 132 | getActivity().finish(); |
| 87 | 133 | break; |
| 88 | 134 | case R.id.record: |
| 89 | - onAuthClick(); | |
| 90 | 135 | User user = UserService.getInstance(getActivity()).getActiveAccountInfo(); |
| 91 | 136 | if (user.getUid() == 0) { |
| 92 | 137 | startActivity(new Intent(getActivity(), LoginActivity.class)); |
| 93 | 138 | } else { |
| 94 | - startActivity(new Intent(getActivity(), ShortVideoActivity.class)); | |
| 139 | + onRecordClick(); | |
| 140 | + onAuthClick(); | |
| 95 | 141 | } |
| 96 | 142 | break; |
| 97 | 143 | } |
| ... | ... | @@ -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) { |
| ... | ... | @@ -141,5 +216,47 @@ 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 | + } | |
| 144 | 233 | |
| 234 | + @Override | |
| 235 | + public void onLoadMore() { | |
| 236 | + } | |
| 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 | + } else { | |
| 247 | + adapter.updateItems(model.getData().getList()); | |
| 248 | + } | |
| 249 | + } else { | |
| 250 | + Toast.makeText(getActivity(), "获取数据失败1 " + model.getCode() + " : " + model.getMessage(), Toast.LENGTH_SHORT).show(); | |
| 251 | + } | |
| 252 | + } else { | |
| 253 | + Toast.makeText(getActivity(), "获取数据失败2", Toast.LENGTH_SHORT).show(); | |
| 254 | + } | |
| 255 | + } | |
| 256 | + | |
| 257 | + @Override | |
| 258 | + public void onFailure(Call<ShortVideoDataModel> call, Throwable t) { | |
| 259 | + binding.contentView.setRefreshing(false); | |
| 260 | + Toast.makeText(getActivity(), "获取数据失败3", Toast.LENGTH_SHORT).show(); | |
| 261 | + } | |
| 145 | 262 | } | ... | ... |
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 com.cnlive.gundam.shortvideo.util.DateUtils; | |
| 4 | + | |
| 5 | +import java.io.Serializable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by Lynn on 2017/7/14. | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class ShortVideoInfo implements Serializable { | |
| 12 | + private String appId; | |
| 13 | + private String createTime; | |
| 14 | + private String description; | |
| 15 | + private String id; | |
| 16 | + private String md5; | |
| 17 | + private String name; | |
| 18 | + private String path; | |
| 19 | + private String spId; | |
| 20 | + private String status; | |
| 21 | + private String updateTime; | |
| 22 | + private String videoId; | |
| 23 | + | |
| 24 | + public String getAppId() { | |
| 25 | + return appId; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setAppId(String appId) { | |
| 29 | + this.appId = appId; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public String getCreateTime() { | |
| 33 | + return DateUtils.getDateToString(Long.parseLong(createTime)); | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setCreateTime(String createTime) { | |
| 37 | + this.createTime = createTime; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public String getDescription() { | |
| 41 | + return description; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setDescription(String description) { | |
| 45 | + this.description = description; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public String getId() { | |
| 49 | + return id; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setId(String id) { | |
| 53 | + this.id = id; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getMd5() { | |
| 57 | + return md5; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setMd5(String md5) { | |
| 61 | + this.md5 = md5; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public String getName() { | |
| 65 | + return name; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setName(String name) { | |
| 69 | + this.name = name; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public String getPath() { | |
| 73 | + return path; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setPath(String path) { | |
| 77 | + this.path = path; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getSpId() { | |
| 81 | + return spId; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setSpId(String spId) { | |
| 85 | + this.spId = spId; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public String getStatus() { | |
| 89 | + return status; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setStatus(String status) { | |
| 93 | + this.status = status; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getUpdateTime() { | |
| 97 | + return updateTime; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setUpdateTime(String updateTime) { | |
| 101 | + this.updateTime = updateTime; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getVideoId() { | |
| 105 | + return videoId; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setVideoId(String videoId) { | |
| 109 | + this.videoId = videoId; | |
| 110 | + } | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public String toString() { | |
| 114 | + return "ShortVideoInfo{" + | |
| 115 | + "appId='" + appId + '\'' + | |
| 116 | + ", createTime='" + createTime + '\'' + | |
| 117 | + ", description='" + description + '\'' + | |
| 118 | + ", id='" + id + '\'' + | |
| 119 | + ", md5='" + md5 + '\'' + | |
| 120 | + ", name='" + name + '\'' + | |
| 121 | + ", path='" + path + '\'' + | |
| 122 | + ", spId='" + spId + '\'' + | |
| 123 | + ", status='" + status + '\'' + | |
| 124 | + ", updateTime='" + updateTime + '\'' + | |
| 125 | + ", videoId='" + videoId + '\'' + | |
| 126 | + '}'; | |
| 127 | + } | |
| 128 | +} | ... | ... |
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,7 @@ 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.media.MediaMetadataRetriever; | |
| 8 | 9 | import android.net.Uri; |
| 9 | 10 | import android.os.Build; |
| 10 | 11 | import android.os.Environment; |
| ... | ... | @@ -289,4 +290,22 @@ public class FileUtils { |
| 289 | 290 | return ""; |
| 290 | 291 | } |
| 291 | 292 | } |
| 293 | + | |
| 294 | + public static String getDuration(String uri) { | |
| 295 | + String duration = null; | |
| 296 | + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); | |
| 297 | + try { | |
| 298 | + if (uri != null) { | |
| 299 | + mmr.setDataSource(uri); | |
| 300 | + duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); | |
| 301 | + } else { | |
| 302 | + Log.d("getUploadInfo", "path should not null"); | |
| 303 | + } | |
| 304 | + } catch (IllegalArgumentException e) { | |
| 305 | + e.printStackTrace(); | |
| 306 | + } catch (IllegalStateException e) { | |
| 307 | + e.printStackTrace(); | |
| 308 | + } | |
| 309 | + return duration; | |
| 310 | + } | |
| 292 | 311 | } | ... | ... |
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
app/src/main/res/drawable-hdpi/ic_short_video_back_recording.png
app/src/main/res/drawable-hdpi/ic_short_video_next.png
app/src/main/res/drawable-hdpi/ic_short_video_next_recording.png
app/src/main/res/drawable-mdpi/default_pic.png
0 → 100644
1003 Bytes
app/src/main/res/drawable-mdpi/ic_short_video_back.png
app/src/main/res/drawable-mdpi/ic_short_video_back_recording.png
app/src/main/res/drawable-mdpi/ic_short_video_next.png
app/src/main/res/drawable-mdpi/ic_short_video_next_recording.png
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
app/src/main/res/drawable-xhdpi/ic_short_video_back_recording.png
app/src/main/res/drawable-xhdpi/ic_short_video_next.png
app/src/main/res/drawable-xhdpi/ic_short_video_next_recording.png
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
app/src/main/res/drawable-xxhdpi/ic_short_video_back_recording.png
app/src/main/res/drawable-xxhdpi/ic_short_video_next.png
app/src/main/res/drawable-xxhdpi/ic_short_video_next_recording.png
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
app/src/main/res/drawable-xxxhdpi/ic_short_video_back_recording.png
app/src/main/res/drawable-xxxhdpi/ic_short_video_next.png
app/src/main/res/drawable-xxxhdpi/ic_short_video_next_recording.png
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
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="@android:color/white" /> | |
| 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:src="@drawable/player_back" /> | |
| 46 | + | |
| 47 | + <TextView | |
| 48 | + android:id="@+id/video_title" | |
| 49 | + android:layout_width="wrap_content" | |
| 50 | + android:layout_height="wrap_content" | |
| 51 | + android:layout_gravity="center" | |
| 52 | + android:textColor="@color/text_white_color" /> | |
| 53 | + </LinearLayout> | |
| 54 | + | |
| 55 | + <LinearLayout | |
| 56 | + android:layout_width="match_parent" | |
| 57 | + android:layout_height="wrap_content" | |
| 58 | + android:layout_alignParentBottom="true" | |
| 59 | + android:background="@color/transparent2" | |
| 60 | + android:orientation="vertical"> | |
| 61 | + | |
| 62 | + <TextView | |
| 63 | + android:id="@+id/video_description" | |
| 64 | + android:layout_width="match_parent" | |
| 65 | + android:layout_height="wrap_content" | |
| 66 | + android:layout_alignParentBottom="true" | |
| 67 | + android:ellipsize="end" | |
| 68 | + android:padding="10dp" | |
| 69 | + android:singleLine="true" | |
| 70 | + android:textColor="@color/text_white_color" /> | |
| 71 | + | |
| 72 | + <LinearLayout | |
| 73 | + android:id="@+id/player_panel" | |
| 74 | + android:layout_width="match_parent" | |
| 75 | + android:layout_height="50dp"> | |
| 76 | + | |
| 77 | + <ImageView | |
| 78 | + android:id="@+id/player_start" | |
| 79 | + android:layout_width="40dp" | |
| 80 | + android:layout_height="40dp" | |
| 81 | + android:layout_marginTop="10dp" | |
| 82 | + android:background="@drawable/play_state" | |
| 83 | + android:onClick="onClick" /> | |
| 84 | + | |
| 85 | + <RelativeLayout | |
| 86 | + android:layout_width="match_parent" | |
| 87 | + android:layout_height="wrap_content" | |
| 88 | + android:layout_marginTop="10dp"> | |
| 89 | + | |
| 90 | + | |
| 91 | + <TextView | |
| 92 | + android:id="@+id/player_time" | |
| 93 | + android:layout_width="wrap_content" | |
| 94 | + android:layout_height="wrap_content" | |
| 95 | + android:layout_alignParentLeft="true" | |
| 96 | + android:text="00:00/00:00" /> | |
| 97 | + | |
| 98 | + <SeekBar | |
| 99 | + android:id="@+id/player_seekbar" | |
| 100 | + android:layout_width="match_parent" | |
| 101 | + android:layout_height="wrap_content" | |
| 102 | + android:layout_below="@+id/player_time" | |
| 103 | + android:focusable="true" /> | |
| 104 | + | |
| 105 | + </RelativeLayout> | |
| 106 | + | |
| 107 | + </LinearLayout> | |
| 108 | + </LinearLayout> | |
| 109 | + </RelativeLayout> | |
| 110 | +</layout> | |
| 0 | 111 | \ 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/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 | |
| 23 | + <android.support.v4.widget.SwipeRefreshLayout | |
| 24 | + android:id="@+id/contentView" | |
| 25 | + android:layout_width="match_parent" | |
| 26 | + android:layout_height="match_parent"> | |
| 27 | + | |
| 6 | 28 | <LinearLayout |
| 7 | 29 | android:layout_width="match_parent" |
| 8 | 30 | android:layout_height="wrap_content" |
| ... | ... | @@ -14,7 +36,15 @@ |
| 14 | 36 | |
| 15 | 37 | <include layout="@layout/user_divider_head_line" /> |
| 16 | 38 | |
| 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}" /> | |
| 45 | + | |
| 17 | 46 | </LinearLayout> |
| 47 | + </android.support.v4.widget.SwipeRefreshLayout> | |
| 18 | 48 | </RelativeLayout> |
| 19 | 49 | |
| 20 | 50 | ... | ... |
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<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:src="@drawable/default_pic" /> | |
| 40 | + | |
| 41 | + <LinearLayout | |
| 42 | + android:layout_width="match_parent" | |
| 43 | + android:layout_height="90dp" | |
| 44 | + android:layout_marginLeft="10dp" | |
| 45 | + android:gravity="center_vertical" | |
| 46 | + android:orientation="vertical"> | |
| 47 | + | |
| 48 | + <TextView | |
| 49 | + android:id="@+id/video_name" | |
| 50 | + android:layout_width="wrap_content" | |
| 51 | + android:layout_height="wrap_content" | |
| 52 | + android:text="@{shortVideoInfo.name}" | |
| 53 | + android:textColor="@color/black" | |
| 54 | + android:textSize="18sp" /> | |
| 55 | + | |
| 56 | + <TextView | |
| 57 | + android:id="@+id/video_time" | |
| 58 | + android:layout_width="wrap_content" | |
| 59 | + android:layout_height="wrap_content" | |
| 60 | + android:layout_marginLeft="10dp" | |
| 61 | + android:layout_marginTop="10dp" | |
| 62 | + android:text="@{shortVideoInfo.createTime}" | |
| 63 | + android:textSize="14sp" /> | |
| 64 | + | |
| 65 | + <TextView | |
| 66 | + android:id="@+id/video_description" | |
| 67 | + android:layout_width="wrap_content" | |
| 68 | + android:layout_height="wrap_content" | |
| 69 | + android:layout_marginLeft="10dp" | |
| 70 | + android:layout_marginTop="3dp" | |
| 71 | + android:text="@{shortVideoInfo.description}" | |
| 72 | + android:textSize="14sp" /> | |
| 73 | + | |
| 74 | + </LinearLayout> | |
| 75 | + | |
| 76 | + </LinearLayout> | |
| 77 | + | |
| 78 | + <View | |
| 79 | + android:layout_width="match_parent" | |
| 80 | + android:layout_height="1dp" | |
| 81 | + android:background="@color/gray_line_color" /> | |
| 82 | + | |
| 83 | + </LinearLayout> | |
| 84 | +</layout> | |
| 0 | 85 | \ 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
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
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,4 +24,5 @@ |
| 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 | </resources> | ... | ... |
app/src/main/res/values/styles.xml
| ... | ... | @@ -20,4 +20,14 @@ |
| 20 | 20 | <item name="android:windowBackground">@color/transparent</item><!--背景透明--> |
| 21 | 21 | <item name="android:backgroundDimEnabled">false</item><!--模糊--> |
| 22 | 22 | </style> |
| 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> | |
| 23 | 33 | </resources> | ... | ... |