Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uikit to experimental/examples/imageviewer #2571

Merged
merged 70 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
6ca5ef4
migrate sample. step 11
dima-avdeev-jb Dec 12, 2022
b6d0320
.gitignore
dima-avdeev-jb Dec 12, 2022
3ad28d0
gradle wrapper
dima-avdeev-jb Dec 12, 2022
f52cc34
simplify context usage
dima-avdeev-jb Dec 12, 2022
246bb2c
import example.imageviewer.shared.R
dima-avdeev-jb Dec 12, 2022
2babad0
expect class Bitmap
dima-avdeev-jb Dec 12, 2022
ed9e3c3
simplify android
dima-avdeev-jb Dec 12, 2022
28713e4
simplify android
dima-avdeev-jb Dec 12, 2022
8be335c
simplify android
dima-avdeev-jb Dec 12, 2022
a0b263f
simplify android
dima-avdeev-jb Dec 12, 2022
99abd70
Notification
dima-avdeev-jb Dec 12, 2022
9ef6d7f
createEmptyBitmap
dima-avdeev-jb Dec 12, 2022
b416b36
cacheDirProvider
dima-avdeev-jb Dec 12, 2022
26c0904
suspend fun loadImages
dima-avdeev-jb Dec 12, 2022
7659b7e
simplify MainImageWrapper
dima-avdeev-jb Dec 12, 2022
ccea557
common ContentState
dima-avdeev-jb Dec 12, 2022
cca8f4a
simplify
dima-avdeev-jb Dec 12, 2022
690c05c
ContentRepository
dima-avdeev-jb Dec 13, 2022
a604a58
working Android
dima-avdeev-jb Dec 14, 2022
d664f7d
remove redundant from android
dima-avdeev-jb Dec 15, 2022
4a72465
simplify
dima-avdeev-jb Dec 15, 2022
94622c5
desktopApp:run
dima-avdeev-jb Dec 15, 2022
94f47ac
remove disk cache from Android
dima-avdeev-jb Dec 15, 2022
5a96faf
simplify Desktop
dima-avdeev-jb Dec 15, 2022
08aeda8
use Tooltip in filter buttons
dima-avdeev-jb Dec 15, 2022
91d9733
Toolbar
dima-avdeev-jb Dec 15, 2022
84c3ddc
Scalable Desktop
dima-avdeev-jb Dec 17, 2022
6df2e64
fix toast
dima-avdeev-jb Dec 17, 2022
dd8baef
simplify
dima-avdeev-jb Dec 17, 2022
203b58d
simplify Android
dima-avdeev-jb Dec 18, 2022
779d24a
images.json
dima-avdeev-jb Dec 18, 2022
5e3ca2d
pictures.json
dima-avdeev-jb Dec 18, 2022
da23d1c
pictures with small and big sizes
dima-avdeev-jb Dec 18, 2022
1d64006
fix open fullscreen by index
dima-avdeev-jb Dec 18, 2022
30af18e
todo Draggable
dima-avdeev-jb Dec 18, 2022
1442a5d
buttons previous/next
dima-avdeev-jb Dec 18, 2022
35a6b3b
ScalableImage android
dima-avdeev-jb Dec 18, 2022
d444d64
Toolbar
dima-avdeev-jb Dec 19, 2022
08b27cc
internal fun
dima-avdeev-jb Dec 19, 2022
930f6df
Desktop zoom, drag
dima-avdeev-jb Dec 19, 2022
77ad4e8
update ktor 2.2.1
dima-avdeev-jb Dec 19, 2022
e49cf5e
remove NetworkRequest class
dima-avdeev-jb Dec 19, 2022
c7715ac
android okhttp
dima-avdeev-jb Dec 19, 2022
0b17bb0
simplify AppState
dima-avdeev-jb Dec 19, 2022
0e6067f
State
dima-avdeev-jb Dec 20, 2022
668f34a
simplify network
dima-avdeev-jb Dec 20, 2022
d0a3631
ioScope
dima-avdeev-jb Dec 20, 2022
cb9e2f7
CancellationException
dima-avdeev-jb Dec 20, 2022
c747101
handle Scroll event
dima-avdeev-jb Dec 21, 2022
71f445e
ScalableImage.desktop.kt
dima-avdeev-jb Dec 21, 2022
75c63dd
ScalableImage.common.kt
dima-avdeev-jb Dec 21, 2022
e864356
ScalableImage.common.kt
dima-avdeev-jb Dec 21, 2022
05ca90b
ScalableImage
dima-avdeev-jb Dec 21, 2022
3e0f2e2
ScalableImage
dima-avdeev-jb Dec 21, 2022
8875a46
Merge remote-tracking branch 'origin/master' into dima-avdeev/add-uik…
dima-avdeev-jb Dec 21, 2022
7fd341c
add uikit
dima-avdeev-jb Dec 21, 2022
8f4dbd4
Slider
dima-avdeev-jb Dec 21, 2022
c5414f5
toast
dima-avdeev-jb Dec 22, 2022
b55108c
fix todo
dima-avdeev-jb Dec 22, 2022
a7b61ec
fix IDE warning
dima-avdeev-jb Dec 22, 2022
8b6ecbc
reformat code
dima-avdeev-jb Dec 22, 2022
28a23ed
readme
dima-avdeev-jb Dec 22, 2022
e58e25d
readme
dima-avdeev-jb Dec 22, 2022
bec5f87
iosApp (AndroidStudio).run.xml
dima-avdeev-jb Dec 22, 2022
b960fa8
remove EXEC_TARGET_ID
dima-avdeev-jb Dec 22, 2022
86d2bbf
change config to master branch
dima-avdeev-jb Dec 22, 2022
49cc529
Update experimental/examples/imageviewer/README.md
dima-avdeev-jb Dec 22, 2022
77557a4
colors
dima-avdeev-jb Dec 22, 2022
2b1f2c3
ScrollableColumn
dima-avdeev-jb Dec 22, 2022
a0548a8
comment
dima-avdeev-jb Dec 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions artwork/imageviewerrepo/pictures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{"big": "1.jpg", "small": "small/1.jpg"},
{"big": "2.jpg", "small": "small/2.jpg"},
{"big": "3.jpg", "small": "small/3.jpg"},
{"big": "4.jpg", "small": "small/4.jpg"},
{"big": "5.jpg", "small": "small/5.jpg"},
{"big": "6.jpg", "small": "small/6.jpg"},
{"big": "7.jpg", "small": "small/7.jpg"},
{"big": "8.jpg", "small": "small/8.jpg"},
{"big": "9.jpg", "small": "small/9.jpg"},
{"big": "10.jpg", "small": "small/10.jpg"},
{"big": "11.jpg", "small": "small/11.jpg"},
{"big": "12.jpg", "small": "small/12.jpg"},
{"big": "13.jpg", "small": "small/13.jpg"}
]
Binary file added artwork/imageviewerrepo/small/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/12.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/13.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/imageviewerrepo/small/9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions experimental/examples/imageviewer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ build/
/captures
.externalNativeBuild
.cxx
iosApp/Podfile.lock
iosApp/Pods/*
iosApp/Imageviewer.xcworkspace/*
iosApp/Imageviewer.xcodeproj/*
!iosApp/Imageviewer.xcodeproj/project.pbxproj
shared/shared.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="desktop" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="desktopApp" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/desktop" />
<option name="externalProjectPath" value="$PROJECT_DIR$/desktopApp" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
Expand All @@ -15,7 +15,9 @@
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iosApp (AndroidStudio)" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" XCODE_PROJECT="$PROJECT_DIR$/iosApp/Imageviewer.xcworkspace" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="Imageviewer">
<method v="2">
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
</method>
</configuration>
</component>
11 changes: 11 additions & 0 deletions experimental/examples/imageviewer/.run/iosApp.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iosApp" type="AppleRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="Imageviewer" TARGET_NAME="Imageviewer" CONFIG_NAME="Debug" IS_LOCATION_SIMULATION_SUPPORTED="true" SCHEME_NAME="iosApp" IS_LOCATION_SIMULATION_ALLOWED="true" LOCATION_SCENARIO_ID="com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier" LOCATION_SCENARIO_TYPE="1" APPLICATION_LANGUAGE="IDELaunchSchemeLanguageUseSystemLanguage" APPLICATION_REGION="" RUN_TARGET_PROJECT_NAME="Imageviewer" RUN_TARGET_NAME="Imageviewer" MAKE_ACTIVE="TRUE" SHOULD_DEBUG_EXTENSIONS="false">
<EXTENSION ID="org.jetbrains.appcode.reveal.RevealRunConfigurationExtension">
<REVEAL_SETTINGS autoInject="false" autoInstall="true" askToEnableAutoInstall="true" />
</EXTENSION>
<embedded_app_extension_list />
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
26 changes: 21 additions & 5 deletions experimental/examples/imageviewer/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
An example of image gallery for remote server image viewing, based on Jetpack Compose UI library (desktop and android).
# Imageviewer

### Running desktop application
* To run, launch command: `./gradlew :desktop:run`
* Or choose **desktop** configuration in IDE and run it.
![desktop-run-configuration.png](screenshots/desktop-run-configuration.png)
An example of image gallery for remote server image viewing,
based on Compose Multiplatform UI library (desktop, android and iOS).

## How to run

Choose a run configuration for an appropriate target in IDE and run it.

![run-configurations.png](run-configurations.png)

To run on iOS device, please correct `iosApp/Configuration/TeamId.xcconfig` with your Apple Team ID.
Alternatively, you may setup signing within XCode opening `iosApp/Imageviewer.xcworkspace` and then
using "Signing & Capabilities" tab of `ImageViewer` target.

Then choose **iosApp** configuration in IDE and run it
(may also be referred as `ImageViewer` in the Run Configurations or `iosApp (AndroidStudio)` for Android studio).

## Run on desktop via Gradle

`./gradlew desktopApp:run`

### Building native desktop distribution

```
./gradlew :desktop:packageDistributionForCurrentOS
# outputs are written to desktop/build/compose/binaries
Expand Down
26 changes: 0 additions & 26 deletions experimental/examples/imageviewer/android/build.gradle.kts

This file was deleted.

This file was deleted.

33 changes: 33 additions & 0 deletions experimental/examples/imageviewer/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
kotlin("multiplatform")
id("com.android.application")
id("org.jetbrains.compose")
}

kotlin {
android()
sourceSets {
val androidMain by getting {
dependencies {
implementation(project(":shared"))
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("androidx.activity:activity-compose:1.6.1")
}
}
}
}

android {
compileSdk = 33
defaultConfig {
applicationId = "org.jetbrains.imageviewer"
minSdk = 24
targetSdk = 33
versionCode = 1
versionName = "1.0"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package example.imageviewer

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import example.imageviewer.view.ImageViewerAndroid

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ImageViewerAndroid()
}
}
}
1 change: 1 addition & 0 deletions experimental/examples/imageviewer/build.gradle.kts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ allprojects {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
mavenLocal()
}
}
54 changes: 0 additions & 54 deletions experimental/examples/imageviewer/common/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

Loading