Large and horizontal devices - special view for panoramio
parent
1171030b11
commit
ebaa0b4f47
app/src/main/java/pl/tpolgrabia/urbanexplorer
|
@ -22,5 +22,5 @@ public class AppConstants {
|
|||
static final String SAVED_CONFIG_KEY = "SAVED_CONFIG_KEY";
|
||||
public static final String GOOGLE_API_KEY = "AIzaSyBAJoK-pu_qnQ0U8EGjM1Zkz_g8oJV4w2g";
|
||||
public static final Locale DEF_APP_LOCALE = Locale.ENGLISH;
|
||||
public static final double PANORAMIO_SHOWER_SIDEBAR_THRESHOLD = 5.0;
|
||||
public static final double PANORAMIO_SHOWER_SIDEBAR_THRESHOLD = 7.0;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,7 @@ public class PanoramioItemLongClickHandler implements AdapterView.OnItemLongClic
|
|||
PanoramioAdapter panAdapter = (PanoramioAdapter) finalLocations.getAdapter();
|
||||
PanoramioImageInfo photoInfo = panAdapter.getItem(pos);
|
||||
MainActivity activity = (MainActivity) homeFragment.getActivity();
|
||||
double dims = PanoramioUtils.calcDiag(activity);
|
||||
if (dims >= AppConstants.PANORAMIO_SHOWER_SIDEBAR_THRESHOLD) {
|
||||
if (PanoramioSwitchHandler.enoughLargeAndHorizontal(activity)) {
|
||||
lg.debug("Sending panoramio image event");
|
||||
EventBus.getDefault().post(new PhotoInfoUpdateEvent(this, photoInfo));
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package pl.tpolgrabia.urbanexplorer.handlers;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import pl.tpolgrabia.panoramiobindings.utils.PanoramioUtils;
|
||||
|
@ -25,10 +28,15 @@ public class PanoramioSwitchHandler implements Runnable {
|
|||
public void run() {
|
||||
lg.debug("Switching to home fragment");
|
||||
mainActivity.switchFragment(new HomeFragment(), HomeFragment.TAG);
|
||||
double diagInches = PanoramioUtils.calcDiag(mainActivity);
|
||||
if (diagInches >= AppConstants.PANORAMIO_SHOWER_SIDEBAR_THRESHOLD) {
|
||||
if (enoughLargeAndHorizontal(mainActivity)) {
|
||||
mainActivity.addFragment(MainActivity.createShowerFragment(null), PanoramioShowerFragment.TAG);
|
||||
// mainActivity.addFragment(new WikiLocationsFragment(), WikiLocationsFragment.TAG);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean enoughLargeAndHorizontal(Activity ctx) {
|
||||
DisplayMetrics metrics = PanoramioUtils.calcMetrics(ctx);
|
||||
return metrics.widthPixels >= metrics.heightPixels // horizontal
|
||||
&& PanoramioUtils.calcDiag(ctx) >= AppConstants.PANORAMIO_SHOWER_SIDEBAR_THRESHOLD;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue