yarolegovich / MaterialPreferences

A highly flexible set of lovely looking views that provides functionality of preferences.
Apache License 2.0
485 stars 67 forks source link

Padding #3

Closed BarisF closed 8 years ago

BarisF commented 8 years ago

It's not possible to add padding left and right ? For the moment, I used LinearLayout in MaterialPreferenceCategory.

And It'll be great for single choice to show the selected pref when it launch and for the others to show in the editbox the value if it exists already too.

yarolegovich commented 8 years ago

I don't understand what do you mean by padding here. Title, summary, icon and other components of AbsMaterialPreferences subclasses have predefined paddings. As for the default value - yeah, good point. Will add this when I have time.

BarisF commented 8 years ago

Here what i want to say, without padding and with padding and divider using linearlayout.

nopadding padding
yarolegovich commented 8 years ago

Send your xml please.

BarisF commented 8 years ago

I use LinearLayout with android:paddingStart and android:paddingEnd because it's not possible with MaterialStandardPreference, ...

` < com.yarolegovich.mp.MaterialPreferenceCategory android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/pref_cat_general" app:mpc_title="@string/pref_general" android:padding="16dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="@dimen/activity_horizontal_margin"
            android:paddingEnd="@dimen/activity_horizontal_margin"
            android:divider="@drawable/divider"
            android:showDividers="middle"
            android:orientation="vertical">

            <com.yarolegovich.mp.MaterialChoicePreference
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:id="@+id/pref_language"
                app:mp_key="pref_key_language"
                app:mp_default_value="English"
                app:mp_title="@string/pref_title_languages"
                app:mp_show_value="onRight"
                app:mp_entry_values="@array/languages" />

            <com.yarolegovich.mp.MaterialStandardPreference
                android:layout_width="match_parent"
                android:layout_height="50dp"
                app:mp_title="Copyright"
                app:mp_summary="Inovim @ 2016" />

            <com.yarolegovich.mp.MaterialStandardPreference
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:id="@+id/pref_version"
                app:mp_key="pref_key_version"
                app:mp_title="Version" />
        </LinearLayout>

    </com.yarolegovich.mp.MaterialPreferenceCategory>`
yarolegovich commented 8 years ago

What version are you testing on? LinearLayout is not needed there, paddings should already be applied (no need to specify them in preference category too). And better not hardcode height, this can cut some part of info. https://pp.vk.me/c630322/v630322751/31fad/HA_CLCLrQ90.jpg https://pp.vk.me/c630322/v630322751/31fa3/ncLIWfzp1W0.jpg

BarisF commented 8 years ago

Api 18 it's not working, then I add LinearLayout, tested on API 23 it's working but I need for API 18.

yarolegovich commented 8 years ago

I figured it out. Think this is due to support library update. For some reason

setBackgroundResource(Utils.clickableBackground(getContext()));

Removed paddings on pre-lollipop. Will push an update in 10 minutes. Thank you for pointing. https://github.com/yarolegovich/MaterialPreferences/blob/master/library/src/main/java/com/yarolegovich/mp/AbsMaterialPreference.java#L213

BarisF commented 8 years ago

Ok thanks, It'll be good too to put divider for MaterialPreferenceCategory.

yarolegovich commented 8 years ago

use version 1.0.5 now. should work. as for dividers - I don't have time now, maybe later. or you can do it yourself and create a pull request ;)

BarisF commented 8 years ago

Ok if I've time too.