Skip to content

Commit

Permalink
Merge pull request #5 from GetStream/feature/photoview-dialog
Browse files Browse the repository at this point in the history
Implement photoview dialog module
  • Loading branch information
skydoves authored Feb 21, 2024
2 parents 0dbe3e0 + 049d44f commit fb415e0
Show file tree
Hide file tree
Showing 37 changed files with 2,413 additions and 66 deletions.
62 changes: 32 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.baseline.profile) apply false
alias(libs.plugins.nexus.plugin)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.binary.compatibility)
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.baseline.profile) apply false
alias(libs.plugins.nexus.plugin)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.binary.compatibility)
}

subprojects {
apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)
apply(plugin = rootProject.libs.plugins.spotless.get().pluginId)

if (!this.name.contains("dialog")) {
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2"
)
)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
trimTrailingWhitespace()
endWithNewline()
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
target("**/*.kt")
targetExclude("$buildDir/**/*.kt")
ktlint().editorConfigOverride(
mapOf(
"indent_size" to "2",
"continuation_indent_size" to "2"
)
)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
trimTrailingWhitespace()
endWithNewline()
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml")
// Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
trimTrailingWhitespace()
endWithNewline()
}
}
}
}
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ jvmTarget = "11"
nexusPlugin = "0.26.0"
androidxMaterial = "1.11.0"
androidxAppcompat = "1.6.1"
androidxActivity = "1.8.2"
androidxFragment = "1.6.2"
androidxLifecycle = "2.7.0"
androidxAnnotation = "1.7.1"
androidxMacroBenchmark = "1.2.3"
androidxTest = "1.5.2"
baselineProfiles = "1.3.1"
uiAutomator = "2.3.0-beta01"
uiAutomator = "2.3.0-rc01"
glide = "4.16.0"
coil = "2.5.0"
spotless = "6.21.0"
Expand Down
1 change: 1 addition & 0 deletions photoview-dialog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
79 changes: 79 additions & 0 deletions photoview-dialog/api/photoview-dialog.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
public final class io/getstream/photoview/dialog/PhotoViewDialog {
public fun <init> (Landroid/content/Context;Lio/getstream/photoview/dialog/viewer/builder/BuilderData;)V
public final fun close ()V
public final fun currentPosition ()I
public final fun dismiss ()V
public final fun setCurrentPosition (I)I
public final fun show ()V
public final fun show (Z)V
public static synthetic fun show$default (Lio/getstream/photoview/dialog/PhotoViewDialog;ZILjava/lang/Object;)V
public final fun updateImages (Ljava/util/List;)V
public final fun updateImages ([Ljava/lang/Object;)V
public final fun updateTransitionImage (Landroid/widget/ImageView;)V
}

public final class io/getstream/photoview/dialog/PhotoViewDialog$Builder {
public fun <init> (Landroid/content/Context;Ljava/util/List;Lio/getstream/photoview/dialog/loader/ImageLoader;)V
public fun <init> (Landroid/content/Context;[Ljava/lang/Object;Lio/getstream/photoview/dialog/loader/ImageLoader;)V
public final fun allowSwipeToDismiss (Z)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun allowZooming (Z)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun build ()Lio/getstream/photoview/dialog/PhotoViewDialog;
public final fun show ()Lio/getstream/photoview/dialog/PhotoViewDialog;
public final fun show (Z)Lio/getstream/photoview/dialog/PhotoViewDialog;
public static synthetic fun show$default (Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;ZILjava/lang/Object;)Lio/getstream/photoview/dialog/PhotoViewDialog;
public final fun withBackgroundColor (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withBackgroundColorResource (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withContainerPadding (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withContainerPadding (IIII)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withContainerPaddingPixels (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withContainerPaddingPixels (IIII)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withDismissListener (Lio/getstream/photoview/dialog/listeners/OnDismissListener;)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withHiddenStatusBar (Z)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withImageChangeListener (Lio/getstream/photoview/dialog/listeners/OnImageChangeListener;)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withImageMarginPixels (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withImagesMargin (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withOverlayView (Landroid/view/View;)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withStartPosition (I)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
public final fun withTransitionFrom (Landroid/widget/ImageView;)Lio/getstream/photoview/dialog/PhotoViewDialog$Builder;
}

public abstract interface class io/getstream/photoview/dialog/listeners/OnDismissListener {
public abstract fun onDismiss ()V
}

public abstract interface class io/getstream/photoview/dialog/listeners/OnImageChangeListener {
public abstract fun onImageChange (I)V
}

public abstract interface class io/getstream/photoview/dialog/loader/ImageLoader {
public abstract fun loadImage (Landroid/widget/ImageView;Ljava/lang/Object;)V
}

public final class io/getstream/photoview/dialog/viewer/builder/BuilderData {
public fun <init> (Ljava/util/List;Lio/getstream/photoview/dialog/loader/ImageLoader;)V
public final fun getBackgroundColor ()I
public final fun getContainerPaddingPixels ()[I
public final fun getImageChangeListener ()Lio/getstream/photoview/dialog/listeners/OnImageChangeListener;
public final fun getImageLoader ()Lio/getstream/photoview/dialog/loader/ImageLoader;
public final fun getImageMarginPixels ()I
public final fun getImages ()Ljava/util/List;
public final fun getOnDismissListener ()Lio/getstream/photoview/dialog/listeners/OnDismissListener;
public final fun getOverlayView ()Landroid/view/View;
public final fun getShouldStatusBarHide ()Z
public final fun getStartPosition ()I
public final fun getTransitionView ()Landroid/widget/ImageView;
public final fun isSwipeToDismissAllowed ()Z
public final fun isZoomingAllowed ()Z
public final fun setBackgroundColor (I)V
public final fun setContainerPaddingPixels ([I)V
public final fun setImageChangeListener (Lio/getstream/photoview/dialog/listeners/OnImageChangeListener;)V
public final fun setImageMarginPixels (I)V
public final fun setOnDismissListener (Lio/getstream/photoview/dialog/listeners/OnDismissListener;)V
public final fun setOverlayView (Landroid/view/View;)V
public final fun setShouldStatusBarHide (Z)V
public final fun setStartPosition (I)V
public final fun setSwipeToDismissAllowed (Z)V
public final fun setTransitionView (Landroid/widget/ImageView;)V
public final fun setZoomingAllowed (Z)V
}

62 changes: 62 additions & 0 deletions photoview-dialog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import io.getstream.photoview.Configuration

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id(libs.plugins.android.library.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.nexus.plugin.get().pluginId)
id(libs.plugins.baseline.profile.get().pluginId)
}

apply(from = "${rootDir}/scripts/publish-module.gradle.kts")

mavenPublishing {
val artifactId = "photoview-dialog"
coordinates(
Configuration.artifactGroup,
artifactId,
rootProject.extra.get("libVersion").toString()
)

pom {
name.set(artifactId)
description.set("PhotoView is an ImageView component for Android that enables zoom functionality through diverse touch gestures.")
}
}

android {
compileSdk = Configuration.compileSdk
namespace = "io.getstream.photoview.dialog"

defaultConfig {
minSdk = Configuration.minSdk
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf(
"-Xexplicit-api=strict"
)
}

tasks.withType(JavaCompile::class.java).configureEach {
this.targetCompatibility = JavaVersion.VERSION_17.toString()
this.sourceCompatibility = JavaVersion.VERSION_17.toString()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
implementation(libs.androidx.appcompat)
api(project(":photoview"))

baselineProfile(project(":benchmark"))
}
18 changes: 18 additions & 0 deletions photoview-dialog/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2024 Stream.IO, Inc.
Copyright 2011, 2012 Chris Banes.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest />
Loading

0 comments on commit fb415e0

Please sign in to comment.