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

ui: inform user of lost network connectivity

Tuleap: #10
Change-Id: I8f047f612897caab31f5d922b38e6d0372ca16c9
parent 42c14b04
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 50 deletions
......@@ -41,6 +41,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
......@@ -74,7 +75,6 @@ public class AccountsManagementFragment extends Fragment {
private AccountsAdapter mIP2IPAdapter;
private DragSortListView mDnDListView;
private View mLoadingView;
private int mShortAnimationDuration;
private DragSortListView.DropListener onDrop = new DragSortListView.DropListener() {
......@@ -167,8 +167,6 @@ public class AccountsManagementFragment extends Fragment {
launchAccountEditActivity(mIP2IPAdapter.accounts.get(0));
}
});
mLoadingView = view.findViewById(R.id.loading_spinner);
}
@Override
......@@ -190,7 +188,6 @@ public class AccountsManagementFragment extends Fragment {
startActivityForResult(intent, ACCOUNT_CREATE_REQUEST);
}
});
crossfade();
}
@Override
......@@ -329,6 +326,13 @@ public class AccountsManagementFragment extends Fragment {
entryView.error_indicator.setVisibility(View.GONE);
entryView.loading_indicator.setVisibility(View.VISIBLE);
} else if (item.isInError()) {
entryView.error_indicator.setImageResource(R.drawable.ic_error_white_24dp);
entryView.error_indicator.setColorFilter(Color.RED);
entryView.error_indicator.setVisibility(View.VISIBLE);
entryView.loading_indicator.setVisibility(View.GONE);
} else if (!item.isRegistered()) {
entryView.error_indicator.setImageResource(R.drawable.ic_network_disconnect_black_24dp);
entryView.error_indicator.setColorFilter(Color.BLACK);
entryView.error_indicator.setVisibility(View.VISIBLE);
entryView.loading_indicator.setVisibility(View.GONE);
} else {
......@@ -401,28 +405,6 @@ public class AccountsManagementFragment extends Fragment {
}
private void crossfade() {
// Set the content view to 0% opacity but visible, so that it is visible
// (but fully transparent) during the animation.
mDnDListView.setAlpha(0f);
mDnDListView.setVisibility(View.VISIBLE);
// Animate the content view to 100% opacity, and clear any animation
// listener set on the view.
mDnDListView.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
// Animate the loading view to 0% opacity. After the animation ends,
// set its visibility to GONE as an optimization step (it won't
// participate in layout passes, etc.)
mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoadingView.setVisibility(View.GONE);
}
});
}
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
......
......@@ -60,6 +60,7 @@ import cx.ring.R;
import cx.ring.adapters.ContactPictureTask;
import cx.ring.adapters.ContactsAdapter;
import cx.ring.adapters.StarredContactsAdapter;
import cx.ring.client.AccountWizard;
import cx.ring.client.ConversationActivity;
import cx.ring.client.HomeActivity;
import cx.ring.client.NewConversationActivity;
......@@ -103,7 +104,8 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
//private SwipeListViewTouchListener mSwipeLvTouchListener;
private LinearLayout mHeader;
private ViewGroup newcontact;
private ViewGroup error_msg_pane;
private TextView error_msg_txt;
@Override
public void onStart() {
......@@ -111,6 +113,7 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
super.onStart();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(LocalService.ACTION_CONF_UPDATE);
intentFilter.addAction(LocalService.ACTION_ACCOUNT_UPDATE);
getActivity().registerReceiver(receiver, intentFilter);
updateLists();
}
......@@ -146,8 +149,15 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
}
public void updateLists() {
if (mCallbacks.getService() != null)
if (mCallbacks.getService() != null) {
mConferenceAdapter.updateDataset(mCallbacks.getService().getConversations());
if (mCallbacks.getService().isConnected()) {
error_msg_pane.setVisibility(View.GONE);
} else {
error_msg_pane.setVisibility(mCallbacks.getService().isConnected() ? View.GONE : View.VISIBLE);
error_msg_txt.setText(R.string.error_no_network);
}
}
}
@Override
......@@ -301,6 +311,9 @@ public class CallListFragment extends Fragment implements SearchView.OnQueryText
}
});
error_msg_pane = (ViewGroup) inflatedView.findViewById(R.id.error_msg_pane);
error_msg_txt = (TextView) error_msg_pane.findViewById(R.id.error_msg_txt);
list.setAdapter(mConferenceAdapter);
list.setVisibility(View.VISIBLE);
contactList.setVisibility(View.GONE);
......
ring-android/app/src/main/res/drawable-hdpi/ic_network_disconnect_black_24dp.png

