Code Monkey home page Code Monkey logo

sheetmenu's Issues

Create Grid Style

Hi. Your library is too nice.
Can you please tell me how I can create Grid layout menu item?

Thanks

Option to show bottomsheet fully

For showing short lists such as menus with 4-6 items, the BottomSheetBehavior.STATE_HALF_EXPANDED that the menu starts with is annoying for the user and they can't tell if there are more items in most cases. There needs to be a display option that allows other values.

Предложения по улучшению

"menu" переименовал бы на "menuId"
"click" на "clickListener"
fun processTitle(textTitle: TextView) на fun TextView.changeTitile()

var itemLayoutId = R.layout.item_linear`
if (layoutManager is GridLayoutManager) {
    itemLayoutId = R.layout.item_grid
}

Я бы поменял на

val itemLayoutId = when (layoutManager) {
    is GridLayoutManager -> R.layout.item_grid
    else -> R.layout.item_linear
}

Ещё бы из функции fun processRecycler(recycler: RecyclerView, dialog: BottomSheetDialog) вынес
if (menu > 0){}, и саму функцию вообще убрал бы. Например, вот так:

fun show(context: Context) {
    ...
    val recycler = root.findViewById(R.id.recycler_view) as RecyclerView
    if (menuId > 0) {
        if (layoutManager == null) {
            layoutManager = createVerticalLinearLayoutManager()
        }
        val itemLayoutId = when (layoutManager) {
            is GridLayoutManager -> R.layout.item_grid
            else -> R.layout.item_linear
        }
        if (adapter == null) {
            adapter = createAdapter(dialog, itemLayoutId)
        }
        recyclerView.adapter = adapter
        recyclerView.layoutManager = layoutManager
    }
    ...
}
MenuItem.OnMenuItemClickListener({
    click.onMenuItemClick(it)
    dialog.cancel()
    true
})

поменял бы на

MenuItem.OnMenuItemClickListener {
    click.onMenuItemClick(it)
    dialog.cancel()
    true
}
protected open fun processGrid(root: View) {
    if (root.findViewById<View>(R.id.text_title).visibility != View.VISIBLE) {
        if (layoutManager is GridLayoutManager) {
            root.marginTop(24)
        }
    }
}

изменил на

protected open fun GridLayoutManager.setTopMarginIfTitleIsVisible(root: View) {
    if (root.findViewById<View>(R.id.text_title).visibility != View.VISIBLE) {
        root.marginTop(24)
    }
}

How can I display the grid menu with the description size below the icon?

Firstly, thank you for support a good program library.
I made a Grid style 4 * 2 menu with icons and descriptions. However, since one menu size is the same as the icon size, the description can not be displayed on one line.
How can I display the grid menu with the description size below the icon?

Thank you for advance.

screenshot_20170920-130556

Not all items are displayed at once

Problem: Not all items are displayed at once, but if you swipe up-everything is visible.

Code:

SheetMenu().apply {
    menu = R.menu.delete_device_menu
    click = MenuItem.OnMenuItemClickListener {
        when (it.itemId) {
            ...
        }
        true
    }
}.show(mContext)

Menu:

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:title="@string/sync_device"
        android:id="@+id/sync_device" />
    <item
        android:title="@string/delete"
        android:id="@+id/delete_device" />
</menu>

its resource menu only

you cant even create dynamic menu, as it only takes resource ID of a menu, pretty useless without dynamic items

How to remove icon area?

Thank you for make useful library.

I want show just only title in sheet. But icon area show always. Is possible remove icon area?

This is my code.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:id="@+id/menu_choose_photo"
    android:title="Choose"/>
  <item
    android:id="@+id/menu_remove_photo"
    android:title="remove"/>
</menu>
 SheetMenu.with(ProfileInputActivity.this)
        .setMenu(R.menu.choose_photo_bottom_sheet_menu)
        .setAutoCancel(false)
        .setClick(item -> {
          Logg.i("###", "|" + item.getTitle() + "|" + item.getItemId());
          return false;
        }).show();

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.