调整代码位置,修改视频封面上传路径

This commit is contained in:
kehaoyuan
2019-09-05 18:34:37 +08:00
parent b77491e91e
commit 2e9ec0bde0
14 changed files with 32 additions and 29 deletions

View File

@ -27,7 +27,8 @@ object UploadImageUtils {
question,
answer,
suggestion,
icon
icon,
poster
}
// 不处理图片,只是单纯的上传

View File

@ -65,7 +65,7 @@ import com.gh.gamecenter.subject.SubjectActivity;
import com.gh.gamecenter.user.ApiResponse;
import com.gh.gamecenter.user.LoginTag;
import com.gh.gamecenter.user.UserViewModel;
import com.gh.gamecenter.video.VideoManagerActivity;
import com.gh.gamecenter.video.videomanager.VideoManagerActivity;
import com.halo.assistant.HaloApp;
import com.jakewharton.rxbinding2.view.RxView;
import com.lightgame.config.CommonDebug;
@ -374,7 +374,9 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
MtaHelper.onEvent("我的光环", "浏览记录");
break;
case R.id.personal_video_manager:
startActivity(VideoManagerActivity.getIntent(getContext(), "", "我的光环-视频投稿"));
CheckLoginUtils.checkLogin(getContext(), "我的光环-视频投稿", () -> {
startActivity(VideoManagerActivity.getIntent(getContext(), "", "我的光环-视频投稿"));
});
break;
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video.upload
package com.gh.gamecenter.video.upload.view
import android.app.Activity
import android.content.Context
@ -32,6 +32,8 @@ import com.gh.base.fragment.WaitingDialogFragment
import com.gh.common.view.DrawableView
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.mvvm.Status
import com.gh.gamecenter.video.upload.OnUploadListener
import com.gh.gamecenter.video.upload.UploadManager
import com.google.android.flexbox.FlexboxLayout
import org.json.JSONArray
import java.io.File
@ -174,7 +176,8 @@ class UploadVideoActivity : BaseActivity() {
override fun onMenuItemClick(item: MenuItem): Boolean {
if (item.itemId == R.id.menu_text) {
if (UploadManager.isUploading(mVideoFileEntity?.path ?: "")) {
if (UploadManager.isUploading(mVideoFileEntity?.path
?: "")) {
DialogUtils.showUploadDraftDialog(this@UploadVideoActivity, null, {
verifyData(true)
})
@ -342,7 +345,7 @@ class UploadVideoActivity : BaseActivity() {
val mimeTypeMap = MimeTypeMap.getSingleton()
val format = mimeTypeMap.getExtensionFromMimeType(contentResolver.getType(fileUri))
mVideoFileEntity = VideoFileEntity(videoPath, null, timeInSecond, videoFile.length() / 1024, format
mVideoFileEntity = VideoFileEntity(videoPath, null, timeInSecond, videoFile.length(), format
?: "")
createUploadTask(videoPath)
@ -389,7 +392,7 @@ class UploadVideoActivity : BaseActivity() {
override fun handleBackPressed(): Boolean {
DialogUtils.showAlertDialog(this, "提示",
"视频正在上传中,确定要返回吗?", "确定返回",
"暂时不了", DialogUtils.ConfirmListener {finish()}, null)
"暂时不了", DialogUtils.ConfirmListener { finish() }, null)
return true
}

View File

@ -1,8 +1,7 @@
package com.gh.gamecenter.video.upload
package com.gh.gamecenter.video.upload.view
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import com.gh.common.util.toJson
@ -19,11 +18,8 @@ import android.media.ThumbnailUtils
import android.provider.MediaStore
import androidx.lifecycle.MediatorLiveData
import com.gh.base.fragment.WaitingDialogFragment
import com.gh.common.util.GzipUtils.compress
import com.halo.assistant.HaloApp
import java.io.File
import java.io.FileOutputStream
import com.gh.common.util.GzipUtils.compress
import com.gh.common.util.UploadImageUtils
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.manager.UserManager
@ -112,7 +108,7 @@ class UploadVideoViewModel(application: Application) : AndroidViewModel(applicat
Utils.toast(application, "视频封面操作失败")
}
UploadImageUtils.compressAndUploadImage(UploadImageUtils.UploadType.answer, imagePath, true,
UploadImageUtils.compressAndUploadImage(UploadImageUtils.UploadType.poster, imagePath, true,
object : UploadImageUtils.OnUploadImageListener {
override fun onSuccess(imageUrl: String) {
content.poster = imageUrl

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video.upload
package com.gh.gamecenter.video.upload.view
data class VideoFileEntity(
val path: String,

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.app.Activity
import android.content.Context
@ -13,7 +13,8 @@ import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
import com.gh.gamecenter.baselist.ListAdapter
import com.gh.gamecenter.databinding.VideoItemBinding
import com.gh.gamecenter.entity.VideoDraftEntity
import com.gh.gamecenter.video.upload.UploadVideoActivity
import com.gh.gamecenter.video.VideoItemViewHolder
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
class MyDraftAdapter(context: Context,
private val mViewModel: MyDraftViewModel,

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.content.Intent
import android.os.Bundle
@ -7,7 +7,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.baselist.ListFragment
import com.gh.gamecenter.entity.VideoDraftEntity
import com.gh.gamecenter.video.upload.UploadVideoActivity
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
class MyDraftFragment : ListFragment<VideoDraftEntity, MyDraftViewModel>() {

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.app.Application
import com.gh.common.util.ErrorHelper

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.content.Context
import android.view.View
@ -11,8 +11,8 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
import com.gh.gamecenter.baselist.ListAdapter
import com.gh.gamecenter.databinding.VideoItemBinding
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.entity.VideoVerifyEntity
import com.gh.gamecenter.video.VideoItemViewHolder
import com.lightgame.utils.Utils
class MyVideoAdapter(context: Context,

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.content.Intent
import android.os.Bundle
@ -7,7 +7,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.baselist.ListFragment
import com.gh.gamecenter.entity.VideoVerifyEntity
import com.gh.gamecenter.video.upload.UploadVideoActivity
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
class MyVideoFragment : ListFragment<VideoVerifyEntity, MyVideoViewModel>() {

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.app.Application
import com.gh.gamecenter.baselist.ListViewModel

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.video
package com.gh.gamecenter.video.videomanager
import android.content.Context
import android.content.Intent
@ -10,11 +10,10 @@ import androidx.fragment.app.Fragment
import com.gh.base.BaseActivity
import com.gh.base.BaseActivity_TabLayout
import com.gh.common.util.EntranceUtils
import com.gh.common.util.GhMatisseFilter
import com.gh.common.util.GhMatisseVideoApplyFilter
import com.gh.common.util.GhMatisseVideoFilter
import com.gh.gamecenter.R
import com.gh.gamecenter.video.upload.UploadVideoActivity
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.MimeType
import com.zhihu.matisse.internal.utils.PathUtils