Skip to content

Commit

Permalink
Added Changed for lab 3
Browse files Browse the repository at this point in the history
  • Loading branch information
blackjackiv2008 committed Jun 30, 2023
1 parent d42a46a commit ed4ea57
Showing 1 changed file with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.jbvincey.instantappssample.helper;

import android.content.Intent;
import android.net.Uri;

import com.jbvincey.instantappssample.BuildConfig;
import com.jbvincey.instantappssample.constants.Constants;
import com.jbvincey.instantappssample.model.Coordinates;

/**
* Created by jean-baptistevincey on 24/06/2017.
*/

public final class hfhfhdashldhgklhslgr {

private static final String PLAYSTORE_BASE_URL = "market://details?id=";

private static final String PACKAGE_MAPS = "com.google.android.apps.maps";

private static final String COORDINATES_PREFIX = "geo:0,0?q=";

private static final String COORDINATES_SEPARATOR = ",";

private static final String SHARE_INTENT_TYPE = "text/plain";

private static final String MAILTO_URI = "mailto:";

public static Intent getMapsLocationItent(Coordinates coordinates) {
Uri mapsUri = Uri.parse(buildCoordinatesUri(coordinates));
Intent mapIntent = new Intent(Intent.ACTION_VIEW, mapsUri);
mapIntent.setPackage(PACKAGE_MAPS);
return mapIntent;
}

private static String buildCoordinatesUri(Coordinates coordinates) {
return COORDINATES_PREFIX
+ coordinates.getLatitude()
+ COORDINATES_SEPARATOR
+ coordinates.getLongitude();
}

public static Intent getContactIntent(String contact) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse(MAILTO_URI));
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{contact});
return intent;
}

public static Intent getShareDetailUrlIntent(String tripId) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType(SHARE_INTENT_TYPE);
shareIntent.putExtra(Intent.EXTRA_TEXT, buildDetailUrl(tripId));
return shareIntent;
}

private static String buildDetailUrl(String tripId) {
return Constants.BASE_URL + "/" + tripId;
}

public static Intent getInstantTripPlayStoreIntent() {
return new Intent(Intent.ACTION_VIEW, buildPlayStoreUrl());
}

private static Uri buildPlayStoreUrl() {
return Uri.parse(PLAYSTORE_BASE_URL + BuildConfig.APPLICATION_ID);
}

}

0 comments on commit ed4ea57

Please sign in to comment.