💳 Bank Card View is a simple and elegant card view with Flip animation.
Add below codes to your root build.gradle
file (not your module build.gradle file).
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
And add a dependency code to your module's build.gradle
file.
dependencies {
implementation 'com.github.iamageo:bank-card-view:1.0.0'
}
Add in you layout file.
<com.iamageo.bank_card_view_android.BankCardView
android:id="@+id/myBankCardView"
app:isFrontCard="true"
app:bankCardName="Geovani Amaral"
app:bankCardNumber="0001 0002 0003 0004"
app:bankCardCVV="123"
app:bankCardValidate="02/27"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
Call in your Activity:
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private val animation: FlipBankCardViewAnimation? = null
override fun onCreate(savedInstanceState: Bundle?) {
binding = ActivityMainBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState)
setContentView(binding.root)
//attributes
binding.myBankCardView.bankCardName = "Jhon Doe"
binding.myBankCardView.bankCardNumber = "0001 0002 0003 0004"
binding.myBankCardView.bankCardValidate = "02/27"
binding.myBankCardView.bankCardCVV = "007"
binding.myBankCardView.bankCardLogo = BankCardView.CardLogo.MASTERCARD
binding.myBankCardView.bankCardBackground = BankCardView.CardBackground.RIPE_MALINKA
//click event
binding.myBankCardView.setOnClickListener {
startAnimation(animation, binding.myBankCardView, binding.myBankCardView, 180)
}
}
}
Attributes | Type | Description |
---|---|---|
bankCardName | String | Name of card. |
bankCardNumber | String | Number of card. |
bankCardValidate | String | Validate date. |
bankCardCVV | String | Security code of card. |
bankCardLogo | Int (drawable) | Logo of card. |
bankCardBackground | Int (drawable) | Background for card view. |
VISA | CIELO | MASTERCARD | AMERICAN_EXPRESS |
---|---|---|---|
For use card logo, call:
binding.myBankCardView.bankCardLogo = BankCardView.CardLogo.MASTERCARD
RIPE_MALINKA | AMY_CHRISP | TRUE_SUNSET | PURPLE_DIVISION |
---|---|---|---|
For use backgrounds, call:
binding.myBankCardView.bankCardBackground = BankCardView.CardBackground.RIPE_MALINKA
Copyright 2022 Geovani Amaral
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.