package com.base.appzxhy.drouterimp

import android.app.Activity
import android.content.Intent
import com.base.appzxhy.ui.main.MainActivity
import com.didi.drouter.annotation.Service
import com.koko.drouter.app.AppService
import java.util.Locale

@Service(function = [AppService::class])
class AppServiceImp : AppService {
    override fun getCurrentSpLocal(): Locale {
        return Locale.getDefault()
    }

    override fun changeActivityLanguage(activity: Activity, currentLocale: Locale, changeAction: () -> Unit): Boolean {
        return false
    }

    override fun finishToMainTop(activity: Activity) {
        val intent = Intent(activity, MainActivity::class.java)
        intent.putExtra("where", "finishToMainTop")
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
        activity.startActivity(intent)
        activity.finish()
    }
}