Merge pull request #136 from poisdeux/issue#103
This implements feature request #103
This commit is contained in:
commit
939a5fc722
|
@ -23,6 +23,9 @@ import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -111,6 +114,12 @@ abstract public class AbstractDetailsFragment extends Fragment
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@ -136,9 +145,18 @@ abstract public class AbstractDetailsFragment extends Fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
super.onSaveInstanceState(outState);
|
inflater.inflate(R.menu.refresh_item, menu);
|
||||||
// outState.putInt(ITEMID, itemId);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_refresh:
|
||||||
|
onRefresh();
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startSync(boolean silentRefresh) {
|
protected void startSync(boolean silentRefresh) {
|
||||||
|
|
|
@ -28,6 +28,9 @@ import android.support.v4.content.Loader;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
@ -133,6 +136,21 @@ public abstract class AbstractListFragment extends Fragment
|
||||||
SyncUtils.disconnectFromLibrarySyncService(getActivity(), serviceConnection);
|
SyncUtils.disconnectFromLibrarySyncService(getActivity(), serviceConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
|
inflater.inflate(R.menu.refresh_item, menu);
|
||||||
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch(item.getItemId()) {
|
||||||
|
case R.id.action_refresh:
|
||||||
|
onRefresh();
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swipe refresh layout callback
|
* Swipe refresh layout callback
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -203,8 +203,6 @@ public class MovieDetailsFragment extends AbstractDetailsFragment
|
||||||
// Start the loaders
|
// Start the loaders
|
||||||
getLoaderManager().initLoader(LOADER_MOVIE, null, this);
|
getLoaderManager().initLoader(LOADER_MOVIE, null, this);
|
||||||
getLoaderManager().initLoader(LOADER_CAST, null, this);
|
getLoaderManager().initLoader(LOADER_CAST, null, this);
|
||||||
|
|
||||||
setHasOptionsMenu(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -185,8 +185,6 @@ public class MusicVideoDetailsFragment extends AbstractDetailsFragment
|
||||||
|
|
||||||
// Start the loaders
|
// Start the loaders
|
||||||
getLoaderManager().initLoader(LOADER_MUSIC_VIDEO, null, this);
|
getLoaderManager().initLoader(LOADER_MUSIC_VIDEO, null, this);
|
||||||
|
|
||||||
setHasOptionsMenu(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -195,8 +195,6 @@ public class TVShowEpisodeDetailsFragment extends AbstractDetailsFragment
|
||||||
// Start the loaders
|
// Start the loaders
|
||||||
getLoaderManager().initLoader(LOADER_EPISODE, null, this);
|
getLoaderManager().initLoader(LOADER_EPISODE, null, this);
|
||||||
// getLoaderManager().initLoader(LOADER_CAST, null, this);
|
// getLoaderManager().initLoader(LOADER_CAST, null, this);
|
||||||
|
|
||||||
setHasOptionsMenu(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -166,8 +166,6 @@ public class TVShowOverviewFragment extends AbstractDetailsFragment
|
||||||
// Start the loaders
|
// Start the loaders
|
||||||
getLoaderManager().initLoader(LOADER_TVSHOW, null, this);
|
getLoaderManager().initLoader(LOADER_TVSHOW, null, this);
|
||||||
getLoaderManager().initLoader(LOADER_CAST, null, this);
|
getLoaderManager().initLoader(LOADER_CAST, null, this);
|
||||||
|
|
||||||
setHasOptionsMenu(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2015 Synced Synapse. All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<menu
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:id="@+id/action_refresh"
|
||||||
|
android:title="@string/refresh"
|
||||||
|
app:showAsAction="never"/>
|
||||||
|
</menu>
|
|
@ -342,6 +342,7 @@
|
||||||
<string name="might_not_have_pvr">An error occurred while getting channels info, probably because your media center doesn\'t have a tuner or it isn\'t configured.\n\nIf that\'s the case and you\'d like to remove this entry from the side menu, you can do it in the Settings.</string>
|
<string name="might_not_have_pvr">An error occurred while getting channels info, probably because your media center doesn\'t have a tuner or it isn\'t configured.\n\nIf that\'s the case and you\'d like to remove this entry from the side menu, you can do it in the Settings.</string>
|
||||||
<string name="error_starting_channel">An error occurred starting channel playback: %1$s</string>
|
<string name="error_starting_channel">An error occurred starting channel playback: %1$s</string>
|
||||||
<string name="channel_switching">Switching to channel %1$s</string>
|
<string name="channel_switching">Switching to channel %1$s</string>
|
||||||
|
<string name="refresh">refresh</string>
|
||||||
|
|
||||||
<string name="tv">TV</string>
|
<string name="tv">TV</string>
|
||||||
<string name="radio">Radio</string>
|
<string name="radio">Radio</string>
|
||||||
|
|
Loading…
Reference in New Issue