Эх сурвалжийг харах

Clean up a bit

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 жил өмнө
parent
commit
924bd7be3a

+ 9 - 10
app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java

@@ -65,7 +65,6 @@ import com.nextcloud.talk.controllers.bottomsheet.EntryMenuController;
 import com.nextcloud.talk.events.BottomSheetLockEvent;
 import com.nextcloud.talk.events.MoreMenuClickEvent;
 import com.nextcloud.talk.persistence.entities.UserEntity;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
 import com.nextcloud.talk.utils.bundle.BundleKeys;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
@@ -406,11 +405,11 @@ public class CallsListController extends BaseController implements SearchView.On
 
     @Subscribe(threadMode = ThreadMode.MAIN)
     public void onMessageEvent(MoreMenuClickEvent moreMenuClickEvent) {
-        BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
+        Bundle bundle = new Bundle();
         Room room = moreMenuClickEvent.getRoom();
-        bundleBuilder.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
+        bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
 
-        prepareAndShowBottomSheetWithBundle(bundleBuilder.build(), true);
+        prepareAndShowBottomSheetWithBundle(bundle, true);
     }
 
     private void prepareAndShowBottomSheetWithBundle(Bundle bundle, boolean shouldShowCallMenuController) {
@@ -442,19 +441,19 @@ public class CallsListController extends BaseController implements SearchView.On
         CallItem callItem = adapter.getItem(position);
         if (callItem != null && getActivity() != null) {
             Room room = callItem.getModel();
-            BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-            bundleBuilder.putString("roomToken", callItem.getModel().getToken());
-            bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
+            Bundle bundle = new Bundle();
+            bundle.putString("roomToken", callItem.getModel().getToken());
+            bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
 
             if (room.hasPassword && (room.participantType.equals(Participant.ParticipantType.GUEST) ||
                     room.participantType.equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {
-                bundleBuilder.putInt(BundleKeys.KEY_OPERATION_CODE, 99);
-                prepareAndShowBottomSheetWithBundle(bundleBuilder.build(), false);
+                bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 99);
+                prepareAndShowBottomSheetWithBundle(bundle, false);
             } else {
                 overridePushHandler(new NoOpControllerChangeHandler());
                 overridePopHandler(new NoOpControllerChangeHandler());
                 Intent callIntent = new Intent(getActivity(), CallActivity.class);
-                callIntent.putExtras(bundleBuilder.build());
+                callIntent.putExtras(bundle);
                 startActivity(callIntent);
             }
         }

+ 4 - 5
app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java

@@ -62,7 +62,6 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
 import com.nextcloud.talk.controllers.base.BaseController;
 import com.nextcloud.talk.models.RetrofitBucket;
 import com.nextcloud.talk.persistence.entities.UserEntity;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
 import org.parceler.Parcels;
@@ -457,10 +456,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ
                         overridePushHandler(new NoOpControllerChangeHandler());
                         overridePopHandler(new NoOpControllerChangeHandler());
                         Intent callIntent = new Intent(getActivity(), CallActivity.class);
-                        BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-                        bundleBuilder.putString("roomToken", roomOverall.getOcs().getData().getToken());
-                        bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
-                        callIntent.putExtras(bundleBuilder.build());
+                        Bundle bundle = new Bundle();
+                        bundle.putString("roomToken", roomOverall.getOcs().getData().getToken());
+                        bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
+                        callIntent.putExtras(bundle);
                         startActivity(callIntent);
                     }
 

+ 6 - 7
app/src/main/java/com/nextcloud/talk/controllers/SwitchAccountController.java

@@ -44,7 +44,6 @@ import com.nextcloud.talk.controllers.base.BaseController;
 import com.nextcloud.talk.models.ImportAccount;
 import com.nextcloud.talk.persistence.entities.UserEntity;
 import com.nextcloud.talk.utils.AccountUtils;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
 import com.nextcloud.talk.utils.bundle.BundleKeys;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
@@ -221,13 +220,13 @@ public class SwitchAccountController extends BaseController {
 
     private void verifyAccount(Account account) {
         ImportAccount importAccount = AccountUtils.getInformationFromAccount(account);
-        BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-        bundleBuilder.putString(BundleKeys.KEY_USERNAME, importAccount.getUsername());
-        bundleBuilder.putString(BundleKeys.KEY_TOKEN, importAccount.getToken());
-        bundleBuilder.putString(BundleKeys.KEY_BASE_URL, importAccount.getBaseUrl());
-        bundleBuilder.putBoolean(BundleKeys.KEY_IS_ACCOUNT_IMPORT, true);
+        Bundle bundle = new Bundle();
+        bundle.putString(BundleKeys.KEY_USERNAME, importAccount.getUsername());
+        bundle.putString(BundleKeys.KEY_TOKEN, importAccount.getToken());
+        bundle.putString(BundleKeys.KEY_BASE_URL, importAccount.getBaseUrl());
+        bundle.putBoolean(BundleKeys.KEY_IS_ACCOUNT_IMPORT, true);
         getRouter().pushController(RouterTransaction.with(new AccountVerificationController
-                (bundleBuilder.build())).pushChangeHandler(new HorizontalChangeHandler())
+                (bundle)).pushChangeHandler(new HorizontalChangeHandler())
                 .popChangeHandler(new HorizontalChangeHandler()));
     }
 

+ 6 - 7
app/src/main/java/com/nextcloud/talk/controllers/WebViewLoginController.java

@@ -50,7 +50,6 @@ import com.nextcloud.talk.events.CertificateEvent;
 import com.nextcloud.talk.models.LoginData;
 import com.nextcloud.talk.persistence.entities.UserEntity;
 import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
 import com.nextcloud.talk.utils.bundle.BundleKeys;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 import com.nextcloud.talk.utils.ssl.MagicTrustManager;
@@ -290,10 +289,10 @@ public class WebViewLoginController extends BaseController {
                 cookieManager.getCookieStore().removeAll();
 
                 if (!isPasswordUpdate && finalMessageType == null) {
-                    BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-                    bundleBuilder.putString(BundleKeys.KEY_USERNAME, loginData.getUsername());
-                    bundleBuilder.putString(BundleKeys.KEY_TOKEN, loginData.getToken());
-                    bundleBuilder.putString(BundleKeys.KEY_BASE_URL, loginData.getServerUrl());
+                    Bundle bundle = new Bundle();
+                    bundle.putString(BundleKeys.KEY_USERNAME, loginData.getUsername());
+                    bundle.putString(BundleKeys.KEY_TOKEN, loginData.getToken());
+                    bundle.putString(BundleKeys.KEY_BASE_URL, loginData.getServerUrl());
                     String protocol = "";
 
                     if (baseUrl.startsWith("http://")) {
@@ -303,10 +302,10 @@ public class WebViewLoginController extends BaseController {
                     }
 
                     if (!TextUtils.isEmpty(protocol)) {
-                        bundleBuilder.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol);
+                        bundle.putString(BundleKeys.KEY_ORIGINAL_PROTOCOL, protocol);
                     }
                     getRouter().pushController(RouterTransaction.with(new AccountVerificationController
-                            (bundleBuilder.build())).pushChangeHandler(new HorizontalChangeHandler())
+                            (bundle)).pushChangeHandler(new HorizontalChangeHandler())
                             .popChangeHandler(new HorizontalChangeHandler()));
                 } else {
                     if (isPasswordUpdate) {

+ 6 - 7
app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java

@@ -42,9 +42,8 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
 import com.nextcloud.talk.controllers.base.BaseController;
 import com.nextcloud.talk.events.BottomSheetLockEvent;
 import com.nextcloud.talk.persistence.entities.UserEntity;
-import com.nextcloud.talk.utils.ColorUtils;
 import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
+import com.nextcloud.talk.utils.ColorUtils;
 import com.nextcloud.talk.utils.bundle.BundleKeys;
 import com.nextcloud.talk.utils.database.user.UserUtils;
 
@@ -255,14 +254,14 @@ public class OperationsMenuController extends BaseController {
             if (operationCode != 99) {
                 showResultImage(true);
             } else {
-                BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-                bundleBuilder.putString("roomToken", room.getToken());
-                bundleBuilder.putParcelable("userEntity", Parcels.wrap(userEntity));
-                bundleBuilder.putString(BundleKeys.KEY_CALL_SESSION, ((CallOverall) o).getOcs().getData().getSessionId());
+                Bundle bundle = new Bundle();
+                bundle.putString("roomToken", room.getToken());
+                bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
+                bundle.putString(BundleKeys.KEY_CALL_SESSION, ((CallOverall) o).getOcs().getData().getSessionId());
                 overridePushHandler(new NoOpControllerChangeHandler());
                 overridePopHandler(new NoOpControllerChangeHandler());
                 Intent callIntent = new Intent(getActivity(), CallActivity.class);
-                callIntent.putExtras(bundleBuilder.build());
+                callIntent.putExtras(bundle);
                 startActivity(callIntent);
             }
         }

+ 5 - 6
app/src/main/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java

@@ -45,7 +45,6 @@ import com.nextcloud.talk.api.models.json.push.PushMessage;
 import com.nextcloud.talk.models.SignatureVerification;
 import com.nextcloud.talk.utils.NotificationUtils;
 import com.nextcloud.talk.utils.PushUtils;
-import com.nextcloud.talk.utils.bundle.BundleBuilder;
 
 import org.parceler.Parcels;
 
@@ -94,12 +93,12 @@ public class MagicFirebaseMessagingService extends FirebaseMessagingService {
                             Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
 
                             Intent intent = new Intent(this, CallActivity.class);
-                            BundleBuilder bundleBuilder = new BundleBuilder(new Bundle());
-                            bundleBuilder.putString("roomToken", decryptedPushMessage.getId());
-                            bundleBuilder.putParcelable("userEntity", Parcels.wrap(signatureVerification
+                            Bundle bundle = new Bundle();
+                            bundle.putString("roomToken", decryptedPushMessage.getId());
+                            bundle.putParcelable("userEntity", Parcels.wrap(signatureVerification
                                     .getUserEntity()));
-                            bundleBuilder.putBoolean("fromNotification", true);
-                            intent.putExtras(bundleBuilder.build());
+                            bundle.putBoolean("fromNotification", true);
+                            intent.putExtras(bundle);
 
                             PendingIntent pendingIntent = PendingIntent.getActivity(this,
                                     0, intent, PendingIntent.FLAG_CANCEL_CURRENT);