This commit is contained in:
renjianbo0118
2021-03-02 23:18:48 +08:00
parent fce732a659
commit 6487f02bd1
11 changed files with 210 additions and 15 deletions

View File

@@ -0,0 +1,12 @@
package com.sl.house_property;
public class DoConfig {
/**
* 我的房产有没有数据
*/
public static String FANGCHAN_DATA = "0";//0代表没有数据 1代表有数据
}

View File

@@ -54,6 +54,7 @@ import tools.ImageCompress;
import utils.BitmapTools;
import utils.Md5;
import utils.MyPhoneValue;
import utils.SPUtils;
import utils.SelectPicDanimicActivity;
@@ -198,6 +199,14 @@ public class Main4Fragment extends BaseFragment<FragmentMain4Binding> implements
mDataBinding.ll3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String fangchan = (String) SPUtils.getSp(getActivity(), DoConfig.FANGCHAN_DATA, "0");
if(fangchan.equals("0")){
Intent intent = new Intent(getActivity(), MyPropertyActivity.class);
intent.putExtra("usertitile", "我的房产");
startActivityForResult(intent, 0);
return;
}
//弹出激活对话框
new DialogHelptwo().showDownloadDialog(getActivity(), "", "","确认", new DialogHelptwo.ClickListener() {
@Override

View File

@@ -43,6 +43,7 @@ import com.sl.house_property.discovery.PropertyActivity;
import com.sl.house_property.discovery.ShareCodeActivity;
import com.sl.house_property.order.SettleActivity;
import com.sl.house_property.user.MyMarketShopActivity;
import com.sl.house_property.user.MyPropertyActivity;
import com.squareup.picasso.Picasso;
import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
@@ -78,6 +79,7 @@ import utils.CommonUtils;
import utils.DateUtils;
import utils.KeyboardUtil;
import utils.Md5;
import utils.SPUtils;
import utils.UtilHelpers;
@@ -359,6 +361,14 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
public void onClick(View v) {
// Intent intent = new Intent(getContext(), PropertyActivity.class);
// startActivity(intent);
String fangchan = (String) SPUtils.getSp(getActivity(), DoConfig.FANGCHAN_DATA, "0");
if(fangchan.equals("0")){
Intent intent = new Intent(getActivity(), MyPropertyActivity.class);
intent.putExtra("usertitile", "我的房产");
startActivityForResult(intent, 0);
return;
}
Intent intent = new Intent(getContext(), HistoryRecordActivity.class);
intent.putExtra("userId", user.getUserid());
intent.putExtra("userName", user.getNickname());
@@ -416,6 +426,14 @@ public class MainFragment extends BaseFragment<FragmentMainBinding> implements V
startActivity(intent);
break;
case R.id.entrancegurd://门禁
String fangchan = (String) SPUtils.getSp(getActivity(), DoConfig.FANGCHAN_DATA, "0");
if(fangchan.equals("0")){
intent = new Intent(getActivity(), MyPropertyActivity.class);
intent.putExtra("usertitile", "我的房产");
startActivityForResult(intent, 0);
return;
}
if ((Config.getInstance(MainFragment.this.getContext()).getUser() == null)) {
intent = new Intent(MainFragment.this.getContext(), LoginActivity.class);
} else {

View File

@@ -6,20 +6,39 @@ import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.google.gson.Gson;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.gyf.immersionbar.ImmersionBar;
import com.selectpicker.OptionsPopupWindow;
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 com.sl.house_property.user.MyPropertyActivity;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import entity.MyHomequEntity;
import entity.RegisterUser;
import entity.SimpleEntity;
import http.ApiConfig;
import my_loader.Loader;
import my_loader.Resultcode;
import rx.Subscription;
import rx.functions.Action1;
import tools.Config;
import utils.Md5;
import utils.SPUtils;
public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
implements View.OnClickListener,
@@ -49,7 +68,7 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
private int myeditcode = 1000;
private Loader mGankLoader;
private int nowradioId;
// @Override
@@ -113,6 +132,64 @@ public class MainTabActivity extends BaseActivity<ActivityMainTabBinding>
// | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) //软键盘自动弹出
.init();
initView();
RegisterUser user = Config.getInstance(MainTabActivity.this).getUser();
Map<String, String> map = new HashMap<>();
if (user != null) {
map.put("userid", user.getUserid());
} else {
map.put("userid", 0 + "");
}
map.put("app", "Cas");
map.put("class", "MyHouseList");
//map.put("home_id", "GetHomeByPid");
map.put("sign", Md5.md5("Cas" + "MyHouseList" + Md5.secret));
getGankList(ApiConfig.BASE_URL, map, getResources().getString(R.string.requsting), 0);
}
private void getGankList(String myurl, Map<String, String> map, String msg, final int requstecode) {
// progressDialog.setMessage(msg);
// progressDialog.setCancelable(false);
// progressDialog.show();
mGankLoader = new Loader();
Subscription subscription = mGankLoader.getMovie(myurl, map).subscribe(new Action1<Resultcode>() {
@Override
public void call(Resultcode resultcode) {
progressDialog.dismiss();
if (!(resultcode.status == 0)) {
setToast(resultcode.msg);
}
if (resultcode.status == 0) {
if (requstecode == 0) {
Gson gs = new Gson();
ArrayList<LinkedTreeMap> adta = (ArrayList<LinkedTreeMap>) resultcode.data;
String s = gs.toJson(adta);
//final ArrayList<MyHomequEntity> list = null;
Type type = new TypeToken<ArrayList<MyHouseEntity>>() {
}.getType();
final ArrayList<MyHouseEntity> list = new Gson().fromJson(s, type);
if(list.size()==0){
SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "0");
}else {
SPUtils.setSP(MainTabActivity.this, DoConfig.FANGCHAN_DATA, "1");
}
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
progressDialog.dismiss();
setToast(getString(R.string.getdatafailure));
throwable.printStackTrace();
}
});
addSubscription(subscription);
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2016 android@19code.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package utils;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
/**
* Create by h4de5ing 2016/5/7 007
* SharedPreferences工具
*
*/
public class SPUtils {
public static void setSP(Context context, String key, Object object) {
String type = object.getClass().getSimpleName();
String packageName = context.getPackageName();
SharedPreferences sp = context.getSharedPreferences(packageName, Context.MODE_PRIVATE);
Editor edit = sp.edit();
if ("String".equals(type)) {
edit.putString(key, (String) object);
} else if ("Integer".equals(type)) {
edit.putInt(key, (Integer) object);
} else if ("Boolean".equals(type)) {
edit.putBoolean(key, (Boolean) object);
} else if ("Float".equals(type)) {
edit.putFloat(key, (Float) object);
} else if ("Long".equals(type)) {
edit.putLong(key, (Long) object);
}
edit.apply();
}
public static Object getSp(Context context, String key, Object defaultObject) {
String type = defaultObject.getClass().getSimpleName();
String packageName = context.getPackageName();
SharedPreferences sp = context.getSharedPreferences(packageName, Context.MODE_PRIVATE);
if ("String".equals(type)) {
return sp.getString(key, (String) defaultObject);
} else if ("Integer".equals(type)) {
return sp.getInt(key, (Integer) defaultObject);
} else if ("Boolean".equals(type)) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if ("Float".equals(type)) {
return sp.getFloat(key, (Float) defaultObject);
} else if ("Long".equals(type)) {
return sp.getLong(key, (Long) defaultObject);
}
return null;
}
public static void cleanAllSP(Context context) {
String packageName = context.getPackageName();
SharedPreferences sp = context.getSharedPreferences(packageName, Context.MODE_PRIVATE);
Editor editor = sp.edit();
editor.clear();
editor.apply();
}
}

View File

@@ -71,7 +71,7 @@
android:button="@null"
android:drawableTop="@drawable/main_bottom_1"
android:gravity="center"
android:text="发现"
android:text="邻里圈"
android:textColor="@color/radiobuttoncolor" />
<RadioButton

View File

@@ -7,27 +7,26 @@
android:padding="8dp"
android:layout_height="wrap_content">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_width="wrap_content"
android:text="新增家庭成员"
android:textSize="16sp"
android:textColor="#000"
android:layout_weight="1"
android:layout_centerInParent="true"
android:gravity="center"
android:layout_height="30dp"/>
<ImageView
android:id="@+id/iv_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:src="@drawable/ic_close"/>
</LinearLayout>
</RelativeLayout>
<EditText
@@ -59,7 +58,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注:添加新家庭成员需成员确认才添加成功"
android:text="注:添加已注册手机用户"
android:textSize="12sp"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp"

View File

@@ -31,7 +31,7 @@
android:layout_marginLeft="16dp"
android:gravity="center"
android:layout_centerInParent="true"
android:text="发现"
android:text="邻里圈"
android:textColor="@color/white"
android:textSize="16sp"

View File

@@ -174,7 +174,7 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/view"
android:layout_marginLeft="8dp"
android:text="发现精彩" />
android:text="社区精彩" />
<TextView
android:id="@+id/moew1"

View File

@@ -190,7 +190,7 @@
android:textColor="#000"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="上传人脸"
android:text="人脸认证"
/>
<ImageView

View File

@@ -10,4 +10,8 @@
// if (i != 0 && i != discoveryListEntity.getLike().size() - 1) {
if (i != 0 ) {
likeString.append(",");
}
}