Code Monkey home page Code Monkey logo

Comments (6)

MobiDevelop avatar MobiDevelop commented on June 8, 2024

Cool yeah, I'd be glad to accept a pull request.

Thanks!

from android-split-pane-layout.

fgalliat avatar fgalliat commented on June 8, 2024

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.

MobiDevelop avatar MobiDevelop commented on June 8, 2024

Do you have this as a patch file or can you make it available as a pull request?

from android-split-pane-layout.

fgalliat avatar fgalliat commented on June 8, 2024

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.

fgalliat avatar fgalliat commented on June 8, 2024

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,199

lastW = 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.

MobiDevelop avatar MobiDevelop commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.