reduce nesting of draggable row

This commit is contained in:
Adrian Ulrich 2016-07-24 15:53:43 +02:00
parent f78485ed38
commit 9f0bcb6d18
9 changed files with 56 additions and 68 deletions

View File

@ -19,67 +19,50 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<View
android:id="@+id/pmark"
android:visibility="gone"
android:layout_width="@dimen/pmark_size"
android:layout_height="@dimen/row_normal_height"
android:background="?now_playing_marker" />
<ch.blinkenlights.android.vanilla.LazyCoverView
android:id="@+id/cover"
android:scaleType="centerCrop"
android:layout_width="@dimen/cover_size"
android:layout_height="@dimen/cover_size"
android:layout_marginLeft="@dimen/cover_padding_with_pmark"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<TextView
android:id="@+id/text"
android:maxLines="2"
android:textColor="?android:textColorPrimary"
android:gravity="left|center_vertical"
android:layout_width="0px"
android:layout_height="@dimen/row_normal_height"
android:layout_marginLeft="@dimen/text_padding"
android:layout_weight="1" />
<View
android:id="@+id/divider"
android:layout_width="@dimen/divider_size"
android:layout_height="fill_parent"
android:visibility="gone"
android:background="?android:attr/dividerHorizontal" />
<CheckedTextView
android:id="@+id/checkbox"
android:visibility="gone"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center_vertical"
android:layout_height="match_parent"
android:layout_width="@dimen/row_normal_height"/>
<ImageView
android:id="@+id/dragger"
android:visibility="gone"
android:src="@drawable/grabber"
android:scaleType="center"
android:layout_width="@dimen/row_normal_height"
android:layout_height="@dimen/row_normal_height"
/>
</LinearLayout>
android:orientation="horizontal">
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@drawable/inset_divider" />
android:id="@+id/pmark"
android:visibility="gone"
android:layout_width="@dimen/pmark_size"
android:layout_height="@dimen/row_normal_height"
android:background="?now_playing_marker" />
<ch.blinkenlights.android.vanilla.LazyCoverView
android:id="@+id/cover"
android:scaleType="centerCrop"
android:layout_width="@dimen/cover_size"
android:layout_height="@dimen/cover_size"
android:layout_marginLeft="@dimen/cover_padding_with_pmark"
android:layout_gravity="center_vertical"
android:visibility="gone" />
<TextView
android:id="@+id/text"
android:maxLines="2"
android:textColor="?android:textColorPrimary"
android:gravity="left|center_vertical"
android:layout_width="0px"
android:layout_height="@dimen/row_normal_height"
android:layout_marginLeft="@dimen/text_padding"
android:layout_weight="1" />
<View
android:id="@+id/divider"
android:layout_width="@dimen/divider_size"
android:layout_height="fill_parent"
android:visibility="gone"
android:background="?android:attr/dividerHorizontal" />
<CheckedTextView
android:id="@+id/checkbox"
android:visibility="gone"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="center_vertical"
android:layout_height="match_parent"
android:layout_width="@dimen/row_normal_height"/>
<ImageView
android:id="@+id/dragger"
android:visibility="gone"
android:src="@drawable/grabber"
android:scaleType="center"
android:layout_width="@dimen/row_normal_height"
android:layout_height="@dimen/row_normal_height" />
</ch.blinkenlights.android.vanilla.DraggableRow>

View File

@ -57,7 +57,8 @@ THE SOFTWARE.
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="?android:attr/selectableItemBackground"
android:divider="@null" />
android:divider="@drawable/inset_divider"
android:dividerHeight="1dip" />
</LinearLayout>

View File

@ -24,5 +24,6 @@ THE SOFTWARE.
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:divider="@drawable/inset_divider"
android:dividerHeight="1dip"
android:fastScrollEnabled="true"/>

View File

@ -19,7 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dslv="http://schemas.android.com/apk/res-auto"
android:id="@+id/list"
android:divider="@null"
android:divider="@drawable/inset_divider"
android:dividerHeight="1dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
dslv:drag_enabled="false"

View File

@ -6,7 +6,8 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:listSelector="?android:attr/selectableItemBackground"
android:divider="@null"
android:divider="@drawable/inset_divider"
android:dividerHeight="1dip"
dslv:drag_enabled="true"
dslv:drag_start_mode="onMove"
dslv:float_background_color="?float_color"

View File

@ -30,7 +30,8 @@ THE SOFTWARE.
android:layout_width="fill_parent">
<com.mobeta.android.dslv.DragSortListView
android:id="@+id/list"
android:divider="@null"
android:divider="@drawable/inset_divider"
android:dividerHeight="1dip"
android:layout_height="0px"
android:layout_width="fill_parent"
android:layout_weight="1"

View File

@ -636,7 +636,7 @@ public class MediaAdapter
public void onClick(View view)
{
int id = view.getId();
view = (View)view.getParent().getParent(); // get view of linear layout, not the click consumer
view = (View)view.getParent(); // get view of linear layout, not the click consumer
Intent intent = createData(view);
mActivity.onItemExpanded(intent);
}

View File

@ -125,7 +125,7 @@ public class PlaylistAdapter extends CursorAdapter implements Handler.Callback {
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent)
{
return mInflater.inflate(R.layout.draggable_row, null);
return mInflater.inflate(R.layout.draggable_row, parent, false);
}
/**

View File

@ -89,7 +89,7 @@ public class TabOrderAdapter extends BaseAdapter {
{
DraggableRow view;
if (convert == null) {
view = (DraggableRow)mInflater.inflate(R.layout.draggable_row, null);
view = (DraggableRow)mInflater.inflate(R.layout.draggable_row, parent, false);
view.setupLayout(DraggableRow.LAYOUT_CHECKBOXES);
} else {
view = (DraggableRow)convert;