From 8a68e8c4996dccca27707912ca2dbeff4cbe769c Mon Sep 17 00:00:00 2001 From: Equip de Desenvolupadors de PBE Date: Wed, 12 Dec 2012 15:37:22 +0000 Subject: [PATCH] --- res/raw/help.mp3 | Bin 0 -> 3409637 bytes src/com/upc/pbe/upcnews/Help.java | 34 ++++++++-------------------------- src/com/upc/pbe/upcnews/MainActivity.java | 14 +++++++++++--- 3 files changed, 19 insertions(+), 29 deletions(-) create mode 100644 res/raw/help.mp3 diff --git a/res/raw/help.mp3 b/res/raw/help.mp3 new file mode 100644 index 0000000..2a3ed7d Binary files /dev/null and b/res/raw/help.mp3 differ diff --git a/src/com/upc/pbe/upcnews/Help.java b/src/com/upc/pbe/upcnews/Help.java index e434584..3b2d32c 100644 --- a/src/com/upc/pbe/upcnews/Help.java +++ b/src/com/upc/pbe/upcnews/Help.java @@ -1,45 +1,27 @@ package com.upc.pbe.upcnews; import android.app.Activity; -import android.content.Intent; +import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; -import android.view.Menu; -import android.view.MenuItem; //Menu Help public class Help extends Activity{ final static String TAG = "Help"; + MediaPlayer mfondo; + public void onCreate(Bundle savedInstanceState) { - Log.d(TAG, "onCreated"); + mfondo = MediaPlayer.create(this, R.raw.help); + mfondo.start(); super.onCreate(savedInstanceState); setContentView(R.layout.help); } - public void onStop(){ + public void onDestroy(){ + mfondo.stop(); Log.d(TAG, "onStopped"); - super.onStop(); + super.onDestroy(); } - public boolean onCreateOptionsMenu(Menu menu) { - //Determina el funcionament al apretar la tecla d'opcions - getMenuInflater().inflate(R.menu.menu, menu); - Log.d(TAG, "Menu"); - return true; - } - - public boolean onOptionsItemSelected(MenuItem item) { - //Determina el funcionament al clickar en el menu d'opcions - switch (item.getItemId()) { - case R.id.itemprefs: - startActivity(new Intent(this, Prefs.class)); - Log.d(TAG, "Preferencies"); - return true; - case R.id.itemhelp: - return true; - default: - return false; - } - } } diff --git a/src/com/upc/pbe/upcnews/MainActivity.java b/src/com/upc/pbe/upcnews/MainActivity.java index aaa0c1b..45d970f 100644 --- a/src/com/upc/pbe/upcnews/MainActivity.java +++ b/src/com/upc/pbe/upcnews/MainActivity.java @@ -7,10 +7,12 @@ import java.util.List; import android.app.Activity; import android.app.DownloadManager; +import android.app.DownloadManager.Request; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; @@ -46,15 +48,21 @@ public class MainActivity extends Activity implements OnClickListener { if(tempFolder.mkdirs()) { Log.d(TAG,"Directori " + tempFolder.toString() + " creat"); } + Log.d(TAG, Environment.getExternalStorageDirectory().toString()); - //Prova descarrega DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); - Descarrega desc = new Descarrega(manager); + Request req = new Request(Uri.parse("http://10.0.2.157/upload/segments/pbe1.ts")); + + //req.setVisibleInDownloadsUi(false); + req.setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory().toString()+"/UPC NEWS", "a.ts"); + manager.enqueue(req); + + /*Descarrega desc = new Descarrega(manager); try { desc.descarrega("http://revistes.upc.es/~imanol/PBE/sample_ep_128k-00004.ts", Environment.DIRECTORY_DOWNLOADS, "marc.ts"); } catch (IOException e) { e.printStackTrace(); - } + }*/ -- libgit2 0.22.2