From 7ba1947bc5092d4a33af283a6c2d0fab547227cb Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 09:39:34 +0200 Subject: [PATCH 01/21] Fix #228 Signed-off-by: Mario Danic --- .../layout/library_fast_scroller_layout.xml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 app/src/main/res/layout/library_fast_scroller_layout.xml diff --git a/app/src/main/res/layout/library_fast_scroller_layout.xml b/app/src/main/res/layout/library_fast_scroller_layout.xml new file mode 100644 index 000000000..20c74bc4e --- /dev/null +++ b/app/src/main/res/layout/library_fast_scroller_layout.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + From 1dc0ac8133f41235290999bcecd042810fe5c868 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 09:49:30 +0200 Subject: [PATCH 02/21] Fix #229 Signed-off-by: Mario Danic --- .../talk/controllers/bottomsheet/CallMenuController.java | 6 ++---- .../talk/controllers/bottomsheet/EntryMenuController.java | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java index 20dc25865..42686c717 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/CallMenuController.java @@ -127,12 +127,10 @@ public class CallMenuController extends BaseController implements FlexibleAdapte if (!TextUtils.isEmpty(room.getDisplayName())) { menuItems.add(new MenuItem( getResources().getString( - R.string.nc_configure_named_room, room.getDisplayName()), 0, null) - ); + R.string.nc_configure_named_room, room.getDisplayName()), 0, null)); } else if (!TextUtils.isEmpty(room.getName())) { menuItems.add(new MenuItem(getResources().getString( - R.string.nc_configure_named_room, room.getName()), 0, null) - ); + R.string.nc_configure_named_room, room.getName()), 0, null)); } else { menuItems.add(new MenuItem(getResources().getString(R.string.nc_configure_room), 0, null)); } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java index b90b8e43a..fc6777342 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/EntryMenuController.java @@ -184,6 +184,10 @@ public class EntryMenuController extends BaseController { super.onViewBound(view); NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this); + if (room != null && operationCode == 2) { + editText.setText(room.getName()); + } + editText.setOnEditorActionListener((v, actionId, event) -> { if (actionId == EditorInfo.IME_ACTION_DONE && proceedButton != null && proceedButton.isEnabled()) { proceedButton.callOnClick(); From c512cd25b83b3abd5b55a761902a5bcf9e349c6f Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 10:11:29 +0200 Subject: [PATCH 03/21] Fix #224 Signed-off-by: Mario Danic --- .../talk/controllers/CallController.java | 8 +----- .../res/drawable/ic_hearing_white_24dp.xml | 25 ------------------- ...e_24dp.xml => ic_volume_up_white_24dp.xml} | 3 +-- app/src/main/res/layout/controller_call.xml | 5 +++- 4 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_hearing_white_24dp.xml rename app/src/main/res/drawable/{ic_speaker_white_24dp.xml => ic_volume_up_white_24dp.xml} (73%) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index ee102b220..58fdc32bb 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -598,13 +598,7 @@ public class CallController extends BaseController { public void onEnableSpeakerphoneClick() { if (audioManager != null) { audioManager.toggleUseSpeakerphone(); - if (audioManager.isSpeakerphoneAutoOn()) { - callControlEnableSpeaker.getFrontImageView().setImageDrawable(getResources().getDrawable(R.drawable - .ic_speaker_white_24dp)); - } else { - callControlEnableSpeaker.getFrontImageView().setImageDrawable(getResources().getDrawable(R.drawable - .ic_hearing_white_24dp)); - } + callControlEnableSpeaker.flipSilently(!callControlEnableSpeaker.isFlipped()); } } diff --git a/app/src/main/res/drawable/ic_hearing_white_24dp.xml b/app/src/main/res/drawable/ic_hearing_white_24dp.xml deleted file mode 100644 index d335efbba..000000000 --- a/app/src/main/res/drawable/ic_hearing_white_24dp.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_speaker_white_24dp.xml b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml similarity index 73% rename from app/src/main/res/drawable/ic_speaker_white_24dp.xml rename to app/src/main/res/drawable/ic_volume_up_white_24dp.xml index b06e76e66..9520e6701 100644 --- a/app/src/main/res/drawable/ic_speaker_white_24dp.xml +++ b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml @@ -21,6 +21,5 @@ - + diff --git a/app/src/main/res/layout/controller_call.xml b/app/src/main/res/layout/controller_call.xml index 7aa7485cd..399614a46 100644 --- a/app/src/main/res/layout/controller_call.xml +++ b/app/src/main/res/layout/controller_call.xml @@ -151,7 +151,10 @@ android:visibility="gone" app:enableInitialAnimation="false" app:frontBackgroundColor="@color/colorPrimary" - app:frontImage="@drawable/ic_hearing_white_24dp"/> + app:animateRearImage="false" + app:rearBackgroundColor="@color/colorPrimaryDark" + app:frontImage="@drawable/ic_volume_up_white_24dp" + app:rearImage="@drawable/ic_volume_up_white_24dp"/> From 9e1c2c76579f990d51095a32248ec65e2ed2cb72 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 14:34:35 +0200 Subject: [PATCH 04/21] Some work on #223 Signed-off-by: Mario Danic --- app/build.gradle | 2 + .../CallNotificationController.java | 38 ++++++++++++++- .../main/res/drawable/incoming_gradient.xml | 28 +++++++++++ .../layout/controller_call_notification.xml | 48 +++++++++++-------- app/src/main/res/values/dimens.xml | 2 +- 5 files changed, 95 insertions(+), 23 deletions(-) create mode 100644 app/src/main/res/drawable/incoming_gradient.xml diff --git a/app/build.gradle b/app/build.gradle index 6bc606d0e..338f57f6b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,6 +19,8 @@ android { versionName "2.1.0beta5" flavorDimensions "default" + renderscriptTargetApi 19 + renderscriptSupportModeEnabled true productFlavors { // used for f-droid diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java index 7fec243fa..90fbb0c6c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java @@ -21,10 +21,17 @@ package com.nextcloud.talk.controllers; import android.annotation.SuppressLint; +import android.graphics.Bitmap; +import android.graphics.drawable.BitmapDrawable; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RenderScript; +import android.renderscript.ScriptIntrinsicBlur; import android.support.annotation.NonNull; +import android.support.constraint.ConstraintLayout; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; @@ -40,7 +47,10 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.model.GlideUrl; import com.bumptech.glide.load.model.LazyHeaders; import com.bumptech.glide.load.resource.bitmap.CircleCrop; +import com.bumptech.glide.load.resource.bitmap.TransformationUtils; import com.bumptech.glide.request.RequestOptions; +import com.bumptech.glide.request.target.SimpleTarget; +import com.bumptech.glide.request.transition.Transition; import com.nextcloud.talk.R; import com.nextcloud.talk.api.NcApi; import com.nextcloud.talk.application.NextcloudTalkApplication; @@ -96,6 +106,9 @@ public class CallNotificationController extends BaseController { @BindView(R.id.callAnswerCameraView) MagicFlipView callAnswerCameraView; + @BindView(R.id.constraintLayout) + ConstraintLayout constraintLayout; + private List disposablesList = new ArrayList<>(); private Bundle originalBundle; private String roomId; @@ -104,6 +117,7 @@ public class CallNotificationController extends BaseController { private Room currentRoom; private MediaPlayer mediaPlayer; private boolean leavingScreen = false; + private RenderScript renderScript; public CallNotificationController(Bundle args) { super(args); @@ -249,6 +263,7 @@ public class CallNotificationController extends BaseController { protected void onViewBound(@NonNull View view) { super.onViewBound(view); + renderScript = RenderScript.create(getActivity()); handleFromNotification(); String callRingtonePreferenceString = appPreferences.getCallRingtoneUri(); @@ -296,8 +311,27 @@ public class CallNotificationController extends BaseController { .load(glideUrl) .centerInside() .override(avatarSize, avatarSize) - .apply(RequestOptions.bitmapTransform(new CircleCrop())) - .into(avatarImageView); + .into(new SimpleTarget() { + @Override + public void onResourceReady(Bitmap resource, Transition transition) { + if (getActivity() != null) { + avatarImageView.setImageBitmap(TransformationUtils.circleCrop(GlideApp.get + (getActivity()).getBitmapPool(), resource, avatarSize, avatarSize)); + } + + final Allocation input = Allocation.createFromBitmap(renderScript, resource); + final Allocation output = Allocation.createTyped(renderScript, input.getType()); + final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(renderScript, Element + .U8_4(renderScript)); + script.setRadius(15f); + script.setInput(input); + script.forEach(output); + output.copyTo(resource); + + constraintLayout.setBackground(new BitmapDrawable(resource)); + } + }); + break; case ROOM_GROUP_CALL: diff --git a/app/src/main/res/drawable/incoming_gradient.xml b/app/src/main/res/drawable/incoming_gradient.xml new file mode 100644 index 000000000..2f78537e7 --- /dev/null +++ b/app/src/main/res/drawable/incoming_gradient.xml @@ -0,0 +1,28 @@ + + + + + + diff --git a/app/src/main/res/layout/controller_call_notification.xml b/app/src/main/res/layout/controller_call_notification.xml index b91f6e649..864c199ea 100644 --- a/app/src/main/res/layout/controller_call_notification.xml +++ b/app/src/main/res/layout/controller_call_notification.xml @@ -21,33 +21,41 @@ - + android:background="@drawable/incoming_gradient"> - + + + + + 40dp 80dp @dimen/avatar_fetching_size_very_big - 140dp + 180dp 20dp 14sp From 1cfb005150bc04fdd72ca1d68bdd523c56d1f388 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 14:38:43 +0200 Subject: [PATCH 05/21] Update bottom margin Signed-off-by: Mario Danic --- app/src/main/res/layout/controller_call_notification.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/layout/controller_call_notification.xml b/app/src/main/res/layout/controller_call_notification.xml index 864c199ea..b12280d06 100644 --- a/app/src/main/res/layout/controller_call_notification.xml +++ b/app/src/main/res/layout/controller_call_notification.xml @@ -52,6 +52,7 @@ android:textAlignment="center" android:textColor="@color/white" android:textSize="28sp" + android:layout_marginBottom="16dp" android:layout_below="@+id/incomingCallTextView" tools:text="Victor Gregorius Magnus"/> From bdbb3a8cd1161238e497bd02917575d5758b10bf Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 10 Jul 2018 22:33:56 +0200 Subject: [PATCH 06/21] Fix #214 Signed-off-by: Mario Danic --- .../talk/controllers/ContactsController.java | 71 +++++-------------- app/src/main/res/layout/bottom_buttons.xml | 59 --------------- .../main/res/layout/controller_generic_rv.xml | 4 -- app/src/main/res/menu/menu_contacts.xml | 30 ++++++++ .../menu/menu_conversation_plus_filter.xml | 7 ++ 5 files changed, 56 insertions(+), 115 deletions(-) delete mode 100644 app/src/main/res/layout/bottom_buttons.xml create mode 100644 app/src/main/res/menu/menu_contacts.xml diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index 06c7478b8..216a4506c 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java @@ -28,7 +28,6 @@ import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.BottomNavigationView; -import android.support.design.widget.CoordinatorLayout; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.RecyclerView; @@ -43,7 +42,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.inputmethod.EditorInfo; -import android.widget.Button; import android.widget.RelativeLayout; import com.bluelinelabs.conductor.RouterTransaction; @@ -68,7 +66,6 @@ import com.nextcloud.talk.models.json.rooms.RoomOverall; import com.nextcloud.talk.models.json.sharees.Sharee; import com.nextcloud.talk.models.json.sharees.ShareesOverall; import com.nextcloud.talk.utils.ApiUtils; -import com.nextcloud.talk.utils.animations.ViewHidingBehaviourAnimation; import com.nextcloud.talk.utils.bundle.BundleKeys; import com.nextcloud.talk.utils.database.user.UserUtils; @@ -130,16 +127,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ @BindView(R.id.swipe_refresh_layout) SwipeRefreshLayout swipeRefreshLayout; - @BindView(R.id.bottom_buttons_layout) - CoordinatorLayout bottomButtonsLinearLayout; - @BindView(R.id.fast_scroller) FastScroller fastScroller; - @Nullable - @BindView(R.id.clear_button) - Button clearButton; - private UserEntity currentUser; private Disposable contactsQueryDisposable; private Disposable cacheQueryDisposable; @@ -165,6 +155,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ private boolean canFetchFurther = true; private boolean canFetchSearchFurther = true; + private MenuItem doneMenuItem; + public ContactsController() { super(); setHasOptionsMenu(true); @@ -195,7 +187,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ if (isNewConversationView) { toggleNewCallHeaderVisibility(!isPublicCall); - checkAndHandleBottomButtons(); + checkAndHandleDoneMenuItem(); if (getActionBar() != null) { getActionBar().setDisplayHomeAsUpEnabled(true); @@ -257,29 +249,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ adapter.addListener(this); } - @Optional - @OnClick(R.id.clear_button) - public void onClearButtonClick() { - if (adapter != null) { - List selectedPositions = adapter.getSelectedPositions(); - for (Integer position : selectedPositions) { - if (adapter.getItem(position) instanceof UserItem) { - UserItem userItem = (UserItem) adapter.getItem(position); - adapter.toggleSelection(position); - if (userItem != null) { - userItem.flipItemSelection(); - } - } - } - } - - checkAndHandleBottomButtons(); - } - - @Optional - @OnClick(R.id.done_button) - public void onDoneButtonClick() { - + private void selectionDone() { if (!isPublicCall && adapter.getSelectedPositions().size() == 1) { RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(currentUser.getBaseUrl(), "1", ((UserItem) adapter.getItem(adapter.getSelectedPositions().get(0))).getModel().getUserId(), null); @@ -411,6 +381,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ case android.R.id.home: getRouter().popCurrentController(); return true; + case R.id.contacts_selection_done: + selectionDone(); + return true; default: return super.onOptionsItemSelected(item); } @@ -421,7 +394,9 @@ public class ContactsController extends BaseController implements SearchView.OnQ super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_conversation_plus_filter, menu); searchItem = menu.findItem(R.id.action_search); + doneMenuItem = menu.findItem(R.id.contacts_selection_done); menu.findItem(R.id.action_new_conversation).setVisible(false); + initSearchView(); } @@ -576,7 +551,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ } if (isNewConversationView) { - checkAndHandleBottomButtons(); + checkAndHandleDoneMenuItem(); } } ; @@ -648,9 +623,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ return ""; } }); - - CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) bottomButtonsLinearLayout.getLayoutParams(); - layoutParams.setBehavior(new ViewHidingBehaviourAnimation()); } private void dispose(@Nullable Disposable disposable) { @@ -725,23 +697,18 @@ public class ContactsController extends BaseController implements SearchView.OnQ return onQueryTextChange(query); } - private void checkAndHandleBottomButtons() { - if (adapter != null && bottomButtonsLinearLayout != null && clearButton != null) { + private void checkAndHandleDoneMenuItem() { + if (adapter != null && doneMenuItem != null) { if (adapter.getSelectedItemCount() > 0 || isPublicCall) { - if (bottomButtonsLinearLayout.getVisibility() != View.VISIBLE) { - bottomButtonsLinearLayout.setVisibility(View.VISIBLE); + if (!doneMenuItem.isVisible()) { + doneMenuItem.setVisible(true); } - if (adapter.getSelectedItemCount() == 0) { - clearButton.setVisibility(View.GONE); - } else { - clearButton.setVisibility(View.VISIBLE); - } } else { - bottomButtonsLinearLayout.setVisibility(View.GONE); + doneMenuItem.setVisible(false); } - } else if (bottomButtonsLinearLayout != null) { - bottomButtonsLinearLayout.setVisibility(View.GONE); + } else if (doneMenuItem != null) { + doneMenuItem.setVisible(false); } } @@ -865,7 +832,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ ((UserItem) adapter.getItem(position)).flipItemSelection(); adapter.toggleSelection(position); - checkAndHandleBottomButtons(); + checkAndHandleDoneMenuItem(); } } return true; @@ -876,7 +843,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ void toggleCallHeader() { toggleNewCallHeaderVisibility(isPublicCall); isPublicCall = !isPublicCall; - checkAndHandleBottomButtons(); + checkAndHandleDoneMenuItem(); } private void toggleNewCallHeaderVisibility(boolean showInitialLayout) { diff --git a/app/src/main/res/layout/bottom_buttons.xml b/app/src/main/res/layout/bottom_buttons.xml deleted file mode 100644 index f0a65f501..000000000 --- a/app/src/main/res/layout/bottom_buttons.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - -