diff --git a/app/build.gradle b/app/build.gradle index 18590f0..e3ee386 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,21 @@ +buildscript { + repositories { + maven { url 'https://maven.fabric.io/public' } + } + + dependencies { + // The Fabric Gradle plugin uses an open ended version to react + // quickly to Android tooling updates + classpath 'io.fabric.tools:gradle:1.+' + } +} + apply plugin: 'com.android.application' +apply plugin: 'io.fabric' + +repositories { + maven { url 'https://maven.fabric.io/public' } +} android { compileSdkVersion 21 @@ -27,5 +44,8 @@ dependencies { compile 'com.android.support:recyclerview-v7:21.0.3' compile 'com.googlecode.android-query:android-query:0.25.9' compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' + compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') { + transitive = true; + } compile 'org.apache.commons:commons-lang3:3.4' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c10098e..768c216 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,10 @@ + diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java index 1e46cbb..64ece64 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java @@ -16,10 +16,12 @@ import android.view.GestureDetector; import android.view.MenuItem; import android.view.MotionEvent; import android.widget.Toast; +import com.crashlytics.android.Crashlytics; import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; +import io.fabric.sdk.android.Fabric; import pl.tpolgrabia.urbanexplorer.callbacks.StandardLocationListener; import pl.tpolgrabia.urbanexplorer.callbacks.StandardLocationListenerCallback; import pl.tpolgrabia.urbanexplorer.dto.panoramio.PanoramioImageInfo; @@ -92,6 +94,8 @@ public class MainActivity extends ActionBarActivity implements GestureDetector.O gestureDetector = new GestureDetectorCompat(this, this); locationCallback = new StandardLocationListener(); initLocalication(); + Fabric fabric = new Fabric.Builder(this).debuggable(true).kits(new Crashlytics()).build(); + Fabric.with(fabric); } @Override @@ -152,6 +156,14 @@ public class MainActivity extends ActionBarActivity implements GestureDetector.O @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + if (e1 == null) { + return false; + } + + if (e2 == null) { + return false; + } + float diffx = e2.getX() - e1.getX(); float diffy = e2.getY() - e1.getY(); Log.d(CLASS_TAG, "Flinging... diffx: " + diffx + " diffy" + diffy diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PanoramioShowerFragment.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PanoramioShowerFragment.java index 4f72cab..02123f8 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PanoramioShowerFragment.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/fragments/PanoramioShowerFragment.java @@ -1,6 +1,8 @@ package pl.tpolgrabia.urbanexplorer.fragments; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; @@ -43,7 +45,7 @@ public class PanoramioShowerFragment extends Fragment { return inflatedView; } - PanoramioImageInfo imageInfo = (PanoramioImageInfo) arguments.getSerializable(PANORAMIO_PHOTO_ARG_KEY); + final PanoramioImageInfo imageInfo = (PanoramioImageInfo) arguments.getSerializable(PANORAMIO_PHOTO_ARG_KEY); if (imageInfo != null) { ImageLoader.getInstance().displayImage( @@ -65,6 +67,16 @@ public class PanoramioShowerFragment extends Fragment { photoLocation = (TextView)inflatedView.findViewById(R.id.photo_location); photoLocation.setText(imageInfo.getLatitude() + "," + imageInfo.getLongitude()); + photoLocation.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + Intent intent = new Intent(android.content.Intent.ACTION_VIEW, + Uri.parse("http://maps.google.com/maps?daddr=" + imageInfo.getLatitude() + "," + + imageInfo.getLongitude())); + startActivity(intent); + return true; + } + }); } diff --git a/app/src/main/res/color/blue.xml b/app/src/main/res/color/blue.xml new file mode 100644 index 0000000..afa20de --- /dev/null +++ b/app/src/main/res/color/blue.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_panoramio_shower.xml b/app/src/main/res/layout/fragment_panoramio_shower.xml index e8ebb72..b531e56 100644 --- a/app/src/main/res/layout/fragment_panoramio_shower.xml +++ b/app/src/main/res/layout/fragment_panoramio_shower.xml @@ -50,7 +50,8 @@ + android:layout_height="wrap_content" + android:textColor="@color/blue" />