Feature: move VideoLayout.kt from format to model

pull/209/head
xufuji456 3 years ago
parent 0de5201683
commit d9db302e5a
  1. 2
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt
  2. 2
      app/src/main/java/com/frank/ffmpeg/model/VideoLayout.kt
  3. 2
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
  4. 13
      app/src/main/java/com/frank/ffmpeg/view/VisualizerView.kt
  5. 1
      app/src/main/res/values/colors.xml

@ -17,7 +17,7 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.frank.ffmpeg.FFmpegCmd import com.frank.ffmpeg.FFmpegCmd
import com.frank.ffmpeg.R import com.frank.ffmpeg.R
import com.frank.ffmpeg.adapter.WaterfallAdapter import com.frank.ffmpeg.adapter.WaterfallAdapter
import com.frank.ffmpeg.format.VideoLayout import com.frank.ffmpeg.model.VideoLayout
import com.frank.ffmpeg.gif.HighQualityGif import com.frank.ffmpeg.gif.HighQualityGif
import com.frank.ffmpeg.handler.FFmpegHandler import com.frank.ffmpeg.handler.FFmpegHandler
import com.frank.ffmpeg.tool.JsonParseTool import com.frank.ffmpeg.tool.JsonParseTool

@ -1,4 +1,4 @@
package com.frank.ffmpeg.format package com.frank.ffmpeg.model
/** /**
* layout of video * layout of video

@ -1,7 +1,7 @@
package com.frank.ffmpeg.util; package com.frank.ffmpeg.util;
import com.frank.ffmpeg.FFmpegApplication; import com.frank.ffmpeg.FFmpegApplication;
import com.frank.ffmpeg.format.VideoLayout; import com.frank.ffmpeg.model.VideoLayout;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;

@ -81,11 +81,11 @@ class VisualizerView : View {
} }
} }
private fun drawWave(canvas: Canvas, i: Int, reversal: Boolean) { private fun drawWave(canvas: Canvas, i: Int, reverse: Boolean) {
if (pointList == null || pointList!!.size < 2) { if (pointList == null || pointList!!.size < 2) {
return return
} }
val ratio = SCALE * if (reversal) -1 else 1 val ratio = SCALE * if (reverse) -1 else 1
if (i < pointList!!.size - 2) { if (i < pointList!!.size - 2) {
val point = pointList!![i] val point = pointList!![i]
val nextPoint = pointList!![i + 1] val nextPoint = pointList!![i + 1]
@ -101,8 +101,8 @@ class VisualizerView : View {
} }
} }
private fun drawLump(canvas: Canvas, i: Int, reversal: Boolean) { private fun drawLump(canvas: Canvas, i: Int, reverse: Boolean) {
val minus = if (reversal) -1 else 1 val minus = if (reverse) -1 else 1
val top = LUMP_MAX_HEIGHT - (LUMP_MIN_HEIGHT + waveData!![i] * SCALE) * minus val top = LUMP_MAX_HEIGHT - (LUMP_MIN_HEIGHT + waveData!![i] * SCALE) * minus
canvas.drawRect((LUMP_SIZE * i).toFloat(), canvas.drawRect((LUMP_SIZE * i).toFloat(),
@ -137,8 +137,7 @@ class VisualizerView : View {
enum class ShowStyle { enum class ShowStyle {
STYLE_HOLLOW_LUMP, STYLE_HOLLOW_LUMP,
STYLE_WAVE, STYLE_WAVE
STYLE_NOTHING
} }
companion object { companion object {
@ -149,7 +148,7 @@ class VisualizerView : View {
private const val LUMP_MIN_HEIGHT = LUMP_WIDTH private const val LUMP_MIN_HEIGHT = LUMP_WIDTH
private const val LUMP_MAX_HEIGHT = 200 private const val LUMP_MAX_HEIGHT = 200
private const val LUMP_SIZE = LUMP_WIDTH + LUMP_SPACE private const val LUMP_SIZE = LUMP_WIDTH + LUMP_SPACE
private val LUMP_COLOR = Color.parseColor("#6de6f6") private val LUMP_COLOR = Color.parseColor("#00eeee")
private const val WAVE_SAMPLING_INTERVAL = 3 private const val WAVE_SAMPLING_INTERVAL = 3

@ -9,5 +9,4 @@
<color name="blueBtn">#00DDFF</color> <color name="blueBtn">#00DDFF</color>
<color name="gray">#BEBEBE</color> <color name="gray">#BEBEBE</color>
<color name="orange">#FF9800</color> <color name="orange">#FF9800</color>
<color name="trasnsWhite">#32FFFFFF</color>
</resources> </resources>

Loading…
Cancel
Save