|
|
|
@ -15,6 +15,8 @@ import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
|
import com.qhclh.ytzh.bean.DownLoadBean; |
|
|
|
import com.qhclh.ytzh.index.IndexFragment; |
|
|
|
import com.qhclh.ytzh.index.fumudai.FumudaiFragment; |
|
|
|
import com.qhclh.ytzh.index.shangpin.ShangpinFragment; |
|
|
|
import com.qhclh.ytzh.me.MeFragment; |
|
|
|
import com.qhclh.ytzh.utils.ApkUtils; |
|
|
|
import com.qhclh.ytzh.utils.Urltool; |
|
|
|
@ -60,6 +62,11 @@ public class MainActivity extends BaseActivity { |
|
|
|
private WorkFragment workFragment; |
|
|
|
private MeFragment meFragment; |
|
|
|
|
|
|
|
private ShangpinFragment shangpinFragment; |
|
|
|
private FumudaiFragment fumudaiFragment; |
|
|
|
///< 0 商品鸡 其他父母代 |
|
|
|
private int indexFlag = 0; |
|
|
|
|
|
|
|
|
|
|
|
private String versionName, downloadUrl; |
|
|
|
private DownLoadBean downLoadBean; |
|
|
|
@ -163,12 +170,28 @@ public class MainActivity extends BaseActivity { |
|
|
|
hideFragment(transaction); |
|
|
|
switch (tabPosition) { |
|
|
|
case TAB_POSITION_INDEX: { |
|
|
|
if (indexFragment == null) { |
|
|
|
indexFragment = new IndexFragment(); |
|
|
|
transaction.add(R.id.main_container, indexFragment); |
|
|
|
if (indexFlag == 0) { |
|
|
|
if (shangpinFragment == null) { |
|
|
|
shangpinFragment = new ShangpinFragment(); |
|
|
|
transaction.add(R.id.main_container, shangpinFragment); |
|
|
|
} else { |
|
|
|
transaction.show(shangpinFragment); |
|
|
|
} |
|
|
|
} else { |
|
|
|
transaction.show(indexFragment); |
|
|
|
if (fumudaiFragment == null) { |
|
|
|
fumudaiFragment = new FumudaiFragment(); |
|
|
|
transaction.add(R.id.main_container, fumudaiFragment); |
|
|
|
} else { |
|
|
|
transaction.show(fumudaiFragment); |
|
|
|
} |
|
|
|
} |
|
|
|
// if (indexFragment == null) { |
|
|
|
// indexFragment = new IndexFragment(); |
|
|
|
// transaction.add(R.id.main_container, indexFragment); |
|
|
|
|
|
|
|
// } else { |
|
|
|
// transaction.show(indexFragment); |
|
|
|
// } |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
@ -196,10 +219,19 @@ public class MainActivity extends BaseActivity { |
|
|
|
} |
|
|
|
|
|
|
|
private void hideFragment(FragmentTransaction transaction) { |
|
|
|
if (indexFragment != null) { |
|
|
|
transaction.hide(indexFragment); |
|
|
|
// if (indexFragment != null) { |
|
|
|
// transaction.hide(indexFragment); |
|
|
|
// } |
|
|
|
|
|
|
|
if (shangpinFragment != null) { |
|
|
|
transaction.hide(shangpinFragment); |
|
|
|
} |
|
|
|
|
|
|
|
if (fumudaiFragment != null) { |
|
|
|
transaction.hide(fumudaiFragment); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (workFragment != null) { |
|
|
|
transaction.hide(workFragment); |
|
|
|
} |
|
|
|
|