Skip to content

Instantly share code, notes, and snippets.

View ljcamargo's full-sized avatar

Luis J Camargo ljcamargo

View GitHub Profile
android {
flavorDimensions "platform"
productFlavors {
google {
dimension "platform"
}
huawei {
dimension "platform"
}
dependencies {
// old code
// implementation 'com.google.android.libraries.places:places:2.3.0'
// implementation "com.google.android.gms:play-services-maps:17.0.0"
// for Google-compatible
googleImplementation 'com.google.android.libraries.places:places:2.3.0'
googleImplementation "com.google.android.gms:play-services-maps:17.0.0"
package app.company.com.maps
import com.google.android.gms.maps.SupportMapFragment
class AgnosticMapFragment: SupportMapFragment() {
companion object {
@JvmStatic
fun newInstance(): AgnosticMapFragment = AgnosticMapFragment()
}
package app.company.com.maps
import com.huawei.hms.maps.SupportMapFragment
class AgnosticMapFragment: SupportMapFragment() {
companion object {
@JvmStatic
fun newInstance(): AgnosticMapFragment = AgnosticMapFragment()
}
package com.company.maps
import androidx.fragment.app.FragmentActivity
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import com.google.android.gms.maps.GoogleMap as Map
class AgnosticMap {
package com.company.maps
import androidx.fragment.app.FragmentActivity
import com.huawei.hms.maps.CameraUpdateFactory
import com.huawei.hms.maps.SupportMapFragment
import com.huawei.hms.maps.model.LatLng
import com.huawei.hms.maps.model.MarkerOptions
import com.huawei.hms.maps.HuaweiMap as Map
class AgnosticMap {
package com.company.maps
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MapsActivity : AppCompatActivity() {
private lateinit var map: AgnosticMap
package mx.ncite.savinglista.common
import org.joda.time.*
import org.joda.time.format.DateTimeFormat
import org.joda.time.format.ISODateTimeFormat
object DateUtils {
open val DAYS = "Dias"
open val WEEKS = "Semanas"
fun isTimeToSave(current: DateTime): Boolean {
if (completed) return false
val timeSpan = timeSpan ?: return false
val timeGrain = timeGrain ?: return false
val maxSpan = when (timeGrain) {
DateUtils.DAYS -> timeSpan - 1
DateUtils.WEEKS -> timeSpan -1
DateUtils.MONTHS -> (timeSpan * 4) - 1
DateUtils.YEARS -> (timeSpan * 4 * 12) - 1
else -> timeSpan