Commit 6bd330adeb25976c1d0d136d0f6f9f2a2e99b39e

Authored by Imanol-Mikel Barba Sabariego
1 parent 0d64c7c0

Advertencia si falta vitamio hecha

res/values/strings.xml
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 <item >2</item> 39 <item >2</item>
40 </string-array> 40 </string-array>
41 <string name="defaultQuality">0</string> 41 <string name="defaultQuality">0</string>
42 - <string name="alertVitamioNotInstalled">Alerta! Llibreries de Vitamio no instalades!</string> 42 + <string name="alertVitamioNotInstalled">Alerta! Llibreries de Vitamio no instal·lades!</string>
43 <string name="alertLogoDescription">Alerta!</string> 43 <string name="alertLogoDescription">Alerta!</string>
44 44
45 </resources> 45 </resources>
46 \ No newline at end of file 46 \ No newline at end of file
src/com/upc/pbe/upcnews/MainActivity.java
@@ -3,17 +3,12 @@ package com.upc.pbe.upcnews; @@ -3,17 +3,12 @@ package com.upc.pbe.upcnews;
3 import java.io.File; 3 import java.io.File;
4 import java.io.IOException; 4 import java.io.IOException;
5 import java.net.MalformedURLException; 5 import java.net.MalformedURLException;
6 -import java.util.List;  
7 6
8 import android.app.Activity; 7 import android.app.Activity;
9 -import android.app.DownloadManager;  
10 -import android.content.Context;  
11 import android.content.Intent; 8 import android.content.Intent;
12 -import android.content.pm.ApplicationInfo;  
13 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
14 -import android.net.Uri; 10 +import android.content.pm.PackageManager.NameNotFoundException;
15 import android.os.Bundle; 11 import android.os.Bundle;
16 -import android.os.Environment;  
17 import android.util.Log; 12 import android.util.Log;
18 import android.view.Menu; 13 import android.view.Menu;
19 import android.view.MenuItem; 14 import android.view.MenuItem;
@@ -34,7 +29,8 @@ public class MainActivity extends Activity implements OnClickListener { @@ -34,7 +29,8 @@ public class MainActivity extends Activity implements OnClickListener {
34 private TextView URLText, alertaText; 29 private TextView URLText, alertaText;
35 30
36 @Override 31 @Override
37 - public void onCreate(Bundle savedInstanceState){ 32 + public void onCreate(Bundle savedInstanceState)
  33 + {
38 //Creem el layout 34 //Creem el layout
39 super.onCreate(savedInstanceState); 35 super.onCreate(savedInstanceState);
40 setContentView(R.layout.main_activity); 36 setContentView(R.layout.main_activity);
@@ -49,21 +45,18 @@ public class MainActivity extends Activity implements OnClickListener { @@ -49,21 +45,18 @@ public class MainActivity extends Activity implements OnClickListener {
49 buttonDescarrega = (ImageButton) findViewById(R.id.button); 45 buttonDescarrega = (ImageButton) findViewById(R.id.button);
50 buttonDescarrega.setOnClickListener(this); 46 buttonDescarrega.setOnClickListener(this);
51 updateURL(); 47 updateURL();
52 - //Mostrem el missatge d'alerta si Vitamio no esta instalat  
53 - if(!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)){  
54 - /*  
55 - * NO SEMBLA QUE FUNCIONI (AIXO COMPROVA LA LLIBRERIA, NO LA APP)  
56 - * PROVAR CLASE D'ANDROID PACKAGEMANAGER PER OBTENIR LLISTA D'APPS INSTALADES  
57 - * QUE ALGU HO MIRI AL SEU MOVIL/TABLET, AL EMU NO PUC :( :( :(  
58 - PackageManager pm = getPackageManager();  
59 - List<ApplicationInfo> apps = pm.getInstalledApplications(0);  
60 - (recorrer la llista per veure si esta Vitamio)  
61 - */ 48 + PackageManager pm = getPackageManager();
  49 + try
  50 + {
  51 + pm.getApplicationInfo("io.vov.vitamio", 0);
  52 + }
  53 + catch (NameNotFoundException e)
  54 + {
62 alerta = (ImageView) findViewById(R.id.imageViewAlerta); 55 alerta = (ImageView) findViewById(R.id.imageViewAlerta);
63 alerta.setVisibility(View.VISIBLE); 56 alerta.setVisibility(View.VISIBLE);
64 alertaText = (TextView) findViewById(R.id.textViewAlerta); 57 alertaText = (TextView) findViewById(R.id.textViewAlerta);
65 alertaText.setVisibility(View.VISIBLE); 58 alertaText.setVisibility(View.VISIBLE);
66 - } 59 + }
67 /* 60 /*
68 * TESTING ANDROID DOWNLOADMANAGER NATIU 61 * TESTING ANDROID DOWNLOADMANAGER NATIU
69 * 62 *
@@ -139,10 +132,10 @@ public class MainActivity extends Activity implements OnClickListener { @@ -139,10 +132,10 @@ public class MainActivity extends Activity implements OnClickListener {
139 /* 132 /*
140 * COSAS POR HACER 133 * COSAS POR HACER
141 * (RELEASE-CRITICAL) Lentitud descarga -- Todos (este miercoles) 134 * (RELEASE-CRITICAL) Lentitud descarga -- Todos (este miercoles)
142 - * (SEVERE) Crash preferences (Me sigue saliendo O.o) 135 + * (NORMAL) Evitar k salga el panel de preferencias dentro de preferencias (no es crucial)
143 * (NORMAL) Poner la defaultURL al server de PBE 136 * (NORMAL) Poner la defaultURL al server de PBE
144 * (WISHLIST) Descarga en segundo plano (Mejora dificil) 137 * (WISHLIST) Descarga en segundo plano (Mejora dificil)
145 - * (WISHLIST) Añadir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD) 138 + * (WISHLIST) A�adir gif Imanol bailando (Easter eggs? vais en serio? XDDDDDDDDDDDD)
146 * Borrar esta puta mierda 139 * Borrar esta puta mierda
147 */ 140 */
148 } 141 }
src/com/upc/pbe/upcnews/VideoActivity.java
@@ -26,10 +26,6 @@ public class VideoActivity extends Activity { @@ -26,10 +26,6 @@ public class VideoActivity extends Activity {
26 26
27 //Creem el layout 27 //Creem el layout
28 super.onCreate(savedInstanceState); 28 super.onCreate(savedInstanceState);
29 - if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))  
30 - {  
31 - return;  
32 - }  
33 setContentView(R.layout.activity_video); 29 setContentView(R.layout.activity_video);
34 video = (VideoView) findViewById(R.id.VideoView1); 30 video = (VideoView) findViewById(R.id.VideoView1);
35 //Creem un listener associat al fi de l'activitat (el fi de cada ts) 31 //Creem un listener associat al fi de l'activitat (el fi de cada ts)