Commit 2ea470f7e8ea93ab3ee960fdd944aefe4aa492f0

Authored by Imanol-Mikel Barba Sabariego
1 parent 2121290e

--no commit message

res/layout/rowlayout.xml
1   -<TextView xmlns:android="http://schemas.android.com/apk/res/android"
2   - android:id="@+id/rowTextView"
3   - android:layout_width="fill_parent"
4   - android:layout_height="wrap_content"
5   - android:background="@drawable/selectedonlist"
6   - android:padding="10dp"
7   - android:textColor="@drawable/selectedonlist2"
8   - android:textSize="16sp" >
9   -
10   -</TextView>
11 1 \ No newline at end of file
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:id="@+id/lelayout"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="wrap_content" >
  6 +
  7 + <TextView
  8 + android:id="@+id/rowTextView"
  9 + android:layout_width="fill_parent"
  10 + android:layout_height="wrap_content"
  11 + android:background="@drawable/selectedonlist"
  12 + android:padding="10dp"
  13 + android:textColor="@drawable/selectedonlist2"
  14 + android:textSize="16sp" >
  15 + </TextView>
  16 +
  17 + <ImageView
  18 + android:id="@+id/rowImageView"
  19 + android:layout_width="wrap_content"
  20 + android:layout_height="wrap_content"
  21 + android:layout_alignParentRight="true"
  22 + android:layout_centerVertical="true"
  23 + android:layout_marginRight="50dp"
  24 + android:src="@android:drawable/btn_star_big_off" />
  25 +
  26 +</RelativeLayout>
12 27 \ No newline at end of file
... ...
src/com/upc/pbe/upcnews/ResourceAdapter.java
... ... @@ -8,6 +8,7 @@ import android.view.LayoutInflater;
8 8 import android.view.View;
9 9 import android.view.ViewGroup;
10 10 import android.widget.ArrayAdapter;
  11 +import android.widget.ImageView;
11 12 import android.widget.TextView;
12 13  
13 14 //Modificacio de l'Adapter d'Adnroid, creat al nostre gust per donar estil als elements de la ListView de directoris i arxius
... ... @@ -27,24 +28,29 @@ public class ResourceAdapter extends ArrayAdapter&lt;String&gt; {
27 28 @Override
28 29 public View getView(int position, View convertView, ViewGroup parent) {
29 30 TextView row;
  31 + ImageView rowImage;
30 32  
31 33 if (convertView == null) {
32 34 LayoutInflater inflater = ((Activity)context).getLayoutInflater();
33 35 row = (TextView) inflater.inflate(R.layout.rowlayout, parent, false);
  36 + rowImage = (ImageView) inflater.inflate(R.layout.rowlayout, parent, false);
34 37 }
35 38 else {
36 39 row = (TextView) convertView;
  40 + rowImage = (ImageView) convertView;
37 41 }
38 42 final String text = entries[position];
39 43 row.setText(text);
40   - //Si es un m3u8, posem el text en verd
  44 + //Si es un m3u8, posem el text en verd i l'icono de video
41 45 if(text.endsWith(".m3u8")) {
42 46 row.setTextColor(Color.parseColor("#5FB404"));
  47 + rowImage.setImageResource(R.drawable.mediacontroller_ff_left);
43 48 }
44   - //Si no, posem el text en blau
  49 + //Si no, posem el text en blau i l'icono de directori
45 50 else{
46 51 row.setTypeface(null,Typeface.NORMAL);
47 52 row.setTextColor(((Activity)context).getResources().getColor(R.color.BlueAndroid));
  53 + rowImage.setImageResource(R.drawable.mediacontroller_ff_right);
48 54 }
49 55 return row;
50 56 }
... ...