This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _TrianglePainter extends CustomPainter { | |
final double lineSize; | |
_TrianglePainter({this.lineSize = 16}); | |
@override | |
void paint(Canvas canvas, Size size) { | |
Path path = Path(); | |
path.moveTo(0, 0); | |
path.lineTo(lineSize, 0); | |
path.lineTo(lineSize / 2, tan(pi / 3) * lineSize / 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create Custom TextView. | |
public class TextViewDrawable extends android.support.v7.widget.AppCompatTextView { | |
public TextViewDrawable(Context context, @Nullable AttributeSet attrs) { | |
super(context, attrs); | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In layout | |
<SearchView | |
android:id="@+id/searchView" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:theme="@style/ReminderTheme" | |
/> | |
In Style |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/lnContainer" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<LinearLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SwipeRefreshLayoutToggleScrollListener extends RecyclerView.OnScrollListener { | |
private int overallYScroll = 0; | |
private GeneralSwipeRefreshLayout mSwipeLayout; | |
public SwipeRefreshLayoutToggleScrollListener(GeneralSwipeRefreshLayout swipeLayout) { | |
mSwipeLayout = swipeLayout; | |
} | |
@Override | |
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//we have to keep current scroll value somewhere in our fragment | |
private int overallYScroll = 0; | |
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { | |
@Override | |
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
super.onScrolled(recyclerView, dx, dy); | |
overallYScroll = overallYScroll + dy; |