Commit c89d05ed06897505b502dcf51b2ae3a76660e6a7

Authored by Imanol-Mikel Barba Sabariego
1 parent c41f5571

Primer intent VideoActivity

AndroidManifest.xml
@@ -6,12 +6,13 @@ @@ -6,12 +6,13 @@
6 <uses-sdk 6 <uses-sdk
7 android:minSdkVersion="9" 7 android:minSdkVersion="9"
8 android:targetSdkVersion="10" /> 8 android:targetSdkVersion="10" />
9 - <uses-permission android:name="android.permission.INTERNET"/> 9 +
  10 + <uses-permission android:name="android.permission.INTERNET" />
10 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 11 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11 - <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>  
12 - <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>  
13 - <uses-feature android:name="android.hardware.wifi" /> 12 + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  13 + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
14 14
  15 + <uses-feature android:name="android.hardware.wifi" />
15 16
16 <application 17 <application
17 android:name=".UpcApp" 18 android:name=".UpcApp"
@@ -27,10 +28,23 @@ @@ -27,10 +28,23 @@
27 <category android:name="android.intent.category.LAUNCHER" /> 28 <category android:name="android.intent.category.LAUNCHER" />
28 </intent-filter> 29 </intent-filter>
29 </activity> 30 </activity>
30 - <activity android:name=".Descarrega"></activity>  
31 - <activity android:name=".Prefs" ></activity>  
32 - <activity android:name=".Help" ></activity>  
33 - <activity android:name=".Directoris"></activity> 31 + <activity android:name=".Descarrega" >
  32 + </activity>
  33 + <activity android:name=".Prefs" >
  34 + </activity>
  35 + <activity android:name=".Help" >
  36 + </activity>
  37 + <activity android:name=".Directoris" >
  38 + </activity>
  39 + <activity
  40 + android:name=".VideoActivity"
  41 + android:label="@string/title_activity_video" >
  42 + <intent-filter>
  43 + <action android:name="android.intent.action.MAIN" />
  44 +
  45 + <category android:name="android.intent.category.LAUNCHER" />
  46 + </intent-filter>
  47 + </activity>
