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

re-use existing view for better performance

AndyScherzinger 7 жил өмнө
parent
commit
b121f8a678

+ 5 - 3
src/main/java/com/owncloud/android/ui/adapter/UserListAdapter.java

@@ -66,9 +66,11 @@ public class UserListAdapter extends ArrayAdapter {
 
 
     @Override
     @Override
     public @NonNull View getView(final int position, View convertView, @NonNull ViewGroup parent) {
     public @NonNull View getView(final int position, View convertView, @NonNull ViewGroup parent) {
-        LayoutInflater inflater = (LayoutInflater) mContext
-                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        View view = inflater.inflate(R.layout.file_details_share_user_item, parent, false);
+        View view = convertView;
+        if (view == null) {
+            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = inflater.inflate(R.layout.file_details_share_user_item, parent, false);
+        }
 
 
         if (mShares != null && mShares.size() > position) {
         if (mShares != null && mShares.size() > position) {
             OCShare share = mShares.get(position);
             OCShare share = mShares.get(position);

+ 1 - 1
src/main/java/com/owncloud/android/utils/DisplayUtils.java

@@ -361,7 +361,7 @@ public class DisplayUtils {
         if (path.length() > 1 && path.charAt(path.length() - 1) == OCFile.PATH_SEPARATOR.charAt(0)) {
         if (path.length() > 1 && path.charAt(path.length() - 1) == OCFile.PATH_SEPARATOR.charAt(0)) {
             return path.substring(0, path.length() - 1);
             return path.substring(0, path.length() - 1);
         }
         }
-        
+
         return path;
         return path;
     }
     }