Mario Danic 8 жил өмнө
parent
commit
b2c27d38e2

+ 0 - 4
build.gradle

@@ -23,10 +23,6 @@ apply plugin: 'checkstyle'
 apply plugin: 'pmd'
 apply plugin: 'findbugs'
 
-configurations.all {
-    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
-}
-
 ext {
     supportLibraryVersion = '24.2.1'
 

+ 1 - 1
src/com/owncloud/android/datamodel/StringPair.java

@@ -21,7 +21,7 @@
 package com.owncloud.android.datamodel;
 
 /**
- * Created by mdjanic on 25/01/2017.
+ * Model for storing key/value String pairs in a nicer way
  */
 
 public class StringPair {

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

@@ -60,7 +60,7 @@ import butterknife.ButterKnife;
 import butterknife.Unbinder;
 
 /**
- * Created by mdjanic on 25/01/2017.
+ * This Activity presents the user information.
  */
 
 public class UserInfoActivity extends FileActivity {
@@ -91,8 +91,6 @@ public class UserInfoActivity extends FileActivity {
     @BindString(R.string.preview_sorry)
     public String sorryMessage;
 
-    private RecyclerView.LayoutManager layoutManager;
-
     private RecyclerView.Adapter adapter;
 
     private RecyclerView.Adapter adapter;
@@ -133,7 +131,7 @@ public class UserInfoActivity extends FileActivity {
             updateActionBarTitleAndHomeButtonByString(getResources().getString(R.string.user_information_description));
         }
 
-        layoutManager = new LinearLayoutManager(this);
+        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
         genericRecyclerView.setLayoutManager(layoutManager);
 
         // This will be enabled once we migrate to new support libraries

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

@@ -40,7 +40,7 @@ import butterknife.BindView;
 import butterknife.ButterKnife;
 
 /**
- * Created by mdjanic on 24/01/2017.
+ * This Adapter populates a RecyclerView with the user information.
  */
 
 
@@ -61,8 +61,6 @@ public class UserInfoAdapter extends RecyclerView.Adapter<UserInfoAdapter.ViewHo
 
     @Override
     public int getItemViewType(int position) {
-        // Just as an example, return 0 or 2 depending on position
-        // Note that unlike in ListView adapters, types don't have to be contiguous
         if (position % 2 == 0) {
             return 0;
         } else {
@@ -111,34 +109,36 @@ public class UserInfoAdapter extends RecyclerView.Adapter<UserInfoAdapter.ViewHo
     }
 
     private void getRelevantInformation() {
-        if (!TextUtils.isEmpty(userInfo.getDisplayName()) && context != null) {
-            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_full_name),
-                    userInfo.getDisplayName()));
-        }
+        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.getEmail())) && context != null) {
-            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_email),
-                    userInfo.getEmail()));
-        }
+            if (!TextUtils.isEmpty((userInfo.getEmail()))) {
+                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_email),
+                        userInfo.getEmail()));
+            }
 
-        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.getPhone())) {
+                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_phone),
+                        userInfo.getPhone()));
+            }
 
-        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.getAddress())) {
+                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_address),
+                        userInfo.getAddress()));
+            }
 
-        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.getWebpage())) {
+                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_website),
+                        userInfo.getWebpage()));
+            }
 
-        if (!TextUtils.isEmpty(userInfo.getTwitter()) && context != null) {
-            stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_twitter),
-                    userInfo.getTwitter()));
+            if (!TextUtils.isEmpty(userInfo.getTwitter())) {
+                stringPairs.add(new StringPair(context.getResources().getString(R.string.user_info_twitter),
+                        userInfo.getTwitter()));
+            }
         }
     }