Commit 0812c7f1881aaf7846c7f587dc103c52c689ed34
1 parent
2767a923
短视频新增上传图片功能,完善短视频列表
Showing
16 changed files
with
211 additions
and
125 deletions
app/libs/libcnlivelive.jar
No preview for this file type
app/libs/libcnliveshortvideo.jar
No preview for this file type
app/src/main/AndroidManifest.xml
| ... | ... | @@ -128,7 +128,10 @@ |
| 128 | 128 | android:configChanges="orientation|keyboardHidden|screenSize" |
| 129 | 129 | android:screenOrientation="portrait" |
| 130 | 130 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 131 | - <activity android:name=".shortvideo.activity.ShortVideoPlayActivity"></activity> | |
| 131 | + <activity android:name=".shortvideo.activity.ShortVideoPlayActivity" | |
| 132 | + android:configChanges="orientation|keyboardHidden|screenSize" | |
| 133 | + android:screenOrientation="portrait" | |
| 134 | + android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | |
| 132 | 135 | </application> |
| 133 | 136 | |
| 134 | 137 | </manifest> |
| 135 | 138 | \ No newline at end of file | ... | ... |
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
| ... | ... | @@ -69,7 +69,7 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { |
| 69 | 69 | if (uid != 0) { |
| 70 | 70 | //进入个人中心页面 |
| 71 | 71 | Intent intent = new Intent(getActivity(), UserPersonalActivity.class); |
| 72 | - intent.putExtra("isEdit",false); | |
| 72 | + intent.putExtra("isEdit", false); | |
| 73 | 73 | startActivity(intent); |
| 74 | 74 | } else { |
| 75 | 75 | //进入登录页面 |
| ... | ... | @@ -81,7 +81,13 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { |
| 81 | 81 | startActivity(new Intent(getActivity(), CommentActivity.class)); |
| 82 | 82 | break; |
| 83 | 83 | case R.id.my_video: |
| 84 | - startActivity(new Intent(getActivity(), MyVideoActivity.class)); | |
| 84 | + int userId = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); | |
| 85 | + if (userId != 0) { | |
| 86 | + startActivity(new Intent(getActivity(), MyVideoActivity.class)); | |
| 87 | + | |
| 88 | + } else { | |
| 89 | + startActivity(new Intent(getActivity(), LoginActivity.class)); | |
| 90 | + } | |
| 85 | 91 | break; |
| 86 | 92 | |
| 87 | 93 | } |
| ... | ... | @@ -99,11 +105,11 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { |
| 99 | 105 | } |
| 100 | 106 | |
| 101 | 107 | private void notifyUI(boolean isLogin) { |
| 102 | - if(isLogin){ | |
| 108 | + if (isLogin) { | |
| 103 | 109 | User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); |
| 104 | 110 | Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg); |
| 105 | 111 | binding.tvNickname.setText(activeAccountInfo.getNickname()); |
| 106 | - }else{ | |
| 112 | + } else { | |
| 107 | 113 | Glide.with(getActivity()).load(R.drawable.cnlive_user_header).into(binding.headImg); |
| 108 | 114 | binding.tvNickname.setText(getString(R.string.click_login)); |
| 109 | 115 | } | ... | ... |
app/src/main/java/com/cnlive/gundam/shortvideo/activity/EditActivity.java
| ... | ... | @@ -49,10 +49,12 @@ import com.cnlive.gundam.R; |
| 49 | 49 | import com.cnlive.gundam.databinding.ActivityEditBinding; |
| 50 | 50 | import com.cnlive.gundam.shortvideo.sticker.StickerAdapter; |
| 51 | 51 | import com.cnlive.gundam.shortvideo.util.ColorPicker; |
| 52 | +import com.cnlive.gundam.shortvideo.util.FileUtils; | |
| 52 | 53 | import com.cnlive.gundam.shortvideo.videorange.HorizontalListView; |
| 53 | 54 | import com.cnlive.gundam.shortvideo.videorange.VideoRangeSeekBar; |
| 54 | 55 | import com.cnlive.gundam.shortvideo.videorange.VideoThumbnailAdapter; |
| 55 | 56 | import com.cnlive.gundam.shortvideo.videorange.VideoThumbnailInfo; |
| 57 | +import com.cnlive.gundam.user.auth.UserService; | |
| 56 | 58 | import com.cnlive.lib.upload.listener.CNPutObjectResponseListener; |
| 57 | 59 | import com.cnlive.lib.upload.model.UploadError; |
| 58 | 60 | import com.cnlive.libs.shortvideo.kit.CNEditKit; |
| ... | ... | @@ -844,11 +846,6 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 844 | 846 | Log.e(TAG, bitmap + " : " + strings[0]); |
| 845 | 847 | binding.editBarBottom.audioChoose.originAudioReverb.setSelection(0); |
| 846 | 848 | binding.editBarBottom.audioChoose.originAudioEffect.setSelection(0); |
| 847 | -// if (mComposeAlertDialog != null) { | |
| 848 | -// mComposeAlertDialog.composeFinished(strings[0]); | |
| 849 | -// mComposeFinished = true; | |
| 850 | -// } | |
| 851 | -// mEditKit.getUploadInfo(strings[0], "test.mp4", "", mPutObjectResponseListener); | |
| 852 | 849 | showVideoDialog(bitmap, strings[0]); |
| 853 | 850 | } |
| 854 | 851 | case ShortVideoConstants.SHORTVIDEO_COMPOSE_ABORTED: |
| ... | ... | @@ -869,7 +866,9 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 869 | 866 | |
| 870 | 867 | private AlertDialog uploadVideoMessageDialog; |
| 871 | 868 | |
| 872 | - public void showVideoDialog(Bitmap bitmap, final String fileUrl) { | |
| 869 | + public void showVideoDialog(final Bitmap bitmap, final String fileUrl) { | |
| 870 | + final String userId = String.valueOf(UserService.getInstance(this).getActiveAccountInfo().getUid()); | |
| 871 | + Log.e("Lynntest", userId); | |
| 873 | 872 | LayoutInflater layoutInflater = LayoutInflater.from(this); |
| 874 | 873 | View videoMesDialog = layoutInflater.inflate(R.layout.upload_video_dialog, null); |
| 875 | 874 | |
| ... | ... | @@ -906,7 +905,7 @@ public class EditActivity extends AppCompatActivity implements ActivityCompat.On |
| 906 | 905 | mComposeAlertDialog.composeFinished(fileUrl); |
| 907 | 906 | mComposeFinished = true; |
| 908 | 907 | } |
| 909 | - mEditKit.getUploadInfo(fileUrl, titleStr.concat(".mp4"), desStr, mPutObjectResponseListener); | |
| 908 | + mEditKit.getUploadInfo(userId, fileUrl, titleStr.concat(".mp4"), desStr, new File(FileUtils.saveBitmap(EditActivity.this, bitmap)), null, mPutObjectResponseListener); | |
| 910 | 909 | uploadVideoMessageDialog.dismiss(); |
| 911 | 910 | } else { |
| 912 | 911 | Toast.makeText(EditActivity.this, "标题不能为空哦~", Toast.LENGTH_SHORT).show(); | ... | ... |
app/src/main/java/com/cnlive/gundam/shortvideo/activity/ShortVideoActivity.java
| ... | ... | @@ -596,7 +596,7 @@ public class ShortVideoActivity extends AppCompatActivity { |
| 596 | 596 | break; |
| 597 | 597 | case R.id.short_video_record_right_img: |
| 598 | 598 | if (binding.shortVideoRecordBottomLayout.shortVideoRecordRightImg.getDrawable().getLevel() == 3) { |
| 599 | - Toast.makeText(ShortVideoActivity.this, "上传", Toast.LENGTH_SHORT).show(); | |
| 599 | +// Toast.makeText(ShortVideoActivity.this, "上传", Toast.LENGTH_SHORT).show(); | |
| 600 | 600 | onNextClick(); |
| 601 | 601 | |
| 602 | 602 | } else if (binding.shortVideoRecordBottomLayout.shortVideoRecordRightImg.getDrawable().getLevel() == 1) { | ... | ... |
app/src/main/java/com/cnlive/gundam/shortvideo/activity/ShortVideoPlayActivity.java
| ... | ... | @@ -178,6 +178,7 @@ public class ShortVideoPlayActivity extends AppCompatActivity { |
| 178 | 178 | toppanel = playBinding.topPlayerPanel; |
| 179 | 179 | playBinding.videoTitle.setText(name); |
| 180 | 180 | playBinding.videoDescription.setText(des); |
| 181 | + mPlayerSeekbar.setOnSeekBarChangeListener(mSeekBarListener); | |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | 184 | private MediaPlayer.OnPreparedListener mOnPreparedListener = new MediaPlayer.OnPreparedListener() { |
| ... | ... | @@ -239,7 +240,7 @@ public class ShortVideoPlayActivity extends AppCompatActivity { |
| 239 | 240 | private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() { |
| 240 | 241 | @Override |
| 241 | 242 | public void onCompletion(IMediaPlayer mp) { |
| 242 | - Toast.makeText(mContext, "OnCompletionListener, play complete.", Toast.LENGTH_LONG).show(); | |
| 243 | +// Toast.makeText(mContext, "OnCompletionListener, play complete.", Toast.LENGTH_LONG).show(); | |
| 243 | 244 | videoPlayEnd(); |
| 244 | 245 | } |
| 245 | 246 | }; |
| ... | ... | @@ -272,10 +273,10 @@ public class ShortVideoPlayActivity extends AppCompatActivity { |
| 272 | 273 | Log.d(TAG, "Buffering End."); |
| 273 | 274 | break; |
| 274 | 275 | case MediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START: |
| 275 | - Toast.makeText(mContext, "Audio Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 276 | +// Toast.makeText(mContext, "Audio Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 276 | 277 | break; |
| 277 | 278 | case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: |
| 278 | - Toast.makeText(mContext, "Video Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 279 | +// Toast.makeText(mContext, "Video Rendering Start", Toast.LENGTH_SHORT).show(); | |
| 279 | 280 | break; |
| 280 | 281 | // case MediaPlayer.MEDIA_INFO_SUGGEST_RELOAD: |
| 281 | 282 | // // Player find a new stream(video or audio), and we could reload the video. |
| ... | ... | @@ -283,7 +284,7 @@ public class ShortVideoPlayActivity extends AppCompatActivity { |
| 283 | 284 | // mVideoView.reload(mDataSource, false); |
| 284 | 285 | // break; |
| 285 | 286 | case MediaPlayer.MEDIA_INFO_RELOADED: |
| 286 | - Toast.makeText(mContext, "Succeed to reload video.", Toast.LENGTH_SHORT).show(); | |
| 287 | +// Toast.makeText(mContext, "Succeed to reload video.", Toast.LENGTH_SHORT).show(); | |
| 287 | 288 | Log.d(TAG, "Succeed to reload video."); |
| 288 | 289 | return false; |
| 289 | 290 | } |
| ... | ... | @@ -408,6 +409,9 @@ public class ShortVideoPlayActivity extends AppCompatActivity { |
| 408 | 409 | case R.id.player_start: |
| 409 | 410 | onPlayBtnClick(); |
| 410 | 411 | break; |
| 412 | + case R.id.back: | |
| 413 | + videoPlayEnd(); | |
| 414 | + break; | |
| 411 | 415 | } |
| 412 | 416 | } |
| 413 | 417 | ... | ... |
app/src/main/java/com/cnlive/gundam/shortvideo/fragment/MyVideoFragment.java
| ... | ... | @@ -57,6 +57,8 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener, |
| 57 | 57 | private Handler mMainHandler; |
| 58 | 58 | private int maxDuration; |
| 59 | 59 | |
| 60 | + private String userId; | |
| 61 | + | |
| 60 | 62 | public MyVideoFragment() { |
| 61 | 63 | // Required empty public constructor |
| 62 | 64 | } |
| ... | ... | @@ -92,8 +94,11 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener, |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | private void loadData() { |
| 97 | + userId = String.valueOf(UserService.getInstance(getActivity()).getActiveAccountInfo().getUid()); | |
| 98 | + | |
| 95 | 99 | Map<String, String> params = new HashMap<>(); |
| 96 | 100 | params.put("appId", Config.getAppId()); |
| 101 | + params.put("userId", userId); | |
| 97 | 102 | params.put("page", "1"); |
| 98 | 103 | params.put("pageSize", "15"); |
| 99 | 104 | params.put("platform_id", Config.getContext().getPackageName()); |
| ... | ... | @@ -132,13 +137,8 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener, |
| 132 | 137 | getActivity().finish(); |
| 133 | 138 | break; |
| 134 | 139 | case R.id.record: |
| 135 | - User user = UserService.getInstance(getActivity()).getActiveAccountInfo(); | |
| 136 | - if (user.getUid() == 0) { | |
| 137 | - startActivity(new Intent(getActivity(), LoginActivity.class)); | |
| 138 | - } else { | |
| 139 | - onRecordClick(); | |
| 140 | - onAuthClick(); | |
| 141 | - } | |
| 140 | + onRecordClick(); | |
| 141 | + onAuthClick(); | |
| 142 | 142 | break; |
| 143 | 143 | } |
| 144 | 144 | } |
| ... | ... | @@ -207,7 +207,7 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener, |
| 207 | 207 | public void run() { |
| 208 | 208 | AuthInfoManager.getInstance().removeAuthResultListener(mCheckAuthResultListener); |
| 209 | 209 | if (AuthInfoManager.getInstance().getAuthState()) { |
| 210 | - Toast.makeText(getActivity(), "Auth Success", Toast.LENGTH_SHORT).show(); | |
| 210 | +// Toast.makeText(getActivity(), "Auth Success", Toast.LENGTH_SHORT).show(); | |
| 211 | 211 | } else { |
| 212 | 212 | Toast.makeText(getActivity(), "Auth Failed", Toast.LENGTH_SHORT).show(); |
| 213 | 213 | } |
| ... | ... | @@ -243,6 +243,8 @@ public class MyVideoFragment extends Fragment implements View.OnClickListener, |
| 243 | 243 | if (model != null && "0".equals(model.getCode())) { |
| 244 | 244 | if (model.getData() == null) { |
| 245 | 245 | Toast.makeText(getActivity(), "暂无数据", Toast.LENGTH_SHORT).show(); |
| 246 | + binding.recyclerView.setVisibility(View.GONE); | |
| 247 | + binding.emptyView.setVisibility(View.VISIBLE); | |
| 246 | 248 | } else { |
| 247 | 249 | adapter.updateItems(model.getData().getList()); |
| 248 | 250 | } | ... | ... |
app/src/main/java/com/cnlive/gundam/shortvideo/model/ShortVideoInfo.java
| 1 | 1 | package com.cnlive.gundam.shortvideo.model; |
| 2 | 2 | |
| 3 | -import com.cnlive.gundam.shortvideo.util.DateUtils; | |
| 4 | - | |
| 5 | 3 | import java.io.Serializable; |
| 6 | 4 | |
| 7 | 5 | /** |
| ... | ... | @@ -9,33 +7,38 @@ import java.io.Serializable; |
| 9 | 7 | */ |
| 10 | 8 | |
| 11 | 9 | public class ShortVideoInfo implements Serializable { |
| 12 | - private String appId; | |
| 13 | - private String createTime; | |
| 10 | +// private String appId; | |
| 11 | +// private String createTime; | |
| 14 | 12 | private String description; |
| 15 | - private String id; | |
| 16 | - private String md5; | |
| 13 | +// private String id; | |
| 14 | +// private String md5; | |
| 17 | 15 | private String name; |
| 18 | - private String path; | |
| 19 | - private String spId; | |
| 16 | + private String picKey; | |
| 17 | +// private String path; | |
| 18 | +// private String spId; | |
| 20 | 19 | private String status; |
| 21 | - private String updateTime; | |
| 20 | +// private String updateTime; | |
| 22 | 21 | private String videoId; |
| 23 | 22 | |
| 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 | - } | |
| 23 | +// public String getAppId() { | |
| 24 | +// return appId; | |
| 25 | +// } | |
| 26 | +// | |
| 27 | +// public void setAppId(String appId) { | |
| 28 | +// this.appId = appId; | |
| 29 | +// } | |
| 30 | +// | |
| 31 | +// public String getCreateTime() { | |
| 32 | +// if (createTime != null) { | |
| 33 | +// return DateUtils.getDateToString(Long.parseLong(createTime)); | |
| 34 | +// }else { | |
| 35 | +// return ""; | |
| 36 | +// } | |
| 37 | +// } | |
| 38 | +// | |
| 39 | +// public void setCreateTime(String createTime) { | |
| 40 | +// this.createTime = createTime; | |
| 41 | +// } | |
| 39 | 42 | |
| 40 | 43 | public String getDescription() { |
| 41 | 44 | return description; |
| ... | ... | @@ -45,21 +48,21 @@ public class ShortVideoInfo implements Serializable { |
| 45 | 48 | this.description = description; |
| 46 | 49 | } |
| 47 | 50 | |
| 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 | - } | |
| 51 | +// public String getId() { | |
| 52 | +// return id; | |
| 53 | +// } | |
| 54 | +// | |
| 55 | +// public void setId(String id) { | |
| 56 | +// this.id = id; | |
| 57 | +// } | |
| 58 | +// | |
| 59 | +// public String getMd5() { | |
| 60 | +// return md5; | |
| 61 | +// } | |
| 62 | +// | |
| 63 | +// public void setMd5(String md5) { | |
| 64 | +// this.md5 = md5; | |
| 65 | +// } | |
| 63 | 66 | |
| 64 | 67 | public String getName() { |
| 65 | 68 | return name; |
| ... | ... | @@ -69,21 +72,29 @@ public class ShortVideoInfo implements Serializable { |
| 69 | 72 | this.name = name; |
| 70 | 73 | } |
| 71 | 74 | |
| 72 | - public String getPath() { | |
| 73 | - return path; | |
| 74 | - } | |
| 75 | - | |
| 76 | - public void setPath(String path) { | |
| 77 | - this.path = path; | |
| 75 | + public String getPicKey() { | |
| 76 | + return picKey; | |
| 78 | 77 | } |
| 79 | 78 | |
| 80 | - public String getSpId() { | |
| 81 | - return spId; | |
| 79 | + public void setPicKey(String picKey) { | |
| 80 | + this.picKey = picKey; | |
| 82 | 81 | } |
| 83 | 82 | |
| 84 | - public void setSpId(String spId) { | |
| 85 | - this.spId = spId; | |
| 86 | - } | |
| 83 | + // public String getPath() { | |
| 84 | +// return path; | |
| 85 | +// } | |
| 86 | +// | |
| 87 | +// public void setPath(String path) { | |
| 88 | +// this.path = path; | |
| 89 | +// } | |
| 90 | +// | |
| 91 | +// public String getSpId() { | |
| 92 | +// return spId; | |
| 93 | +// } | |
| 94 | +// | |
| 95 | +// public void setSpId(String spId) { | |
| 96 | +// this.spId = spId; | |
| 97 | +// } | |
| 87 | 98 | |
| 88 | 99 | public String getStatus() { |
| 89 | 100 | return status; |
| ... | ... | @@ -93,13 +104,13 @@ public class ShortVideoInfo implements Serializable { |
| 93 | 104 | this.status = status; |
| 94 | 105 | } |
| 95 | 106 | |
| 96 | - public String getUpdateTime() { | |
| 97 | - return updateTime; | |
| 98 | - } | |
| 99 | - | |
| 100 | - public void setUpdateTime(String updateTime) { | |
| 101 | - this.updateTime = updateTime; | |
| 102 | - } | |
| 107 | +// public String getUpdateTime() { | |
| 108 | +// return updateTime; | |
| 109 | +// } | |
| 110 | +// | |
| 111 | +// public void setUpdateTime(String updateTime) { | |
| 112 | +// this.updateTime = updateTime; | |
| 113 | +// } | |
| 103 | 114 | |
| 104 | 115 | public String getVideoId() { |
| 105 | 116 | return videoId; |
| ... | ... | @@ -112,16 +123,10 @@ public class ShortVideoInfo implements Serializable { |
| 112 | 123 | @Override |
| 113 | 124 | public String toString() { |
| 114 | 125 | return "ShortVideoInfo{" + |
| 115 | - "appId='" + appId + '\'' + | |
| 116 | - ", createTime='" + createTime + '\'' + | |
| 117 | - ", description='" + description + '\'' + | |
| 118 | - ", id='" + id + '\'' + | |
| 119 | - ", md5='" + md5 + '\'' + | |
| 126 | + "description='" + description + '\'' + | |
| 120 | 127 | ", name='" + name + '\'' + |
| 121 | - ", path='" + path + '\'' + | |
| 122 | - ", spId='" + spId + '\'' + | |
| 128 | + ", picKey='" + picKey + '\'' + | |
| 123 | 129 | ", status='" + status + '\'' + |
| 124 | - ", updateTime='" + updateTime + '\'' + | |
| 125 | 130 | ", videoId='" + videoId + '\'' + |
| 126 | 131 | '}'; |
| 127 | 132 | } | ... | ... |
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.graphics.Bitmap; | |
| 8 | 9 | import android.media.MediaMetadataRetriever; |
| 9 | 10 | import android.net.Uri; |
| 10 | 11 | import android.os.Build; |
| ... | ... | @@ -15,6 +16,9 @@ import android.util.Log; |
| 15 | 16 | import android.webkit.MimeTypeMap; |
| 16 | 17 | |
| 17 | 18 | import java.io.File; |
| 19 | +import java.io.FileOutputStream; | |
| 20 | +import java.io.IOException; | |
| 21 | +import java.util.UUID; | |
| 18 | 22 | |
| 19 | 23 | /** |
| 20 | 24 | * Created by Lynn on 6/28/2017. |
| ... | ... | @@ -308,4 +312,54 @@ public class FileUtils { |
| 308 | 312 | } |
| 309 | 313 | return duration; |
| 310 | 314 | } |
| 315 | + | |
| 316 | + | |
| 317 | + private static final String SD_PATH = "/sdcard/cn_sv_cover_img"; | |
| 318 | + private static final String IN_PATH = "/dskqxt/pic/"; | |
| 319 | + | |
| 320 | + /** | |
| 321 | + * 随机生产文件名 | |
| 322 | + * | |
| 323 | + * @return | |
| 324 | + */ | |
| 325 | + private static String generateFileName() { | |
| 326 | + return UUID.randomUUID().toString(); | |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * 保存bitmap到本地 | |
| 331 | + * | |
| 332 | + * @param context | |
| 333 | + * @param mBitmap | |
| 334 | + * @return | |
| 335 | + */ | |
| 336 | + public static String saveBitmap(Context context, Bitmap mBitmap) { | |
| 337 | + String savePath; | |
| 338 | + File filePic; | |
| 339 | + if (Environment.getExternalStorageState().equals( | |
| 340 | + Environment.MEDIA_MOUNTED)) { | |
| 341 | + savePath = SD_PATH; | |
| 342 | + } else { | |
| 343 | + savePath = context.getApplicationContext().getFilesDir() | |
| 344 | + .getAbsolutePath() | |
| 345 | + + IN_PATH; | |
| 346 | + } | |
| 347 | + try { | |
| 348 | + filePic = new File(savePath + generateFileName() + ".png"); | |
| 349 | + if (!filePic.exists()) { | |
| 350 | + filePic.getParentFile().mkdirs(); | |
| 351 | + filePic.createNewFile(); | |
| 352 | + } | |
| 353 | + FileOutputStream fos = new FileOutputStream(filePic); | |
| 354 | + mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); | |
| 355 | + fos.flush(); | |
| 356 | + fos.close(); | |
| 357 | + } catch (IOException e) { | |
| 358 | + // TODO Auto-generated catch block | |
| 359 | + e.printStackTrace(); | |
| 360 | + return null; | |
| 361 | + } | |
| 362 | + | |
| 363 | + return filePic.getAbsolutePath(); | |
| 364 | + } | |
| 311 | 365 | } | ... | ... |
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 | 3 | <item android:color="#ffcc00" android:state_activated="true" /> |
| 4 | - <item android:color="@android:color/white" /> | |
| 4 | + <item android:color="#EEE8AA" /> | |
| 5 | 5 | </selector> |
| 6 | 6 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_short_video_play.xml
app/src/main/res/layout/edit_bottombar.xml
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <RelativeLayout |
| 5 | 5 | android:layout_width="match_parent" |
| 6 | 6 | android:layout_height="match_parent" |
| 7 | - android:background="#616060"> | |
| 7 | + android:background="@color/white"> | |
| 8 | 8 | |
| 9 | 9 | <RelativeLayout |
| 10 | 10 | android:id="@+id/edit_layout" |
| ... | ... | @@ -106,7 +106,7 @@ |
| 106 | 106 | android:layout_width="match_parent" |
| 107 | 107 | android:layout_height="2px" |
| 108 | 108 | android:layout_below="@+id/edit_layout" |
| 109 | - android:background="#FF000000" /> | |
| 109 | + android:background="@color/ffcc00" /> | |
| 110 | 110 | |
| 111 | 111 | <FrameLayout |
| 112 | 112 | android:layout_width="match_parent" | ... | ... |
app/src/main/res/layout/edit_caption.xml
| ... | ... | @@ -21,8 +21,8 @@ |
| 21 | 21 | android:layout_weight="1" |
| 22 | 22 | android:hint="input text ..." |
| 23 | 23 | android:paddingLeft="8dp" |
| 24 | - android:textColor="#ffffff" | |
| 25 | - android:textColorHint="#ffffff" /> | |
| 24 | + android:textColor="#ffcc00" | |
| 25 | + android:textColorHint="#f0f0f0" /> | |
| 26 | 26 | |
| 27 | 27 | <ImageView |
| 28 | 28 | android:id="@+id/text_color" |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | android:layout_height="25dp" |
| 31 | 31 | android:layout_gravity="center_vertical" |
| 32 | 32 | android:layout_margin="10dp" |
| 33 | - android:background="#ffffff" | |
| 33 | + android:background="#ffcc00" | |
| 34 | 34 | android:onClick="onClick" /> |
| 35 | 35 | |
| 36 | 36 | </LinearLayout> | ... | ... |
app/src/main/res/layout/fragment_my_video.xml
| ... | ... | @@ -21,29 +21,39 @@ |
| 21 | 21 | android:layout_height="match_parent"> |
| 22 | 22 | |
| 23 | 23 | <android.support.v4.widget.SwipeRefreshLayout |
| 24 | - android:id="@+id/contentView" | |
| 25 | - android:layout_width="match_parent" | |
| 26 | - android:layout_height="match_parent"> | |
| 27 | - | |
| 28 | - <LinearLayout | |
| 24 | + android:id="@+id/contentView" | |
| 29 | 25 | android:layout_width="match_parent" |
| 30 | - android:layout_height="wrap_content" | |
| 31 | - android:orientation="vertical"> | |
| 26 | + android:layout_height="match_parent"> | |
| 32 | 27 | |
| 33 | - <include | |
| 34 | - android:id="@+id/myVideoIncludLayout" | |
| 35 | - layout="@layout/toolbar_my_video" /> | |
| 36 | - | |
| 37 | - <include layout="@layout/user_divider_head_line" /> | |
| 38 | - | |
| 39 | - <android.support.v7.widget.RecyclerView | |
| 40 | - android:id="@+id/recycler_view" | |
| 28 | + <LinearLayout | |
| 41 | 29 | android:layout_width="match_parent" |
| 42 | - android:layout_height="match_parent" | |
| 43 | - app:adapter="@{listAdapter}" | |
| 44 | - app:layoutManager="@{layoutManager}" /> | |
| 45 | - | |
| 46 | - </LinearLayout> | |
| 30 | + android:layout_height="wrap_content" | |
| 31 | + android:orientation="vertical"> | |
| 32 | + | |
| 33 | + <include | |
| 34 | + android:id="@+id/myVideoIncludLayout" | |
| 35 | + layout="@layout/toolbar_my_video" /> | |
| 36 | + | |
| 37 | + <include layout="@layout/user_divider_head_line" /> | |
| 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 | + | |
| 46 | + <TextView | |
| 47 | + android:id="@+id/empty_view" | |
| 48 | + android:layout_width="match_parent" | |
| 49 | + android:layout_height="match_parent" | |
| 50 | + android:layout_gravity="center" | |
| 51 | + android:gravity="center" | |
| 52 | + android:text="您还没有录制过视频\n\n快去录制吧⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾*" | |
| 53 | + android:textSize="20sp" | |
| 54 | + android:visibility="gone" /> | |
| 55 | + | |
| 56 | + </LinearLayout> | |
| 47 | 57 | </android.support.v4.widget.SwipeRefreshLayout> |
| 48 | 58 | </RelativeLayout> |
| 49 | 59 | ... | ... |
app/src/main/res/layout/layout_item_short_video.xml
| ... | ... | @@ -36,7 +36,9 @@ |
| 36 | 36 | android:id="@+id/cover_image" |
| 37 | 37 | android:layout_width="90dp" |
| 38 | 38 | android:layout_height="90dp" |
| 39 | - android:src="@drawable/default_pic" /> | |
| 39 | + android:padding="2dp" | |
| 40 | + app:error="@{@drawable/default_pic}" | |
| 41 | + app:imageUrl="@{shortVideoInfo.picKey}" /> | |
| 40 | 42 | |
| 41 | 43 | <LinearLayout |
| 42 | 44 | android:layout_width="match_parent" |
| ... | ... | @@ -53,14 +55,14 @@ |
| 53 | 55 | android:textColor="@color/black" |
| 54 | 56 | android:textSize="18sp" /> |
| 55 | 57 | |
| 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" /> | |
| 58 | + <!--<TextView--> | |
| 59 | + <!--android:id="@+id/video_time"--> | |
| 60 | + <!--android:layout_width="wrap_content"--> | |
| 61 | + <!--android:layout_height="wrap_content"--> | |
| 62 | + <!--android:layout_marginLeft="10dp"--> | |
| 63 | + <!--android:layout_marginTop="10dp"--> | |
| 64 | + <!--android:text="@{shortVideoInfo.createTime}"--> | |
| 65 | + <!--android:textSize="14sp" />--> | |
| 64 | 66 | |
| 65 | 67 | <TextView |
| 66 | 68 | android:id="@+id/video_description" | ... | ... |