[Android] Code cleaning

Geoffrey Métais git at videolan.org
Thu Aug 31 17:48:15 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Aug 31 17:13:20 2017 +0200| [7a66c73434a4bc63aa046fb1a6315fd691e83ae1] | committer: Geoffrey Métais

Code cleaning

> https://code.videolan.org/videolan/vlc-android/commit/7a66c73434a4bc63aa046fb1a6315fd691e83ae1
---

 .../videolan/vlc/gui/dialogs/SavePlaylistDialog.java | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.java
index 67f3da6d7..90c3ae4ff 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SavePlaylistDialog.java
@@ -80,7 +80,7 @@ public class SavePlaylistDialog extends DialogFragment implements View.OnClickLi
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         mMedialibrary = VLCApplication.getMLInstance();
-        mAdapter = new AudioBrowserAdapter(getActivity(),MediaLibraryItem.TYPE_PLAYLIST,  this, false);
+        mAdapter = new AudioBrowserAdapter(getActivity(), MediaLibraryItem.TYPE_PLAYLIST, this, false);
         mAdapter.addAll(new ArrayList<MediaLibraryItem>(Arrays.asList(mMedialibrary.getPlaylists())));
         mTracks = (MediaWrapper[]) getArguments().getParcelableArray(KEY_TRACKS);
         mNewTrack = (MediaWrapper[]) getArguments().getParcelableArray(KEY_NEW_TRACKS);
@@ -101,13 +101,18 @@ public class SavePlaylistDialog extends DialogFragment implements View.OnClickLi
 
     @Override
     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
-        View view = inflater.inflate(R.layout.dialog_playlist, container);
+        return inflater.inflate(R.layout.dialog_playlist, container);
+    }
 
-        mListView = (RecyclerView) view.findViewById(android.R.id.list);
-        mSaveButton = (Button) view.findViewById(R.id.dialog_playlist_save);
-        mCancelButton = (Button) view.findViewById(R.id.dialog_playlist_cancel);
-        mEmptyView = (TextView) view.findViewById(android.R.id.empty);
-        TextInputLayout mLayout = (TextInputLayout)view.findViewById(R.id.dialog_playlist_name);
+    @Override
+    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+
+        mListView = view.findViewById(android.R.id.list);
+        mSaveButton = view.findViewById(R.id.dialog_playlist_save);
+        mCancelButton = view.findViewById(R.id.dialog_playlist_cancel);
+        mEmptyView = view.findViewById(android.R.id.empty);
+        TextInputLayout mLayout = view.findViewById(R.id.dialog_playlist_name);
         mEditText = mLayout.getEditText();
         mSaveButton.setOnClickListener(this);
         mCancelButton.setOnClickListener(new View.OnClickListener() {
@@ -121,7 +126,6 @@ public class SavePlaylistDialog extends DialogFragment implements View.OnClickLi
         mListView.setLayoutManager(new LinearLayoutManager(view.getContext()));
         mListView.setAdapter(mAdapter);
         updateEmptyView();
-        return view;
     }
 
     void updateEmptyView() {



More information about the Android mailing list