mrKlar / PagedDragDropGrid

An Android ViewGroup that implements a paged grid with drag'n'drop moveable items
406 stars 185 forks source link

example PagedDragDropGrid #16

Closed Bigli closed 11 years ago

Bigli commented 11 years ago

Good day, I have a problem in the constructor, exemple.xml, when I connect (``ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid vylitaet error in xml, at com.Projects.libs.gridView.DragDropGrid.onMeasure (DragDropGrid.java: 696) at android.view.View.measure (View.java: 12723) at android.widget.HorizontalScrollView.measureChildWithMargins (HorizontalScrollView . Java: 1159) at android.widget.FrameLayout.onMeasure (FrameLayout.java: 293) at android.widget.HorizontalScrollView.onMeasure (HorizontalScrollView.java: 303) at android.view.View.measure (View.java: 12723) at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698) at android.widget.FrameLayout.onMeasure (FrameLayout.java: 293) at android.view.View.measure (View.java: 12723) at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698) at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java: 1369) at android.widget.LinearLayout.measureVertical (LinearLayout.java: 660) at android.widget.LinearLayout.onMeasure (LinearLayout.java: 553) at android.view.View.measure (View.java: 12723) at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java: 4698) at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java: 1369) at android.widget.LinearLayout.measureVertical (LinearLayout.java: 660) at android.widget.LinearLayout.onMeasure (LinearLayout.java: 553) at android.view.View.measure (View.java: 12723) at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView (RenderSessionImp l.java: 542) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render (RenderSessionImpl.jav a: 444) at com.android.layoutlib.bridge.Bridge.createSession (Bridge.java: 326) at com.android.ide.common.rendering.LayoutLibrary.createSession (LayoutLibrary.java: 325) at org.jetbrains.android.uipreview.RenderService.createRenderSession (RenderService. java: 127) at org.jetbrains.android.uipreview.RenderUtil.renderLayout (RenderUtil.java: 151) at at com.intellij.openapi.application.impl.ApplicationImpl $ 6.run (ApplicationImpl.java: 465) at java.util.concurrent.Executors $ RunnableAdapter.call (Executors.java: 471) at java.util.concurrent.FutureTask $ Sync.innerRun (FutureTask.java: 334) at java.util.concurrent.FutureTask.run (FutureTask.java: 166) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java: 1110) at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java: 603) at java.lang.Thread.run (Thread.java: 722) at com.intellij.openapi.application.impl.ApplicationImpl $ 1 $ 1.run (ApplicationImpl.java: 153)

Line 696 Display display = wm.getDefaultDisplay ();

@ Override     protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) {         int widthMode = MeasureSpec.getMode (widthMeasureSpec);         int heightMode = MeasureSpec.getMode (heightMeasureSpec);         int widthSize = MeasureSpec.getSize (widthMeasureSpec);         int heightSize = MeasureSpec.getSize (heightMeasureSpec);

        WindowManager wm = (WindowManager) getContext (). GetSystemService (Context.WINDOW_SERVICE);

        Display display = wm.getDefaultDisplay ();

        widthSize = acknowledgeWidthSize (widthMode, widthSize, display);         heightSize = acknowledgeHeightSize (heightMode, heightSize, display);

        adaptChildrenMeasuresToViewSize (widthSize, heightSize);         searchBiggestChildMeasures ();         computeGridMatrixSize (widthSize, heightSize);         computeColumnsAndRowsSizes (widthSize, heightSize);

        measureChild (deleteZone, MeasureSpec.makeMeasureSpec (gridPageWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec ((int) getPixelFromDip (40), MeasureSpec.EXACTLY));

        setMeasuredDimension (widthSize * adapter.pageCount (), heightSize);     }`)

Please help me, and I apologize for the bad English, in the code I have not changed anything.

lkorth commented 11 years ago

Do you run in to the same problem when you run the example app?

In the future please put three back ticks (```) before and after your code segments, it makes it easier to read

Bigli commented 11 years ago

Excuse me, in the future I will put ``, the code I have works fine, and the application starts, but the designer swears. I just downloaded the example and opened the idea

lkorth commented 11 years ago

So is this an error that is coming from your IDE when you're working on the xml? That's what it looks like based on the stack trace.

at org.jetbrains.android.uipreview.RenderService.createRenderSession (RenderService.java: 127)
at org.jetbrains.android.uipreview.RenderUtil.renderLayout (RenderUtil.java: 151)
at com.intellij.openapi.application.impl.ApplicationImpl $ 6.run (ApplicationImpl.java: 465)
Bigli commented 11 years ago

This is a bug in my idea of ​​12, when I switch to the design.

lkorth commented 11 years ago

So is IntelliJ crashing or just spitting out this error?

Bigli commented 11 years ago

Failure idea

lkorth commented 11 years ago

I don't usually work in IntelliJ, but I just cloned the project and opened it and opened example.xml and everything works fine. You might want to reclone the project and try opening it again.

Bigli commented 11 years ago

You work in a eclips?

lkorth commented 11 years ago

I do, but I tried to replicate your error in IntelliJ and it opened the layout no problem.

Bigli commented 11 years ago

This error can be caused by some sort of dll?

lkorth commented 11 years ago

It's most likely a configuration issue. You might want to try upgrading, the current version is 12.1

Bigli commented 11 years ago

I'm using 2.0.4, and when I import the project, it is an error "No frameworks detected."

lkorth commented 11 years ago

Make sure it's finding your Android SDK and properly detecting the project as an Android project. You may also want to read some of JetBrain's documentation on using their software.

Bigli commented 11 years ago

Forgot to mention about the mistake "colorfilter: Lighting Color Filters are not supported" perhaps because of her mistake? I re-downloaded, but it did not help.

Bigli commented 11 years ago

I also have been a mistake in the code (""layout.setBackground(context.getResources().getDrawable(R.drawable.list_selector_holo_light));) I had to comment. Class ExamplePagedDragDropGridAdapter.

lkorth commented 11 years ago

That line is used for onClick background selectors and is optional.

Sorry, but this area is for issues with the library which this is clearly not. Good luck solving your problem.

Bigli commented 11 years ago

Thank you very much for your response.

Bigli commented 11 years ago

The question remains open, downloaded all the sdk, all else fails, try a eclips, did not help, somebody help me.

lkorth commented 11 years ago

You may want to try something like StackOverflow as this is only for issues with the library, not your IDE or computer

Bigli commented 11 years ago

I'm just wondering why you have it working, but I have not.

lkorth commented 11 years ago

If you use the version of eclipse that comes with the sdk that will eliminate any configuration problems you may have. You should be able to update the sdk and then import the library and it'll work. It's that simple.

Bigli commented 11 years ago

I use exactly the sdk on the link you gave, I installed all the updates as well, I put the version 4.2, but the problem still exists.

lkorth commented 11 years ago

What is the problem exactly?

Bigli commented 11 years ago

In xml does not open in Design Editor, But the program works fine.

lkorth commented 11 years ago

The problem you are seeing is because eclipse is trying to create the view for the designer, but the view depends on the adapter. You cannot use the gui designer for the layout that uses this widget.

lkorth commented 11 years ago

It looks like it could be solved using the answer to this question

Basically surround the code that cannot be run without the adapter with

if(!isInEditMode()){
    //...
}
Bigli commented 11 years ago

Thank you so much, it helped me!