This commit is contained in:
jinyuer
2020-09-18 09:14:08 +08:00
parent eeb10b698c
commit c79e6751fe
13 changed files with 224 additions and 33 deletions

View File

@@ -82,7 +82,9 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> {
mDataBinding.userImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), MyUserMessage.class);
intent.putExtra("usertitile", "个人信息");
startActivityForResult(intent, 0);
}
});
initTopView();

View File

@@ -372,12 +372,13 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
startActivity(intent);
break;
case R.id.cargara://车库
if ((Config.getInstance(MainFragment.this.getContext()).getUser() == null)) {
intent = new Intent(MainFragment.this.getContext(), LoginActivity.class);
} else {
intent = new Intent(getActivity(), CarGarageActivity.class);
}
startActivity(intent);
Toast.makeText(getContext(),"功能正在开发",Toast.LENGTH_SHORT).show();
// if ((Config.getInstance(MainFragment.this.getContext()).getUser() == null)) {
// intent = new Intent(MainFragment.this.getContext(), LoginActivity.class);
// } else {
// intent = new Intent(getActivity(), CarGarageActivity.class);
// }
// startActivity(intent);
break;
case R.id.moew1:
intent = new Intent(getActivity(), MyMarketShopActivity.class);

View File

@@ -15,11 +15,11 @@ import com.gyf.immersionbar.ImmersionBar;
import com.sl.house_property.cart.CartFragment;
import com.sl.house_property.databinding.ActivityMainTabBinding;
import com.sl.house_property.discovery.DiscoveryFragment;
import com.sl.house_property.discovery.LikeFragment;
import java.util.ArrayList;
import tools.Config;
import utils.UtilHelpers;
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
implements View.OnClickListener, MainFragment.OnFragmentInteractionListener,
@@ -44,6 +44,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
private Main3Fragment fragment2;
private CartFragment fragment3;
private Main4Fragment fragment4;
private LikeFragment likeFragment;
private Fragment currentFragment;
private int myeditcode = 1000;
@@ -51,7 +52,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
private int nowradioId;
// @Override
// @Override
// public boolean dispatchTouchEvent(MotionEvent ev) {
// switch (ev.getAction()) {
// case MotionEvent.ACTION_DOWN:
@@ -62,30 +63,36 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
// return super.dispatchTouchEvent(ev);
//
// }
public void visibilyBottom(int isVisibily){
public void visibilyBottom(int isVisibily) {
findViewById(R.id.rl_bottom).setVisibility(isVisibily);
}
//2. 保存MyOnTouchListener接口的列表
private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<MyOnTouchListener>();
//1.触摸事件接口
public interface MyOnTouchListener {
public boolean onTouch(MotionEvent ev);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
for (MyOnTouchListener listener : onTouchListeners) {
// listener.onTouch(ev);
// listener.onTouch(ev);
}
return super.dispatchTouchEvent(ev);
}
//4.提供给Fragment通过getActivity()方法来注册自己的触摸事件的方法
public void registerMyOnTouchListener(MyOnTouchListener myOnTouchListener) {
onTouchListeners.add(myOnTouchListener);
}
//5.提供给Fragment通过getActivity()方法来注销自己的触摸事件的方法
public void unregisterMyOnTouchListener(MyOnTouchListener myOnTouchListener) {
onTouchListeners.remove(myOnTouchListener);
}
@Override
protected int getLayoutResId() {
@@ -194,6 +201,15 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
}
currentFragment = fragment4;
break;
case R.id.like:
if (likeFragment == null) {
likeFragment = LikeFragment.newInstance();
fragmentTransaction.add(R.id.mycontent, likeFragment, "likeFragment");
} else {
fragmentTransaction.show(likeFragment);
}
currentFragment = likeFragment;
break;
}
try {
fragmentTransaction.commit();

View File

@@ -0,0 +1,92 @@
package com.sl.house_property.discovery;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import com.gyf.immersionbar.ImmersionBar;
import com.sl.house_property.BaseFragment;
import com.sl.house_property.R;
import com.sl.house_property.databinding.FragmentLikeBinding;
import java.util.ArrayList;
import entity.RegisterUser;
import tools.Config;
public class LikeFragment extends BaseFragment<FragmentLikeBinding> {
private ArrayList<Fragment> fragments;
private String[] strings;
public static LikeFragment newInstance() {
LikeFragment fragment = new LikeFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
protected int getLayoutId() {
return R.layout.fragment_like;
}
@Override
protected void loadData() {
}
class MyViewPagerAdapter extends FragmentPagerAdapter {
public MyViewPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragments.get(position);
}
@Override
public int getCount() {
return fragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return strings[position];
}
}
@Override
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
super.onCreateVew(inflater, savedInstanceState);
ImmersionBar.with(this)
.keyboardEnable(true) //解决软键盘与底部输入框冲突问题
// .keyboardEnable(true, WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
.init();
strings = new String[2];
strings[0] = "说说";
strings[1] = "商品";
fragments = new ArrayList<>();
RegisterUser user =
Config.getInstance(getActivity()).getUser();
String userId = "";
if (user != null) {
userId = user.getUserid();
} else {
userId = "0";
}
fragments.add(HistoryRecordFragment.newInstance(1, userId));
fragments.add(HistoryRecordFragment.newInstance(2, userId));
MyViewPagerAdapter myViewPagerAdapter = new MyViewPagerAdapter(getChildFragmentManager());
mDataBinding.fl.setAdapter(myViewPagerAdapter);
mDataBinding.tb.setupWithViewPager(mDataBinding.fl);
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/gwc2"/>
<item android:state_checked="false" android:drawable="@mipmap/gwc1"/>
<item android:state_checked="true" android:drawable="@mipmap/gouwuche"/>
<item android:state_checked="false" android:drawable="@mipmap/gouwuche_no"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/zan_p"/>
<item android:state_checked="false" android:drawable="@mipmap/zan"/>
</selector>

View File

@@ -16,8 +16,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/mycontent"
@@ -30,11 +29,11 @@
<LinearLayout
android:id="@+id/rl_bottom"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
android:orientation="vertical"
android:visibility="visible">
<View
android:layout_width="match_parent"
@@ -75,6 +74,17 @@
android:text="发现"
android:textColor="@color/radiobuttoncolor" />
<RadioButton
android:id="@+id/like"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:drawableTop="@drawable/main_bottom_like"
android:gravity="center"
android:text="点赞"
android:textColor="@color/radiobuttoncolor" />
<RadioButton
android:id="@+id/button3"
android:layout_width="match_parent"

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/ll"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="@dimen/mystatusbar"
android:orientation="horizontal">
<ImageView
android:visibility="gone"
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingLeft="16dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginTop="5dp"
android:layout_centerVertical="true"
android:paddingRight="5dp"
android:src="@mipmap/fanhui" />
<android.support.design.widget.TabLayout
android:id="@+id/tb"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" />
</RelativeLayout>
<android.support.v4.view.ViewPager
android:id="@+id/fl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
</android.support.v4.view.ViewPager>
</LinearLayout>
</layout>

View File

@@ -42,6 +42,7 @@
android:textSize="17sp" />
<ImageView
android:visibility="gone"
android:id="@+id/scan"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@@ -106,23 +107,7 @@
android:layout_gravity="center"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/cargara"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:layout_weight="1"
android:background="@mipmap/garage">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:text="@string/carroom"
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/entrancegurd"
@@ -140,8 +125,40 @@
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:layout_weight="1"
android:background="@mipmap/garage">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:text="物业服务"
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/cargara"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:layout_weight="1"
android:background="@mipmap/garage">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:text="@string/carroom"
android:textColor="@color/white"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB