Commit 83a93021dbbb5b8beed62b2f315aa730dffd2d69
1 parent
1277cf4f
Recursos resaltados
Showing
6 changed files
with
165 additions
and
123 deletions
gen/com/upc/pbe/upcnews/R.java
1 | -/* AUTO-GENERATED FILE. DO NOT MODIFY. | |
2 | - * | |
3 | - * This class was automatically generated by the | |
4 | - * aapt tool from the resource data it found. It | |
5 | - * should not be modified by hand. | |
6 | - */ | |
7 | - | |
8 | -package com.upc.pbe.upcnews; | |
9 | - | |
10 | -public final class R { | |
11 | - public static final class attr { | |
12 | - } | |
13 | - public static final class color { | |
14 | - public static final int Black=0x7f050002; | |
15 | - public static final int Blue=0x7f050004; | |
16 | - public static final int BlueAndroid=0x7f050005; | |
17 | - public static final int Gay=0x7f050007; | |
18 | - public static final int Gray=0x7f05000a; | |
19 | - public static final int Green=0x7f050009; | |
20 | - public static final int Orange=0x7f050003; | |
21 | - public static final int Red=0x7f050008; | |
22 | - public static final int White=0x7f050006; | |
23 | - public static final int Whyte_POwaH=0x7f050001; | |
24 | - public static final int backgroundmain=0x7f050000; | |
25 | - } | |
26 | - public static final class dimen { | |
27 | - public static final int TitleSize=0x7f060000; | |
28 | - public static final int lesize=0x7f060001; | |
29 | - } | |
30 | - public static final class drawable { | |
31 | - public static final int ic_action_search=0x7f020000; | |
32 | - public static final int ic_launcher=0x7f020001; | |
33 | - public static final int ic_ledarklogo=0x7f020002; | |
34 | - public static final int ic_menu_name=0x7f020003; | |
35 | - public static final int ic_startbutton=0x7f020004; | |
36 | - public static final int selectedonlist=0x7f020005; | |
37 | - public static final int selectedonlist2=0x7f020006; | |
38 | - public static final int startbuttontoggle=0x7f020007; | |
39 | - } | |
40 | - public static final class id { | |
41 | - public static final int LinearLayout1=0x7f0a0001; | |
42 | - public static final int RelativeLayout1=0x7f0a0006; | |
43 | - public static final int button=0x7f0a0007; | |
44 | - public static final int itemhelp=0x7f0a000d; | |
45 | - public static final int itemprefs=0x7f0a000c; | |
46 | - public static final int listView1=0x7f0a0003; | |
47 | - public static final int menu_settings=0x7f0a000b; | |
48 | - public static final int rowTextView=0x7f0a000a; | |
49 | - public static final int textView1=0x7f0a0004; | |
50 | - public static final int textView2=0x7f0a0005; | |
51 | - public static final int textViewTitle=0x7f0a0002; | |
52 | - public static final int textViewUrl=0x7f0a0009; | |
53 | - public static final int textViewXml=0x7f0a0008; | |
54 | - public static final int videoView1=0x7f0a0000; | |
55 | - } | |
56 | - public static final class layout { | |
57 | - public static final int activity_video=0x7f030000; | |
58 | - public static final int dirs=0x7f030001; | |
59 | - public static final int help=0x7f030002; | |
60 | - public static final int main_activity=0x7f030003; | |
61 | - public static final int rowlayout=0x7f030004; | |
62 | - } | |
63 | - public static final class menu { | |
64 | - public static final int activity_main=0x7f090000; | |
65 | - public static final int activity_video=0x7f090001; | |
66 | - public static final int menu=0x7f090002; | |
67 | - } | |
68 | - public static final class string { | |
69 | - public static final int app_name=0x7f070000; | |
70 | - public static final int button=0x7f07000c; | |
71 | - public static final int button1=0x7f07000d; | |
72 | - public static final int defaultURL=0x7f070012; | |
73 | - public static final int desc=0x7f070009; | |
74 | - public static final int descarregar=0x7f070003; | |
75 | - public static final int dir=0x7f07000a; | |
76 | - public static final int directoris=0x7f07000b; | |
77 | - public static final int hello_world=0x7f070010; | |
78 | - public static final int help=0x7f070008; | |
79 | - public static final int hint=0x7f070004; | |
80 | - public static final int menu_settings=0x7f070001; | |
81 | - public static final int prefs=0x7f070007; | |
82 | - public static final int startbuttondescription=0x7f07000f; | |
83 | - public static final int title=0x7f07000e; | |
84 | - public static final int title_activity_main=0x7f070002; | |
85 | - public static final int title_activity_video=0x7f070011; | |
86 | - public static final int url=0x7f070005; | |
87 | - public static final int urlhint=0x7f070006; | |
88 | - } | |
89 | - public static final class style { | |
90 | - public static final int AppTheme=0x7f080000; | |
91 | - } | |
92 | - public static final class xml { | |
93 | - public static final int prefs=0x7f040000; | |
94 | - } | |
95 | -} | |
1 | +/* AUTO-GENERATED FILE. DO NOT MODIFY. | |
2 | + * | |
3 | + * This class was automatically generated by the | |
4 | + * aapt tool from the resource data it found. It | |
5 | + * should not be modified by hand. | |
6 | + */ | |
7 | + | |
8 | +package com.upc.pbe.upcnews; | |
9 | + | |
10 | +public final class R { | |
11 | + public static final class attr { | |
12 | + } | |
13 | + public static final class color { | |
14 | + public static final int Black=0x7f050002; | |
15 | + public static final int Blue=0x7f050004; | |
16 | + public static final int BlueAndroid=0x7f050005; | |
17 | + public static final int Gay=0x7f050007; | |
18 | + public static final int Gray=0x7f05000a; | |
19 | + public static final int Green=0x7f050009; | |
20 | + public static final int Orange=0x7f050003; | |
21 | + public static final int Red=0x7f050008; | |
22 | + public static final int White=0x7f050006; | |
23 | + public static final int Whyte_POwaH=0x7f050001; | |
24 | + public static final int backgroundmain=0x7f050000; | |
25 | + } | |
26 | + public static final class dimen { | |
27 | + public static final int TitleSize=0x7f060000; | |
28 | + public static final int lesize=0x7f060001; | |
29 | + } | |
30 | + public static final class drawable { | |
31 | + public static final int ic_action_search=0x7f020000; | |
32 | + public static final int ic_launcher=0x7f020001; | |
33 | + public static final int ic_ledarklogo=0x7f020002; | |
34 | + public static final int ic_menu_name=0x7f020003; | |
35 | + public static final int ic_startbutton=0x7f020004; | |
36 | + public static final int selectedonlist=0x7f020005; | |
37 | + public static final int selectedonlist2=0x7f020006; | |
38 | + public static final int startbuttontoggle=0x7f020007; | |
39 | + } | |
40 | + public static final class id { | |
41 | + public static final int LinearLayout1=0x7f0a0001; | |
42 | + public static final int RelativeLayout1=0x7f0a0006; | |
43 | + public static final int button=0x7f0a0007; | |
44 | + public static final int itemhelp=0x7f0a000d; | |
45 | + public static final int itemprefs=0x7f0a000c; | |
46 | + public static final int listView1=0x7f0a0003; | |
47 | + public static final int menu_settings=0x7f0a000b; | |
48 | + public static final int rowTextView=0x7f0a000a; | |
49 | + public static final int textView1=0x7f0a0004; | |
50 | + public static final int textView2=0x7f0a0005; | |
51 | + public static final int textViewTitle=0x7f0a0002; | |
52 | + public static final int textViewUrl=0x7f0a0009; | |
53 | + public static final int textViewXml=0x7f0a0008; | |
54 | + public static final int videoView1=0x7f0a0000; | |
55 | + } | |
56 | + public static final class layout { | |
57 | + public static final int activity_video=0x7f030000; | |
58 | + public static final int dirs=0x7f030001; | |
59 | + public static final int help=0x7f030002; | |
60 | + public static final int main_activity=0x7f030003; | |
61 | + public static final int rowlayout=0x7f030004; | |
62 | + } | |
63 | + public static final class menu { | |
64 | + public static final int activity_main=0x7f090000; | |
65 | + public static final int activity_video=0x7f090001; | |
66 | + public static final int menu=0x7f090002; | |
67 | + } | |
68 | + public static final class string { | |
69 | + public static final int app_name=0x7f070000; | |
70 | + public static final int button=0x7f07000c; | |
71 | + public static final int button1=0x7f07000d; | |
72 | + public static final int defaultURL=0x7f070012; | |
73 | + public static final int desc=0x7f070009; | |
74 | + public static final int descarregar=0x7f070003; | |
75 | + public static final int dir=0x7f07000a; | |
76 | + public static final int directoris=0x7f07000b; | |
77 | + public static final int hello_world=0x7f070010; | |
78 | + public static final int help=0x7f070008; | |
79 | + public static final int hint=0x7f070004; | |
80 | + public static final int menu_settings=0x7f070001; | |
81 | + public static final int prefs=0x7f070007; | |
82 | + public static final int startbuttondescription=0x7f07000f; | |
83 | + public static final int title=0x7f07000e; | |
84 | + public static final int title_activity_main=0x7f070002; | |
85 | + public static final int title_activity_video=0x7f070011; | |
86 | + public static final int url=0x7f070005; | |
87 | + public static final int urlhint=0x7f070006; | |
88 | + } | |
89 | + public static final class style { | |
90 | + public static final int AppTheme=0x7f080000; | |
91 | + public static final int leBoldText=0x7f080001; | |
92 | + } | |
93 | + public static final class xml { | |
94 | + public static final int prefs=0x7f040000; | |
95 | + } | |
96 | +} | ... | ... |
res/layout/dirs.xml
... | ... | @@ -3,19 +3,21 @@ |
3 | 3 | android:id="@+id/LinearLayout1" |
4 | 4 | android:layout_width="match_parent" |
5 | 5 | android:layout_height="match_parent" |
6 | + android:layout_gravity="center" | |
6 | 7 | android:background="@color/backgroundmain" |
7 | 8 | android:gravity="center_horizontal" |
8 | 9 | android:orientation="vertical" > |
9 | 10 | |
10 | 11 | <TextView |
11 | 12 | android:id="@+id/textViewTitle" |
12 | - android:layout_width="wrap_content" | |
13 | - android:layout_height="wrap_content" | |
14 | - android:layout_marginLeft="14dp" | |
13 | + android:layout_width="fill_parent" | |
14 | + android:layout_height="50dp" | |
15 | 15 | android:background="@color/backgroundmain" |
16 | + android:gravity="center" | |
16 | 17 | android:text="@string/title" |
17 | 18 | android:textAppearance="?android:attr/textAppearanceMedium" |
18 | - android:textColor="@color/Whyte_POwaH" /> | |
19 | + android:textColor="@color/Whyte_POwaH" | |
20 | + android:textStyle="bold" /> | |
19 | 21 | |
20 | 22 | <ListView |
21 | 23 | android:id="@+id/listView1" | ... | ... |
res/values/styles.xml
src/com/upc/pbe/upcnews/BandwidthMeasurer.java
... | ... | @@ -6,12 +6,10 @@ public class BandwidthMeasurer |
6 | 6 | { |
7 | 7 | public double Measure(long rxBytes, long Time) |
8 | 8 | { |
9 | + long AfterTime = System.currentTimeMillis(); | |
9 | 10 | double bps; |
10 | 11 | long TotalRxAfterTest = TrafficStats.getTotalRxBytes(); |
11 | - long AfterTime = System.currentTimeMillis(); | |
12 | - | |
13 | 12 | double TimeDifference = AfterTime - Time; |
14 | - | |
15 | 13 | double rxDiff = TotalRxAfterTest - rxBytes; |
16 | 14 | |
17 | 15 | if(rxDiff != 0) | ... | ... |
src/com/upc/pbe/upcnews/Directoris.java
... | ... | @@ -4,7 +4,6 @@ import java.util.ArrayList; |
4 | 4 | |
5 | 5 | import android.app.Activity; |
6 | 6 | import android.content.Intent; |
7 | -import android.graphics.Typeface; | |
8 | 7 | import android.os.Bundle; |
9 | 8 | import android.util.Log; |
10 | 9 | import android.view.KeyEvent; |
... | ... | @@ -12,7 +11,6 @@ import android.view.Menu; |
12 | 11 | import android.view.MenuItem; |
13 | 12 | import android.view.View; |
14 | 13 | import android.widget.AdapterView; |
15 | -import android.widget.ArrayAdapter; | |
16 | 14 | import android.widget.ListView; |
17 | 15 | import android.widget.TextView; |
18 | 16 | import android.widget.AdapterView.OnItemClickListener; |
... | ... | @@ -71,7 +69,6 @@ public class Directoris extends Activity implements OnItemClickListener |
71 | 69 | { |
72 | 70 | ArrayList<String> entries = parser.parse(d.doInBackground(currentFolder)); |
73 | 71 | this.createEntries(entries); |
74 | - this.styleEntries(); | |
75 | 72 | } |
76 | 73 | |
77 | 74 | public void createEntries(ArrayList<String> directories) |
... | ... | @@ -79,27 +76,10 @@ public class Directoris extends Activity implements OnItemClickListener |
79 | 76 | String[] entries = directories.toArray(new String[directories.size()]); |
80 | 77 | ListView listView = (ListView) findViewById(R.id.listView1); |
81 | 78 | listView.setAdapter(null); |
82 | - ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.rowlayout, entries); | |
79 | + ResourceAdapter adapter = new ResourceAdapter(this, R.layout.rowlayout, entries); | |
83 | 80 | listView.setAdapter(adapter); |
84 | 81 | } |
85 | 82 | |
86 | - public void styleEntries() | |
87 | - { | |
88 | - ListView listView = (ListView) findViewById(R.id.listView1); | |
89 | - for(int i = 0; i < listView.getCount(); i++) | |
90 | - { | |
91 | - TextView text = (TextView) listView.getAdapter().getView(i,null,null); | |
92 | - if(text.getText().toString().endsWith(".m3u8")) | |
93 | - { | |
94 | - text.setTypeface(null,Typeface.BOLD); | |
95 | - Log.d(TAG, text.getText().toString()); | |
96 | - /* | |
97 | - * No va, mejorar (optional) | |
98 | - */ | |
99 | - } | |
100 | - } | |
101 | - } | |
102 | - | |
103 | 83 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) |
104 | 84 | { |
105 | 85 | String path = ((TextView)view).getText().toString(); | ... | ... |
src/com/upc/pbe/upcnews/ResourceAdapter.java
0 → 100644
1 | +package com.upc.pbe.upcnews; | |
2 | + | |
3 | +import android.app.Activity; | |
4 | +import android.content.Context; | |
5 | +import android.graphics.Color; | |
6 | +import android.graphics.Typeface; | |
7 | +import android.view.LayoutInflater; | |
8 | +import android.view.View; | |
9 | +import android.view.ViewGroup; | |
10 | +import android.widget.ArrayAdapter; | |
11 | +import android.widget.TextView; | |
12 | + | |
13 | +public class ResourceAdapter extends ArrayAdapter<String> | |
14 | +{ | |
15 | + | |
16 | + Context context; | |
17 | + int layoutResourceId; | |
18 | + String[] entries = null; | |
19 | + | |
20 | + public ResourceAdapter(Context context, int layoutResourceId, String[] data) | |
21 | + { | |
22 | + super(context, layoutResourceId, data); | |
23 | + this.layoutResourceId = layoutResourceId; | |
24 | + this.context = context; | |
25 | + entries = data; | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + public View getView(int position, View convertView, ViewGroup parent) | |
30 | + { | |
31 | + TextView row; | |
32 | + | |
33 | + if (convertView == null) | |
34 | + { | |
35 | + LayoutInflater inflater = ((Activity)context).getLayoutInflater(); | |
36 | + row = (TextView) inflater.inflate(R.layout.rowlayout, parent, false); | |
37 | + } | |
38 | + else | |
39 | + { | |
40 | + row = (TextView) convertView; | |
41 | + } | |
42 | + | |
43 | + final String text = entries[position]; | |
44 | + row.setText(text); | |
45 | + if(text.endsWith(".m3u8")) //Playlists | |
46 | + { | |
47 | + row.setTypeface(null, Typeface.BOLD); | |
48 | + row.setTextColor(Color.WHITE); | |
49 | + } | |
50 | + else //Normal entries | |
51 | + { | |
52 | + row.setTypeface(null,Typeface.NORMAL); | |
53 | + row.setTextColor(((Activity)context).getResources().getColor(R.color.BlueAndroid)); | |
54 | + } | |
55 | + return row; | |
56 | + } | |
57 | +} | |
0 | 58 | \ No newline at end of file | ... | ... |