|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.rthoni.stssaguenay.ui.fragments;
|
2
|
2
|
|
3
|
3
|
import android.app.ProgressDialog;
|
|
4
|
+import android.graphics.Color;
|
4
|
5
|
import android.os.Bundle;
|
5
|
6
|
import android.support.annotation.Nullable;
|
6
|
7
|
import android.support.v4.app.Fragment;
|
|
@@ -9,9 +10,11 @@ import android.support.v7.widget.RecyclerView;
|
9
|
10
|
import android.view.LayoutInflater;
|
10
|
11
|
import android.view.View;
|
11
|
12
|
import android.view.ViewGroup;
|
|
13
|
+import android.widget.ImageView;
|
12
|
14
|
import android.widget.TextView;
|
13
|
15
|
import android.widget.Toast;
|
14
|
16
|
|
|
17
|
+import com.amulyakhare.textdrawable.TextDrawable;
|
15
|
18
|
import com.luticate.utils.business.LuPromise;
|
16
|
19
|
import com.rthoni.stssaguenay.R;
|
17
|
20
|
import com.rthoni.stssaguenay.business.RoutesBusiness;
|
|
@@ -41,10 +44,10 @@ public class StopRoutesPickerFragment extends Fragment {
|
41
|
44
|
private RoutesAdapter _routesAdapter;
|
42
|
45
|
|
43
|
46
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
|
47
|
+ public ImageView _imageView;
|
44
|
48
|
public TextView _textView;
|
45
|
|
- public ViewHolder(TextView v) {
|
|
49
|
+ public ViewHolder(View v) {
|
46
|
50
|
super(v);
|
47
|
|
- _textView = v;
|
48
|
51
|
}
|
49
|
52
|
}
|
50
|
53
|
|
|
@@ -55,14 +58,22 @@ public class StopRoutesPickerFragment extends Fragment {
|
55
|
58
|
@Override
|
56
|
59
|
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
57
|
60
|
View v = LayoutInflater.from(parent.getContext())
|
58
|
|
- .inflate(R.layout.simple_recycler_view_item, parent, false);
|
59
|
|
- ViewHolder vh = new ViewHolder((TextView)v);
|
|
61
|
+ .inflate(R.layout.route_recycler_view_item, parent, false);
|
|
62
|
+ ViewHolder vh = new ViewHolder(v);
|
|
63
|
+ vh._textView = (TextView) v.findViewById(R.id.textView);
|
|
64
|
+ vh._imageView = (ImageView) v.findViewById(R.id.imageView);
|
60
|
65
|
return vh;
|
61
|
66
|
}
|
62
|
67
|
|
63
|
68
|
@Override
|
64
|
69
|
public void onBindViewHolder(ViewHolder holder, int position) {
|
65
|
70
|
final RoutesDbo routeDbo = _routes.get(position);
|
|
71
|
+ TextDrawable drawable = TextDrawable.builder()
|
|
72
|
+ .beginConfig()
|
|
73
|
+ .textColor(Color.parseColor("#" + routeDbo.getFgColor()))
|
|
74
|
+ .endConfig()
|
|
75
|
+ .buildRound(routeDbo.getId(), Color.parseColor("#" + routeDbo.getBgColor()));
|
|
76
|
+ holder._imageView.setImageDrawable(drawable);
|
66
|
77
|
holder._textView.setText(routeDbo.getFullName());
|
67
|
78
|
holder._textView.setOnClickListener(new View.OnClickListener() {
|
68
|
79
|
@Override
|