Search in sources :

Example 1 with XMPPAccountAdapter

use of com.xabber.android.ui.adapter.XMPPAccountAdapter in project xabber-android by redsolution.

the class AccountSyncDialogFragment method setupView.

public View setupView() {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_account_sync, null);
    switchSyncAll = (Switch) view.findViewById(R.id.switchSyncAll);
    switchSyncAll.setChecked(SettingsManager.isSyncAllAccounts());
    switchSyncAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (adapter != null)
                adapter.setAllChecked(b);
        }
    });
    if (AccountManager.getInstance().haveNotAllowedSyncAccounts())
        switchSyncAll.setEnabled(false);
    setXmppAccounts(XabberAccountManager.getInstance().getXmppAccountsForSync());
    adapter = new XMPPAccountAdapter(getActivity());
    adapter.setItems(xmppAccounts);
    if (adapter != null && SettingsManager.isSyncAllAccounts())
        adapter.setAllChecked(true);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
    return view;
}
Also used : XMPPAccountAdapter(com.xabber.android.ui.adapter.XMPPAccountAdapter) LayoutInflater(android.view.LayoutInflater) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Example 2 with XMPPAccountAdapter

use of com.xabber.android.ui.adapter.XMPPAccountAdapter in project xabber-android by redsolution.

the class AccountSyncFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    tvLastSyncDate = (TextView) view.findViewById(R.id.tvLastSyncDate);
    switchSyncAll = (Switch) view.findViewById(R.id.switchSyncAll);
    switchSyncAll.setChecked(SettingsManager.isSyncAllAccounts());
    switchSyncAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (adapter != null)
                adapter.setAllChecked(b);
            saveSyncSettings();
        }
    });
    if (AccountManager.getInstance().haveNotAllowedSyncAccounts())
        switchSyncAll.setEnabled(false);
    setXmppAccounts(XabberAccountManager.getInstance().getXmppAccountsForSync());
    adapter = new XMPPAccountAdapter(getActivity(), this);
    adapter.setItems(xmppAccounts);
    if (adapter != null && SettingsManager.isSyncAllAccounts())
        adapter.setAllChecked(true);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(adapter);
}
Also used : XMPPAccountAdapter(com.xabber.android.ui.adapter.XMPPAccountAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) CompoundButton(android.widget.CompoundButton)

Aggregations

CompoundButton (android.widget.CompoundButton)2 XMPPAccountAdapter (com.xabber.android.ui.adapter.XMPPAccountAdapter)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1