|
|
@@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentTransaction;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.widget.FrameLayout;
|
|
|
import android.widget.LinearLayout;
|
|
|
@@ -17,20 +18,25 @@ import com.kfzs.duanduan.view.DialogStorageLow;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.event.BigEvent;
|
|
|
import com.sheep.gamegroup.model.entity.Container;
|
|
|
-import com.sheep.gamegroup.model.entity.SystemNotification;
|
|
|
+import com.sheep.gamegroup.util.ActionUtil;
|
|
|
+import com.sheep.gamegroup.util.ChannelContent;
|
|
|
import com.sheep.gamegroup.util.CommonUtil;
|
|
|
import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.DrawablesHelper;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
import com.sheep.gamegroup.util.MainTab;
|
|
|
+import com.sheep.gamegroup.util.SysAppUtil;
|
|
|
+import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.ViewPagerFragmentAdapter;
|
|
|
+import com.sheep.gamegroup.view.dialog.DialogGameOrTaskOrGift;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtFind;
|
|
|
-import com.sheep.gamegroup.view.fragment.FgtMainAudit;
|
|
|
import com.sheep.gamegroup.view.fragment.FgtSmallSheep;
|
|
|
import com.sheep.jiuyan.samllsheep.R;
|
|
|
import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
@@ -55,8 +61,18 @@ public class ActMain extends BaseActivity {
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
StatusBarUtils.setTranslucent(this);
|
|
|
super.onCreate(savedInstanceState);
|
|
|
+ //第一次进入主页检查是否是会长推广的游戏,并显示弹出框
|
|
|
+ if (DataUtil.getAsBoolean(FIRST_SHOW_MAIN, true)) {
|
|
|
+ DataUtil.putAsBoolean(FIRST_SHOW_MAIN, false);
|
|
|
+ String game_id = ChannelContent.getInstance().getGameId();
|
|
|
+ if (game_id != null) {
|
|
|
+ ActionUtil.getInstance().addNextAction(MiddleSchemeAct.SHOW_DIALOG_GAME_OR_GIFT_TASK, game_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ public static final String FIRST_SHOW_MAIN = "first_show_main";//是否是第一次显示主页
|
|
|
+
|
|
|
@BindView(R.id.view_pager_container)
|
|
|
ViewPager view_pager_container;
|
|
|
@BindView(R.id.frame_container)
|
|
|
@@ -77,7 +93,7 @@ public class ActMain extends BaseActivity {
|
|
|
initViewPager();
|
|
|
initFind();
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
- main_layout.setPadding(0, 0, 0, G.getHasVirtualKey(this) -G.getNoHasVirtualKey(this) );
|
|
|
+ main_layout.setPadding(0, 0, 0, G.getHasVirtualKey(this) - G.getNoHasVirtualKey(this));
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -152,8 +168,8 @@ public class ActMain extends BaseActivity {
|
|
|
lastTab.setActivated(false);
|
|
|
if (curTab != null)
|
|
|
curTab.setActivated(true);
|
|
|
- if(lastPosition == MainTab.FgtSmallSheep.ordinal() && position != MainTab.FgtSmallSheep.ordinal()){
|
|
|
- ((FgtSmallSheep)MainTab.FgtSmallSheep.getFragment()).onPause();
|
|
|
+ if (lastPosition == MainTab.FgtSmallSheep.ordinal() && position != MainTab.FgtSmallSheep.ordinal()) {
|
|
|
+ ((FgtSmallSheep) MainTab.FgtSmallSheep.getFragment()).onPause();
|
|
|
}
|
|
|
showFind(position == MainTab.Fgt_Find.ordinal());
|
|
|
//更新position
|
|
|
@@ -196,7 +212,9 @@ public class ActMain extends BaseActivity {
|
|
|
view_pager_container.bringToFront();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private Fragment fgtFind;
|
|
|
+
|
|
|
public void initFind() {
|
|
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
|
|
Bundle bundle = new Bundle();
|
|
|
@@ -265,11 +283,36 @@ public class ActMain extends BaseActivity {
|
|
|
return container;
|
|
|
}
|
|
|
|
|
|
+ private int onResumeCount = 0;//调用onResume次数
|
|
|
@Override
|
|
|
protected void onResume() {
|
|
|
super.onResume();
|
|
|
if (container != null && container.getT() != null)
|
|
|
container.getT().call(1);
|
|
|
+ if(!checkNextAction(MiddleSchemeAct.SHOW_DIALOG_GAME_OR_GIFT_TASK)){
|
|
|
+ if(onResumeCount == 0) {
|
|
|
+ SysAppUtil.showVersionInfo(this, SpUtils.getIgnoreMd5(), new Action1<Integer>() {
|
|
|
+ @Override
|
|
|
+ public void call(Integer integer) {
|
|
|
+ Jump2View.getInstance().tryShowHalfScreenAd(ActMain.this, getContainer());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ onResumeCount ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void doNextAction(Object action) {
|
|
|
+ if (action instanceof String) {
|
|
|
+ String game_id = action.toString();
|
|
|
+ if (TextUtils.isEmpty(game_id)) {
|
|
|
+ if (TestUtil.isTest())
|
|
|
+ G.showToast("game_id为空");
|
|
|
+ } else {
|
|
|
+ new DialogGameOrTaskOrGift(this, game_id).showDialog();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -278,6 +321,7 @@ public class ActMain extends BaseActivity {
|
|
|
if (container != null && container.getT() != null)
|
|
|
container.getT().call(2);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 主要的事件广播接收更新处理
|
|
|
*
|
|
|
@@ -291,6 +335,7 @@ public class ActMain extends BaseActivity {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
super.onDestroy();
|