Skip to content
Snippets Groups Projects
Commit 897a1bec authored by Adrien Béraud's avatar Adrien Béraud
Browse files

blacklist: update on account change

Change-Id: I25aa432f17adad155a8f9d474b211cc65ee4e46c
parent 3adf2216
No related branches found
No related tags found
No related merge requests found
......@@ -126,15 +126,17 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr
toggleView(accountId, true);
FragmentManager fragmentManager = getChildFragmentManager();
Fragment existingFragment = fragmentManager.findFragmentByTag(JamiAccountSummaryFragment.TAG);
if (existingFragment == null) {
JamiAccountSummaryFragment fragment = new JamiAccountSummaryFragment();
Bundle args = new Bundle();
args.putString(ACCOUNT_ID_KEY, accountId);
if (existingFragment == null) {
JamiAccountSummaryFragment fragment = new JamiAccountSummaryFragment();
fragment.setArguments(args);
fragmentManager.beginTransaction()
.add(R.id.fragment_container, fragment, JamiAccountSummaryFragment.TAG)
.commit();
} else {
if (!existingFragment.isStateSaved())
existingFragment.setArguments(args);
((JamiAccountSummaryFragment) existingFragment).setAccount(accountId);
}
}
......@@ -149,6 +151,14 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr
binding.pager.setOffscreenPageLimit(4);
binding.slidingTabs.setupWithViewPager(binding.pager);
binding.pager.setAdapter(new PreferencesPagerAdapter(getChildFragmentManager(), getActivity(), accountId, isJami));
BlackListFragment existingFragment = (BlackListFragment) getChildFragmentManager().findFragmentByTag(BlackListFragment.TAG);
if (existingFragment != null) {
Bundle args = new Bundle();
args.putString(ACCOUNT_ID_KEY, accountId);
if (!existingFragment.isStateSaved())
existingFragment.setArguments(args);
existingFragment.setAccount(accountId);
}
}
@Override
......
......@@ -38,6 +38,7 @@ import cx.ring.client.HomeActivity;
import cx.ring.databinding.FragBlacklistBinding;
import cx.ring.model.CallContact;
import cx.ring.mvp.BaseSupportFragment;
import cx.ring.utils.DeviceUtils;
public class BlackListFragment extends BaseSupportFragment<BlackListPresenter> implements BlackListView,
BlackListViewHolder.BlackListListeners {
......@@ -69,7 +70,10 @@ public class BlackListFragment extends BaseSupportFragment<BlackListPresenter> i
return;
}
presenter.setAccountId(getArguments().getString(AccountEditionFragment.ACCOUNT_ID_KEY));
((HomeActivity) getActivity()).setToolbarTitle(R.string.ic_blacklist_menu);
HomeActivity activity = (HomeActivity) getActivity();
if (activity != null && DeviceUtils.isTablet(activity)) {
activity.setTabletTitle(R.string.ic_blacklist_menu);
}
}
@Override
......@@ -109,4 +113,8 @@ public class BlackListFragment extends BaseSupportFragment<BlackListPresenter> i
public void displayEmptyListMessage(final boolean display) {
binding.emptyTextView.setVisibility(display ? View.VISIBLE : View.GONE);
}
public void setAccount(String accountId) {
presenter.setAccountId(accountId);
}
}
\ No newline at end of file
......@@ -153,7 +153,7 @@ public class Interaction {
}
JsonObject toJson(String value) {
return new JsonParser().parse(value).getAsJsonObject();
return JsonParser.parseString(value).getAsJsonObject();
}
String fromJson(JsonObject json) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment