From d3731d0827f9d991570423b88158c09b5f61ea9f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 15 Nov 2013 16:31:52 -0500 Subject: [PATCH] [Android] Get rid of some unnecessary variables in the getView() methods of some adapters. Directly referencing convertView is fine. --- .../folderbrowser/FolderBrowserAdapter.java | 13 ++++++------- .../dolphinemu/gamelist/GameListAdapter.java | 13 ++++++------- .../dolphinemu/sidemenu/SideMenuAdapter.java | 9 ++++----- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java index 8d96a8232c..81d738b143 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java @@ -56,19 +56,18 @@ public final class FolderBrowserAdapter extends ArrayAdapter @Override public View getView(int position, View convertView, ViewGroup parent) { - View v = convertView; - if (v == null) + if (convertView == null) { LayoutInflater vi = LayoutInflater.from(context); - v = vi.inflate(id, parent, false); + convertView = vi.inflate(id, parent, false); } final FolderBrowserItem item = items.get(position); if (item != null) { - ImageView icon = (ImageView) v.findViewById(R.id.ListItemIcon); - TextView title = (TextView) v.findViewById(R.id.ListItemTitle); - TextView subtitle = (TextView) v.findViewById(R.id.ListItemSubTitle); + ImageView icon = (ImageView) convertView.findViewById(R.id.ListItemIcon); + TextView title = (TextView) convertView.findViewById(R.id.ListItemTitle); + TextView subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle); if(title != null) { @@ -100,6 +99,6 @@ public final class FolderBrowserAdapter extends ArrayAdapter } } } - return v; + return convertView; } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java index d0b3642ffe..ca30f4f284 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java @@ -55,19 +55,18 @@ public final class GameListAdapter extends ArrayAdapter @Override public View getView(int position, View convertView, ViewGroup parent) { - View v = convertView; - if (v == null) + if (convertView == null) { LayoutInflater vi = LayoutInflater.from(context); - v = vi.inflate(id, parent, false); + convertView = vi.inflate(id, parent, false); } final GameListItem item = items.get(position); if (item != null) { - TextView title = (TextView) v.findViewById(R.id.ListItemTitle); - TextView subtitle = (TextView) v.findViewById(R.id.ListItemSubTitle); - ImageView icon = (ImageView) v.findViewById(R.id.ListItemIcon); + TextView title = (TextView) convertView.findViewById(R.id.ListItemTitle); + TextView subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle); + ImageView icon = (ImageView) convertView.findViewById(R.id.ListItemIcon); if (title != null) title.setText(item.getName()); @@ -83,7 +82,7 @@ public final class GameListAdapter extends ArrayAdapter } } - return v; + return convertView; } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java index 6ea97e3f66..60fd8b56f3 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java @@ -54,23 +54,22 @@ public final class SideMenuAdapter extends ArrayAdapter @Override public View getView(int position, View convertView, ViewGroup parent) { - View v = convertView; - if (v == null) + if (convertView == null) { LayoutInflater vi = LayoutInflater.from(context); - v = vi.inflate(id, null); + convertView = vi.inflate(id, null); } final SideMenuItem item = items.get(position); if (item != null) { - TextView title = (TextView) v.findViewById(R.id.SideMenuTitle); + TextView title = (TextView) convertView.findViewById(R.id.SideMenuTitle); if (title != null) title.setText(item.getName()); } - return v; + return convertView; } }