android/source/src/java/org/libreoffice/SearchController.java |   11 +---------
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit dcc6b286ea58bca21fd6a85fde2bffa2cce8d564
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat May 7 23:03:20 2022 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun May 8 08:28:38 2022 +0200

    android: Don't use res ID in switch-case (SearchController)
    
    Addresses this Lint warning:
    
    > ../../src/java/org/libreoffice/SearchController.java:73: Resource IDs
    > will be non-final by default in Android Gradle Plugin version 8.0, avoid
    > using them in switch case statements
    
    There's no need to explicitly set `SearchDirection.DOWN`
    for `R.id.button_search_down` since it has previously been
    set as default value anyway.
    
    Change-Id: I283c00b97e1417f5dc3a48922238df7a29032137
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133998
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/source/src/java/org/libreoffice/SearchController.java 
b/android/source/src/java/org/libreoffice/SearchController.java
index 8bdf42e8be8c..6095e1fd2afe 100644
--- a/android/source/src/java/org/libreoffice/SearchController.java
+++ b/android/source/src/java/org/libreoffice/SearchController.java
@@ -69,15 +69,8 @@ public class SearchController implements 
View.OnClickListener {
         ImageButton button = (ImageButton) view;
 
         SearchDirection direction = SearchDirection.DOWN;
-        switch(button.getId()) {
-            case R.id.button_search_down:
-                direction = SearchDirection.DOWN;
-                break;
-            case R.id.button_search_up:
-                direction = SearchDirection.UP;
-                break;
-            default:
-                break;
+        if (button.getId() == R.id.button_search_up) {
+            direction = SearchDirection.UP;
         }
 
         String searchText = ((EditText) 
mActivity.findViewById(R.id.search_string)).getText().toString();

Reply via email to