[2.15.0-merge-master]
This commit is contained in:
@@ -2,10 +2,19 @@ package com.mogo.eagle.core.utilcode.mogo
|
||||
|
||||
fun AppIdentityModeUtils.getMisChannelCode(appIdentityMode: String): Int {
|
||||
return when {
|
||||
isTaxi(appIdentityMode) && isPassenger(appIdentityMode) -> 1
|
||||
isTaxi(appIdentityMode) && isDriver(appIdentityMode) -> 2
|
||||
isBus(appIdentityMode) && isPassenger(appIdentityMode) -> 3
|
||||
isBus(appIdentityMode) && isDriver(appIdentityMode) -> 4
|
||||
isTaxi(appIdentityMode) && isPassenger(appIdentityMode) -> 1 // 出租乘客端
|
||||
isTaxi(appIdentityMode) && isDriver(appIdentityMode) -> 2 // 出租司机端
|
||||
|
||||
isBus(appIdentityMode) && isPassenger(appIdentityMode) -> 3 // 公交乘客端
|
||||
isBus(appIdentityMode) && isDriver(appIdentityMode) -> 4 // 公交司机端
|
||||
|
||||
isCharter(appIdentityMode) && isPassenger(appIdentityMode) -> 8 // 包车乘客端
|
||||
isCharter(appIdentityMode) && isDriver(appIdentityMode) -> 9 // 包车司机端
|
||||
|
||||
isShuttle(appIdentityMode) && isPassenger(appIdentityMode) -> 10 // 接驳乘客端
|
||||
isShuttle(appIdentityMode) && isDriver(appIdentityMode) -> 11 // 接驳司机端
|
||||
|
||||
isSweeper(appIdentityMode) && isDriver(appIdentityMode) -> 12 // 清扫车司机端
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
@@ -23,6 +32,14 @@ object AppIdentityModeUtils {
|
||||
private const val TAXI = "Taxi"
|
||||
private const val BUS = "Bus"
|
||||
private const val SWEEPER = "Sweeper"
|
||||
private const val SHUTTLE = "Shuttle"
|
||||
private const val CHARTER = "Charter"
|
||||
|
||||
// 车型
|
||||
private const val M1 = "M1"
|
||||
private const val M2 = "M2"
|
||||
private const val JL = "JL"
|
||||
|
||||
|
||||
|
||||
private fun getInfo(appIdentityMode: String): Array<String> {
|
||||
@@ -86,6 +103,49 @@ object AppIdentityModeUtils {
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是 接驳车(这里不细分具体是:司机、乘客等类型)
|
||||
*
|
||||
* @param appIdentityMode productFlavors 配置的类型
|
||||
* @return true - 是小巴车端 false - 不是小巴车端
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isShuttle(appIdentityMode: String): Boolean {
|
||||
val (bussness, _, _) = getInfo(appIdentityMode)
|
||||
if (bussness.isNotEmpty()) {
|
||||
return bussness == SHUTTLE
|
||||
}
|
||||
return false
|
||||
}
|
||||
/**
|
||||
* 是否是 接驳车(这里不细分具体是:司机、乘客等类型)
|
||||
*
|
||||
* @param appIdentityMode productFlavors 配置的类型
|
||||
* @return true - 是小巴车端 false - 不是小巴车端
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isShuttlePassenger(appIdentityMode: String): Boolean {
|
||||
return isShuttle(appIdentityMode) && isPassenger(appIdentityMode)
|
||||
}
|
||||
@JvmStatic
|
||||
fun isM2(appIdentityMode: String): Boolean {
|
||||
val (_, _, model) = getInfo(appIdentityMode)
|
||||
if (model.isNotEmpty()) {
|
||||
return model == M2
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isJL(appIdentityMode: String): Boolean {
|
||||
val (_, _, model) = getInfo(appIdentityMode)
|
||||
if (model.isNotEmpty()) {
|
||||
return model == JL
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否是 清扫车(这里不细分具体是:司机、乘客等类型)
|
||||
*
|
||||
@@ -161,6 +221,45 @@ object AppIdentityModeUtils {
|
||||
return isTaxi(appIdentityMode) && isPassenger(appIdentityMode)
|
||||
}
|
||||
|
||||
fun isBusPassengerM1(appIdentityMode: String): Boolean {
|
||||
return isBus(appIdentityMode) && isPassenger(appIdentityMode) && isM1(appIdentityMode)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否包车
|
||||
*/
|
||||
@JvmStatic
|
||||
fun isCharter(appIdentityMode: String): Boolean {
|
||||
val (bussness, _, _) = getInfo(appIdentityMode)
|
||||
if (bussness.isNotEmpty()) {
|
||||
return bussness == CHARTER
|
||||
}
|
||||
return false
|
||||
}
|
||||
@JvmStatic
|
||||
fun isM1(appIdentityMode: String): Boolean {
|
||||
val (_, _, model) = getInfo(appIdentityMode)
|
||||
if (model.isNotEmpty()) {
|
||||
return model == M1
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun getProduct(appIdentityMode: String): Product {
|
||||
val (bussness, _, _) = getInfo(appIdentityMode)
|
||||
return when (bussness) {
|
||||
TAXI -> Product.TAXI
|
||||
BUS -> Product.BUS
|
||||
SWEEPER -> Product.SWEEPER
|
||||
SHUTTLE -> Product.SHUTTLE
|
||||
CHARTER -> Product.CHARTER
|
||||
else -> Product.TAXI
|
||||
}
|
||||
}
|
||||
|
||||
enum class Product{
|
||||
BUS,TAXI,SWEEPER,SHUTTLE,CHARTER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,5 +41,7 @@ class SceneConstant {
|
||||
//清扫车
|
||||
const val M_SWEEPER = "M_SWEEPER-"
|
||||
|
||||
//M1司机端
|
||||
const val M_CHARTER_D = "M_CHARTER_D-"
|
||||
}
|
||||
}
|
||||
@@ -118,6 +118,7 @@ public final class NetworkUtils {
|
||||
if ( infoWifi != null ) {
|
||||
NetworkInfo.State wifi = infoWifi.getState();
|
||||
if ( wifi == NetworkInfo.State.CONNECTED ) {
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -129,6 +130,10 @@ public final class NetworkUtils {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEthernet()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,5 +26,19 @@ public final class TimeTransformUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String stringForTimeWithHours(int timeMs) {
|
||||
if (timeMs <= 0 || timeMs >= 24 * 60 * 60 * 1000) {
|
||||
return "00:00";
|
||||
}
|
||||
int totalSeconds = timeMs / 1000;
|
||||
int seconds = totalSeconds % 60;
|
||||
int minutes = (totalSeconds / 60) % 60;
|
||||
int hours = totalSeconds / 3600;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
Formatter mFormatter = new Formatter(stringBuilder, Locale.getDefault());
|
||||
return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user