This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy, HH:mm"); | |
String date = df.format(Calendar.getInstance().getTime()); | |
"yyyy.MM.dd G 'at' HH:mm:ss z" ---- 2001.07.04 AD at 12:08:56 PDT | |
"hh 'o''clock' a, zzzz" ----------- 12 o'clock PM, Pacific Daylight Time | |
"EEE, d MMM yyyy HH:mm:ss Z"------- Wed, 4 Jul 2001 12:08:56 -0700 | |
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"------- 2001-07-04T12:08:56.235-0700 | |
"yyMMddHHmmssZ"-------------------- 010704120856-0700 | |
"K:mm a, z" ----------------------- 0:08 PM, PDT | |
"h:mm a" -------------------------- 12:08 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SwipeLockableViewPager(context: Context, attrs: AttributeSet) : ViewPager(context, attrs) { | |
private var swipeEnabled = false | |
override fun onTouchEvent(event: MotionEvent): Boolean { | |
return when (swipeEnabled) { | |
true -> super.onTouchEvent(event) | |
false -> false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapView.setOnTouchListener { v, event -> | |
when (event?.action) { | |
MotionEvent.ACTION_MOVE -> | |
scrollView.requestDisallowInterceptTouchEvent(true) | |
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> | |
scrollView.requestDisallowInterceptTouchEvent(false) | |
} | |
mapView.onTouchEvent(event) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object RetrofitClient { | |
private const val BASE_URL = "" | |
private lateinit var retrofit: Retrofit | |
fun getClient(): APIService { | |
if (retrofit == null) { | |
retrofit = Retrofit.Builder() | |
.baseUrl(BASE_URL) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void createNotification(String title, String message) { | |
int num = (int) System.currentTimeMillis(); | |
Intent resultIntent = new Intent(PusherService.this, MainActivity.class); | |
resultIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |
resultIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); | |
PendingIntent resultPendingIntent = | |
PendingIntent.getActivity(this, num, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); | |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private FusedLocationProviderClient fusedLocationProviderClient; | |
private LocationRequest locationRequest; | |
private LocationCallback locationCallback; | |
fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this); | |
fusedLocationProviderClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() { | |
@Override | |
public void onSuccess(Location location) { | |
if (location != null) { |