Factorized wait layout and chat room popup error + added it to contact's details view
This commit is contained in:
parent
2948b31ff3
commit
f14e4e6f3f
8 changed files with 148 additions and 164 deletions
|
@ -186,22 +186,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/waitScreen"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#99c4c4c4">
|
||||
|
||||
<ProgressBar
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@color/colorA"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
</ProgressBar>
|
||||
|
||||
</RelativeLayout>
|
||||
<include layout="@layout/wait_layout" android:id="@+id/waitScreen"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -134,23 +134,7 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/waitScreen"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#99c4c4c4">
|
||||
|
||||
<ProgressBar
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@color/colorA"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
</ProgressBar>
|
||||
|
||||
</RelativeLayout>
|
||||
<include layout="@layout/wait_layout" android:id="@+id/waitScreen"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorH"
|
||||
|
@ -111,4 +115,8 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/wait_layout" android:id="@+id/waitScreen"/>
|
||||
|
||||
</RelativeLayout>
|
17
res/layout/wait_layout.xml
Normal file
17
res/layout/wait_layout.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#99c4c4c4">
|
||||
|
||||
<ProgressBar
|
||||
android:indeterminate="true"
|
||||
android:indeterminateTint="@color/colorA"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true">
|
||||
|
||||
</ProgressBar>
|
||||
|
||||
</RelativeLayout>
|
|
@ -952,6 +952,22 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
toast.show();
|
||||
}
|
||||
|
||||
public void displayChatRoomError() {
|
||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.chat_room_creation_failed));
|
||||
Button delete = dialog.findViewById(R.id.delete_button);
|
||||
Button cancel = dialog.findViewById(R.id.cancel);
|
||||
delete.setVisibility(View.GONE);
|
||||
cancel.setText(getString(R.string.ok));
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public Dialog displayDialog(String text){
|
||||
Dialog dialog = new Dialog(this);
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
|
|
@ -253,22 +253,6 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
updateListSelected();
|
||||
}
|
||||
|
||||
private void displayChatRoomError() {
|
||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.chat_room_creation_failed));
|
||||
Button delete = dialog.findViewById(R.id.delete_button);
|
||||
Button cancel = dialog.findViewById(R.id.cancel);
|
||||
delete.setVisibility(View.GONE);
|
||||
cancel.setText(getString(R.string.ok));
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
if (mContactsSelected != null && mContactsSelected.size() > 0) {
|
||||
|
@ -318,7 +302,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
displayChatRoomError();
|
||||
LinphoneActivity.instance().displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
displayChatRoomError();
|
||||
LinphoneActivity.instance().displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
|
@ -293,22 +293,6 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
mAddParticipantsButton.setVisibility(mIsEditionEnabled ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void displayChatRoomError() {
|
||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.chat_room_creation_failed));
|
||||
Button delete = dialog.findViewById(R.id.delete_button);
|
||||
Button cancel = dialog.findViewById(R.id.cancel);
|
||||
delete.setVisibility(View.GONE);
|
||||
cancel.setText(getString(R.string.ok));
|
||||
cancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void displayMeAdminStatusUpdated() {
|
||||
if (mAdminStateChangedDialog != null) mAdminStateChangedDialog.dismiss();
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import android.view.View.OnClickListener;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -49,6 +50,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
private LinphoneContact contact;
|
||||
private ImageView editContact, deleteContact, back;
|
||||
private TextView organization;
|
||||
private RelativeLayout mWaitLayout;
|
||||
private LayoutInflater inflater;
|
||||
private View view;
|
||||
private boolean displayChatAddressOnly = false;
|
||||
|
@ -74,15 +76,17 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
if (room != null) {
|
||||
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
|
||||
} else {
|
||||
//TODO wait layout
|
||||
mWaitLayout.setVisibility(View.VISIBLE);
|
||||
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
|
||||
chatRoom.setListener(new ChatRoomListenerStub() {
|
||||
@Override
|
||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
//TODO error
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +107,9 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
displayChatAddressOnly = getArguments().getBoolean("ChatAddressOnly");
|
||||
}
|
||||
|
||||
mWaitLayout = view.findViewById(R.id.waitScreen);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
|
||||
editContact = view.findViewById(R.id.editContact);
|
||||
editContact.setOnClickListener(this);
|
||||
|
||||
|
|
Loading…
Reference in a new issue