Skip to content
Snippets Groups Projects
Commit 5ea84ae5 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#17159: Update AccountSelectionButton on dialog selection

parent cf15b949
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,8 @@ import android.widget.TextView;
import java.util.ArrayList;
import com.savoirfairelinux.sflphone.utils.AccountSelectionButton;
public class AccountSelectionDialog extends AlertDialog
{
private static final String TAG = "AccountSelectionDialog";
......@@ -51,12 +53,14 @@ public class AccountSelectionDialog extends AlertDialog
ListView mListView;
ArrayAdapter mListAdapter;
ArrayList<String> mItems;
AccountSelectionButton mButton;
public AccountSelectionDialog(Context context, ArrayList<String> items)
public AccountSelectionDialog(Context context, ArrayList<String> items, AccountSelectionButton b)
{
super(context);
mContext = context;
mItems = items;
mButton = b;
}
private AdapterView.OnItemClickListener onClick = new AdapterView.OnItemClickListener()
......@@ -64,6 +68,7 @@ public class AccountSelectionDialog extends AlertDialog
// public void onClick(DialogInterface dialog, int which) {
public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
Log.i(TAG, "Selected Account: " + ((TextView)view).getText());
mButton.setText(((TextView)view).getText());
}
};
......
......@@ -269,19 +269,7 @@ public class ContactListFragment extends ListFragment implements OnQueryTextList
{
View inflatedView = inflater.inflate(R.layout.call_element_list, container, false);
Button accountSelectionButton = (Button) inflatedView.findViewById(R.id.account_selection_button);
accountSelectionButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
ArrayList<String> list = (ArrayList<String>)service.getAccountList();
AccountSelectionDialog accountSelectionDialog = new AccountSelectionDialog(getActivity(), list);
accountSelectionDialog.show();
}
catch (RemoteException e) {
Log.e(TAG, "Remote exception", e);
}
}
});
// Button accountSelectionButton = (Button) inflatedView.findViewById(R.id.account_selection_button);
return inflatedView;
}
......
......@@ -63,12 +63,13 @@ public class AccountSelectionButton extends Button
public void setSipService(ISipService service, Context context) {
mService = service;
mContext = context;
final AccountSelectionButton b = this;
setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
ArrayList<String> list = (ArrayList<String>)mService.getAccountList();
AccountSelectionDialog accountSelectionDialog = new AccountSelectionDialog(mContext, list);
AccountSelectionDialog accountSelectionDialog = new AccountSelectionDialog(mContext, list, b);
accountSelectionDialog.show();
}
catch (RemoteException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment