Skip to content

Commit

Permalink
-prima di uscire si passa sempre dalla home #36
Browse files Browse the repository at this point in the history
  • Loading branch information
ciopper90 committed Apr 15, 2014
1 parent b84eaf0 commit b920c49
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
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">0.6.14</string>
<string name="app_version">0.6.15</string>
<string name="menu_settings">Settings</string>
<string name="caricamento">Caricamento in corso</string>
<string name="menu_comunicazioni">Ultime 20 Comunicazioni:</string>
Expand Down
4 changes: 0 additions & 4 deletions src/it/gaiacri/mobile/ElencoAttivita.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import it.gaiacri.mobile.Utils.DateUtils;
import it.gaiacri.mobile.Utils.ErrorJson;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;

import org.json.JSONArray;
Expand Down Expand Up @@ -36,7 +33,6 @@
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class ElencoAttivita extends Fragment {
Expand Down
29 changes: 22 additions & 7 deletions src/it/gaiacri/mobile/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void onCreate(Bundle savedInstanceState) {
t.setArguments(b);
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, t).commit();
.replace(R.id.content_frame, t,"main").commit();
title=getString(R.string.title_activity_menu_principale);
}

Expand Down Expand Up @@ -191,6 +191,7 @@ private class DrawerItemClickListener implements ListView.OnItemClickListener {
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Fragment test=null;
String tag="";
mDrawerList.setItemChecked(position, true);
Bundle b=new Bundle();
b.putString("sid", "test");
Expand All @@ -199,6 +200,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position,
title=getString(R.string.ns_menu_home_page);
test = new MenuPrincipale();
test.setArguments(b);
tag="main";
}
//Rubrica Delegati
if(((TextView)view.findViewById(R.id.menurow_title)).getText().toString().equals(getString(R.string.ns_menu_rubrica_delegati))){
Expand Down Expand Up @@ -248,17 +250,12 @@ public void onItemClick(AdapterView<?> parent, View view, int position,
startActivity(Intent.createChooser(emailIntent, "Send email..."));
}





if (test != null) {
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, test).commit(); //
.replace(R.id.content_frame, test,tag).commit(); //

}

//You should reset item counter
mDrawer.closeDrawer(mDrawerList);

Expand Down Expand Up @@ -316,4 +313,22 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

@Override
public void onBackPressed() {
FragmentManager fragmentManager = getSupportFragmentManager();
if(fragmentManager.findFragmentById(R.id.content_frame).getTag()!= "main"){
title=getString(R.string.ns_menu_home_page);
Fragment test = new MenuPrincipale();
Bundle b=new Bundle();
b.putString("sid", "prova");
test.setArguments(b);
fragmentManager.beginTransaction()
.replace(R.id.content_frame, test,"main").commit(); //
}else{
super.onBackPressed();
}
}



}
10 changes: 6 additions & 4 deletions src/it/gaiacri/mobile/MenuPrincipale.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.util.HashMap;

import org.json.JSONArray;
import org.json.JSONException;

import android.os.Bundle;
Expand Down Expand Up @@ -245,9 +244,12 @@ public void onClick(DialogInterface dialog, int id) {

//potrebbe dare problemi...sicuramente dara problemi :P
public void AddPosta(){
FragmentManager fragmentManager = this.getActivity().getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.posta_frame, new PostaIngresso()).commit(); //
FragmentActivity activity=this.getActivity();
if(activity!= null){
FragmentManager fragmentManager = activity.getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.posta_frame, new PostaIngresso()).commit(); //
}
}

}

0 comments on commit b920c49

Please sign in to comment.