Fix landscape

This commit is contained in:
Mario Danic 2017-02-20 21:04:48 +01:00 committed by AndyScherzinger
parent 4fa40f7392
commit 27716f8425
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -62,6 +62,8 @@ import java.util.ArrayList;
import third_parties.in.srain.cube.GridViewWithHeaderAndFooter;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
public class ExtendedListFragment extends Fragment
implements OnItemClickListener, OnEnforceableRefreshListener, SearchView.OnQueryTextListener {
@ -170,7 +172,11 @@ public class ExtendedListFragment extends Fragment
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
searchView.setMaxWidth((int)(width * 0.7));
if (getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
searchView.setMaxWidth((int)(width * 0.8));
} else {
searchView.setMaxWidth((int)(width * 0.7));
}
searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
@Override