Merge pull request #12 from nextcloud/listItemStyle

Material Design list item style
This commit is contained in:
Mario Đanić 2017-10-24 23:38:27 +02:00 committed by GitHub
commit 9b67c3fef6
13 changed files with 92 additions and 97 deletions

View File

@ -29,6 +29,8 @@ import android.support.annotation.Nullable;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.text.InputType;
@ -279,16 +281,19 @@ public class CallsListController extends BaseController implements SearchView.On
}
private void prepareViews() {
recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity()));
LinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new FlexibleItemDecoration(getActivity())
.withDivider(R.drawable.divider));
recyclerView.addItemDecoration(new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
));
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(true));
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.colorPrimary));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
}
private void dispose(@Nullable Disposable disposable) {

View File

@ -29,6 +29,8 @@ import android.support.annotation.Nullable;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.text.InputType;
@ -69,7 +71,6 @@ import javax.inject.Inject;
import autodagger.AutoInjector;
import butterknife.BindView;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.common.FlexibleItemDecoration;
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@ -327,15 +328,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ
}
private void prepareViews() {
recyclerView.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity()));
LinearLayoutManager layoutManager = new SmoothScrollLinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new FlexibleItemDecoration(getActivity())
.withDivider(R.drawable.divider));
recyclerView.addItemDecoration(new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
));
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(true));
swipeRefreshLayout.setProgressBackgroundColorSchemeColor(getResources().getColor(R.color.colorPrimary));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
}
private void dispose(@Nullable Disposable disposable) {

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017 Mario Danic
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1dp"/>
<solid android:color="@color/colorPrimary"/>
</shape>

View File

@ -27,8 +27,8 @@
<path
android:fillColor="#FFFFFF"
android:pathData="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91
3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27 .28 v.79l5 4.99L20.49
android:pathData="M15.5 14h-0.79l-0.28-0.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91
3 9.5 5.91 16 9.5 16c1.61 0 3.09-0.59 4.23-1.57l 0.27 0.28 v 0.79l5 4.99L20.49
19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5
14z" />
<path

View File

@ -20,14 +20,15 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/item_height"
android:layout_height="@dimen/item_height"
android:layout_centerInParent="true"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
@ -48,7 +49,7 @@
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/padding_between_elements"
/>
android:textSize="18sp"
tools:text="Verifying..."/>
</RelativeLayout>
</RelativeLayout>

View File

@ -22,4 +22,4 @@
android:layout_gravity="bottom"
android:animateLayoutChanges="true"
android:background="?android:attr/windowBackground"/>
</LinearLayout>
</LinearLayout>

View File

@ -20,6 +20,7 @@
-->
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -28,7 +29,7 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
android:layout_height="match_parent"
tools:listitem="@layout/rv_item_call"/>
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.v4.widget.SwipeRefreshLayout>

View File

@ -47,4 +47,4 @@
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</RelativeLayout>
</RelativeLayout>

View File

@ -23,4 +23,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
</RelativeLayout>

View File

@ -31,4 +31,4 @@
</WebView>
</LinearLayout>
</LinearLayout>

View File

@ -3,7 +3,9 @@
~ Nextcloud Talk application
~
~ @author Mario Danic
~ @author Andy Scherzinger
~ Copyright (C) 2017 Mario Danic
~ Copyright (C) 2017 Andy Scherzinger
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@ -21,54 +23,60 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="@dimen/item_height">
<cn.carbs.android.avatarimageview.library.AvatarImageView
android:id="@+id/avatar_image_invisible"
android:visibility="invisible"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/padding_between_elements"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:scaleType="centerInside"
app:aiv_CornerRadius="20dp"
app:aiv_CornerRadius="@dimen/avatar_corner_radius"
app:aiv_ShowBoarder="false"
app:aiv_TextSizeRatio="0.5"/>
<cn.carbs.android.avatarimageview.library.AvatarImageView
android:id="@+id/avatar_image"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/padding_between_elements"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:scaleType="centerInside"
app:aiv_CornerRadius="20dp"
app:aiv_CornerRadius="@dimen/avatar_corner_radius"
app:aiv_ShowBoarder="false"
app:aiv_TextSizeRatio="0.5"/>
<TextView
android:id="@+id/name_text"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/avatar_image"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/padding_between_elements"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_toEndOf="@id/avatar_image"/>
<TextView
android:id="@+id/timestamp_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/name_text"
android:layout_centerInParent="true"
android:layout_toEndOf="@id/avatar_image"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/padding_between_elements"
android:layout_marginTop="@dimen/padding_between_elements"/>
android:orientation="vertical">
</RelativeLayout>
<TextView
android:id="@+id/name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="middle"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
tools:text="Call item text"/>
<TextView
android:id="@+id/timestamp_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
tools:text="A week ago"/>
</LinearLayout>
</RelativeLayout>

View File

@ -3,7 +3,9 @@
~ Nextcloud Talk application
~
~ @author Mario Danic
~ @author Andy Scherzinger
~ Copyright (C) 2017 Mario Danic
~ Copyright (C) 2017 Andy Scherzinger
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
@ -21,34 +23,33 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/item_height"
android:orientation="vertical">
<cn.carbs.android.avatarimageview.library.AvatarImageView
android:id="@+id/avatar_image_invisible"
android:visibility="invisible"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/padding_between_elements"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:scaleType="centerInside"
app:aiv_CornerRadius="20dp"
app:aiv_CornerRadius="@dimen/avatar_corner_radius"
app:aiv_ShowBoarder="false"
app:aiv_TextSizeRatio="0.5"/>
<cn.carbs.android.avatarimageview.library.AvatarImageView
android:id="@+id/avatar_image"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/padding_between_elements"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:scaleType="centerInside"
app:aiv_CornerRadius="20dp"
app:aiv_CornerRadius="@dimen/avatar_corner_radius"
app:aiv_ShowBoarder="false"
app:aiv_TextSizeRatio="0.5"/>
@ -57,10 +58,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:ellipsize="end"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/padding_between_elements"
android:layout_toEndOf="@id/avatar_image"/>
android:textAppearance="?android:attr/textAppearanceListItem"
android:layout_toEndOf="@id/avatar_image"
tools:text="Contact item text"/>
</RelativeLayout>
</RelativeLayout>

View File

@ -3,11 +3,17 @@
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="item_height">72dp</dimen>
<dimen name="display_target_image_size">200dp</dimen>
<dimen name="display_target_image_margin">24dp</dimen>
<!-- Custom transition dimensions -->
<dimen name="padding_normal">16dp</dimen>
<dimen name="margin_normal">16dp</dimen>
<dimen name="padding_between_elements">8dp</dimen>
<dimen name="margin_between_elements">8dp</dimen>
<dimen name="avatar_size">40dp</dimen>
<dimen name="avatar_corner_radius">20dp</dimen>
</resources>