Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
2,617 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/skydoves/transformationlayoutdemo/DetailActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
app/src/main/java/com/skydoves/transformationlayoutdemo/HomeFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
app/src/main/java/com/skydoves/transformationlayoutdemo/LibraryFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/skydoves/transformationlayoutdemo/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
Oops, something went wrong.