Skip to content
Snippets Groups Projects
Commit 658999c1 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #36914: fix backstack issues, change selector of app sections

parent 18e30542
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:drawable="@color/darker_gray" android:state_pressed="true"/>
<item android:drawable="@color/lighter_gray" android:state_selected="true"/>
<item android:drawable="@color/lighter_gray" android:state_activated="true"/>
</selector>
\ No newline at end of file
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@+id/pts_main" android:layout_below="@+id/pts_main" />
android:paddingBottom="@dimen/contact_drawer_handle_height" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="@+id/user_name" android:layout_alignLeft="@+id/user_name"
android:layout_alignRight="@+id/user_name"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/user_name"
android:layout_below="@+id/user_name" > android:layout_below="@+id/user_name" >
<Spinner <Spinner
...@@ -59,7 +59,9 @@ ...@@ -59,7 +59,9 @@
<ListView <ListView
android:id="@+id/listView" android:id="@+id/listView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content"
android:choiceMode="singleChoice"
android:listSelector="@drawable/navigation_selector" >
</ListView> </ListView>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
android:paddingBottom="10dip" android:paddingBottom="10dip"
android:paddingLeft="15dip" android:paddingLeft="15dip"
android:paddingTop="10dip" android:paddingTop="10dip"
android:background="?android:attr/activatedBackgroundIndicator"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="20sp" /> android:textSize="20sp" />
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<item name="android:actionMenuTextAppearance">@style/MyActionBar.MenuTextStyle</item> <item name="android:actionMenuTextAppearance">@style/MyActionBar.MenuTextStyle</item>
<item name="android:windowActionBarOverlay">true</item> <item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@drawable/bg_72</item> <item name="android:windowBackground">@drawable/bg_72</item>
<item name="android:activatedBackgroundIndicator">@drawable/navigation_selector</item>
</style> </style>
<style name="AppThemeWithoutOverlay" parent="android:Theme.Holo.Light"> <style name="AppThemeWithoutOverlay" parent="android:Theme.Holo.Light">
......
...@@ -34,6 +34,7 @@ as that of the covered work. ...@@ -34,6 +34,7 @@ as that of the covered work.
<style name="AppTheme" parent="android:Theme.Light" > <style name="AppTheme" parent="android:Theme.Light" >
<item name="android:background">@drawable/bg_72</item> <item name="android:background">@drawable/bg_72</item>
<item name="android:activatedBackgroundIndicator">@drawable/navigation_selector</item>
</style> </style>
<style name="AccountFormContainer"> <style name="AccountFormContainer">
......
...@@ -333,7 +333,7 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca ...@@ -333,7 +333,7 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca
fContent = getSupportFragmentManager().findFragmentByTag(entry.getName()); fContent = getSupportFragmentManager().findFragmentByTag(entry.getName());
if(fContent == null) if(fContent == null)
Log.i(TAG, "Null frag"); Log.i(TAG, "Null frag");
getSupportFragmentManager().popBackStack(); getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
return; return;
} }
...@@ -686,6 +686,9 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca ...@@ -686,6 +686,9 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca
if (fContent instanceof HomeFragment) if (fContent instanceof HomeFragment)
break; break;
if(getSupportFragmentManager().getBackStackEntryCount() == 0)
break;
BackStackEntry entry = getSupportFragmentManager().getBackStackEntryAt(0); BackStackEntry entry = getSupportFragmentManager().getBackStackEntryAt(0);
fContent = getSupportFragmentManager().findFragmentByTag(entry.getName()); fContent = getSupportFragmentManager().findFragmentByTag(entry.getName());
getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
...@@ -694,15 +697,15 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca ...@@ -694,15 +697,15 @@ public class HomeActivity extends FragmentActivity implements DialingFragment.Ca
case 1: case 1:
if (fContent instanceof AccountsManagementFragment) if (fContent instanceof AccountsManagementFragment)
break; break;
Log.i(TAG, "BackStackEntries: " + getSupportFragmentManager().getBackStackEntryCount());
fContent = new AccountsManagementFragment(); fContent = new AccountsManagementFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fContent, "Home").addToBackStack("Home").commit(); getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fContent, "Accounts").addToBackStack("Accounts").commit();
break; break;
case 2: case 2:
if (fContent instanceof AboutFragment) if (fContent instanceof AboutFragment)
break; break;
fContent = new AboutFragment(); fContent = new AboutFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fContent, "Home").addToBackStack("Home").commit(); getSupportFragmentManager().beginTransaction().replace(R.id.main_frame, fContent, "About").addToBackStack("About").commit();
break; break;
} }
......
...@@ -13,6 +13,12 @@ import android.widget.TextView; ...@@ -13,6 +13,12 @@ import android.widget.TextView;
public class AboutFragment extends Fragment { public class AboutFragment extends Fragment {
@Override
public void onResume() {
super.onResume();
getActivity().getActionBar().setTitle(R.string.menu_item_about);
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View inflatedView = inflater.inflate(R.layout.frag_about, parent, false); View inflatedView = inflater.inflate(R.layout.frag_about, parent, false);
...@@ -21,7 +27,7 @@ public class AboutFragment extends Fragment { ...@@ -21,7 +27,7 @@ public class AboutFragment extends Fragment {
String linkText = "<a href='http://sflphone.org/'>" + getResources().getString(R.string.web_site) + "</a>"; String linkText = "<a href='http://sflphone.org/'>" + getResources().getString(R.string.web_site) + "</a>";
link.setText(Html.fromHtml(linkText)); link.setText(Html.fromHtml(linkText));
link.setMovementMethod(LinkMovementMethod.getInstance()); link.setMovementMethod(LinkMovementMethod.getInstance());
getActivity().getActionBar().setTitle(R.string.menu_item_about);
return inflatedView; return inflatedView;
} }
......
...@@ -146,7 +146,6 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa ...@@ -146,7 +146,6 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa
mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
Log.i(TAG, "anim time: " + mShortAnimationDuration); Log.i(TAG, "anim time: " + mShortAnimationDuration);
getActivity().getActionBar().setTitle(R.string.menu_item_accounts);
} }
...@@ -204,11 +203,9 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa ...@@ -204,11 +203,9 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa
intentFilter2.addAction(ConfigurationManagerCallback.ACCOUNTS_CHANGED); intentFilter2.addAction(ConfigurationManagerCallback.ACCOUNTS_CHANGED);
getActivity().registerReceiver(accountReceiver, intentFilter2); getActivity().registerReceiver(accountReceiver, intentFilter2);
getActivity().getSupportLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this); getActivity().getSupportLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
getActivity().getActionBar().setTitle(R.string.menu_item_accounts);
} }
@Override @Override
public void onCreateOptionsMenu(Menu m, MenuInflater inf) { public void onCreateOptionsMenu(Menu m, MenuInflater inf) {
super.onCreateOptionsMenu(m, inf); super.onCreateOptionsMenu(m, inf);
...@@ -433,16 +430,13 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa ...@@ -433,16 +430,13 @@ public class AccountsManagementFragment extends ListFragment implements LoaderCa
@Override @Override
public void onLoaderReset(android.support.v4.content.Loader<Bundle> arg0) { public void onLoaderReset(android.support.v4.content.Loader<Bundle> arg0) {
// TODO Stub de la méthode généré automatiquement
} }
@Override @Override
public android.support.v4.content.Loader<Bundle> onCreateLoader(int arg0, Bundle arg1) { public android.support.v4.content.Loader<Bundle> onCreateLoader(int arg0, Bundle arg1) {
AccountsLoader l = new AccountsLoader(getActivity(), mCallbacks.getService()); AccountsLoader l = new AccountsLoader(getActivity(), mCallbacks.getService());
l.forceLoad(); l.forceLoad();
return l; return l;
} }
} }
...@@ -52,6 +52,12 @@ public class HomeFragment extends Fragment { ...@@ -52,6 +52,12 @@ public class HomeFragment extends Fragment {
ViewPager mViewPager; ViewPager mViewPager;
SectionsPagerAdapter mSectionsPagerAdapter = null; SectionsPagerAdapter mSectionsPagerAdapter = null;
@Override
public void onResume() {
super.onResume();
getActivity().getActionBar().setTitle(R.string.menu_item_home);
}
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity) {
super.onAttach(activity); super.onAttach(activity);
...@@ -65,18 +71,13 @@ public class HomeFragment extends Fragment { ...@@ -65,18 +71,13 @@ public class HomeFragment extends Fragment {
@Override @Override
public void onCreate(Bundle savedBundle) { public void onCreate(Bundle savedBundle) {
super.onCreate(savedBundle); super.onCreate(savedBundle);
//FIXME : getFragmentManager does not handle nested fragments, pages are not saved!
mSectionsPagerAdapter = new SectionsPagerAdapter(getActivity(), getChildFragmentManager()); mSectionsPagerAdapter = new SectionsPagerAdapter(getActivity(), getChildFragmentManager());
getActivity().getActionBar().setTitle(R.string.menu_item_home);
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_home, container, false); ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_home, container, false);
// Set up the ViewPager with the sections adapter. // Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) rootView.findViewById(R.id.pager); mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
mViewPager.setPageTransformer(true, new ZoomOutPageTransformer(0.7f)); mViewPager.setPageTransformer(true, new ZoomOutPageTransformer(0.7f));
......
...@@ -112,7 +112,6 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A ...@@ -112,7 +112,6 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A
} }
} }
@Override @Override
...@@ -154,7 +153,7 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A ...@@ -154,7 +153,7 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A
((ListView) inflatedView.findViewById(R.id.listView)).setOnItemClickListener(new OnItemClickListener() { ((ListView) inflatedView.findViewById(R.id.listView)).setOnItemClickListener(new OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos, long arg3) { public void onItemClick(AdapterView<?> arg0, View selected, int pos, long arg3) {
mCallbacks.onSectionSelected(pos); mCallbacks.onSectionSelected(pos);
} }
}); });
...@@ -192,24 +191,12 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A ...@@ -192,24 +191,12 @@ public class MenuFragment extends Fragment implements LoaderCallbacks<Bundle>, A
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
} }
public Account getSelectedAccount() { public Account getSelectedAccount() {
return mAccountAdapter.getSelectedAccount(); return mAccountAdapter.getSelectedAccount();
} }
/**
* Called by activity to pass a reference to sipservice to Fragment.
*
* @param isip
*/
public void onServiceSipBinded(ISipService isip) {
}
public void updateAllAccounts() { public void updateAllAccounts() {
if (getActivity() != null) if (getActivity() != null)
getActivity().getSupportLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this); getActivity().getSupportLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment