-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
49e76eb
commit 026a1d3
Showing
28 changed files
with
1,220 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,13 @@ | ||
Copyright 2020 Hypersoft | ||
|
||
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. |
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,5 @@ | ||
Apache CustomBadge | ||
Copyright 2020 The Apache Software Foundation | ||
|
||
This product includes software developed at | ||
The Apache Software Foundation (http://www.apache.org/). |
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/hypersoft/flipableview/FlipOnceActivity.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,47 @@ | ||
package com.hypersoft.flipableview | ||
|
||
import android.os.Bundle | ||
import android.widget.Toast | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import com.hypersoft.easyviewflip.EasyViewFlip | ||
import com.hypersoft.flipableview.databinding.ActivityFlipOnceBinding | ||
|
||
class FlipOnceActivity : AppCompatActivity() { | ||
|
||
private var binding: ActivityFlipOnceBinding? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
binding = ActivityFlipOnceBinding.inflate(layoutInflater) | ||
setContentView(binding?.root) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
} | ||
|
||
binding?.apply { | ||
cardFlipView.setFlipDuration(1000) | ||
cardFlipView.setFlipEnabled(true) | ||
kingBackSide.setOnClickListener { cardFlipView.flipTheView() } | ||
kingFrontSide.setOnClickListener { cardFlipView.flipTheView() } | ||
|
||
cardFlipView.setOnFlipListener(object : EasyViewFlip.OnFlipAnimationListener{ | ||
override fun onViewFlipCompleted( | ||
easyFlipView: EasyViewFlip?, | ||
newCurrentSide: EasyViewFlip.FlipState? | ||
) { | ||
Toast.makeText( | ||
this@FlipOnceActivity, | ||
"Flipped once ! Ace revealed $newCurrentSide", Toast.LENGTH_LONG | ||
).show() | ||
} | ||
}) | ||
} | ||
|
||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/hypersoft/flipableview/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,33 @@ | ||
package com.hypersoft.flipableview | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import com.hypersoft.flipableview.databinding.ActivityMainBinding | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
private var binding: ActivityMainBinding? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
binding = ActivityMainBinding.inflate(layoutInflater) | ||
setContentView(binding?.root) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
} | ||
|
||
binding?.apply { | ||
mbSimpleView.setOnClickListener { startActivity(Intent(this@MainActivity, SimpleViewActivity::class.java))} | ||
mbRecyclerView.setOnClickListener { startActivity(Intent(this@MainActivity, RecyclerViewActivity::class.java)) } | ||
mbFlipOnceExample.setOnClickListener { startActivity(Intent(this@MainActivity, FlipOnceActivity::class.java)) } | ||
} | ||
|
||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
app/src/main/java/com/hypersoft/flipableview/RecyclerViewActivity.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,40 @@ | ||
package com.hypersoft.flipableview | ||
|
||
import android.os.Bundle | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import androidx.recyclerview.widget.GridLayoutManager | ||
import com.hypersoft.flipableview.databinding.ActivityRecyclerViewBinding | ||
|
||
class RecyclerViewActivity : AppCompatActivity() { | ||
|
||
private var binding: ActivityRecyclerViewBinding? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
binding = ActivityRecyclerViewBinding.inflate(layoutInflater) | ||
setContentView(binding?.root) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
} | ||
// val list: List<TestModel> = ArrayList() | ||
val list = mutableListOf<TestModel>() | ||
binding?.apply { | ||
recyclerView.layoutManager = GridLayoutManager(this@RecyclerViewActivity, 2) | ||
|
||
for (i in 0..19) { | ||
val model = TestModel() | ||
model.isFlipped = false | ||
list.add(model) | ||
} | ||
|
||
recyclerView.adapter = SampleAdapter(list) | ||
|
||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
app/src/main/java/com/hypersoft/flipableview/SampleAdapter.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,46 @@ | ||
package com.hypersoft.flipableview | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.hypersoft.easyviewflip.EasyViewFlip | ||
import com.hypersoft.flipableview.databinding.ItemRecyclerviewBinding | ||
|
||
class SampleAdapter(): RecyclerView.Adapter<SampleAdapter.CustomViewHolder>() { | ||
|
||
private lateinit var list: List<TestModel> | ||
|
||
constructor(list: List<TestModel>): this() { | ||
this.list = list | ||
} | ||
|
||
inner class CustomViewHolder(val binding: ItemRecyclerviewBinding): RecyclerView.ViewHolder(binding.root) | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomViewHolder { | ||
val layoutInflater = LayoutInflater.from(parent.context) | ||
val binding = ItemRecyclerviewBinding.inflate(layoutInflater, parent, false) | ||
return CustomViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: CustomViewHolder, position: Int) { | ||
holder.binding.apply { | ||
if (flipView.getCurrentFlipState() == EasyViewFlip.FlipState.FRONT_SIDE && list[position].isFlipped) { | ||
flipView.setFlipDuration(0) | ||
flipView.flipTheView() | ||
} else if (flipView.getCurrentFlipState() == EasyViewFlip.FlipState.BACK_SIDE && !list[position].isFlipped) { | ||
flipView.setFlipDuration(0) | ||
flipView.flipTheView() | ||
} | ||
|
||
flipView.setOnClickListener { | ||
list[position].isFlipped = !list[position].isFlipped | ||
flipView.setFlipDuration(700) | ||
flipView.flipTheView() | ||
} | ||
} | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return list.size | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/hypersoft/flipableview/SimpleViewActivity.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,48 @@ | ||
package com.hypersoft.flipableview | ||
|
||
import android.os.Bundle | ||
import android.widget.Toast | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.core.view.ViewCompat | ||
import androidx.core.view.WindowInsetsCompat | ||
import com.hypersoft.easyviewflip.EasyViewFlip | ||
import com.hypersoft.flipableview.databinding.ActivitySimpleViewBinding | ||
|
||
class SimpleViewActivity : AppCompatActivity() { | ||
|
||
private var binding: ActivitySimpleViewBinding? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
binding = ActivitySimpleViewBinding.inflate(layoutInflater) | ||
setContentView(binding?.root) | ||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> | ||
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) | ||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) | ||
insets | ||
} | ||
|
||
binding?.apply { | ||
easyFlipView.setFlipDuration(1000) | ||
easyFlipView.setFlipEnabled(true) | ||
imgFrontCard.setOnClickListener { easyFlipView.flipTheView() } | ||
imgBackCard.setOnClickListener { easyFlipView.flipTheView() } | ||
|
||
easyFlipView2.setFlipDuration(5000) | ||
easyFlipView2.setToHorizontalType() | ||
easyFlipView2.setFlipTypeFromLeft() | ||
|
||
easyFlipView.setOnFlipListener(object: EasyViewFlip.OnFlipAnimationListener { | ||
override fun onViewFlipCompleted( | ||
easyFlipView: EasyViewFlip?, | ||
newCurrentSide: EasyViewFlip.FlipState? | ||
) { | ||
Toast.makeText(this@SimpleViewActivity, | ||
"Flip Completed! New Side is: " + newCurrentSide, Toast.LENGTH_LONG).show() | ||
} | ||
}) | ||
} | ||
} | ||
} |
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,5 @@ | ||
package com.hypersoft.flipableview | ||
|
||
class TestModel { | ||
var isFlipped: Boolean = false | ||
} |
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,55 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.jetbrains.kotlin.android) | ||
id("maven-publish") | ||
} | ||
|
||
android { | ||
namespace = "com.hypersoft.easyviewflip" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 24 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles("consumer-rules.pro") | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
|
||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.material) | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("release") { | ||
groupId = "com.hypersoft.easyviewflip" | ||
artifactId = "easyviewflip" | ||
version = "1.0.1" | ||
|
||
afterEvaluate { | ||
from(components["release"]) | ||
} | ||
} | ||
} | ||
} |
Empty file.
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
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,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest /> |
Oops, something went wrong.