瀏覽代碼

Fix codacy issues

Mario Danic 8 年之前
父節點
當前提交
eaae09877f

+ 2 - 0
src/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -93,6 +93,8 @@ public class UserInfoActivity extends FileActivity {
 
     private RecyclerView.Adapter adapter;
 
+    private RecyclerView.Adapter adapter;
+
     private Unbinder unbinder;
 
     private UserInfo userInfo;

+ 21 - 28
src/com/owncloud/android/ui/adapter/UserInfoAdapter.java

@@ -4,17 +4,17 @@
  * @author Mario Danic
  * Copyright (C) 2017 Mario Danic
  * Copyright (C) 2017 Nextcloud GmbH.
- *
+ * <p>
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * at your option) any later version.
- *
+ * <p>
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
- *
+ * <p>
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -109,36 +109,29 @@ public class UserInfoAdapter extends RecyclerView.Adapter<UserInfoAdapter.ViewHo
     }
 
     private void getRelevantInformation() {
-        if (context != null) {
-            if (!TextUtils.isEmpty(userInfo.getDisplayName())) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_full_name),
-                        userInfo.getDisplayName()));
-            }
+        if (!TextUtils.isEmpty(userInfo.getDisplayName()) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_full_name),
+                    userInfo.getDisplayName()));
 
-            if (!TextUtils.isEmpty((userInfo.getEmail()))) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_email),
-                        userInfo.getEmail()));
-            }
+        if (!TextUtils.isEmpty((userInfo.getEmail())) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_email),
+                    userInfo.getEmail()));
 
-            if (!TextUtils.isEmpty(userInfo.getPhone())) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_phone),
-                        userInfo.getPhone()));
-            }
+        if (!TextUtils.isEmpty(userInfo.getPhone()) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_phone),
+                    userInfo.getPhone()));
 
-            if (!TextUtils.isEmpty(userInfo.getAddress())) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_address),
-                        userInfo.getAddress()));
-            }
+        if (!TextUtils.isEmpty(userInfo.getAddress()) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_address),
+                    userInfo.getAddress()));
 
-            if (!TextUtils.isEmpty(userInfo.getWebpage())) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_website),
-                        userInfo.getWebpage()));
-            }
+        if (!TextUtils.isEmpty(userInfo.getWebpage()) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_website),
+                    userInfo.getWebpage()));
 
-            if (!TextUtils.isEmpty(userInfo.getTwitter())) {
-                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_twitter),
-                        userInfo.getTwitter()));
-            }
+        if (!TextUtils.isEmpty(userInfo.getTwitter()) && context != null) {
+            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_twitter),
+                    userInfo.getTwitter()));
         }
     }
 

+ 0 - 2
src/main/java/com/owncloud/android/ui/activity/ManageAccountsActivity.java

@@ -34,7 +34,6 @@ import android.os.Handler;
 import android.os.IBinder;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.graphics.drawable.DrawableCompat;
-import android.util.Log;
 import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
@@ -56,7 +55,6 @@ import com.owncloud.android.utils.DisplayUtils;
 
 import org.parceler.Parcels;
 
-import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.Set;