From b7a29c6058b9e0f1ddb493f55e933062b913484e Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Fri, 8 Nov 2013 19:10:40 -0800 Subject: Removed some duplicate layouts --- .../dsub/activity/SubsonicFragmentActivity.java | 4 ++-- .../daneren2005/dsub/fragments/SearchFragment.java | 10 +++++----- .../dsub/fragments/SelectArtistFragment.java | 6 +++--- .../dsub/fragments/SelectBookmarkFragment.java | 6 +++--- .../dsub/fragments/SelectGenreFragment.java | 20 ++++---------------- .../dsub/fragments/SelectPlaylistFragment.java | 12 ++++++------ .../dsub/fragments/SelectPodcastsFragment.java | 8 ++++---- src/github/daneren2005/dsub/view/ArtistAdapter.java | 2 +- .../daneren2005/dsub/view/ArtistEntryView.java | 8 ++++---- src/github/daneren2005/dsub/view/ArtistView.java | 10 +++++----- src/github/daneren2005/dsub/view/GenreView.java | 9 +++++---- .../daneren2005/dsub/view/PlaylistAdapter.java | 2 +- src/github/daneren2005/dsub/view/PlaylistView.java | 9 ++++++--- .../daneren2005/dsub/view/PodcastChannelView.java | 8 ++++---- 14 files changed, 53 insertions(+), 61 deletions(-) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java index 4df064e5..9c006ae1 100644 --- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java +++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java @@ -223,7 +223,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { }; if(getIntent().hasExtra(Constants.INTENT_EXTRA_VIEW_ALBUM)) { - int fragmentID = R.id.select_artist_layout; + int fragmentID = R.id.fragment_list_layout; if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID)) { SubsonicFragment fragment = new SelectDirectoryFragment(); Bundle args = new Bundle(); @@ -231,7 +231,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity { args.putString(Constants.INTENT_EXTRA_NAME_NAME, getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_PARENT_NAME)); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_artist_layout, currentFragment.getSupportTag()); + replaceFragment(fragment, R.id.fragment_list_layout, currentFragment.getSupportTag()); fragmentID = fragment.getRootId(); } diff --git a/src/github/daneren2005/dsub/fragments/SearchFragment.java b/src/github/daneren2005/dsub/fragments/SearchFragment.java index 61516e28..25fee43d 100644 --- a/src/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/src/github/daneren2005/dsub/fragments/SearchFragment.java @@ -81,7 +81,7 @@ public class SearchFragment extends SubsonicFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.search, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); setTitle(R.string.search_title); View buttons = inflater.inflate(R.layout.search_buttons, null); @@ -94,7 +94,7 @@ public class SearchFragment extends SubsonicFragment { moreAlbumsButton = buttons.findViewById(R.id.search_more_albums); moreSongsButton = buttons.findViewById(R.id.search_more_songs); - list = (ListView) rootView.findViewById(R.id.search_list); + list = (ListView) rootView.findViewById(R.id.fragment_list); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override @@ -293,11 +293,11 @@ public class SearchFragment extends SubsonicFragment { args.putString(Constants.INTENT_EXTRA_NAME_NAME, artist.getName()); fragment.setArguments(args); - replaceFragment(fragment, R.id.search_layout); + replaceFragment(fragment, R.id.fragment_list_layout); } private void onAlbumSelected(MusicDirectory.Entry album, boolean autoplay) { - int id = R.id.search_layout; + int id = R.id.fragment_list_layout; Bundle args; if(album.getParent() != null) { SubsonicFragment parentFragment = new SelectDirectoryFragment(); @@ -306,7 +306,7 @@ public class SearchFragment extends SubsonicFragment { args.putString(Constants.INTENT_EXTRA_NAME_NAME, album.getArtist()); parentFragment.setArguments(args); - replaceFragment(parentFragment, R.id.search_layout); + replaceFragment(parentFragment, R.id.fragment_list_layout); id = parentFragment.getRootId(); } diff --git a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java index f1f0fa8c..7cca8d6c 100644 --- a/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectArtistFragment.java @@ -63,9 +63,9 @@ public class SelectArtistFragment extends SubsonicFragment implements AdapterVie @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.select_artist, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); - artistList = (ListView) rootView.findViewById(R.id.select_artist_list); + artistList = (ListView) rootView.findViewById(R.id.fragment_list); artistList.setOnItemClickListener(this); folderButtonParent = inflater.inflate(R.layout.select_artist_header, artistList, false); @@ -170,7 +170,7 @@ public class SelectArtistFragment extends SubsonicFragment implements AdapterVie } fragment.setArguments(args); - replaceFragment(fragment, R.id.select_artist_layout); + replaceFragment(fragment, R.id.fragment_list_layout); } } diff --git a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java index 909e86f3..cf57ce58 100644 --- a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java @@ -63,11 +63,11 @@ public class SelectBookmarkFragment extends SubsonicFragment implements AdapterV @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.select_genres, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); - bookmarkListView = (ListView)rootView.findViewById(R.id.select_genre_list); + bookmarkListView = (ListView)rootView.findViewById(R.id.fragment_list); bookmarkListView.setOnItemClickListener(this); - emptyView = rootView.findViewById(R.id.select_genre_empty); + emptyView = rootView.findViewById(R.id.fragment_list_empty); if(bookmarks == null) { refresh(); diff --git a/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java b/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java index 2a6693ca..e6bf66b6 100644 --- a/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectGenreFragment.java @@ -64,11 +64,11 @@ public class SelectGenreFragment extends SubsonicFragment implements AdapterView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.select_genres, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); - genreListView = (ListView)rootView.findViewById(R.id.select_genre_list); + genreListView = (ListView)rootView.findViewById(R.id.fragment_list); genreListView.setOnItemClickListener(this); - emptyView = rootView.findViewById(R.id.select_genre_empty); + emptyView = rootView.findViewById(R.id.fragment_list_empty); if(genres == null) { refresh(); @@ -92,18 +92,6 @@ public class SelectGenreFragment extends SubsonicFragment implements AdapterView return false; } - - @Override - public void setPrimaryFragment(boolean primary) { - super.setPrimaryFragment(primary); - if(rootView != null) { - if(primary) { - ((ViewGroup)rootView).getChildAt(0).setVisibility(View.VISIBLE); - } else { - ((ViewGroup)rootView).getChildAt(0).setVisibility(View.GONE); - } - } - } @Override protected void refresh(boolean refresh) { @@ -155,6 +143,6 @@ public class SelectGenreFragment extends SubsonicFragment implements AdapterView args.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_EXTRA, genre.getName()); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_genre_layout); + replaceFragment(fragment, R.id.fragment_list_layout); } } diff --git a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java index 48338b3d..9ae229b8 100644 --- a/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectPlaylistFragment.java @@ -59,10 +59,10 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.select_playlist, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); - list = (ListView) rootView.findViewById(R.id.select_playlist_list); - emptyTextView = rootView.findViewById(R.id.select_playlist_empty); + list = (ListView) rootView.findViewById(R.id.fragment_list); + emptyTextView = rootView.findViewById(R.id.fragment_list_empty); list.setOnItemClickListener(this); registerForContextMenu(list); @@ -133,7 +133,7 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_playlist_layout); + replaceFragment(fragment, R.id.fragment_list_layout); break; case R.id.playlist_menu_play_shuffled: fragment = new SelectDirectoryFragment(); @@ -144,7 +144,7 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV args.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_playlist_layout); + replaceFragment(fragment, R.id.fragment_list_layout); break; case R.id.playlist_menu_delete: deletePlaylist(playlist); @@ -171,7 +171,7 @@ public class SelectPlaylistFragment extends SubsonicFragment implements AdapterV args.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName()); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_playlist_layout); + replaceFragment(fragment, R.id.fragment_list_layout); } @Override diff --git a/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java b/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java index e9a06076..3ce7917e 100644 --- a/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectPodcastsFragment.java @@ -81,12 +81,12 @@ public class SelectPodcastsFragment extends SubsonicFragment implements AdapterV @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { - rootView = inflater.inflate(R.layout.select_podcasts, container, false); + rootView = inflater.inflate(R.layout.abstract_list_fragment, container, false); - podcastListView = (ListView)rootView.findViewById(R.id.select_podcasts_list); + podcastListView = (ListView)rootView.findViewById(R.id.fragment_list); podcastListView.setOnItemClickListener(this); registerForContextMenu(podcastListView); - emptyView = rootView.findViewById(R.id.select_podcasts_empty); + emptyView = rootView.findViewById(R.id.fragment_list_empty); if(channels == null) { if(!primaryFragment) { @@ -205,7 +205,7 @@ public class SelectPodcastsFragment extends SubsonicFragment implements AdapterV args.putString(Constants.INTENT_EXTRA_NAME_PODCAST_DESCRIPTION, channel.getDescription()); fragment.setArguments(args); - replaceFragment(fragment, R.id.select_podcasts_layout); + replaceFragment(fragment, R.id.fragment_list_layout); } } diff --git a/src/github/daneren2005/dsub/view/ArtistAdapter.java b/src/github/daneren2005/dsub/view/ArtistAdapter.java index ff66f396..1998eaed 100644 --- a/src/github/daneren2005/dsub/view/ArtistAdapter.java +++ b/src/github/daneren2005/dsub/view/ArtistAdapter.java @@ -42,7 +42,7 @@ public class ArtistAdapter extends ArrayAdapter implements SectionIndexe private final Integer[] positions; public ArtistAdapter(Context activity, List artists) { - super(activity, R.layout.artist_list_item, artists); + super(activity, R.layout.basic_list_item, artists); this.activity = activity; Set sectionSet = new LinkedHashSet(30); diff --git a/src/github/daneren2005/dsub/view/ArtistEntryView.java b/src/github/daneren2005/dsub/view/ArtistEntryView.java index 1d3993a0..958b4b87 100644 --- a/src/github/daneren2005/dsub/view/ArtistEntryView.java +++ b/src/github/daneren2005/dsub/view/ArtistEntryView.java @@ -48,12 +48,12 @@ public class ArtistEntryView extends UpdateView { public ArtistEntryView(Context context) { super(context); this.context = context; - LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true); + LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true); - titleView = (TextView) findViewById(R.id.artist_name); - starButton = (ImageButton) findViewById(R.id.artist_star); + titleView = (TextView) findViewById(R.id.item_name); + starButton = (ImageButton) findViewById(R.id.item_star); starButton.setFocusable(false); - moreButton = (ImageView) findViewById(R.id.artist_more); + moreButton = (ImageView) findViewById(R.id.item_more); moreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.showContextMenu(); diff --git a/src/github/daneren2005/dsub/view/ArtistView.java b/src/github/daneren2005/dsub/view/ArtistView.java index 2a284905..6f54e800 100644 --- a/src/github/daneren2005/dsub/view/ArtistView.java +++ b/src/github/daneren2005/dsub/view/ArtistView.java @@ -47,12 +47,12 @@ public class ArtistView extends UpdateView { public ArtistView(Context context) { super(context); this.context = context; - LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true); + LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true); - titleView = (TextView) findViewById(R.id.artist_name); - starButton = (ImageButton) findViewById(R.id.artist_star); - starButton.setFocusable(false); - moreButton = (ImageView) findViewById(R.id.artist_more); + titleView = (TextView) findViewById(R.id.item_name); + starButton = (ImageButton) findViewById(R.id.item_star); + starButton.setFocusable(false); + moreButton = (ImageView) findViewById(R.id.item_more); moreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.showContextMenu(); diff --git a/src/github/daneren2005/dsub/view/GenreView.java b/src/github/daneren2005/dsub/view/GenreView.java index 69456c28..6a8e04ef 100644 --- a/src/github/daneren2005/dsub/view/GenreView.java +++ b/src/github/daneren2005/dsub/view/GenreView.java @@ -34,12 +34,13 @@ public class GenreView extends UpdateView { public GenreView(Context context) { super(context); - LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true); + LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true); - titleView = (TextView) findViewById(R.id.artist_name); - starButton = (ImageButton) findViewById(R.id.artist_star); + titleView = (TextView) findViewById(R.id.item_name); + starButton = (ImageButton) findViewById(R.id.item_star); starButton.setFocusable(false); - moreButton = (ImageView) findViewById(R.id.artist_more); + moreButton = (ImageView) findViewById(R.id.item_more); + moreButton.setVisibility(View.GONE); moreButton.setClickable(false); } diff --git a/src/github/daneren2005/dsub/view/PlaylistAdapter.java b/src/github/daneren2005/dsub/view/PlaylistAdapter.java index f25996dd..ff0294b7 100644 --- a/src/github/daneren2005/dsub/view/PlaylistAdapter.java +++ b/src/github/daneren2005/dsub/view/PlaylistAdapter.java @@ -36,7 +36,7 @@ public class PlaylistAdapter extends ArrayAdapter { private final Context activity; public PlaylistAdapter(Context activity, List Playlists) { - super(activity, R.layout.playlist_list_item, Playlists); + super(activity, R.layout.basic_list_item, Playlists); this.activity = activity; } diff --git a/src/github/daneren2005/dsub/view/PlaylistView.java b/src/github/daneren2005/dsub/view/PlaylistView.java index 31332b22..b5034493 100644 --- a/src/github/daneren2005/dsub/view/PlaylistView.java +++ b/src/github/daneren2005/dsub/view/PlaylistView.java @@ -21,6 +21,7 @@ package github.daneren2005.dsub.view; import android.content.Context; import android.view.LayoutInflater; import android.view.View; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; import github.daneren2005.dsub.R; @@ -46,10 +47,12 @@ public class PlaylistView extends UpdateView { public PlaylistView(Context context) { super(context); this.context = context; - LayoutInflater.from(context).inflate(R.layout.playlist_list_item, this, true); + LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true); - titleView = (TextView) findViewById(R.id.playlist_name); - moreButton = (ImageView) findViewById(R.id.playlist_more); + titleView = (TextView) findViewById(R.id.item_name); + starButton = (ImageButton) findViewById(R.id.item_star); + starButton.setFocusable(false); + moreButton = (ImageView) findViewById(R.id.item_more); moreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.showContextMenu(); diff --git a/src/github/daneren2005/dsub/view/PodcastChannelView.java b/src/github/daneren2005/dsub/view/PodcastChannelView.java index 5b9225d7..9ad78d1c 100644 --- a/src/github/daneren2005/dsub/view/PodcastChannelView.java +++ b/src/github/daneren2005/dsub/view/PodcastChannelView.java @@ -41,12 +41,12 @@ public class PodcastChannelView extends UpdateView { public PodcastChannelView(Context context) { super(context); this.context = context; - LayoutInflater.from(context).inflate(R.layout.artist_list_item, this, true); + LayoutInflater.from(context).inflate(R.layout.basic_list_item, this, true); - titleView = (TextView) findViewById(R.id.artist_name); - starButton = (ImageButton) findViewById(R.id.artist_star); + titleView = (TextView) findViewById(R.id.item_name); + starButton = (ImageButton) findViewById(R.id.item_star); starButton.setFocusable(false); - moreButton = (ImageView) findViewById(R.id.artist_more); + moreButton = (ImageView) findViewById(R.id.item_more); moreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.showContextMenu(); -- cgit v1.2.3