Better UI for operations

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-24 13:45:53 +01:00
parent 3b8c31e887
commit b14999fdec
2 changed files with 19 additions and 9 deletions

View File

@ -150,7 +150,7 @@ public class CallsListController extends BaseController implements SearchView.On
if (adapter == null) { if (adapter == null) {
adapter = new FlexibleAdapter<>(callItems, getActivity(), false); adapter = new FlexibleAdapter<>(callItems, getActivity(), false);
if (userEntity != null) { if (userEntity != null) {
fetchData(); fetchData(false);
} }
} }
@ -238,7 +238,7 @@ public class CallsListController extends BaseController implements SearchView.On
} }
} }
private void fetchData() { private void fetchData(boolean fromBottomSheet) {
dispose(null); dispose(null);
callItems = new ArrayList<>(); callItems = new ArrayList<>();
@ -295,6 +295,13 @@ public class CallsListController extends BaseController implements SearchView.On
if (swipeRefreshLayout != null) { if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
} }
if (fromBottomSheet) {
bottomSheet.setCancelable(true);
if (bottomSheet.isShowing()) {
bottomSheet.cancel();
}
}
}); });
} }
@ -310,7 +317,7 @@ public class CallsListController extends BaseController implements SearchView.On
layoutManager.getOrientation() layoutManager.getOrientation()
)); ));
swipeRefreshLayout.setOnRefreshListener(this::fetchData); swipeRefreshLayout.setOnRefreshListener(() -> fetchData(false));
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary); swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
} }
@ -378,12 +385,14 @@ public class CallsListController extends BaseController implements SearchView.On
if (!bottomSheetLockEvent.isCancel()) { if (!bottomSheetLockEvent.isCancel()) {
bottomSheet.setCancelable(bottomSheetLockEvent.isCancel()); bottomSheet.setCancelable(bottomSheetLockEvent.isCancel());
} else { } else {
new Handler().postDelayed(() -> { if (bottomSheetLockEvent.getDelay() != 0) {
fetchData(true);
} else {
bottomSheet.setCancelable(true); bottomSheet.setCancelable(true);
if (bottomSheet.isShowing()) { if (bottomSheet.isShowing()) {
bottomSheet.cancel(); bottomSheet.cancel();
} }
}, bottomSheetLockEvent.getDelay()); }
} }
} }
} }

View File

@ -28,8 +28,9 @@
android:id="@+id/progress_bar" android:id="@+id/progress_bar"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_centerHorizontal="true" android:layout_centerInParent="true"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:indeterminate="true" android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary" android:indeterminateTint="@color/colorPrimary"
android:indeterminateTintMode="src_in" android:indeterminateTintMode="src_in"
@ -39,8 +40,8 @@
android:id="@+id/result_image_view" android:id="@+id/result_image_view"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_centerHorizontal="true" android:layout_centerInParent="true"
android:layout_marginBottom="12dp" android:layout_marginBottom="8dp"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
@ -55,6 +56,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginEnd="24dp" android:layout_marginEnd="24dp"
android:layout_marginStart="24dp" android:layout_marginStart="24dp"
android:layout_marginBottom="12dp"
android:maxLines="2" android:maxLines="2"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
@ -68,7 +70,6 @@
android:layout_below="@id/result_text_view" android:layout_below="@id/result_text_view"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:background="#0000" android:background="#0000"
android:text="@string/nc_ok" android:text="@string/nc_ok"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"