94 lines
3.5 KiB
Java
94 lines
3.5 KiB
Java
package com.gh.gamecenter.libao;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
|
import com.gh.gamecenter.common.constant.EntranceConsts;
|
|
import com.gh.gamecenter.common.constant.RouteConsts;
|
|
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
|
import com.gh.gamecenter.feature.entity.LibaoEntity;
|
|
import com.halo.assistant.HaloApp;
|
|
import com.therouter.TheRouter;
|
|
import com.therouter.router.Autowired;
|
|
import com.therouter.router.Navigator;
|
|
import com.therouter.router.Route;
|
|
|
|
import kotlin.Pair;
|
|
|
|
/**
|
|
* Created by khy on 2016/12/13.
|
|
* 礼包详情
|
|
*/
|
|
@Route(path = RouteConsts.activity.libaoDetailActivity, description = "礼包详情")
|
|
public class LibaoDetailActivity extends ToolBarActivity {
|
|
@Autowired(name = EntranceConsts.KEY_LIBAO_ID, description = "礼包ID", required = true)
|
|
public String libaoId;
|
|
|
|
@Autowired(name = EntranceConsts.KEY_ENTRANCE, description = "入口埋点字段(开发内部使用)")
|
|
public String entrance;
|
|
@Override
|
|
protected Intent provideNormalIntent() {
|
|
return getTargetIntent(this, LibaoDetailActivity.class, LibaoDetailFragment.class, getIntent().getExtras());
|
|
}
|
|
|
|
public static Intent getIntent(Context context, LibaoEntity libaoEntity, boolean isClickReceiveBtnIn, String entrance) {
|
|
Navigator navigator = TheRouter.build(RouteConsts.activity.libaoDetailActivity)
|
|
.fillParams(bundle -> {
|
|
HaloApp.put(EntranceConsts.KEY_LIBAO_ENTITY, libaoEntity);
|
|
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
|
bundle.putBoolean(EntranceConsts.KEY_IS_CLICK_RECEIVE_BTN, isClickReceiveBtnIn);
|
|
return null;
|
|
});
|
|
return navigator.createIntent(context);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getIntent(Context context, LibaoEntity libaoEntity, String entrance) {
|
|
return getIntent(context, libaoEntity, false, entrance);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getIntentById(Context context, String id, String entrance) {
|
|
Navigator navigator = TheRouter.build(RouteConsts.activity.libaoDetailActivity)
|
|
.fillParams(bundle -> {
|
|
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance);
|
|
bundle.putString(EntranceConsts.KEY_LIBAO_ID, id);
|
|
return null;
|
|
});
|
|
return navigator.createIntent(context);
|
|
}
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
TheRouter.inject(this);
|
|
|
|
super.onCreate(savedInstanceState);
|
|
ExtensionsKt.updateStatusBarColor(this, com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface);
|
|
}
|
|
|
|
@Override
|
|
protected void onDarkModeChanged() {
|
|
super.onDarkModeChanged();
|
|
ExtensionsKt.updateStatusBarColor(this, com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface);
|
|
}
|
|
|
|
@Override
|
|
public Pair<String, String> getBusinessId() {
|
|
LibaoEntity libaoEntity = null;
|
|
if (getTargetFragment() != null) {
|
|
libaoEntity = ((LibaoDetailFragment) getTargetFragment()).getLibaoEntity();
|
|
}
|
|
if (libaoEntity != null) {
|
|
return new Pair<>(libaoEntity.getId(), "");
|
|
} else if (libaoId != null) {
|
|
return new Pair<>(libaoId, "");
|
|
} else {
|
|
return super.getBusinessId();
|
|
}
|
|
}
|
|
}
|