Giter VIP home page Giter VIP logo

Comments (10)

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 2, 2024

You mean like the share dialog? If so, that's what I'd like too.

from dialogplus.

doyonghoon avatar doyonghoon commented on September 2, 2024

interesting. what if just putting a transparency view on the header of listview as big as vertically half of the screen size and it enables to scroll from bottom to top at any time. In addition, there would be a sticky-headerview that does move like a headerview but only sticks at the top of the screen when the scroll is covered entire screen. It's inspired from the Google Keep, there is list of apps to share where is found at one's todo.

from dialogplus.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 2, 2024

@doyonghoon Actually, this is possible, but maybe it would be better to search in Android's code?
I've tried searching for this in the Android's code, but couldn't find how it really works (it's complicated).
Looking at the view hirerchy , this is what I've found:

untitled20150328124438

The TextView is for the title of the share dialog, btw.

I've searched for "resolver_list", and got to this class "com.android.internal.app.ResolverActivity" .
The UI is being prepared there, but as I wrote, it's quite complex.

from dialogplus.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 2, 2024

Searching for the "resolver_list" in the resources I've found this file "platforms\android-22\data\res\layout/resolver_list.xml" :

<com.android.internal.widget.ResolverDrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:maxWidth="@dimen/resolver_max_width"
    android:maxCollapsedHeight="192dp"
    android:maxCollapsedHeightSmall="56dp"
    android:id="@id/contentPanel">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alwaysShow="true"
        android:elevation="8dp"
        android:background="@color/white" >
        <TextView android:id="@+id/title"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  android:minHeight="56dp"
                  android:textAppearance="?attr/textAppearanceMedium"
                  android:gravity="start|center_vertical"
                  android:paddingStart="?attr/dialogPreferredPadding"
                  android:paddingEnd="?attr/dialogPreferredPadding"
                  android:paddingTop="8dp"
                  android:paddingBottom="8dp" />
        <LinearLayout android:id="@+id/profile_button"
                      android:layout_width="wrap_content"
                      android:layout_height="48dp"
                      android:layout_marginTop="4dp"
                      android:layout_marginEnd="4dp"
                      android:paddingStart="8dp"
                      android:paddingEnd="8dp"
                      android:paddingTop="4dp"
                      android:paddingBottom="4dp"
                      android:focusable="true"
                      android:visibility="gone"
                      style="?attr/borderlessButtonStyle">
            <ImageView android:id="@+id/icon"
                       android:layout_width="24dp"
                       android:layout_height="24dp"
                       android:layout_gravity="start|center_vertical"
                       android:layout_marginStart="4dp"
                       android:layout_marginEnd="16dp"
                       android:layout_marginTop="12dp"
                       android:layout_marginBottom="12dp"
                       android:scaleType="fitCenter" />
            <TextView android:id="@id/text1"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="start|center_vertical"
                      android:layout_marginEnd="16dp"
                      android:textAppearance="?attr/textAppearanceButton"
                      android:textColor="?attr/textColorPrimary"
                      android:minLines="1"
                      android:maxLines="1"
                      android:ellipsize="marquee" />
        </LinearLayout>
    </LinearLayout>

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/resolver_list"
        android:clipToPadding="false"
        android:scrollbarStyle="outsideOverlay"
        android:background="@color/white"
        android:elevation="8dp"
        android:nestedScrollingEnabled="true"
        android:divider="@null" />

    <TextView android:id="@+id/empty"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_alwaysShow="true"
              android:text="@string/noApplications"
              android:padding="32dp"
              android:gravity="center"
              android:visibility="gone" />

    <LinearLayout
        android:id="@+id/button_bar"
        android:visibility="gone"
        style="?android:attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_ignoreOffset="true"
        android:layout_alwaysShow="true"
        android:gravity="end|center_vertical"
        android:orientation="horizontal"
        android:layoutDirection="locale"
        android:measureWithLargestChild="true"
        android:background="@color/white"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:paddingStart="12dp"
        android:paddingEnd="12dp"
        android:elevation="8dp">
        <Button android:id="@+id/button_once"
                android:layout_width="wrap_content"
                android:layout_gravity="start"
                android:maxLines="2"
                style="?android:attr/buttonBarNegativeButtonStyle"
                android:minHeight="@dimen/alert_dialog_button_bar_height"
                android:layout_height="wrap_content"
                android:enabled="false"
                android:text="@string/activity_resolver_use_once"
                android:onClick="onButtonClick" />
        <Button android:id="@+id/button_always"
                android:layout_width="wrap_content"
                android:layout_gravity="end"
                android:maxLines="2"
                android:minHeight="@dimen/alert_dialog_button_bar_height"
                style="?android:attr/buttonBarPositiveButtonStyle"
                android:layout_height="wrap_content"
                android:enabled="false"
                android:text="@string/activity_resolver_use_always"
                android:onClick="onButtonClick" />
    </LinearLayout>

