rongi / rotate-layout Goto Github PK
View Code? Open in Web Editor NEWAndroid layout that can rotate any view.
License: MIT License
Android layout that can rotate any view.
License: MIT License
Hi, Rongi!
Thanks for your library. I've met an issue on the following layout. I have vertical ListView each item of which has its own ListView rotated counterclockwise. See image:
Rotating inner ListView means that all its items will be rotated. It isn't OK for me cause I need to get a kind of horizontal ListView. So I've rotated layout of each item clockwise for 90 degrees.
Everything works fine except on issue: when starting scrolling horizontally touching the right upper of the horizontal ListView item then horizontal list view jumps.
At the same time if I scroll touching other conners of the horizontal ListView item this "jumps" almost were not visible. I suggested that the jumping is caused because of coordinates conversion in RotateLayout.dispatchTouchEvent(MotionEvent event)
method. Cause after dispatchTouchEvent this event could be used by another view (horizontal ListView in my example). So I replaced
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
viewTouchPoint[0] = event.getX();
viewTouchPoint[1] = event.getY();
rotateMatrix.mapPoints(childTouchPoint, viewTouchPoint);
event.setLocation(childTouchPoint[0], childTouchPoint[1]);
return super.dispatchTouchEvent(event);
}
with the following code that restores back old coords:
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
float oldX = viewTouchPoint[0] = event.getX();
float oldY = viewTouchPoint[1] = event.getY();
rotateMatrix.mapPoints(childTouchPoint, viewTouchPoint);
event.setLocation(childTouchPoint[0], childTouchPoint[1]);
boolean result = super.dispatchTouchEvent(event);
event.setLocation(oldX, oldY);
return result;
}
So I would like to ask you to check my change. Don't you see any issues that it can bring ? If not maybe you will include this change to your repository. Thanks for attention :).
Hey, I might have missed it somewhere but is there a way to change the contained layout angle via code instead of using the xml [app:layout_angle="90"] ?
So that the angle changes dynamically.
EDIT: I tried doing ((RotateLayout.LayoutParams) layout.getView().getLayoutParams()).angle = (int) newAngle;
and it worked but it doesn't seem very clean.
i opened the latest project from release in android studio (also tried getting latest repo from git clone)
Gradle sync fails with below message
ERROR: Unsupported method: GradleProject.getProjectDirectory().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
I have a landscape activity and use below layout, and call mWebView.loadUrl("http://www.google.com"); it will cause the webview only fill the center of the screen. And if not call loadUrl, seems it is ok. Why?
<com.github.rongi.rotate_layout.layout.RotateLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/form1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000">
<WebView
android:id="@+id/webview"
app:layout_angle="90"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.github.rongi.rotate_layout.layout.RotateLayout>
JFrog just announced that they'll be shutting down JCenter, keeping it as a read-only package repo:
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/
Key dates are:
Hence rate-layout
should also be migrated to another maven repository like Maven central.
please change attribute name from angel to anything
Thanks
I use a chart inside the rotate-layout.
It works well with touch and drag. But it does not with multitouch (pinch to zoom), it works like if it isn't rotate.
I cloned the repo to fix it myself, but I was not able to compile it (I lost two hours trying to do it)
I think that the problem is that in dispatchTouchEvent() is modified only one pointer (the first).
The solution should be to modify all positions, but since the MotionEvent does not have methods to do that, a new MotionEvent must be created. Check this solution
I have implemented this Layout since long in my project now, When I have implemented Accessability with it, Its not working in RotationLayout Only.
Any suggestion or Help..
I like to rotate my VideoView. I tried your library but it did not worked in this case. Any workout for this?
Hello,
I'm using this library to achieve a horizontal list view by implementing the suggestion given by Kc Ochibili as an answer to this question: http://stackoverflow.com/questions/3240331/horizontal-listview-in-android. I'm getting the following errors when I try to use the library:
"error: Error parsing XML: unbound prefix"
and
"Attribute is missing the Android namespace prefix"
Here's what the code looks like so far:
`<com.github.rongi.rotate_layout.layout.RotateLayout
app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.newsfeedreader.NewsDisplay$PlaceholderFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/rss_feed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
app:layout_angle="-90"
/>
</com.github.rongi.rotate_layout.layout.RotateLayout>`
How can I get rid of these errors so that I can use this library? I'm trying to build an RSS feed reader by following this tutorial: https://www.androidpit.com/java-guide-2-program-your-own-rss-reader.
P.S. I'm a newbie when it comes to android development so please bear with me. :)
Because the warning of Android Studio :
Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
How can i rotate the view with any angle ?
I appreciate your hard effort. There is every thing perfectly buhh only one thing which I have noticed and faced is overflow/contextual menu are not accurate position in rotation even thy are not rotate.
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.