Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Feb 28, 2020
1 parent f197d87 commit c152c02
Show file tree
Hide file tree
Showing 100 changed files with 2,617 additions and 34 deletions.
39 changes: 5 additions & 34 deletions .gitignore
@@ -1,8 +1,6 @@
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex
Expand All @@ -14,10 +12,9 @@
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
/.idea
.gradle/
build/

Expand All @@ -36,50 +33,24 @@ proguard/
# Android Studio captures folder
captures/

# IntelliJ
# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
freeline_project_description.json
1 change: 1 addition & 0 deletions app/.gitignore
@@ -0,0 +1 @@
/build
30 changes: 30 additions & 0 deletions app/build.gradle
@@ -0,0 +1,30 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: '../dependencies.gradle'

android {
compileSdkVersion versions.compileSdk
defaultConfig {
applicationId "com.skydoves.transformationlayoutdemo"
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.versionCode
versionName versions.versionName
}
androidExtensions {
experimental = true
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$versions.kotlin"
implementation "com.google.android.material:material:$versions.googleMaterial"
implementation "androidx.constraintlayout:constraintlayout:$versions.constraintVersion"
implementation "com.github.bumptech.glide:glide:$versions.glideVersion"
kapt "com.github.bumptech.glide:compiler:$versions.glideVersion"
implementation project(":transformationlayout")
}

apply from: '../spotless.gradle'
26 changes: 26 additions & 0 deletions app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.skydoves.transformationlayoutdemo">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity android:name=".DetailActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
@@ -0,0 +1,65 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* 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.
*/

package com.skydoves.transformationlayoutdemo

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.bumptech.glide.Glide
import com.skydoves.transformationlayout.TransformationLayout
import com.skydoves.transformationlayout.onTransformationEndContainer
import com.skydoves.transformationlayoutdemo.recycler.Poster
import kotlinx.android.synthetic.main.activity_detail.detail_description
import kotlinx.android.synthetic.main.activity_detail.detail_title
import kotlinx.android.synthetic.main.activity_detail.profile_detail_background

class DetailActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
onTransformationEndContainer(intent.getParcelableExtra(parmasExtraName))
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_detail)

intent.getParcelableExtra<Poster>(posterExtraName)?.let {
Glide.with(this)
.load(it.poster)
.into(profile_detail_background)
detail_title.text = it.name
detail_description.text = it.description
}
}

companion object {
const val parmasExtraName = "parmasExtraName"
const val posterExtraName = "posterExtraName"
fun startActivity(
context: Context,
transformationLayout: TransformationLayout,
poster: Poster
) {
if (context is Activity) {
val bundle = transformationLayout.withActivity(context, poster.name)
val intent = Intent(context, DetailActivity::class.java)
intent.putExtra(parmasExtraName, transformationLayout.getParcelableParams())
intent.putExtra(posterExtraName, poster)
context.startActivity(intent, bundle)
}
}
}
}
@@ -0,0 +1,67 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* 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.
*/

package com.skydoves.transformationlayoutdemo

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.skydoves.transformationlayoutdemo.MockUtil.getMockPosters
import com.skydoves.transformationlayoutdemo.recycler.PosterAdapter
import com.skydoves.transformationlayoutdemo.recycler.PosterMenuAdapter
import kotlinx.android.synthetic.main.fragment_home.backgroundView
import kotlinx.android.synthetic.main.fragment_home.container
import kotlinx.android.synthetic.main.fragment_home.fab
import kotlinx.android.synthetic.main.fragment_home.menu_home
import kotlinx.android.synthetic.main.fragment_home.recyclerView
import kotlinx.android.synthetic.main.fragment_home.recyclerView_menu
import kotlinx.android.synthetic.main.fragment_home.transformationLayout

class HomeFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_home, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

recyclerView.adapter = PosterAdapter().apply { addPosterList(getMockPosters()) }
recyclerView_menu.adapter = PosterMenuAdapter().apply { addPosterList(getMockPosters()) }

fab.setOnClickListener {
if (!transformationLayout.isTransforming) {
backgroundView.visibility = View.VISIBLE
}
transformationLayout.startTransform(container)
}

menu_home.setOnClickListener {
if (!transformationLayout.isTransforming) {
backgroundView.visibility = View.GONE
}
transformationLayout.finishTransform(container)
Toast.makeText(context, "Compose New", Toast.LENGTH_SHORT).show()
}
}
}
@@ -0,0 +1,57 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* 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.
*/

package com.skydoves.transformationlayoutdemo

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.skydoves.transformationlayoutdemo.MockUtil.getMockPosters
import com.skydoves.transformationlayoutdemo.recycler.PosterLineAdapter
import kotlinx.android.synthetic.main.fragment_library.container
import kotlinx.android.synthetic.main.fragment_library.fab
import kotlinx.android.synthetic.main.fragment_library.menu_card
import kotlinx.android.synthetic.main.fragment_library.recyclerView
import kotlinx.android.synthetic.main.fragment_library.transformationLayout

class LibraryFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_library, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

recyclerView.adapter = PosterLineAdapter().apply { addPosterList(getMockPosters()) }

fab.setOnClickListener {
transformationLayout.startTransform(container)
}

menu_card.setOnClickListener {
transformationLayout.finishTransform(container)
Toast.makeText(context, "Play", Toast.LENGTH_SHORT).show()
}
}
}
@@ -0,0 +1,59 @@
/*
* Designed and developed by 2020 skydoves (Jaewoong Eum)
*
* 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.
*/

package com.skydoves.transformationlayoutdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager.widget.ViewPager
import com.skydoves.transformationlayout.onTransformationStartContainer
import kotlinx.android.synthetic.main.activity_main.main_bottom_navigation
import kotlinx.android.synthetic.main.activity_main.main_viewpager

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
onTransformationStartContainer()
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

with(main_viewpager) {
adapter = MainPagerAdapter(supportFragmentManager)
offscreenPageLimit = 3
addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) = Unit
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) = Unit

override fun onPageSelected(position: Int) {
main_bottom_navigation.menu.getItem(position).isChecked = true
}
})
}

main_bottom_navigation.setOnNavigationItemSelectedListener {
when (it.itemId) {
R.id.action_one -> main_viewpager.currentItem = 0
R.id.action_two -> main_viewpager.currentItem = 1
R.id.action_three -> main_viewpager.currentItem = 2
}
true
}
}
}

0 comments on commit c152c02

Please sign in to comment.