Commit 8a68e8c4996dccca27707912ca2dbeff4cbe769c

Authored by Imanol-Mikel Barba Sabariego
1 parent 6b555c4c

--no commit message

res/raw/help.mp3 0 → 100644
No preview for this file type
src/com/upc/pbe/upcnews/Help.java
1 1 package com.upc.pbe.upcnews;
2 2  
3 3 import android.app.Activity;
4   -import android.content.Intent;
  4 +import android.media.MediaPlayer;
5 5 import android.os.Bundle;
6 6 import android.util.Log;
7   -import android.view.Menu;
8   -import android.view.MenuItem;
9 7  
10 8 //Menu Help
11 9 public class Help extends Activity{
12 10  
13 11 final static String TAG = "Help";
14 12  
  13 + MediaPlayer mfondo;
  14 +
15 15 public void onCreate(Bundle savedInstanceState) {
16   - Log.d(TAG, "onCreated");
  16 + mfondo = MediaPlayer.create(this, R.raw.help);
  17 + mfondo.start();
17 18 super.onCreate(savedInstanceState);
18 19 setContentView(R.layout.help);
19 20 }
20   - public void onStop(){
  21 + public void onDestroy(){
  22 + mfondo.stop();
21 23 Log.d(TAG, "onStopped");
22   - super.onStop();
  24 + super.onDestroy();
23 25 }
24 26  
25   - public boolean onCreateOptionsMenu(Menu menu) {
26   - //Determina el funcionament al apretar la tecla d'opcions
27   - getMenuInflater().inflate(R.menu.menu, menu);
28   - Log.d(TAG, "Menu");
29   - return true;
30   - }
31   -
32   - public boolean onOptionsItemSelected(MenuItem item) {
33   - //Determina el funcionament al clickar en el menu d'opcions
34   - switch (item.getItemId()) {
35   - case R.id.itemprefs:
36   - startActivity(new Intent(this, Prefs.class));
37   - Log.d(TAG, "Preferencies");
38   - return true;
39   - case R.id.itemhelp:
40   - return true;
41   - default:
42   - return false;
43   - }
44   - }
45 27 }
... ...
src/com/upc/pbe/upcnews/MainActivity.java
... ... @@ -7,10 +7,12 @@ import java.util.List;
7 7  
8 8 import android.app.Activity;
9 9 import android.app.DownloadManager;
  10 +import android.app.DownloadManager.Request;
10 11 import android.content.Context;
11 12 import android.content.Intent;
12 13 import android.content.pm.PackageInfo;
13 14 import android.content.pm.PackageManager;
  15 +import android.net.Uri;
14 16 import android.os.Bundle;
15 17 import android.os.Environment;
16 18 import android.util.Log;
... ... @@ -46,15 +48,21 @@ public class MainActivity extends Activity implements OnClickListener {
46 48 if(tempFolder.mkdirs()) {
47 49 Log.d(TAG,"Directori " + tempFolder.toString() + " creat");
48 50 }
  51 + Log.d(TAG, Environment.getExternalStorageDirectory().toString());
49 52  
50   - //Prova descarrega
51 53 DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
52   - Descarrega desc = new Descarrega(manager);
  54 + Request req = new Request(Uri.parse("http://10.0.2.157/upload/segments/pbe1.ts"));
  55 +
  56 + //req.setVisibleInDownloadsUi(false);
  57 + req.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory().toString()+"/UPC NEWS", "a.ts");
  58 + manager.enqueue(req);
  59 +
  60 + /*Descarrega desc = new Descarrega(manager);
53 61 try {
54 62 desc.descarrega("http://revistes.upc.es/~imanol/PBE/sample_ep_128k-00004.ts", Environment.DIRECTORY_DOWNLOADS, "marc.ts");
55 63 } catch (IOException e) {
56 64 e.printStackTrace();
57   - }
  65 + }*/
58 66  
59 67  
60 68  
... ...