Skip to content

Commit

Permalink
aggiornamento alla v1.0.3
Browse files Browse the repository at this point in the history
bugfix minori
inizio gestione chiamate anche su tablet
  • Loading branch information
ciopper90 committed Jul 9, 2014
1 parent c1e8738 commit 426a2f0
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 104 deletions.
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.gaiacri.mobile"
android:versionCode="3"
android:versionCode="4"
android:versionName="@string/app_version" >

<uses-sdk
Expand Down
Binary file added apk/GaiaAndroidV1.0.3.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>

<string name="app_name">Gaia Mobile</string>
<string name="app_version">1.0.2</string>
<string name="app_version">1.0.3</string>
<string name="menu_settings">Settings</string>
<string name="caricamento">Caricamento in corso</string>
<string name="menu_comunicazioni">Ultime 20 Comunicazioni:</string>
Expand Down
2 changes: 0 additions & 2 deletions src/it/gaiacri/mobile/PostaIngresso.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ protected void onPostExecute(String ris) {
//e.printStackTrace();
}
fixMittente();
//da gestire la risposta
//in base a come viene ritornata
aggiornalist();
}
}
Expand Down
79 changes: 25 additions & 54 deletions src/it/gaiacri/mobile/RubricaDelegati.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class RubricaDelegati extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v=inflater.inflate(R.layout.activity_rubrica_delegati, container, false);
richiestaDelegati();
context= this.getActivity();
Expand All @@ -69,17 +68,12 @@ public RichiestaDelegati(HashMap<String, String> data) {

protected void onPostExecute(String ris) {
if(ErrorJson.Controllo(ris,RubricaDelegati.this.getActivity(),risposta)==0){
Log.d("Json",risposta.toString());
//Log.d("Json",risposta.toString());

if(rubrica==null)
rubrica= new ArrayList<Rubrica>();

try {
// prin
//String TAG="Risposta: ";
//att_title=risposta.getString("nome");
//att_luogo=risposta.getString("luogo");
//int info_totale=risposta.getInt("totale");
JSONArray res=risposta.getJSONArray("risultati");

//recupera anche mittente da mostrare e salvare
Expand All @@ -91,23 +85,13 @@ protected void onPostExecute(String ris) {
String rubrica_cognome=obj.getString("cognome");
String rubrica_numero=obj.getString("numero");
String rubrica_email=obj.getString("email");
//JSONObject mittente=obj.optJSONObject("deleghe");
/*String posta_mittente="";
if(!(mittente == null)){
posta_mittente=obj.getJSONObject("mittente").getString("id");
if(!mitt.contains(posta_mittente))
mitt.add(posta_mittente);
}*/
rubrica.add(new Rubrica(rubrica_avatar,rubrica_nome,rubrica_cognome,rubrica_numero,rubrica_email,new ArrayList<String>()));//Log.d("ciao", );
rubrica.add(new Rubrica(rubrica_avatar,rubrica_nome,rubrica_cognome,rubrica_numero,rubrica_email,new ArrayList<String>()));
}

orderArray();
} catch (JSONException e) {
Log.e("ERROR" ,e.getMessage());
//e.printStackTrace();
}
//da gestire la risposta
//in base a come viene ritornata
}

}
Expand All @@ -128,7 +112,6 @@ private void orderArray(){
Collections.sort(rubrica, new Comparator<Rubrica>() {
@Override
public int compare(Rubrica arg0, Rubrica arg1) {
// TODO Auto-generated method stub
return (arg0.getCognome() + " "+ arg0.getNome()).compareTo(arg1.getCognome() + " "+ arg1.getNome());
}
});
Expand All @@ -139,21 +122,20 @@ public int compare(Rubrica arg0, Rubrica arg1) {
private void aggiornalist() {

if(rubrica!=null){
//Questa è la lista che rappresenta la sorgente dei dati della listview
//ogni elemento è una mappa(chiave->valore)
ArrayList<HashMap<String, Object>> data=new ArrayList<HashMap<String,Object>>();

HashMap<String,Object> ServiceMap=new HashMap<String, Object>();//creiamo una mappa di valori
HashMap<String,Object> ServiceMap=new HashMap<String, Object>();
Rubrica pos=null;
for(int i=0;i<rubrica.size();i++){
ServiceMap=new HashMap<String, Object>();//creiamo una mappa di valori
ServiceMap=new HashMap<String, Object>();
pos=rubrica.get(i);
ServiceMap.put("rubrica_nome", pos.getNome());
ServiceMap.put("rubrica_cognome",pos.getCognome());
data.add(ServiceMap); //aggiungiamo la mappa di valori alla sorgente dati
data.add(ServiceMap);
}
String[] from={"rubrica_cognome","rubrica_nome"}; //dai valori contenuti in queste chiavi
int[] to={R.id.rubrica_nome,R.id.rubrica_ruoli};//agli id delle view
//binding dei dati con la gui
String[] from={"rubrica_cognome","rubrica_nome"};
int[] to={R.id.rubrica_nome,R.id.rubrica_ruoli};

//costruzione dell adapter
SimpleAdapter adapter=new SimpleAdapter(
Expand All @@ -172,30 +154,25 @@ public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);

//set Avatar
//Log.d("avatar",""+rubrica.get(position).getAvatar());
ImageView iw=(ImageView) row.findViewById(R.id.rubrica_avatar);
iw.setImageBitmap(rubrica.get(position).getBitmap(context));

//((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).setTag(tag);
if(!RubricaUtils.isTelephonyEnabled(context))
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setVisibility(View.GONE);

((BootstrapButton)row.findViewById(R.id.rubrica_email)).setTag(rubrica.get(position).getEmail());
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setTag(rubrica.get(position).getNumero());
if(!RubricaUtils.isTelephonyEnabled(context))
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setVisibility(View.GONE);;

//settare azioni
((BootstrapButton)row.findViewById(R.id.rubrica_email)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendMail((String)((BootstrapButton)v.findViewById(R.id.rubrica_email)).getTag(),context);
//String id=(String)((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).getTag();
}
});
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendCall((String)((BootstrapButton)v.findViewById(R.id.rubrica_chiama)).getTag(),context);
//String id=(String)((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).getTag();
}
});

