Skip to content

Instantly share code, notes, and snippets.

View KucherenkoIhor's full-sized avatar

Ihor Kucherenko KucherenkoIhor

View GitHub Profile
val textInputLayouts = arrayOf(
tilFirstName,
tilLastName,
tilEmail,
tilPhone,
tilYear,
tilDob,
tilPassword,
tilConfirmPassword)
tilFirstName.onReady = { observable ->
disposable = observable.subscribe { isValid ->
btnSignIn.isEnabled = isValid
}
}
<com.kucherenko.RxValidationTextInputLayout
android:id="@+id/tilFirstName"
style="@style/TextInputLayout.Counter"
android:layout_marginTop="@dimen/margin_l"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="parent"
app:help="at least 3 letters"
app:error="@string/invalid_first_name"
app:errorTextAppearance="@style/TextAppearance.AppCompat.Small.Error"
class AdapterSingleSelectionDelegate<T>(val datasource: List<T>, val itemChanged: (position: Int) -> Unit, val isAutoSelectFirst: Boolean = false) {
private var selectedPositionCurrent = if (isAutoSelectFirst) 0 else -1
private var selectedPositionPrevious = 0
fun selectPosition(position: Int) {
val temp = selectedPositionCurrent
selectedPositionCurrent = position
if (temp != -1)
itemChanged(temp)
extern "C"
JNIEXPORT jint JNICALL
Java_com_kucherenkoihor_vpl_VideoProcessing_getDuration(
JNIEnv *env,
jobject /* this */,
jstring input) {
av_register_all();
AVFormatContext* pFormatCtx = NULL;
if (avformat_open_input(&pFormatCtx, jStr2str(env, input), NULL, NULL) < 0) {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
compile 'com.github.KucherenkoIhor:VideoProcessingLibrary:master-SNAPSHOT'
add_library( # Sets the name of the library.
vpl
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/vpl.cpp)
target_link_libraries( # Specifies the target library.
vpl
ndk {
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a"
}
set(ffmpeg_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp/ffmpeg)
add_library(avutil-55 SHARED IMPORTED)
set_target_properties(avutil-55 PROPERTIES IMPORTED_LOCATION
${ffmpeg_DIR}/lib/${ANDROID_ABI}/libavutil-55.so)
add_library(avformat-57 SHARED IMPORTED)
set_target_properties(avformat-57 PROPERTIES IMPORTED_LOCATION
${ffmpeg_DIR}/lib/${ANDROID_ABI}/libavformat-57.so)
add_library(avcodec-57 SHARED IMPORTED)
sourceSets {
main {
// let gradle pack the shared library into apk
jniLibs.srcDirs = ['src/main/cpp/ffmpeg/lib']
}
}