Skip to content

Commit

Permalink
common 和 videoedit 改成kotlin语言
Browse files Browse the repository at this point in the history
  • Loading branch information
aaatttcccc committed Feb 24, 2022
1 parent 2bac858 commit b39cc45
Show file tree
Hide file tree
Showing 20 changed files with 398 additions and 503 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/zhongjh/cameraapp/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// 某些手机拍摄没有自带宽高,那么我们可以自己获取
if (localFile.getWidth() == 0 && localFile.isVideo()) {
MediaExtraInfo mediaExtraInfo = MediaUtils.getVideoSize(getApplication(), localFile.getPath());
localFile.setWidth(mediaExtraInfo.getWidth());
localFile.setHeight(mediaExtraInfo.getHeight());
localFile.setDuration(mediaExtraInfo.getDuration());
localFile.setWidth(mediaExtraInfo.width);
localFile.setHeight(mediaExtraInfo.height);
localFile.setDuration(mediaExtraInfo.duration);
}
Log.i(TAG, "onResult 宽高: " + localFile.getWidth() + "x" + localFile.getHeight());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ public void onResult(List<LocalFile> result) {
// 某些手机拍摄没有自带宽高,那么我们可以自己获取
if (localFile.getWidth() == 0 && localFile.isVideo()) {
MediaExtraInfo mediaExtraInfo = MediaUtils.getVideoSize(getApplication(), localFile.getPath());
localFile.setWidth(mediaExtraInfo.getWidth());
localFile.setHeight(mediaExtraInfo.getHeight());
localFile.setDuration(mediaExtraInfo.getDuration());
localFile.setWidth(mediaExtraInfo.width);
localFile.setHeight(mediaExtraInfo.height);
localFile.setDuration(mediaExtraInfo.duration);
}
Log.d(TAG, "onResult 宽高: " + localFile.getWidth() + "x" + localFile.getHeight());
Log.d(TAG, UriUtils.uriToFile(getApplicationContext(), localFile.getUri()).getPath());
Expand Down
4 changes: 0 additions & 4 deletions combined/src/main/java/com/zhongjh/combined/Combined.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ public Combined(Activity activity, int requestCode,

@Override
public void onAddDataSuccess(@NotNull List<MultiMediaView> multiMediaViews) {
// // 如果需要其他参数的话,循环数据初始化相关数值,这个读取时间会较长,建议异步线程执行
// for (MultiMediaView item : multiMediaViews) {
// item.initDataByPath();
// }
}

@Override
Expand Down
20 changes: 10 additions & 10 deletions common/src/main/java/com/zhongjh/common/entity/IncapableCause.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ class IncapableCause {
/**
* 默认toast模式
*/
private var mForm = TOAST
private var mTitle: String? = null
private val mMessage: String
private var form = TOAST
private var title: String? = null
private val message: String

constructor(message: String) {
mMessage = message
this.message = message
}

constructor(@Form form: Int, message: String) {
mForm = form
mMessage = message
this.form = form
this.message = message
}

companion object {
Expand All @@ -62,16 +62,16 @@ class IncapableCause {
if (cause == null) {
return
}
when (cause.mForm) {
when (cause.form) {
NONE -> {
}
DIALOG -> {
val incapableDialog: IncapableDialog? = IncapableDialog.newInstance(cause.mTitle, cause.mMessage)
val incapableDialog: IncapableDialog? = IncapableDialog.newInstance(cause.title, cause.message)
incapableDialog?.show((context as FragmentActivity).supportFragmentManager,
IncapableDialog::class.java.name)
}
TOAST -> Toast.makeText(context, cause.mMessage, Toast.LENGTH_SHORT).show()
else -> Toast.makeText(context, cause.mMessage, Toast.LENGTH_SHORT).show()
TOAST -> Toast.makeText(context, cause.message, Toast.LENGTH_SHORT).show()
else -> Toast.makeText(context, cause.message, Toast.LENGTH_SHORT).show()
}
}
}
Expand Down
38 changes: 0 additions & 38 deletions common/src/main/java/com/zhongjh/common/entity/MediaExtraInfo.java

This file was deleted.

13 changes: 13 additions & 0 deletions common/src/main/java/com/zhongjh/common/entity/MediaExtraInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.zhongjh.common.entity

/**
* 多媒体参数类
*
* @author zhongjh
* @date 2022/2/08
*/
class MediaExtraInfo {
var width: Int = 0
var height: Int = 0
var duration: Long = 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ interface VideoEditListener {
* @param progress 进度百分比
* @param progressTime 进度时间
*/
fun onProgress(progress: Int, progressTime: Long);
fun onProgress(progress: Int, progressTime: Long)

/**
* 取消
*/
fun onCancel();
fun onCancel()

/**
* 异常
* @param message 信息
*/
fun onError(message: String);
fun onError(message: String)

}
31 changes: 0 additions & 31 deletions common/src/main/java/com/zhongjh/common/utils/AppUtils.java

This file was deleted.

23 changes: 23 additions & 0 deletions common/src/main/java/com/zhongjh/common/utils/AppUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.zhongjh.common.utils

import android.content.Context

/**
*
* 跟App相关的辅助类
* @author zhongjh
* @date 2021/9/10
*/
object AppUtils {
/**
* 获取应用程序名称
*/
@JvmStatic
fun getAppName(context: Context): String {
val packageManager = context.packageManager
val packageInfo = packageManager.getPackageInfo(
context.packageName, 0)
val labelRes = packageInfo.applicationInfo.labelRes
return context.resources.getString(labelRes)
}
}
148 changes: 0 additions & 148 deletions common/src/main/java/com/zhongjh/common/utils/MediaUtils.java

This file was deleted.

Loading

0 comments on commit b39cc45

Please sign in to comment.