//settare azioni
((BootstrapButton)row.findViewById(R.id.rubrica_email)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendMail((String)((BootstrapButton)v.findViewById(R.id.rubrica_email)).getTag(),context);
}
});
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendCall((String)((BootstrapButton)v.findViewById(R.id.rubrica_chiama)).getTag(),context);
}
});
return row;
}
};
Expand All @@ -221,24 +198,23 @@ public void richiestaDelegati(){
private class ImageDownloaderProva extends AsyncTask<Object,Object,Object> {
@Override
protected void onProgressUpdate (Object... values){
Log.d("update", "via");
//Log.d("update", "via");
aggiornalist();
}

@Override
protected Object doInBackground(Object... param) {
// TODO Auto-generated method stub
String url="";
for(int i=0;i<rubrica.size();i++){
url=rubrica.get(i).getAvatar();
if(!url.equals("https://gaia.cri.it/./upload/avatar/placeholder/10.jpg")){
//e in cache??
if(cache.contains(url)){
Log.i("cache", "image"+rubrica.get(i).getAvatar());
//Log.i("cache", "image"+rubrica.get(i).getAvatar());
rubrica.get(i).setBitmap(cache.get(url));
publishProgress("");
}else{
Log.i("download", "image"+rubrica.get(i).getAvatar());
//Log.i("download", "image"+rubrica.get(i).getAvatar());
ImageDownloader im=new ImageDownloader();
im.execute(url,i);
}
Expand All @@ -252,19 +228,14 @@ private class ImageDownloader extends AsyncTask<Object,Bitmap,Bitmap> {
private int i;
@Override
protected Bitmap doInBackground(Object... param) {
// TODO Auto-generated method stub
i = (Integer) param[1];
return downloadBitmap((String)param[0]);
}

@Override
protected void onPostExecute(Bitmap result) {
Log.i("Async-Example", "onPostExecute Called");
rubrica.get(i).setBitmap(result);
aggiornalist();
//image.setImageBitmap(result);
//downloadedImg.setImageBitmap(result);

}

private Bitmap downloadBitmap(String url) {
Expand Down
54 changes: 14 additions & 40 deletions src/it/gaiacri/mobile/RubricaVolontari.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class RubricaVolontari extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v=inflater.inflate(R.layout.activity_rubrica_delegati, container, false);
richiestaDelegati();
context= this.getActivity();
Expand All @@ -69,17 +68,12 @@ public RichiestaDelegati(HashMap<String, String> data) {

protected void onPostExecute(String ris) {
if(ErrorJson.Controllo(ris,RubricaVolontari.this.getActivity(),risposta)==0){
Log.d("Json",risposta.toString());
//Log.d("Json",risposta.toString());

if(rubrica==null)
rubrica= new ArrayList<Rubrica>();

try {
// prin
//String TAG="Risposta: ";
//att_title=risposta.getString("nome");
//att_luogo=risposta.getString("luogo");
//int info_totale=risposta.getInt("totale");
JSONArray res=risposta.getJSONArray("risultati");

//recupera anche mittente da mostrare e salvare
Expand All @@ -91,25 +85,13 @@ protected void onPostExecute(String ris) {
String rubrica_cognome=obj.getString("cognome");
String rubrica_numero=obj.getString("numero");
String rubrica_email=obj.getString("email");
//JSONObject mittente=obj.optJSONObject("deleghe");
/*String posta_mittente="";
if(!(mittente == null)){
posta_mittente=obj.getJSONObject("mittente").getString("id");
if(!mitt.contains(posta_mittente))
mitt.add(posta_mittente);
}*/
rubrica.add(new Rubrica(rubrica_avatar,rubrica_nome,rubrica_cognome,rubrica_numero,rubrica_email,new ArrayList<String>()));//Log.d("ciao", );
rubrica.add(new Rubrica(rubrica_avatar,rubrica_nome,rubrica_cognome,rubrica_numero,rubrica_email,new ArrayList<String>()));
}

orderArray();
} catch (JSONException e) {
Log.e("ERROR" ,e.getMessage());
//e.printStackTrace();
}
//da gestire la risposta
//in base a come viene ritornata
}

}
@Override
public void restore(){
Expand All @@ -128,7 +110,6 @@ private void orderArray(){
Collections.sort(rubrica, new Comparator<Rubrica>() {
@Override
public int compare(Rubrica arg0, Rubrica arg1) {
// TODO Auto-generated method stub
return (arg0.getCognome() + " "+ arg0.getNome()).compareTo(arg1.getCognome() + " "+ arg1.getNome());
}
});
Expand All @@ -139,21 +120,20 @@ public int compare(Rubrica arg0, Rubrica arg1) {
private void aggiornalist() {

if(rubrica!=null){
//Questa è la lista che rappresenta la sorgente dei dati della listview
//ogni elemento è una mappa(chiave->valore)
ArrayList<HashMap<String, Object>> data=new ArrayList<HashMap<String,Object>>();

HashMap<String,Object> ServiceMap=new HashMap<String, Object>();//creiamo una mappa di valori
HashMap<String,Object> ServiceMap=new HashMap<String, Object>();
//creiamo una mappa di valori
Rubrica pos=null;
for(int i=0;i<rubrica.size();i++){
ServiceMap=new HashMap<String, Object>();//creiamo una mappa di valori
ServiceMap=new HashMap<String, Object>();
pos=rubrica.get(i);
ServiceMap.put("rubrica_nome", pos.getNome());
ServiceMap.put("rubrica_cognome",pos.getCognome());
data.add(ServiceMap); //aggiungiamo la mappa di valori alla sorgente dati
}
String[] from={"rubrica_cognome","rubrica_nome"}; //dai valori contenuti in queste chiavi
int[] to={R.id.rubrica_nome,R.id.rubrica_ruoli};//agli id delle view
data.add(ServiceMap);
}
//binding dei dati con gui
String[] from={"rubrica_cognome","rubrica_nome"};
int[] to={R.id.rubrica_nome,R.id.rubrica_ruoli};

//costruzione dell adapter
SimpleAdapter adapter=new SimpleAdapter(
Expand All @@ -172,26 +152,23 @@ public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);

//set Avatar
//Log.d("avatar",""+rubrica.get(position).getAvatar());
ImageView iw=(ImageView) row.findViewById(R.id.rubrica_avatar);
iw.setImageBitmap(rubrica.get(position).getBitmap(context));

//((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).setTag(tag);
if(!RubricaUtils.isTelephonyEnabled(context))
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setVisibility(View.GONE);

((BootstrapButton)row.findViewById(R.id.rubrica_email)).setTag(rubrica.get(position).getEmail());
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setTag(rubrica.get(position).getNumero());
if(!RubricaUtils.isTelephonyEnabled(context))
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setVisibility(View.GONE);;
//settare azioni
((BootstrapButton)row.findViewById(R.id.rubrica_email)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendMail((String)((BootstrapButton)v.findViewById(R.id.rubrica_email)).getTag(),context);
//String id=(String)((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).getTag();
}
});
((BootstrapButton)row.findViewById(R.id.rubrica_chiama)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
RubricaUtils.sendCall((String)((BootstrapButton)v.findViewById(R.id.rubrica_chiama)).getTag(),context);
//String id=(String)((BootstrapButton)v.findViewById(R.id.buttonPartecipa)).getTag();
}
});
return row;
Expand All @@ -200,6 +177,7 @@ public void onClick(View v) {
//utilizzo dell'adapter
listView.setAdapter(adapter);
}else{
//durante il caricamento dei dati viene mostrato il messaggio "Caricamento"
ArrayAdapter<String> arrayAdapter =new ArrayAdapter<String>(context, R.layout.riga_attivita, R.id.textViewList,new String[]{"Caricamento.."});
listView.setAdapter(arrayAdapter);
}
Expand All @@ -220,16 +198,13 @@ private class ImageDownloaderProva extends AsyncTask<Object,Object,Object> {
@Override
protected Object doInBackground(Object... param) {
String url="";
// TODO Auto-generated method stub
for(int i=0;i<rubrica.size();i++){
url=rubrica.get(i).getAvatar();
if(!url.equals("https://gaia.cri.it/./upload/avatar/placeholder/10.jpg")){
//e in cache??
if(cache.contains(url)){
//Log.i("cache", "image"+rubrica.get(i).getAvatar());
rubrica.get(i).setBitmap(cache.get(url));
}else{
//Log.i("download", "image"+rubrica.get(i).getAvatar());
ImageDownloader im=new ImageDownloader();
im.execute(url,i);
}
Expand All @@ -243,7 +218,6 @@ private class ImageDownloader extends AsyncTask<Object,Bitmap,Bitmap> {
private int i;
@Override
protected Bitmap doInBackground(Object... param) {
// TODO Auto-generated method stub
i = (Integer) param[1];
return downloadBitmap((String)param[0]);
}
Expand Down
Loading

0 comments on commit 426a2f0

Please sign in to comment.