d
This commit is contained in:
@@ -31,7 +31,9 @@ android {
|
||||
checkReleaseBuilds false
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
dataBinding{
|
||||
enabled=true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,15 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".main.my.activity.DemoActivity"></activity>
|
||||
<activity android:name=".main.my.activity.MainsdfdsfActivity"></activity>
|
||||
<activity android:name=".main.my.activity.DemoActivity" />
|
||||
<activity android:name=".main.kehu.activity.FpOrderInfoActivity" />
|
||||
<activity android:name=".main.kehu.activity.MoActivity" />
|
||||
<activity android:name=".main.activity.ForgetPasActivity" />
|
||||
<activity android:name=".main.activity.ModifyPasActivity" />
|
||||
<activity android:name=".main.find.ConversationActivity" />
|
||||
<activity android:name=".main.find.CommentActivity" />
|
||||
<activity android:name=".main.kehu.activity.JsonDataActivity"></activity>
|
||||
<activity android:name=".main.kehu.activity.JsonDataActivity" />
|
||||
<activity android:name=".main.kehu.activity.CustomerDetailActivity" />
|
||||
<activity android:name=".main.activity.Main2Activity" /> <!-- 开启页 -->
|
||||
<activity
|
||||
@@ -76,7 +77,7 @@
|
||||
<activity
|
||||
android:name=".main.activity.MainActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/DefaultCityPickerTheme"></activity>
|
||||
android:theme="@style/DefaultCityPickerTheme" />
|
||||
<activity android:name=".view.webview.XfiveWebActivity" />
|
||||
<activity
|
||||
android:name=".main.activity.mine.MessageNoticeActivity"
|
||||
@@ -92,7 +93,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".main.kehu.activity.DesignActivity"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".main.my.activity.PersonalProfileActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
@@ -15,11 +15,13 @@ import com.fenghoo.seven.dialog.BaseTipsDialog;
|
||||
import com.fenghoo.seven.dialog.HomeShopDialog;
|
||||
import com.fenghoo.seven.main.activity.LoginPasswordActivity;
|
||||
import com.fenghoo.seven.main.activity.Main2Activity;
|
||||
import com.fenghoo.seven.main.my.activity.MainsdfdsfActivity;
|
||||
import com.fenghoo.seven.main.my.activity.PersonalProfileActivity;
|
||||
import com.fenghoo.seven.main.my.entity.loginInfoBean;
|
||||
import com.fenghoo.seven.main.my.fragment.mvp.contract.MyContract;
|
||||
import com.fenghoo.seven.main.my.fragment.mvp.presenter.MyPresenterImpl;
|
||||
import com.fenghoo.seven.utils.GlideTools;
|
||||
import com.fenghoo.seven.utils.JumpUtils;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.fenghoo.seven.utils.ToolsUtils;
|
||||
import com.fenghoo.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
@@ -103,19 +105,20 @@ public class MyFragment
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// JumpUtils.gotoActivity(getActivity(), DemoActivity.class, false, "", "");
|
||||
new BaseTipsDialog().showDownloadDialog(getActivity(), "确认要退出登录吗?", "确定", new BaseTipsDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
ProfileSpUtils.getInstance().saveLoginSatus(false);
|
||||
Intent intent = new Intent(getActivity(), LoginPasswordActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancle() {
|
||||
|
||||
}
|
||||
});
|
||||
JumpUtils.gotoActivity(getActivity(), MainsdfdsfActivity.class, false, "", "");
|
||||
// new BaseTipsDialog().showDownloadDialog(getActivity(), "确认要退出登录吗?", "确定", new BaseTipsDialog.ClickListener() {
|
||||
// @Override
|
||||
// public void confirm() {
|
||||
// ProfileSpUtils.getInstance().saveLoginSatus(false);
|
||||
// Intent intent = new Intent(getActivity(), LoginPasswordActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void cancle() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
//1、初始化Dialog
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.fenghoo.seven.main.my.activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.fenghoo.seven.R;
|
||||
import com.fenghoo.seven.databinding.ActivityMainsdfdsfBinding;
|
||||
import com.fenghoo.seven.main.my.entity.Emtems;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* @param
|
||||
* @description mvvm demo
|
||||
* @return
|
||||
*/
|
||||
public class MainsdfdsfActivity extends AppCompatActivity {
|
||||
Emtems emtems = new Emtems("firstname", "lastname");
|
||||
private ActivityMainsdfdsfBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_mainsdfdsf);
|
||||
binding.setEmtems(emtems);
|
||||
binding.setPresenter(new Presenter());
|
||||
// binding.firstname.setText(emtems.getFirstname());
|
||||
// binding.lastname.setText(emtems.getLastname());
|
||||
binding.viewStub.getViewStub().inflate();
|
||||
}
|
||||
public class Presenter {
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
emtems.setFirstname(s.toString());
|
||||
// binding.setEmtems(emtems);
|
||||
emtems.setFired(!emtems.isFired.get());
|
||||
}
|
||||
public void onClick(View view){
|
||||
ToastUtils.showToast(MainsdfdsfActivity.this, "点到了");
|
||||
}
|
||||
public void onClickListenerBinding(Emtems emtems){
|
||||
ToastUtils.showToast(MainsdfdsfActivity.this, emtems.getFirstname());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.fenghoo.seven.main.my.entity;
|
||||
|
||||
|
||||
import com.fenghoo.seven.BR;
|
||||
|
||||
import androidx.databinding.BaseObservable;
|
||||
import androidx.databinding.Bindable;
|
||||
import androidx.databinding.ObservableArrayMap;
|
||||
import androidx.databinding.ObservableBoolean;
|
||||
|
||||
/**
|
||||
* Time: 2020/9/23
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class Emtems extends BaseObservable {
|
||||
String firstname;
|
||||
String lastname;
|
||||
public ObservableBoolean isFired=new ObservableBoolean();
|
||||
public ObservableArrayMap<String, String> user = new ObservableArrayMap<>();
|
||||
|
||||
|
||||
@Bindable
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public void setFirstname(String firstname) {
|
||||
this.firstname = firstname;
|
||||
notifyPropertyChanged(BR.firstname);
|
||||
}
|
||||
|
||||
@Bindable
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
public void setLastname(String lastname) {
|
||||
this.lastname = lastname;
|
||||
notifyPropertyChanged(BR.lastname);
|
||||
}
|
||||
|
||||
public void setFired(boolean fired) {
|
||||
isFired.set(fired);
|
||||
}
|
||||
|
||||
public Emtems(String firstname,String lastname){
|
||||
this.firstname=firstname;
|
||||
this.lastname=lastname;
|
||||
isFired.set(false);
|
||||
user.put("hello","word");
|
||||
user.put("hi","hi");
|
||||
user.put("yo","yo");
|
||||
|
||||
}
|
||||
}
|
||||
76
app/src/main/res/layout/activity_mainsdfdsf.xml
Normal file
76
app/src/main/res/layout/activity_mainsdfdsf.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:bind="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View"/>
|
||||
|
||||
<variable
|
||||
name="emtems"
|
||||
type="com.fenghoo.seven.main.my.entity.Emtems" />
|
||||
<variable
|
||||
name="presenter"
|
||||
type="com.fenghoo.seven.main.my.activity.MainsdfdsfActivity.Presenter" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".main.my.activity.MainsdfdsfActivity">
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/view_stub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/viewstub"
|
||||
android:layout_gravity="center_horizontal"
|
||||
/>
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:onTextChanged="@{presenter.onTextChanged}" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/firstname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:onClick="@{presenter.onClick}"
|
||||
android:text="@{emtems.firstname}" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:onClick="@{()->presenter.onClickListenerBinding(emtems)}"
|
||||
android:text="@{emtems.lastname}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:visibility="@{emtems.isFired?View.GONE:View.VISIBLE}"
|
||||
android:onClick="@{()->presenter.onClickListenerBinding(emtems)}"
|
||||
android:text="@{String.valueOf(1+2)}" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text='@{emtems.user["hello"]}'/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text='@{emtems.user["hi"]}'/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text='@{emtems.user["yo"]}'/>
|
||||
<include
|
||||
layout="@layout/activity_mainsdfdsf_demo"
|
||||
bind:emtems="@{emtems}"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
31
app/src/main/res/layout/activity_mainsdfdsf_demo.xml
Normal file
31
app/src/main/res/layout/activity_mainsdfdsf_demo.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="emtems"
|
||||
type="com.fenghoo.seven.main.my.entity.Emtems" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".main.my.activity.MainsdfdsfActivity">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/firstname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="@{emtems.firstname}" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="@{emtems.lastname}" />
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
19
app/src/main/res/layout/viewstub.xml
Normal file
19
app/src/main/res/layout/viewstub.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerHorizontal="true"
|
||||
tools:context=".main.my.activity.MainsdfdsfActivity">
|
||||
<ImageView
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
|
||||
android:src="@mipmap/ic_launcher"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user