3.62 KiB

ring-android/app/src/main/res/drawable-ldpi/ic_network_disconnect_black_24dp.png

3.46 KiB

ring-android/app/src/main/res/drawable-mdpi/ic_network_disconnect_black_24dp.png

3.52 KiB

ring-android/app/src/main/res/drawable-xhdpi/ic_network_disconnect_black_24dp.png

3.81 KiB

ring-android/app/src/main/res/drawable-xxhdpi/ic_network_disconnect_black_24dp.png

4.1 KiB

ring-android/app/src/main/res/drawable-xxxhdpi/ic_network_disconnect_black_24dp.png

4.31 KiB

......@@ -15,7 +15,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:layout_height="wrap_content"
android:minHeight="72dp">
<cx.ring.views.dragsortlv.DragSortListView
android:id="@+id/accounts_list"
......@@ -24,7 +25,7 @@
android:background="@color/white"
android:choiceMode="multipleChoice"
android:dividerHeight="1px"
android:visibility="gone"
android:visibility="visible"
dslv:collapsed_height="1px"
dslv:drag_enabled="true"
dslv:drag_handle_id="@id/drag_handle"
......@@ -35,16 +36,6 @@
dslv:remove_enabled="false"
dslv:slide_shuffle_speed="0.3" />
<ProgressBar
android:id="@+id/loading_spinner"
style="?android:progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:indeterminate="false" />
<TextView
android:id="@+id/empty_account_list"
android:layout_width="wrap_content"
......@@ -54,6 +45,7 @@
android:gravity="center"
android:text="@string/empty_account_list"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_color_secondary"
android:visibility="gone">
</TextView>
......
......@@ -18,12 +18,33 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
android:animateLayoutChanges="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/error_msg_pane"
android:padding="16dp"
android:background="#e57373"
android:visibility="gone">
<TextView
android:id="@+id/error_msg_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textColor="@color/text_color_primary"
android:textSize="14sp" />
</RelativeLayout>
<se.emilsjolander.stickylistheaders.StickyListHeadersListView
android:id="@+id/contacts_stickylv"
......@@ -35,7 +56,13 @@ along with this program; if not, write to the Free Software
android:fastScrollEnabled="true"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:scrollbarStyle="outsideOverlay" />
android:scrollbarStyle="outsideOverlay"
android:layout_alignParentLeft="true"
android:layout_marginLeft="0dp"
android:layout_below="@+id/error_msg_pane"
android:elevation="8dp"
android:visibility="gone"
android:background="@android:color/white" />
<ListView
android:id="@+id/confs_list"
......@@ -45,18 +72,28 @@ along with this program; if not, write to the Free Software
android:divider="@null"
android:paddingBottom="8dp"
android:paddingTop="8dp"
tools:listitem="@layout/item_calllist"/>
tools:listitem="@layout/item_calllist"
android:layout_alignParentLeft="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_below="@+id/error_msg_pane"
android:elevation="8dp"
android:background="@android:color/white"
android:visibility="gone" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/newconv_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_compat_margin"
android:src="@drawable/ic_add_white_24dp"
app:backgroundTint="@color/color_primary_light"
app:elevation="6dp"
app:pressedTranslationZ="12dp"
app:rippleColor="@color/color_primary_dark" />
app:rippleColor="@color/color_primary_dark"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/fab_compat_margin" />
</FrameLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
......@@ -36,7 +36,8 @@
android:layout_alignParentLeft="true"
android:ellipsize="middle"
android:singleLine="true"
android:layout_marginRight="56dp" />
android:layout_toLeftOf="@+id/error_indicator"
android:layout_toStartOf="@+id/error_indicator" />
<CheckBox
android:id="@+id/account_checked"
......@@ -64,10 +65,10 @@
android:focusable="false"
android:src="@drawable/ic_error_white_24dp"
android:focusableInTouchMode="false"
android:layout_marginRight="16dp"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/account_checked"
android:layout_toLeftOf="@+id/loading_indicator"
android:tint="@color/error_red" />
android:tint="@color/error_red"
android:layout_margin="16dp" />
</RelativeLayout>
\ No newline at end of file
......@@ -46,6 +46,7 @@ as that of the covered work.
<string name="create_new_account_dialog">Would you like to register an account now?</string>
<string name="cannot_pass_sipcall_title">SIP account not available</string>
<string name="cannot_pass_sipcall">Current selected account is not available</string>
<string name="error_no_network">No network connectivity</string>
<!-- AB menus -->
<string name="ab_account_creation">New account</string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment