Skip to content

Commit

Permalink
Merge pull request #35 from krazykira/release-to-maven-central
Browse files Browse the repository at this point in the history
Published version 1.1.1 to Maven Central and Deprecated JCenter
  • Loading branch information
krazykira authored Dec 29, 2021
2 parents a6635e2 + e7fae36 commit 99c70c8
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 130 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This is an Android library which can be used to apply different Filters/Effects

### Change Log
```
1.1.0 - Added ability to save video once you apply a FILTER (not EFFECT), Updated Sample app with a detailed example,
1.1.0 - Added ability to save video once you apply a FILTER (not EFFECT), Updated Sample app with a detailed example, (Available on Jcenter)
1.1.1 - Updated Dependencies & Published the videffects to MavenCentral. All future versions from now onwards will be distributed via MavenCentral.
```
## Supported Effects

Expand Down Expand Up @@ -48,7 +49,7 @@ The following list of effects are currently avaialble and can be applied using V
- Add the following code to your project's `build.gradle` file
```sh
repositories {
jcenter()
mavenCentral()
}
```

Expand All @@ -57,7 +58,7 @@ The following list of effects are currently avaialble and can be applied using V
```sh
dependencies {
// Gradle path for VidEffects
implementation "com.sherazkhilji.videffects:videffects:1.1.0"
implementation "com.github.krazykira:videffects:1.1.1"
}
```

Expand Down Expand Up @@ -155,7 +156,7 @@ Developed by
License
=======
Copyright 2020 Sheraz Ahmed Khilji
Copyright 2022 Sheraz Ahmed Khilji
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
16 changes: 11 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

buildscript {
repositories {
mavenCentral()
}
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
Expand All @@ -22,12 +26,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
buildFeatures {
viewBinding true
}
}

dependencies {
implementation project(":videffects")
// implementation "com.sherazkhilji.videffects:videffects:1.1.0"
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'com.google.android.material:material:1.1.0'
// implementation "com.github.krazykira:videffects:1.1.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
import com.sherazkhilji.sample.R
import com.sherazkhilji.sample.databinding.ActivityGalleryBinding
import com.videffects.sample.model.AssetsGalleryModel
import com.videffects.sample.model.screenHeight
import com.videffects.sample.model.screenWidth
import com.videffects.sample.model.toPx
import kotlinx.android.synthetic.main.activity_gallery.*


class AssetsGalleryActivity : AppCompatActivity() {

private lateinit var binding: ActivityGalleryBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_gallery)
recyclerView.layoutManager = GridLayoutManager(this, SPAN_COUNT)
recyclerView.adapter = PreviewAdapter(AssetsGalleryModel(this))
recyclerView.addItemDecoration(SpacesItemDecoration())
binding = ActivityGalleryBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.recyclerView.layoutManager = GridLayoutManager(this, SPAN_COUNT)
binding.recyclerView.adapter = PreviewAdapter(AssetsGalleryModel(this))
binding.recyclerView.addItemDecoration(SpacesItemDecoration())

buttonSamplePlayer.setOnClickListener {
binding.buttonSamplePlayer.setOnClickListener {
startActivity(Intent(this, SamplePlayerActivity::class.java))
}
}
Expand Down
67 changes: 37 additions & 30 deletions app/src/main/java/com/videffects/sample/view/VideoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.AssetFileDescriptor
import android.media.MediaPlayer
import android.os.Build
import android.os.Bundle
Expand All @@ -17,12 +16,12 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.sherazkhilji.sample.R
import com.sherazkhilji.sample.databinding.ActivityVideoBinding
import com.sherazkhilji.videffects.filter.NoEffectFilter
import com.sherazkhilji.videffects.interfaces.Filter
import com.sherazkhilji.videffects.interfaces.ShaderInterface
import com.videffects.sample.controller.VideoController
import com.videffects.sample.model.resizeView
import kotlinx.android.synthetic.main.activity_video.*


class VideoActivity : AppCompatActivity() {
Expand All @@ -33,31 +32,35 @@ class VideoActivity : AppCompatActivity() {
const val ASSET_NAME = "name"

fun startActivity(ctx: Context, assetName: String) {
ctx.startActivity(Intent(ctx, VideoActivity::class.java)
.putExtra(ASSET_NAME, assetName))
ctx.startActivity(
Intent(ctx, VideoActivity::class.java)
.putExtra(ASSET_NAME, assetName)
)
}
}

private var videoController: VideoController? = null
private lateinit var binding: ActivityVideoBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_video)
binding = ActivityVideoBinding.inflate(layoutInflater)
setContentView(binding.root)
val filename = intent.getStringExtra(ASSET_NAME)
?: throw RuntimeException("Asset name is null")
?: throw RuntimeException("Asset name is null")
videoController = VideoController(this, filename)
progress.setOnClickListener { }
binding.progress.setOnClickListener { }
}

