davideas / flipview Goto Github PK
View Code? Open in Web Editor NEWFlipping views like Gmail & beyond
Flipping views like Gmail & beyond
How to set app:checked="false" programmatically
Hello,I'm new to this. I created ViewPager with FlipView items in it. Each FlipView Item contains front and rear side (both TextView). However I cannot display any text on these items and have no idea why is it.
FlashCardsSlideAdapter.kt
class FlashCardsSlideAdapter(private val context: Context, private val arrayOfRands: ArrayList<RandDataType>): PagerAdapter(){
private val myImages = arrayOf(R.drawable.a1, R.drawable.a4, R.drawable.a3, R.drawable.a4)
private var layoutInflater:LayoutInflater? = null
override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view === `object`
}
override fun getCount(): Int {
return arrayOfRands.size
}
override fun instantiateItem(container: ViewGroup, position: Int): Any {
layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val v = layoutInflater!!.inflate(R.layout.item_in_cards, null)
val vp = container as ViewPager
vp.addView(v, 0)
return v
}
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
val vp = container as ViewPager
val v = `object` as View
vp.removeView(v)
}
}
ViewPager in fragment_flash_cards.xml
<androidx.viewpager.widget.ViewPager android:layout_width="match_parent"
android:layout_height="0dp" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="500dp"
android:id="@+id/flashPager">
</androidx.viewpager.widget.ViewPager>
item_in_cards.xml
<eu.davidea.flipview.FlipView android:layout_width="match_parent"
android:layout_height="250dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:frontLayout="@layout/fron_flip"
app:rearLayout="@layout/rear_flip"
android:clickable="true">
</eu.davidea.flipview.FlipView>
fron_flip.xml
<TextView android:layout_width="match_parent" android:layout_height="match_parent"
android:textAlignment="center"
android:id="@+id/mainWordText"
android:background="@color/colorAccent"
android:gravity="center_vertical"
android:text="@string/HeyString"
/>
rear_flip.xml is almost same as front_flip.
Used library: https://github.com/davideas/FlipView
Before applying FlipView library text in TextViews in ViewPager worked fine.
Thanks for any reply.
In FlipView, you can only "add" a rear layout. Meaning, that if you click on it, it shows in that order:
There's no way to remove the second or the third rear layout.
Could you add double Click on the FlipView, Thank you
If i want to flip view without rearImageAnimation
, i cannot set it to non.
you must change this code:
setRearImageAnimation(AnimationUtils.loadAnimation(getContext(), animationResId > 0 ? animationResId : R.anim.scale_up));
to :
if(animationResId > 0) setRearImageAnimation(AnimationUtils.loadAnimation(getContext(),animationResId));
Or is there another way?
Hello folks.
It sounds basic, but I really did not find it. Is it possible to flip the view vertically, instead horizontally?
Thanks in advance!
Hi, this is really just a question: is it possible to load dynamic views? Imagine an adapter that displays different views according to their position in the recyclerview. Can I flip those views, and have both front views and rear views dynamically generated? My idea is to have a flip view for each item and add dynamically both front and rear view but I am having trouble achieving it. Thanks for your time & attention.
Color is actually managed by setChildBackgroundDrawable(...) and there isn't a dedicated function only for it.
Typical listview. Inflating each row in an adapter. Put both front and back layouts inside a FlipView in xml and inflating that instead. If you need to see the code, I can post if necessary.
Row 1 - tap this one
Row 2
Row 3
Row 4 - flipped also
Row 5
Row 6
Row 7 - Flipped also
Row 8
Row 9
Row 10 - flipped also
Hi
how to disable and enable flipping programmatically!?
thanks
This is the demo project. Any ideas?
https://github.com/thelong1EU/FlipViewDemo
Particularly the "animationDuration" attribute which already defined elsewhere.
Here's what I found in my research: https://code.google.com/p/android/issues/detail?id=22576
Suggested solution from the above link is to use app prefix.
The idea is that when calling stopLayoutAnimation()
the initial animation should not perform anymore, even if after a new View creation.
White Tick โ icon is showing on rear background.
Hi,
First of all thanks for the library.
I'm trying to create a simple demo to see how it works. I have your view declared as a row of a RecyclerView adapter.
<eu.davidea.flipview.FlipView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="200dp"
android:layout_height="200dp"
android:animateFirstView="false"
android:clickable="false"
app:frontLayout="@layout/view_list_word_front"
app:rearLayout="@layout/view_list_word_back">
</eu.davidea.flipview.FlipView>
The front and back are both just a simple CardView, empty.
If I run the code I see a circle shape with the front view as part of it. Where is this circle coming from? Why that shape? Why is not just showing the shape of the CardView?
Thanks
Hi
how to get the checked items? and their count?
how to mark list items?
thanks...
Experimented that, only with API 23, only flipping entire layouts, demo app:
If you know why, please let me know.
@davideas Would you be willing to re-publish this to mavenCentral or another repository other than bintray?
Not sure how this happens, but it happens. Searching a way to find the cause.
This doesn't happen in the example app, which it works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.