Comments (6)
Cool yeah, I'd be glad to accept a pull request.
Thanks!
from android-split-pane-layout.
mod: public SplitPaneLayout(Context context) {
mod: this( context, ORIENTATION_HORIZONTAL, 50 );
mod: }
add: public SplitPaneLayout(Context context, int mOrientation, int mSplitterPositionPercent) {
add: super(context);
add: this.mOrientation = mOrientation;
add: this.mSplitterPositionPercent = mSplitterPositionPercent;
mod: mSplitterDrawable = new PaintDrawable(0x88FF0000);
mod: mSplitterDraggingDrawable = new PaintDrawable(0x880000FF);
add: }
Your version of private void extractAttributes(Context context, AttributeSet attrs) requires a lot of external resources, it is well for abstraction, but i think that it is too much to simplify integration, but it's only MY opinion.. I can't blame abstraction ;)
rem: protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
I totally avoided it (that changed nothing when it didn't worked & nothing after....)
add: protected int lastW = -1, lastH = -1;
kep: @OverRide
kep: protected void onLayout(boolean changed, int l, int t, int r, int b) {
SplitLayoutActivity.getInstance().status("onLayout("+changed+",l="+l+", t="+ t +", r="+ r +", b="+ b +")");
kep: int w = r - l;
kep: int h = b - t;
add: lastW = w; lastH = h;
add: if ( mOrientation == ORIENTATION_HORIZONTAL ) {
add: mSplitterPosition = (int)( (float)mSplitterPositionPercent / 100.0F * (float)w );
add: } else {
add: mSplitterPosition = (int)( (float)mSplitterPositionPercent / 100.0F * (float)h );
add: }
kep: switch (mOrientation) { .....
kep: public boolean onTouchEvent(MotionEvent event) {
(...)
kep: case MotionEvent.ACTION_UP: {
kep: if (isDragging) {
kep: isDragging = false;
kep: switch (mOrientation) {
kep: case ORIENTATION_HORIZONTAL: {
rem: //mSplitterPosition = x;
add: mSplitterPositionPercent = (int)(((float)x / (float)lastW) * 100F);
kep: break;
kep: }
kep: case ORIENTATION_VERTICAL: {
rem: //mSplitterPosition = y;
add: mSplitterPositionPercent = (int)(((float)y / (float)lastH) * 100F);
kep: break;
kep: }
kep: }
rem: //mSplitterPositionPercent = -1;
kep: remeasure();
kep: requestLayout();
kep: }
kep: break;
& that's all I kept all other code, sorry for the dirty-shape of my post, It's my 1st post on gitHub,
You're free to do what you want with my modifs.
for useage :
ex. MainActivity
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
setContentView(R.layout.main);
EditText v0 = new EditText(this);
v0.setText("left");
EditText v1 = new EditText(this);
v1.setText("right");
EditText v11 = new EditText(this);
v11.setText("right upper");
EditText v12 = new EditText(this);
v12.setText("right lower");
SplitPaneLayout splitRight = new SplitPaneLayout(this, SplitPaneLayout.ORIENTATION_VERTICAL, 35);
splitRight.addView(v11, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
splitRight.addView(v12, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
SplitPaneLayout splitPan = new SplitPaneLayout(this);
splitPan.addView(v0, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
//splitPan.addView(v1, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
splitPan.addView(splitRight, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
((LinearLayout) findViewById(R.id.mainPan)).addView(splitPan, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
... the different VIEWS LayoutParams aren't used ...
carry on ;)
& Thx for the work you already done
from android-split-pane-layout.
Do you have this as a patch file or can you make it available as a pull request?
from android-split-pane-layout.
I'll make you a correct diff this evening...
what need I know about "Pull Request" ? -> text ? code ? freeform ?
(I saw the section after posting my answer ;( )
@+
from android-split-pane-layout.
I didn't managed to add a pull request...
so I join you a diff form the 2 versions ( I kept some debugs ...)
I'm currently having some troubles when a/some SplitPane is/are in another
(nested layouts) & then I manipulate the splitDivider :
the recompuation of two parts sizes sometimes seems to not work ...),
When I'll have time to reproduce/dbug it, I'll tell you ...
here the diff code (from your currently commited version).
21a22,24
import com.example.testsplitlayout.SplitLayoutActivity;
48c51
< private int mOrientation = 0;
private int mOrientation = ORIENTATION_VERTICAL;
64a68,72
this( context, ORIENTATION_HORIZONTAL, 50 );
}public SplitPaneLayout(Context context, int mOrientation, int mSplitterPositionPercent) {
66,68c74,77
< mSplitterPositionPercent = 50;
< mSplitterDrawable = new PaintDrawable(0x88FFFFFF);< mSplitterDraggingDrawable = new PaintDrawable(0x88FFFFFF);
this.mOrientation = mOrientation; this.mSplitterPositionPercent = mSplitterPositionPercent; mSplitterDrawable = new PaintDrawable(0x88FF0000); mSplitterDraggingDrawable = new PaintDrawable(0x880000FF);
69a79
78a89,90
131,132c143,146
< @OverRide< protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//@OverRide
protected void DISABLED_onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
SplitLayoutActivity.getInstance().status("onMeasure("+widthMeasureSpec+","+heightMeasureSpec+")");141c155
< case 0: {
case ORIENTATION_HORIZONTAL: {
153c167
< case 1: {
case ORIENTATION_VERTICAL: {
167a182,185
protected int lastW = -1, lastH = -1;
169a188
SplitLayoutActivity.getInstance().status("onLayout("+changed+",l="+l+", t="+ t +", r="+ r +", b="+ b +")");
171a191,199lastW = w; lastH = h; if ( mOrientation == ORIENTATION_HORIZONTAL ) { mSplitterPosition = (int)( (float)mSplitterPositionPercent / 100.0F * (float)w ); } else { mSplitterPosition = (int)( (float)mSplitterPositionPercent / 100.0F * (float)h ); }
173c201
< case 0: {
case ORIENTATION_HORIZONTAL: {
229c257,258
< mSplitterPosition = x;
// mSplitterPosition = x;
mSplitterPositionPercent = (int)(((float)x / (float)lastW) * 100F);
233c262,263< mSplitterPosition = y;
// mSplitterPosition = y;
mSplitterPositionPercent = (int)(((float)y / (float)lastH) * 100F);
237c267< mSplitterPositionPercent = -1;
// mSplitterPositionPercent = -1;
271a302
SplitLayoutActivity.getInstance().status("own remeasure()");
372a404
SplitLayoutActivity.getInstance().status("setSplitterPositionPercent("+ position +")");
from android-split-pane-layout.
Sorry for the lack of response on this. To be honest, I am too busy to try to decipher this so I am going to have to decline to merge your changes without a proper pull request of diff/patch file I can download. Sorry.
from android-split-pane-layout.
Related Issues (20)
- remeasure method called twice
- on resize automatic recalculation HOT 1
- Could not find method runProGuard() HOT 2
- java.lang.UnsupportedOperationException: Can't convert value at index 1 to dimension: type=0x1d HOT 2
- Adding parent layout to one child view error
- Is this usable within a fragment? HOT 3
- Cant find SplitPaneLayout_paneSizeMin & SplitPaneLayout_splitterTouchSlop
- Child layouts aren't focusable when creating layout programmatically HOT 1
- SplitPaneLayout doesn't have default attributes when creating layout programmatically HOT 1
- Attributtes aren't saved on orientation changes if they are changed programmatically HOT 2
- splitterTouchSlop doesn't work if children is clickable HOT 1
- splitter position is incorrect based on its percentage if splitPaneLayout just occupy a portion of the screen HOT 1
- Splitter drawable is partially hidden when it is placed at borders HOT 1
- Precompiled library is obsolete in Maven Central
- https://www.hashcollision.org/hkn/java
- #KaliLinux [Errno 13]
- Why res/drawable-hdpi/ for your ShapeDrawables? HOT 1
- Child Splits HOT 1
- How to use split pan for spliting 3 layouts in android HOT 2
- Ability to set min / max position HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-split-pane-layout.