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 39 <item >2</item>
40 40 </string-array>
41 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 43 <string name="alertLogoDescription">Alerta!</string>
44 44  
45 45 </resources>
46 46 \ No newline at end of file
... ...
src/com/upc/pbe/upcnews/MainActivity.java
... ... @@ -3,17 +3,12 @@ package com.upc.pbe.upcnews;
3 3 import java.io.File;
4 4 import java.io.IOException;
5 5 import java.net.MalformedURLException;
6   -import java.util.List;
7 6  
8 7 import android.app.Activity;
9   -import android.app.DownloadManager;
10   -import android.content.Context;
11 8 import android.content.Intent;
12   -import android.content.pm.ApplicationInfo;
13 9 import android.content.pm.PackageManager;
14   -import android.net.Uri;
  10 +import android.content.pm.PackageManager.NameNotFoundException;
15 11 import android.os.Bundle;
16   -import android.os.Environment;
17 12 import android.util.Log;
18 13 import android.view.Menu;
19 14 import android.view.MenuItem;
... ... @@ -34,7 +29,8 @@ public class MainActivity extends Activity implements OnClickListener {
34 29 private TextView URLText, alertaText;
35 30  
36 31 @Override
37   - public void onCreate(Bundle savedInstanceState){
  32 + public void onCreate(Bundle savedInstanceState)
  33 + {
38 34 //Creem el layout
39 35 super.onCreate(savedInstanceState);
40 36 setContentView(R.layout.main_activity);
... ... @@ -49,21 +45,18 @@ public class MainActivity extends Activity implements OnClickListener {
49 45 buttonDescarrega = (ImageButton) findViewById(R.id.button);
50 46 buttonDescarrega.setOnClickListener(this);
51 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 55 alerta = (ImageView) findViewById(R.id.imageViewAlerta);
63 56 alerta.setVisibility(View.VISIBLE);
64 57 alertaText = (TextView) findViewById(R.id.textViewAlerta);
65 58 alertaText.setVisibility(View.VISIBLE);
66   - }
  59 + }
67 60 /*
68 61 * TESTING ANDROID DOWNLOADMANAGER NATIU
69 62 *
... ... @@ -139,10 +132,10 @@ public class MainActivity extends Activity implements OnClickListener {
139 132 /*
140 133 * COSAS POR HACER
141 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 136 * (NORMAL) Poner la defaultURL al server de PBE
144 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 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 26  
27 27 //Creem el layout
28 28 super.onCreate(savedInstanceState);
29   - if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this))
30   - {
31   - return;
32   - }
33 29 setContentView(R.layout.activity_video);
34 30 video = (VideoView) findViewById(R.id.VideoView1);
35 31 //Creem un listener associat al fi de l'activitat (el fi de cada ts)
... ...