diff --git a/ring-android/app/src/main/java/cx/ring/fragments/AccountsManagementFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/AccountsManagementFragment.java index bb2d99594b51dfb6e04a0257752d186d9b29a571..065dada48c6588a99e3dfcc6181cbb953c25884e 100644 --- a/ring-android/app/src/main/java/cx/ring/fragments/AccountsManagementFragment.java +++ b/ring-android/app/src/main/java/cx/ring/fragments/AccountsManagementFragment.java @@ -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) { diff --git a/ring-android/app/src/main/java/cx/ring/fragments/CallListFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/CallListFragment.java index d78353334902857ac8661813f8cd10e14225d4d6..74adc0dd9bec2ef42c68a42d12ccb0bd369165e8 100644 --- a/ring-android/app/src/main/java/cx/ring/fragments/CallListFragment.java +++ b/ring-android/app/src/main/java/cx/ring/fragments/CallListFragment.java @@ -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); diff --git a/ring-android/app/src/main/res/drawable-hdpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-hdpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..f9e7eddb49079cf9fc3e7d591cda1d7e0efbe6dc Binary files /dev/null and b/ring-android/app/src/main/res/drawable-hdpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/drawable-ldpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-ldpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..8be95371dde5d901aa25876c9ad6b842364d79d2 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-ldpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/drawable-mdpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-mdpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..be26ae73100447b5e25f369fa946c64bae631062 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-mdpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/drawable-xhdpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-xhdpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..54800300463b4408354743553c6a09dea208169b Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xhdpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/drawable-xxhdpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-xxhdpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..34eb88c482ad7be15fae264ab4c320ba0ca89198 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxhdpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/drawable-xxxhdpi/ic_network_disconnect_black_24dp.png b/ring-android/app/src/main/res/drawable-xxxhdpi/ic_network_disconnect_black_24dp.png new file mode 100644 index 0000000000000000000000000000000000000000..840320b07cd0ad3a3ab66dbd6d05554ffc15f7d6 Binary files /dev/null and b/ring-android/app/src/main/res/drawable-xxxhdpi/ic_network_disconnect_black_24dp.png differ diff --git a/ring-android/app/src/main/res/layout/frag_accounts_list.xml b/ring-android/app/src/main/res/layout/frag_accounts_list.xml index ead1b9627fb5b45d240e21cfe680680d7567948a..ebd1421928d1634bdf9e48be0c567ddec5fc0362 100644 --- a/ring-android/app/src/main/res/layout/frag_accounts_list.xml +++ b/ring-android/app/src/main/res/layout/frag_accounts_list.xml @@ -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> diff --git a/ring-android/app/src/main/res/layout/frag_call_list.xml b/ring-android/app/src/main/res/layout/frag_call_list.xml index a90c940cf48180b9694d3bc414a17abbc8de856e..0291a6d67dbcd56284806766ac621f57c631f728 100644 --- a/ring-android/app/src/main/res/layout/frag_call_list.xml +++ b/ring-android/app/src/main/res/layout/frag_call_list.xml @@ -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 diff --git a/ring-android/app/src/main/res/layout/item_account_pref.xml b/ring-android/app/src/main/res/layout/item_account_pref.xml index ee774ce51fa38fa65c4e18d02980c43fd103029e..a34d7cc30a2c8d7b759f5b694742d74f52199318 100644 --- a/ring-android/app/src/main/res/layout/item_account_pref.xml +++ b/ring-android/app/src/main/res/layout/item_account_pref.xml @@ -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 diff --git a/ring-android/app/src/main/res/values/strings.xml b/ring-android/app/src/main/res/values/strings.xml index 4884b2d9f4c8de092c5b02e6523b59b79d4b4da7..f4cf56364bbd67274611879ad1c43b5d35ae938b 100644 --- a/ring-android/app/src/main/res/values/strings.xml +++ b/ring-android/app/src/main/res/values/strings.xml @@ -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>