Giter VIP home page Giter VIP logo

Comments (7)

felipecsl avatar felipecsl commented on August 15, 2024

Yeah, check the sample app here. You can call addTargetView twice, one for top and one for bottom.
If you run the sample app, open the actionbar overflow menu and tap "Toggle bottom QuickReturn", then you'll have both active at the same time.

from quickreturn.

misrakli avatar misrakli commented on August 15, 2024

Thank you for your quick response.
I asked you because i tried this already out and didnt get it work.
The "bottom view" is placed over the "top view" but is scrolled down when the list is scrolled, so the place is wrong but the scrolling is right, both views are hidden. By the way using only topView works fine.

The differences to youre example are:

  1. I am adding the framelayout in onCreate to an other layout (relativelayout)
  2. I have separeted the Activity from the View (two different classes), the activity is acting as the presenter
  3. The "top" and "bottom" views are included in my activity_layout.xml per "include"
  4. I have to call adddTargetView in onGlobalLayout in my view, otherwise getWidth of the topView always returns 0 and topView (without bottomView) doesnt work, too

Do you have any ideas?
Thank you.

from quickreturn.

felipecsl avatar felipecsl commented on August 15, 2024

I will check this and get back to you. If you can provide some code snippets or a test app demonstrating the bug, it would be super helpful.
Thanks!

from quickreturn.

misrakli avatar misrakli commented on August 15, 2024

Hi Felipe,
thank you for reopening...Here are some snippets, hope they will help you..
Can't figure out how it works in your test app.. Thank you for your help.

base_layout.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/base_drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/base_view_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </RelativeLayout>

    <ListView
        android:id="@+id/base_drawer_list"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#FFFFFF"
        android:choiceMode="none"
        android:divider="#E6E6E6"
        android:dividerHeight="1dp" />

</android.support.v4.widget.DrawerLayout>

testlayout.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#E6E6E6" >

    <ListView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="#FFFFFF"
        android:dividerHeight="1dp"
        android:padding="0dp" >
    </ListView>

    <LinearLayout
        android:id="@+id/topView_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white" >

        <include
            android:id="@+id/topView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            layout="@layout/topView_layout />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/bottomView_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#33b5e5" >

        <include
            android:id="@+id/bottomView"
            layout="@layout/bottomView_layout"
            android:visibility="gone" />
    </LinearLayout>

</FrameLayout>
public class MyBaseActivity extends Activity {
    @override 
    public  onCreate(Bundle b){
        super.onCreate(b);
        setContentView(R.layout.my_base_layout);
        IMyViewInterface viewInterface = createView();
        ..
        this.baseContainer = (RelativeLayout)findViewById(R.id.base_view_container);

        View view = ViewCreator.createView(getLayoutInflater(), this.baseContainer, this.view.getResource());
        viewInterface.setView(view);
        viewInterface.setup();
        baseContainer.addView(view);
    }

    protected abstract IMyViewInterface createView();
}

public class MyTestActivity extends MyBaseActivity {
    @override 
    protected IMyViewInterface  createView() {
    return new MyTestView();
}

public class MyTestView implements IMyViewInterface {

    private View view;

    @override 
    public void setView(View view) {
        this.view = view;
    }

    @override
    public void setup() {
        this.bottomView = this.view.findViewById(R.id.bottomView);
        this.bottomView.setVisibility(View.GONE);
       this.TopView = this.view.findViewById(R.id.topView);
       this.list = this.view.findViewById(R.id.list);
        this.listOrders.setAdapter(new QuickReturnAdapter(this.adapter));
        final QuickReturnAttacher quickReturnAttacher = QuickReturnAttacher.forView(list);

        quickReturnAttacher.addTargetView(this.scanInfo, QuickReturnTargetView.POSITION_BOTTOM);

        this.listOrders.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener()
        {

            @Override
            public void onGlobalLayout()
            {
                   //I have to do it this way because otherwise topView is never shown, because height is always 0 if called getHeight() directly in setup()
                    quickReturnAttacher.addTargetView(stopDescriptionContainer,
                        QuickReturnTargetView.POSITION_TOP, topView.getHeight())
                        .setAnimatedTransition(false);
            }
        });

    }

from quickreturn.

misrakli avatar misrakli commented on August 15, 2024

Hi Felipe, any progress on this issue?
did my code snippets help you?

from quickreturn.

felipecsl avatar felipecsl commented on August 15, 2024

@misrakli sorry didn't have time to check yet. Will keep you posted

from quickreturn.

misrakli avatar misrakli commented on August 15, 2024

Ok..

from quickreturn.

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.