Skip to content

Commit

Permalink
Refactor to have multiple sample apps in examples folder (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
7hong13 authored Dec 16, 2022
1 parent 279d96c commit ebcee8f
Show file tree
Hide file tree
Showing 47 changed files with 472 additions and 121 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/kanban/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions examples/kanban/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/kanban/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions examples/kanban/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions examples/kanban/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions examples/kanban/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

android {
namespace = "dev.yorkie.examples"
namespace = "com.example.kanbanapp"
compileSdk = 33

defaultConfig {
applicationId = "dev.yorkie.examples"
applicationId = "com.example.kanbanapp"
minSdk = 23
targetSdk = 33
versionCode = 1
Expand All @@ -19,6 +19,7 @@ android {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
Expand All @@ -37,8 +38,6 @@ android {
}
buildFeatures {
compose = true
dataBinding = true
viewBinding = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.3.2"
Expand All @@ -51,7 +50,7 @@ android {
}

dependencies {
implementation(project(":yorkie"))
implementation("dev.yorkie:yorkie-android:0.2.19-alpha.3")
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.7.0")
Expand All @@ -63,6 +62,10 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.viewModel}")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.5")
implementation("androidx.test:monitor:1.6.0")
implementation("androidx.test.ext:junit-ktx:1.1.4")
testImplementation("junit:junit:4.12")
androidTestImplementation("junit:junit:4.12")
debugImplementation("androidx.compose.ui:ui-tooling:${Versions.composeUi}")
debugImplementation("androidx.compose.ui:ui-test-manifest:${Versions.composeUi}")
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
# proguardFiles setting in build.gradle.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.kanbanapp

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.kanbanapp", appContext.packageName)
}
}
23 changes: 23 additions & 0 deletions examples/kanban/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.KanbanApp">

<activity android:name=".KanbanBoardActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.yorkie.examples
package com.example.kanbanapp

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.yorkie.examples
package com.example.kanbanapp

import android.os.Bundle
import androidx.activity.ComponentActivity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.yorkie.examples
package com.example.kanbanapp

import android.content.Context
import androidx.lifecycle.ViewModel
Expand All @@ -24,7 +24,7 @@ class KanbanBoardViewModel : ViewModel() {
val list: StateFlow<ImmutableList<KanbanColumn>> = _list.asStateFlow()

fun init(context: Context) {
val client = Client(context, "api.yorkie.dev", 443, true)
val client = Client(context, "10.0.2.2:8080", true)
viewModelScope.launch {
if (client.activateAsync().await()) {
client.attachAsync(document).await()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Yorkie" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.KanbanApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions examples/kanban/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">Kanban App</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Yorkie" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.KanbanApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
Expand Down
13 changes: 13 additions & 0 deletions examples/kanban/app/src/main/res/xml/backup_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>
19 changes: 19 additions & 0 deletions examples/kanban/app/src/main/res/xml/data_extraction_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.yorkie
package com.example.kanbanapp

import org.junit.Assert.assertEquals
import org.junit.Test
Expand Down
6 changes: 6 additions & 0 deletions examples/kanban/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "7.3.1" apply false
id("com.android.library") version "7.3.1" apply false
id("org.jetbrains.kotlin.android") version "1.7.20" apply false
}
23 changes: 23 additions & 0 deletions examples/kanban/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
Binary file added examples/kanban/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/kanban/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Fri Dec 16 01:35:54 KST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit ebcee8f

Please sign in to comment.