From d3c4968312187223404cbfde3b78435ccedaab81 Mon Sep 17 00:00:00 2001 From: "DESKTOP-EMSE65H\\Archontis" Date: Sat, 25 Feb 2023 01:34:40 +0200 Subject: [PATCH] Refactor onCreate method: extract initLayout method This commit refactors the onCreate() method by exctracting a new method to handle the layout inflation and setting of the content view. The readability of onCreate method is improved. This change does not affect the functionality of the original code. --- .../android/ui/activity/FileDisplayActivity.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 3772fa942b..9d9fe89d43 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -251,12 +251,10 @@ public class FileDisplayActivity extends FileActivity super.onCreate(savedInstanceState); loadSavedInstanceState(savedInstanceState); + /// USER INTERFACE - - // Inflate and set the layout view - binding = FilesBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - + initLayout(); + // setup toolbar setupHomeSearchToolbarWithSortAndListButtons(); @@ -303,6 +301,12 @@ public class FileDisplayActivity extends FileActivity } } + private void initLayout() { + // Inflate and set the layout view + binding = FilesBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + } + private void checkStoragePath() { String newStorage = Environment.getExternalStorageDirectory().getAbsolutePath(); String storagePath = preferences.getStoragePath(newStorage);