34 </application> 48 </application>
35 49
36 </manifest> 50 </manifest>
37 \ No newline at end of file 51 \ No newline at end of file
gen/com/upc/pbe/upcnews/R.java
@@ -16,33 +16,36 @@ public final class R { @@ -16,33 +16,36 @@ public final class R {
16 public static final int ic_menu_name=0x7f020002; 16 public static final int ic_menu_name=0x7f020002;
17 } 17 }
18 public static final class id { 18 public static final class id {
19 - public static final int AbsoluteLayout1=0x7f080009;  
20 - public static final int ImageView01=0x7f08000b;  
21 - public static final int ImageView1=0x7f08000a;  
22 - public static final int LinearLayout1=0x7f080000;  
23 - public static final int button=0x7f08000e;  
24 - public static final int button1=0x7f080002;  
25 - public static final int button2=0x7f080003;  
26 - public static final int button3=0x7f080004;  
27 - public static final int button4=0x7f080005;  
28 - public static final int button5=0x7f080006;  
29 - public static final int itemhelp=0x7f080011;  
30 - public static final int itemprefs=0x7f080010;  
31 - public static final int menu_settings=0x7f08000f;  
32 - public static final int textView1=0x7f080007;  
33 - public static final int textView2=0x7f080008;  
34 - public static final int textViewRoute=0x7f08000c;  
35 - public static final int textViewTitle=0x7f080001;  
36 - public static final int textViewXml=0x7f08000d; 19 + public static final int AbsoluteLayout1=0x7f08000a;
  20 + public static final int ImageView01=0x7f08000c;
  21 + public static final int ImageView1=0x7f08000b;
  22 + public static final int LinearLayout1=0x7f080001;
  23 + public static final int button=0x7f08000f;
  24 + public static final int button1=0x7f080003;
  25 + public static final int button2=0x7f080004;
  26 + public static final int button3=0x7f080005;
  27 + public static final int button4=0x7f080006;
  28 + public static final int button5=0x7f080007;
  29 + public static final int itemhelp=0x7f080012;
  30 + public static final int itemprefs=0x7f080011;
  31 + public static final int menu_settings=0x7f080010;
  32 + public static final int textView1=0x7f080008;
  33 + public static final int textView2=0x7f080009;
  34 + public static final int textViewRoute=0x7f08000d;
  35 + public static final int textViewTitle=0x7f080002;
  36 + public static final int textViewXml=0x7f08000e;
  37 + public static final int videoView1=0x7f080000;
37 } 38 }
38 public static final class layout { 39 public static final class layout {
39 - public static final int dirs=0x7f030000;  
40 - public static final int help=0x7f030001;  
41 - public static final int main_activity=0x7f030002; 40 + public static final int activity_video=0x7f030000;
  41 + public static final int dirs=0x7f030001;
  42 + public static final int help=0x7f030002;
  43 + public static final int main_activity=0x7f030003;
42 } 44 }
43 public static final class menu { 45 public static final class menu {
44 public static final int activity_main=0x7f070000; 46 public static final int activity_main=0x7f070000;
45 - public static final int menu=0x7f070001; 47 + public static final int activity_video=0x7f070001;
  48 + public static final int menu=0x7f070002;
46 } 49 }
47 public static final class string { 50 public static final class string {
48 public static final int app_name=0x7f050000; 51 public static final int app_name=0x7f050000;
@@ -52,6 +55,7 @@ public final class R { @@ -52,6 +55,7 @@ public final class R {
52 public static final int descarregar=0x7f050003; 55 public static final int descarregar=0x7f050003;
53 public static final int dir=0x7f05000a; 56 public static final int dir=0x7f05000a;
54 public static final int directoris=0x7f05000b; 57 public static final int directoris=0x7f05000b;
  58 + public static final int hello_world=0x7f050010;
55 public static final int help=0x7f050008; 59 public static final int help=0x7f050008;
56 public static final int hint=0x7f050004; 60 public static final int hint=0x7f050004;
57 public static final int logodescription=0x7f05000f; 61 public static final int logodescription=0x7f05000f;
@@ -59,6 +63,7 @@ public final class R { @@ -59,6 +63,7 @@ public final class R {
59 public static final int prefs=0x7f050007; 63 public static final int prefs=0x7f050007;
60 public static final int title=0x7f05000e; 64 public static final int title=0x7f05000e;
61 public static final int title_activity_main=0x7f050002; 65 public static final int title_activity_main=0x7f050002;
  66 + public static final int title_activity_video=0x7f050011;
62 public static final int url=0x7f050005; 67 public static final int url=0x7f050005;
63 public static final int urlhint=0x7f050006; 68 public static final int urlhint=0x7f050006;
64 } 69 }
res/layout/activity_video.xml 0 โ†’ 100644
  1 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent" >
  5 +
  6 + <VideoView
  7 + android:id="@+id/videoView1"
  8 + android:layout_width="wrap_content"
  9 + android:layout_height="wrap_content"
  10 + android:layout_centerHorizontal="true"
  11 + android:layout_centerVertical="true" />
  12 +
  13 +</RelativeLayout>
res/menu/activity_video.xml 0 โ†’ 100644
  1 +<menu xmlns:android="http://schemas.android.com/apk/res/android">
  2 + <item android:id="@+id/menu_settings"
  3 + android:title="@string/menu_settings"
  4 + android:orderInCategory="100" />
  5 +</menu>
res/values/strings.xml
@@ -16,5 +16,7 @@ @@ -16,5 +16,7 @@
16 <string name="button1">Play</string> 16 <string name="button1">Play</string>
17 <string name="title">Directories found:</string> 17 <string name="title">Directories found:</string>
18 <string name="logodescription">Logo Image</string> 18 <string name="logodescription">Logo Image</string>
  19 + <string name="hello_world">Hello world!</string>
  20 + <string name="title_activity_video">VideoActivity</string>
19 21
20 </resources> 22 </resources>
21 \ No newline at end of file 23 \ No newline at end of file
src/com/upc/pbe/upcnews/Directoris.java
@@ -134,6 +134,10 @@ public class Directoris extends Activity implements OnClickListener { @@ -134,6 +134,10 @@ public class Directoris extends Activity implements OnClickListener {
134 Log.d(TAG, e.getMessage()); 134 Log.d(TAG, e.getMessage());
135 } 135 }
136 } 136 }
137 - 137 +
  138 + //VideoPlayer
  139 + String urlvid = null;
  140 + ((UpcApp) getApplication()).setDesc(urlvid);
  141 + startActivity(new Intent(this, VideoActivity.class));
138 } 142 }
139 } 143 }
140 \ No newline at end of file 144 \ No newline at end of file
src/com/upc/pbe/upcnews/VideoActivity.java 0 โ†’ 100644
  1 +package com.upc.pbe.upcnews;
  2 +
  3 +import android.net.Uri;
  4 +import android.os.Bundle;
  5 +import android.app.Activity;
  6 +import android.view.Menu;
  7 +import android.widget.MediaController;
  8 +import android.widget.VideoView;
  9 +
  10 +public class VideoActivity extends Activity {
  11 +
  12 + VideoView video;
  13 + String url;
  14 +
  15 + @Override
  16 + public void onCreate(Bundle savedInstanceState) {
  17 + super.onCreate(savedInstanceState);
  18 + setContentView(R.layout.activity_video);
  19 + url = ((UpcApp) getApplication()).getDesc();
  20 +
  21 + //Creacio del VideoPlayer associat a una URL
  22 + video = (VideoView) findViewById(R.id.videoView1);
  23 + video.setVideoURI(Uri.parse(url));
  24 + video.setMediaController(new MediaController(this));
  25 + video.start();
  26 + video.requestFocus();
  27 + }
  28 +
  29 + @Override
  30 + public boolean onCreateOptionsMenu(Menu menu) {
  31 + getMenuInflater().inflate(R.menu.activity_video, menu);
  32 + return true;
  33 + }
  34 +}