Browse Source

no message

master
lh 8 years ago
parent
commit
4b3d056306
5 changed files with 120 additions and 6 deletions
  1. +38
    -6
      app/src/main/java/com/qhclh/ytzh/home/MainActivity.java
  2. +30
    -0
      app/src/main/java/com/qhclh/ytzh/index/fumudai/FumudaiFragment.java
  3. +30
    -0
      app/src/main/java/com/qhclh/ytzh/index/shangpin/ShangpinFragment.java
  4. +11
    -0
      app/src/main/res/layout/fragment_index_fumudai.xml
  5. +11
    -0
      app/src/main/res/layout/fragment_index_shangpin.xml

+ 38
- 6
app/src/main/java/com/qhclh/ytzh/home/MainActivity.java View File

@ -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);
}


+ 30
- 0
app/src/main/java/com/qhclh/ytzh/index/fumudai/FumudaiFragment.java View File

@ -0,0 +1,30 @@
package com.qhclh.ytzh.index.fumudai;
import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;
/**
* Created by 青花瓷 on 2017/12/22.
*/
public class FumudaiFragment extends BaseFragment {
@Override
protected int setLayout() {
return R.layout.fragment_index_fumudai;
}
@Override
protected void initView() {
}
@Override
protected void initData() {
}
@Override
protected void initOper() {
}
}

+ 30
- 0
app/src/main/java/com/qhclh/ytzh/index/shangpin/ShangpinFragment.java View File

@ -0,0 +1,30 @@
package com.qhclh.ytzh.index.shangpin;
import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;
/**
* Created by 青花瓷 on 2017/12/22.
*/
public class ShangpinFragment extends BaseFragment {
@Override
protected int setLayout() {
return R.layout.fragment_index_shangpin;
}
@Override
protected void initView() {
}
@Override
protected void initData() {
}
@Override
protected void initOper() {
}
}

+ 11
- 0
app/src/main/res/layout/fragment_index_fumudai.xml View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="父母代"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

+ 11
- 0
app/src/main/res/layout/fragment_index_shangpin.xml View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="商品鸡"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

Loading…
Cancel
Save