|
@@ -3,6 +3,8 @@ package com.sunwin.visitorapp.activity;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.view.View;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
@@ -13,27 +15,30 @@ import androidx.fragment.app.FragmentTransaction;
|
|
|
import com.sunwin.visitorapp.BaseActivity;
|
|
|
import com.sunwin.visitorapp.R;
|
|
|
import com.sunwin.visitorapp.fragment.HomeFr;
|
|
|
+import com.sunwin.visitorapp.fragment.RegTypeFragment;
|
|
|
import com.sunwin.visitorapp.fragment.VisitSignFragment;
|
|
|
import com.sunwin.visitorapp.utils.Constant;
|
|
|
+import com.sunwin.visitorapp.utils.SharePrefenceUtils;
|
|
|
import com.sunwin.visitorapp.utils.ToastUtils;
|
|
|
import com.sunwin.visitorapp.view.UINav;
|
|
|
|
|
|
-public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
+public class HomeAc extends BaseActivity implements View.OnClickListener, RegTypeFragment.Listener {
|
|
|
|
|
|
private UINav mUINav;
|
|
|
private RelativeLayout mLlHomeTitle;
|
|
|
private TextView mTextTitle;
|
|
|
+ private LinearLayout mViewMenu;
|
|
|
+ private ImageView mImageSetting;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_home);
|
|
|
|
|
|
-
|
|
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
|
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
|
|
//添加fragment
|
|
|
- fragmentTransaction.add(R.id.FragmentView, new HomeFr());
|
|
|
+ fragmentTransaction.add(R.id.FragmentView, isLogin ? new HomeFr() : new RegTypeFragment(this));
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
fragmentManager.executePendingTransactions();
|
|
@@ -71,9 +76,12 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
replaceFragment(VisitSignFragment.newInstance(1));
|
|
|
break;
|
|
|
case R.id.MenuItemRegister://登记
|
|
|
- intent = new Intent(this, VisitorRegActivity.class);
|
|
|
- intent.putExtra(Constant.IIntentValue.ISLOGINUSER, true);
|
|
|
- startActivity(intent);
|
|
|
+ showHome(false);
|
|
|
+ updateTitle("访客登记");
|
|
|
+ replaceFragment(RegTypeFragment.newInstance(this));
|
|
|
+// intent = new Intent(this, VisitorRegActivity.class);
|
|
|
+// intent.putExtra(Constant.IIntentValue.ISLOGINUSER, true);
|
|
|
+// startActivity(intent);
|
|
|
break;
|
|
|
case R.id.MenuItemLeave://签离
|
|
|
showHome(false);
|
|
@@ -92,7 +100,10 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
private void initView() {
|
|
|
mUINav = (UINav) findViewById(R.id.UINav);
|
|
|
mLlHomeTitle = (RelativeLayout) findViewById(R.id.ll_home_title);
|
|
|
- mTextTitle = findViewById(R.id.TextTitle);
|
|
|
+ mLlHomeTitle = (RelativeLayout) findViewById(R.id.ll_home_title);
|
|
|
+ mTextTitle = findViewById(R.id.TextTitle);
|
|
|
+ mViewMenu = findViewById(R.id.ViewMenu);
|
|
|
+ mImageSetting = findViewById(R.id.ImageSetting);
|
|
|
|
|
|
findViewById(R.id.MenuItemRecord).setOnClickListener(this);
|
|
|
findViewById(R.id.MenuItemSign).setOnClickListener(this);
|
|
@@ -102,6 +113,9 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
findViewById(R.id.ImageSetting).setOnClickListener(this);
|
|
|
showHome(true);
|
|
|
|
|
|
+ mViewMenu.setVisibility(isLogin ? View.VISIBLE : View.INVISIBLE);
|
|
|
+ mImageSetting.setVisibility(isLogin ? View.VISIBLE : View.INVISIBLE);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -110,7 +124,7 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
mUINav.setVisibility(showHome ? View.GONE : View.VISIBLE);
|
|
|
}
|
|
|
|
|
|
- private void updateTitle(String title){
|
|
|
+ private void updateTitle(String title) {
|
|
|
mUINav.setMainData(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
@@ -119,4 +133,27 @@ public class HomeAc extends BaseActivity implements View.OnClickListener {
|
|
|
}
|
|
|
}, title);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * RegTypeFragment Listener
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void showIdCardReg() {
|
|
|
+ SharePrefenceUtils.putBoolean(Constant.ISharePrefence.LOGINTAG, false);
|
|
|
+ Intent intent = new Intent(this, VisitorRegActivity.class);
|
|
|
+ intent.putExtra(Constant.IIntentValue.VISIT_REG_TYPE, 1);
|
|
|
+ intent.putExtra(Constant.IIntentValue.ISLOGINUSER, isLogin);
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void showNoCardReg() {
|
|
|
+// SharePrefenceUtils.putBoolean(Constant.ISharePrefence.LOGINTAG, false);
|
|
|
+// Intent intent = new Intent(this, VisitorRegActivity.class);
|
|
|
+// intent.putExtra(Constant.IIntentValue.VISIT_REG_TYPE, 2);
|
|
|
+// intent.putExtra(Constant.IIntentValue.ISLOGINUSER, isLogin);
|
|
|
+// startActivity(intent);
|
|
|
+ Intent intent = new Intent(this, VisitInputActivity.class);
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
}
|