diff --git a/gen/com/upc/pbe/upcnews/R.java b/gen/com/upc/pbe/upcnews/R.java index c8ff396..b07f5e1 100644 --- a/gen/com/upc/pbe/upcnews/R.java +++ b/gen/com/upc/pbe/upcnews/R.java @@ -1,95 +1,96 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.upc.pbe.upcnews; - -public final class R { - public static final class attr { - } - public static final class color { - public static final int Black=0x7f050002; - public static final int Blue=0x7f050004; - public static final int BlueAndroid=0x7f050005; - public static final int Gay=0x7f050007; - public static final int Gray=0x7f05000a; - public static final int Green=0x7f050009; - public static final int Orange=0x7f050003; - public static final int Red=0x7f050008; - public static final int White=0x7f050006; - public static final int Whyte_POwaH=0x7f050001; - public static final int backgroundmain=0x7f050000; - } - public static final class dimen { - public static final int TitleSize=0x7f060000; - public static final int lesize=0x7f060001; - } - public static final class drawable { - public static final int ic_action_search=0x7f020000; - public static final int ic_launcher=0x7f020001; - public static final int ic_ledarklogo=0x7f020002; - public static final int ic_menu_name=0x7f020003; - public static final int ic_startbutton=0x7f020004; - public static final int selectedonlist=0x7f020005; - public static final int selectedonlist2=0x7f020006; - public static final int startbuttontoggle=0x7f020007; - } - public static final class id { - public static final int LinearLayout1=0x7f0a0001; - public static final int RelativeLayout1=0x7f0a0006; - public static final int button=0x7f0a0007; - public static final int itemhelp=0x7f0a000d; - public static final int itemprefs=0x7f0a000c; - public static final int listView1=0x7f0a0003; - public static final int menu_settings=0x7f0a000b; - public static final int rowTextView=0x7f0a000a; - public static final int textView1=0x7f0a0004; - public static final int textView2=0x7f0a0005; - public static final int textViewTitle=0x7f0a0002; - public static final int textViewUrl=0x7f0a0009; - public static final int textViewXml=0x7f0a0008; - public static final int videoView1=0x7f0a0000; - } - public static final class layout { - public static final int activity_video=0x7f030000; - public static final int dirs=0x7f030001; - public static final int help=0x7f030002; - public static final int main_activity=0x7f030003; - public static final int rowlayout=0x7f030004; - } - public static final class menu { - public static final int activity_main=0x7f090000; - public static final int activity_video=0x7f090001; - public static final int menu=0x7f090002; - } - public static final class string { - public static final int app_name=0x7f070000; - public static final int button=0x7f07000c; - public static final int button1=0x7f07000d; - public static final int defaultURL=0x7f070012; - public static final int desc=0x7f070009; - public static final int descarregar=0x7f070003; - public static final int dir=0x7f07000a; - public static final int directoris=0x7f07000b; - public static final int hello_world=0x7f070010; - public static final int help=0x7f070008; - public static final int hint=0x7f070004; - public static final int menu_settings=0x7f070001; - public static final int prefs=0x7f070007; - public static final int startbuttondescription=0x7f07000f; - public static final int title=0x7f07000e; - public static final int title_activity_main=0x7f070002; - public static final int title_activity_video=0x7f070011; - public static final int url=0x7f070005; - public static final int urlhint=0x7f070006; - } - public static final class style { - public static final int AppTheme=0x7f080000; - } - public static final class xml { - public static final int prefs=0x7f040000; - } -} +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.upc.pbe.upcnews; + +public final class R { + public static final class attr { + } + public static final class color { + public static final int Black=0x7f050002; + public static final int Blue=0x7f050004; + public static final int BlueAndroid=0x7f050005; + public static final int Gay=0x7f050007; + public static final int Gray=0x7f05000a; + public static final int Green=0x7f050009; + public static final int Orange=0x7f050003; + public static final int Red=0x7f050008; + public static final int White=0x7f050006; + public static final int Whyte_POwaH=0x7f050001; + public static final int backgroundmain=0x7f050000; + } + public static final class dimen { + public static final int TitleSize=0x7f060000; + public static final int lesize=0x7f060001; + } + public static final class drawable { + public static final int ic_action_search=0x7f020000; + public static final int ic_launcher=0x7f020001; + public static final int ic_ledarklogo=0x7f020002; + public static final int ic_menu_name=0x7f020003; + public static final int ic_startbutton=0x7f020004; + public static final int selectedonlist=0x7f020005; + public static final int selectedonlist2=0x7f020006; + public static final int startbuttontoggle=0x7f020007; + } + public static final class id { + public static final int LinearLayout1=0x7f0a0001; + public static final int RelativeLayout1=0x7f0a0006; + public static final int button=0x7f0a0007; + public static final int itemhelp=0x7f0a000d; + public static final int itemprefs=0x7f0a000c; + public static final int listView1=0x7f0a0003; + public static final int menu_settings=0x7f0a000b; + public static final int rowTextView=0x7f0a000a; + public static final int textView1=0x7f0a0004; + public static final int textView2=0x7f0a0005; + public static final int textViewTitle=0x7f0a0002; + public static final int textViewUrl=0x7f0a0009; + public static final int textViewXml=0x7f0a0008; + public static final int videoView1=0x7f0a0000; + } + public static final class layout { + public static final int activity_video=0x7f030000; + public static final int dirs=0x7f030001; + public static final int help=0x7f030002; + public static final int main_activity=0x7f030003; + public static final int rowlayout=0x7f030004; + } + public static final class menu { + public static final int activity_main=0x7f090000; + public static final int activity_video=0x7f090001; + public static final int menu=0x7f090002; + } + public static final class string { + public static final int app_name=0x7f070000; + public static final int button=0x7f07000c; + public static final int button1=0x7f07000d; + public static final int defaultURL=0x7f070012; + public static final int desc=0x7f070009; + public static final int descarregar=0x7f070003; + public static final int dir=0x7f07000a; + public static final int directoris=0x7f07000b; + public static final int hello_world=0x7f070010; + public static final int help=0x7f070008; + public static final int hint=0x7f070004; + public static final int menu_settings=0x7f070001; + public static final int prefs=0x7f070007; + public static final int startbuttondescription=0x7f07000f; + public static final int title=0x7f07000e; + public static final int title_activity_main=0x7f070002; + public static final int title_activity_video=0x7f070011; + public static final int url=0x7f070005; + public static final int urlhint=0x7f070006; + } + public static final class style { + public static final int AppTheme=0x7f080000; + public static final int leBoldText=0x7f080001; + } + public static final class xml { + public static final int prefs=0x7f040000; + } +} diff --git a/res/layout/dirs.xml b/res/layout/dirs.xml index 3e21001..e24ff4f 100644 --- a/res/layout/dirs.xml +++ b/res/layout/dirs.xml @@ -3,19 +3,21 @@ android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_gravity="center" android:background="@color/backgroundmain" android:gravity="center_horizontal" android:orientation="vertical" > + android:textColor="@color/Whyte_POwaH" + android:textStyle="bold" /> \ No newline at end of file diff --git a/src/com/upc/pbe/upcnews/BandwidthMeasurer.java b/src/com/upc/pbe/upcnews/BandwidthMeasurer.java index 0e8cdbd..4ab1e94 100644 --- a/src/com/upc/pbe/upcnews/BandwidthMeasurer.java +++ b/src/com/upc/pbe/upcnews/BandwidthMeasurer.java @@ -6,12 +6,10 @@ public class BandwidthMeasurer { public double Measure(long rxBytes, long Time) { + long AfterTime = System.currentTimeMillis(); double bps; long TotalRxAfterTest = TrafficStats.getTotalRxBytes(); - long AfterTime = System.currentTimeMillis(); - double TimeDifference = AfterTime - Time; - double rxDiff = TotalRxAfterTest - rxBytes; if(rxDiff != 0) diff --git a/src/com/upc/pbe/upcnews/Directoris.java b/src/com/upc/pbe/upcnews/Directoris.java index fe5bc93..f7423e3 100644 --- a/src/com/upc/pbe/upcnews/Directoris.java +++ b/src/com/upc/pbe/upcnews/Directoris.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import android.app.Activity; import android.content.Intent; -import android.graphics.Typeface; import android.os.Bundle; import android.util.Log; import android.view.KeyEvent; @@ -12,7 +11,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; -import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; @@ -71,7 +69,6 @@ public class Directoris extends Activity implements OnItemClickListener { ArrayList entries = parser.parse(d.doInBackground(currentFolder)); this.createEntries(entries); - this.styleEntries(); } public void createEntries(ArrayList directories) @@ -79,27 +76,10 @@ public class Directoris extends Activity implements OnItemClickListener String[] entries = directories.toArray(new String[directories.size()]); ListView listView = (ListView) findViewById(R.id.listView1); listView.setAdapter(null); - ArrayAdapter adapter = new ArrayAdapter(this, R.layout.rowlayout, entries); + ResourceAdapter adapter = new ResourceAdapter(this, R.layout.rowlayout, entries); listView.setAdapter(adapter); } - public void styleEntries() - { - ListView listView = (ListView) findViewById(R.id.listView1); - for(int i = 0; i < listView.getCount(); i++) - { - TextView text = (TextView) listView.getAdapter().getView(i,null,null); - if(text.getText().toString().endsWith(".m3u8")) - { - text.setTypeface(null,Typeface.BOLD); - Log.d(TAG, text.getText().toString()); - /* - * No va, mejorar (optional) - */ - } - } - } - public void onItemClick(AdapterView parent, View view, int position, long id) { String path = ((TextView)view).getText().toString(); diff --git a/src/com/upc/pbe/upcnews/ResourceAdapter.java b/src/com/upc/pbe/upcnews/ResourceAdapter.java new file mode 100644 index 0000000..8e386f5 --- /dev/null +++ b/src/com/upc/pbe/upcnews/ResourceAdapter.java @@ -0,0 +1,57 @@ +package com.upc.pbe.upcnews; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; +import android.graphics.Typeface; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +public class ResourceAdapter extends ArrayAdapter +{ + + Context context; + int layoutResourceId; + String[] entries = null; + + public ResourceAdapter(Context context, int layoutResourceId, String[] data) + { + super(context, layoutResourceId, data); + this.layoutResourceId = layoutResourceId; + this.context = context; + entries = data; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + TextView row; + + if (convertView == null) + { + LayoutInflater inflater = ((Activity)context).getLayoutInflater(); + row = (TextView) inflater.inflate(R.layout.rowlayout, parent, false); + } + else + { + row = (TextView) convertView; + } + + final String text = entries[position]; + row.setText(text); + if(text.endsWith(".m3u8")) //Playlists + { + row.setTypeface(null, Typeface.BOLD); + row.setTextColor(Color.WHITE); + } + else //Normal entries + { + row.setTypeface(null,Typeface.NORMAL); + row.setTextColor(((Activity)context).getResources().getColor(R.color.BlueAndroid)); + } + return row; + } +} \ No newline at end of file