fun setupVideoSurfaceView(mediaPlayer: MediaPlayer, width: Double, height: Double) {
videoSurfaceView.resizeView(width, height)
videoSurfaceView.init(mediaPlayer, NoEffectFilter())
binding.videoSurfaceView.resizeView(width, height)
binding.videoSurfaceView.init(mediaPlayer, NoEffectFilter())
}

fun setupSeekBar(onSeekBarChangeListener: SeekBar.OnSeekBarChangeListener) {
intensitySeekBar.max = 100
intensitySeekBar.isEnabled = false
intensitySeekBar.setOnSeekBarChangeListener(onSeekBarChangeListener)
binding.intensitySeekBar.max = 100
binding.intensitySeekBar.isEnabled = false
binding.intensitySeekBar.setOnSeekBarChangeListener(onSeekBarChangeListener)
}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
Expand Down Expand Up @@ -91,9 +94,9 @@ class VideoActivity : AppCompatActivity() {
}

override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand All @@ -104,13 +107,13 @@ class VideoActivity : AppCompatActivity() {

override fun onResume() {
super.onResume()
videoSurfaceView.onResume()
binding.videoSurfaceView.onResume()
}

override fun onPause() {
super.onPause()
videoController?.onPause()
videoSurfaceView.onPause()
binding.videoSurfaceView.onPause()
}

override fun onDestroy() {
Expand All @@ -120,39 +123,43 @@ class VideoActivity : AppCompatActivity() {
}

private fun requestStoragePermissions() {
ActivityCompat.requestPermissions(this,
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
WRITE_EXTERNAL_STORAGE)
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
WRITE_EXTERNAL_STORAGE
)
}

private fun isStoragePermissionNotGranted(): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|| Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|| Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
) {
return true
}
val result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
val result =
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
return result != PackageManager.PERMISSION_GRANTED
}

fun onSelectShader(shader: ShaderInterface) {
videoSurfaceView.setShader(shader)
intensitySeekBar.isEnabled = false
intensitySeekBar.progress = 100
binding.videoSurfaceView.setShader(shader)
binding.intensitySeekBar.isEnabled = false
binding.intensitySeekBar.progress = 100
}

fun onSelectFilter(filter: Filter) {
videoSurfaceView.setFilter(filter)
intensitySeekBar.isEnabled = true
intensitySeekBar.progress = 0
binding.videoSurfaceView.setFilter(filter)
binding.intensitySeekBar.isEnabled = true
binding.intensitySeekBar.progress = 0
}

fun onStartSavingVideo() {
progress.visibility = View.VISIBLE
binding.progress.visibility = View.VISIBLE
}

fun onFinishSavingVideo(msg: String) {
runOnUiThread {
progress.visibility = View.GONE
binding.progress.visibility = View.GONE
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
}
}
Expand Down
13 changes: 4 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
ext.kotlin_version = '1.6.10'

repositories {
jcenter()
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
Loading

0 comments on commit 99c70c8

Please sign in to comment.