Remove screenOrientation methods

This commit is contained in:
misaochan 2016-09-06 18:49:39 +12:00
parent 38d4531f42
commit 9d61dc4345

View file

@ -117,7 +117,7 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
protected void onPreExecute() { protected void onPreExecute() {
super.onPreExecute(); super.onPreExecute();
listener.onTaskStarted(); listener.onTaskStarted();
lockScreenOrientation(); //lockScreenOrientation();
} }
@Override @Override
@ -136,7 +136,7 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
protected void onPostExecute(List<Place> result) { protected void onPostExecute(List<Place> result) {
super.onPostExecute(result); super.onPostExecute(result);
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
unlockScreenOrientation(); //unlockScreenOrientation();
mAdapter = new NearbyAdapter(getActivity(), places); mAdapter = new NearbyAdapter(getActivity(), places);
ListView listview = (ListView) getView().findViewById(R.id.listview); ListView listview = (ListView) getView().findViewById(R.id.listview);
@ -145,7 +145,6 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Place place = places.get(position); Place place = places.get(position);
LatLng placeLatLng = place.location; LatLng placeLatLng = place.location;
@ -168,23 +167,6 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
} }
} }
private void lockScreenOrientation() {
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
private void unlockScreenOrientation() {
try {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
} catch (NullPointerException e){
Log.e(TAG, "NPE: ", e);
}
}
private class NearbyAdapter extends ArrayAdapter<Place> { private class NearbyAdapter extends ArrayAdapter<Place> {
public List<Place> placesList; public List<Place> placesList;