Skip to content
Snippets Groups Projects
Commit 87ede207 authored by Jawn's avatar Jawn
Browse files

Custom pull to refresh, so that colors are set everywhere we use it automagically

parent 2d9db344
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,8 +59,7 @@ public class CommitsFragment extends Fragment implements SwipeRefreshLayout.OnRe
listView.addHeaderView(repoUrl);
 
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
if(Repository.selectedProject != null)
loadData();
Loading
Loading
Loading
Loading
@@ -48,8 +48,7 @@ public class FilesFragment extends Fragment implements OnItemClickListener, Swip
listView.setOnItemClickListener(this);
 
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
path = new ArrayList<String>();
if(Repository.selectedProject != null)
Loading
Loading
Loading
Loading
@@ -49,8 +49,7 @@ public class IssuesFragment extends Fragment implements OnItemClickListener, Swi
addIssueButton.attachToListView(listView);
 
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
if(Repository.selectedProject != null)
loadData();
Loading
Loading
Loading
Loading
@@ -49,8 +49,7 @@ public class UsersFragment extends Fragment implements OnItemClickListener, Swip
addUserButton.attachToListView(listView);
 
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
if(Repository.selectedProject != null)
loadData();
Loading
Loading
package com.commit451.gitlab.views;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import com.commit451.gitlab.R;
/**
* Just so that we do not have to keep setting the colors everywhere
* Created by Jawn on 7/5/2015.
*/
public class GitLabSwipeRefreshLayout extends SwipeRefreshLayout {
public GitLabSwipeRefreshLayout(Context context) {
super(context);
init();
}
public GitLabSwipeRefreshLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setColorSchemeResources(R.color.red, R.color.orange, R.color.yellow);
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
<com.commit451.gitlab.views.GitLabSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
Loading
Loading
@@ -10,4 +10,4 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
 
</android.support.v4.widget.SwipeRefreshLayout>
\ No newline at end of file
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
<com.commit451.gitlab.views.GitLabSwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
Loading
Loading
@@ -27,5 +27,5 @@
 
</RelativeLayout>
 
</android.support.v4.widget.SwipeRefreshLayout>
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
Loading
Loading
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
 
<android.support.v4.widget.SwipeRefreshLayout
<com.commit451.gitlab.views.GitLabSwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
Loading
Loading
@@ -16,7 +16,7 @@
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
 
</android.support.v4.widget.SwipeRefreshLayout>
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
<com.melnykov.fab.FloatingActionButton
android:id="@+id/add_issue_button"
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@
android:gravity="center"
android:visibility="gone"/>
 
<android.support.v4.widget.SwipeRefreshLayout
<com.commit451.gitlab.views.GitLabSwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
Loading
Loading
@@ -24,7 +24,7 @@
android:layout_alignParentLeft="true"
android:layout_below="@+id/add_user_button" />
 
</android.support.v4.widget.SwipeRefreshLayout>
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
<com.melnykov.fab.FloatingActionButton
android:id="@+id/add_user_button"
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
\ No newline at end of file
<resources>
<color name="red">#DF461B</color>
<color name="orange">#FB6C17</color>
<color name="yellow">#FAA11A</color>
<color name="grey">#373D47</color>
</resources>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment