theming of swipe layout and list item decoration

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
AndyScherzinger 2017-10-24 22:02:36 +02:00
parent 761bfb9c16
commit 951947f9f0
3 changed files with 20 additions and 40 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,20 @@ 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.ItemDecoration dividerItemDecoration = new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
);
recyclerView.addItemDecoration(dividerItemDecoration);
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,19 @@ 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.ItemDecoration dividerItemDecoration = new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
);
recyclerView.addItemDecoration(dividerItemDecoration);
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>