</com.android.internal.widget.ResolverDrawerLayout>

So I think the magic is in the "ResolverDrawerLayout" class.

from dialogplus.

doyonghoon avatar doyonghoon commented on September 2, 2024

@AndroidDeveloperLB so let me explain what I've achieved so far. The classes that you mentioned, ResolverDrawerLayout and ResolverActivity are not publicly accessible since it is unfortunately used only in the Google Android team. However, I copied whole codes related with ResolverActivity from lolipop_code_base and it has been eventually reproduced in DialogPlus.

As you expect, two parts are divided into to create this feature, list of apps to share.

  • First part is a dimmed screen that covered at top of the screen. There are lots of attributes used to resemble closely Dialog, those attrs enable to create dimmed screen part such as android:windowIsTranslucent. Also enter animation and exit animation are covered in this part.
  • Second part is an interation that scrolling from bottom to top, stretching the dialog to whole screen. The ResolverDrawerLayout is utilized for stretching to whole screen and share-apps on list are items on ListView.

I'm worried to cover this feature(scrolling from bottom to top, streching to whole screen) in DialogPlus since the way to create it may be quite different from the original one. DialogPlus is locked in only Dialog, however this feature is an Activity. I think we need to customize it as View to adopt it into DialogPlus, There could be painful efforts to reproduce it. How do you guys think of it? @AndroidDeveloperLB @orhanobut

thanks.

sample

from dialogplus.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 2, 2024

@doyonghoon Well, maybe it's best to try it on various device configurations, including tablets and landscape orientation.
This way you could see if it really works the same way, or differently on some cases.

Also, about what I've found, I didn't mean that it's easy or that it's an available API. I just wrote that this is what I've found. You can see that the package name has the word "internal" in it, so you see it's not meant for everyone else to use.

from dialogplus.

doyonghoon avatar doyonghoon commented on September 2, 2024

@AndroidDeveloperLB Let me dive into how to adopt it into DialogPlus and let me give some suggestions for it. I think ScreenType is a key point that let enable this feature. There should be a new type of enum value that describes covering only half of the screen when DialogPlus enters on window, even if there are enough items to cover whole screen. ResolverDrawerLayout will be mandatory to create scrolling from bottom to top, eventually stretching the dialog to whole screen.

@orhanobut mind if I create a pull request for this issue and you point out if there are parts to improve? thanks.

from dialogplus.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on September 2, 2024

@doyonghoon Sorry, I didn't dive enough to be of any help.

from dialogplus.

orhanobut avatar orhanobut commented on September 2, 2024

@doyonghoon @AndroidDeveloperLB First of all thanks for discussing about this feature. Currently I didn't have enough time to cover this feature but I'll be happy if you make a pull request of course. We can discuss the implementation and make it smooth and proper together. 👍

from dialogplus.

orhanobut avatar orhanobut commented on September 2, 2024

This feature is added since v1.6

from dialogplus.

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.