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
| import com.google.android.gms.maps.GoogleMap | |
| import com.google.android.gms.maps.model.LatLng | |
| import com.google.android.gms.maps.model.Polyline | |
| import com.google.android.gms.maps.model.PolylineOptions | |
| import com.google.maps.android.SphericalUtil | |
| val optionsForeground: PolylineOptions? = null | |
| fun showCurvedPolyline( | |
| googleMap: GoogleMap, |
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
| import android.text.TextUtils | |
| import android.widget.EditText | |
| import androidx.appcompat.widget.AppCompatEditText | |
| fun String.isEmpty(): Boolean { | |
| return (TextUtils.isEmpty(this) | |
| || this.equals("", ignoreCase = true) | |
| || this.equals("{}", ignoreCase = true) | |
| || this.equals("null", ignoreCase = true) | |
| || this.equals("undefined", ignoreCase = true)) |
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
| fun onDocument(): Intent { | |
| val mimeTypes = arrayOf( | |
| "application/pdf", | |
| "image/*" | |
| ) | |
| val intent = Intent(Intent.ACTION_GET_CONTENT) | |
| intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); | |
| intent.addCategory(Intent.CATEGORY_OPENABLE) | |
| intent.type = if (mimeTypes.size == 1) mimeTypes[0] else "*/*" | |
| if (mimeTypes.isNotEmpty()) { |
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
| import java.text.SimpleDateFormat | |
| import java.util.* | |
| fun getDefaultDateTime(date: String): String { | |
| val formatter = SimpleDateFormat("dd-MM-yyyy hh:mm aa") | |
| return formatter.format(date.toDate()) | |
| } | |
| fun getDefaultDateTime1(date: String): String { | |
| val formatter = SimpleDateFormat("dd-MM-yyyy HH:MM") |
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
| ./gradlew tasks |
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
| abstract class BaseDataBindingBottomSheetDialogFragment : BottomSheetDialogFragment() { | |
| private var mProgressDialog: Dialog? = null | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| initControl() | |
| initView(view) | |
| setListener() |
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
| fun getBearing(begin: LatLng, end: LatLng): Float { | |
| val lat = abs(x = begin.latitude - end.latitude) | |
| val lng = abs(x = begin.longitude - end.longitude) | |
| if (begin.latitude < end.latitude && begin.longitude < end.longitude) | |
| return (Math.toDegrees(Math.atan(lng / lat)).toFloat()) | |
| else if (begin.latitude >= end.latitude && begin.longitude < end.longitude) | |
| return (((90 - Math.toDegrees(Math.atan(lng / lat))) + 90).toFloat()) | |
| else if (begin.latitude >= end.latitude && begin.longitude >= end.longitude) | |
| return ((Math.toDegrees(Math.atan(lng / lat)) + 180).toFloat()) |
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
| fun getMeters(miles: Double): Double { | |
| return miles * 1609.344 | |
| } |
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
| public static String removeZero(String str) | |
| { | |
| // Count leading zeros | |
| int i = 0; | |
| while (str.charAt(i) == '0') | |
| i++; | |
| // Convert str into StringBuffer as Strings | |
| // are immutable. | |
| StringBuffer sb = new StringBuffer(str); |
NewerOlder