MainActivity.java
9.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package com.hjx.personalcenter.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.hjx.personalcenter.R;
import com.hjx.personalcenter.customdialog.HeadDialog;
import com.hjx.personalcenter.interfaces.DialogCallBack;
import com.hjx.personalcenter.util.AlertUtils;
import com.mylhyl.circledialog.CircleDialog;
import com.mylhyl.circledialog.callback.ConfigInput;
import com.mylhyl.circledialog.params.InputParams;
import com.mylhyl.circledialog.view.listener.OnInputClickListener;
import com.zaaach.toprightmenu.MenuItem;
import com.zaaach.toprightmenu.TopRightMenu;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements View.OnClickListener, DialogCallBack.CallBackView {
private ImageView iv_imformatioan, iv_look_card, iv_setting, iv_sign, iv_head, iv_sex;
private TextView tv_edit_presoninfo, tv_sign, oktakephone, cancetakephone,
tv_username, tv_username1, tv_mygad, tv_sex, tv_useinfo_adress, tv_useinfo_birthday,
tv_useinfo_qq, tv_useinfo_school, tv_useinfo_gender;
private LinearLayout linel_mycuoti, linel_mynote, linel_mycollege, linel_myclass;
private TopRightMenu mTopRightMenu;
private boolean showIcon = true;
private boolean dimBg = true;
private boolean needAnim = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initData();
initLister();
}
private void initView() {
iv_imformatioan = (ImageView) findViewById(R.id.iv_imformatioan);
iv_look_card = (ImageView) findViewById(R.id.iv_look_card);
tv_edit_presoninfo = (TextView) findViewById(R.id.tv_edit_presoninfo);
iv_setting = (ImageView) findViewById(R.id.iv_setting);
iv_sign = (ImageView) findViewById(R.id.iv_sign);
tv_sign = (TextView) findViewById(R.id.tv_sign);
//头像
iv_head = (ImageView) findViewById(R.id.iv_head);
//初始化个人信息
iv_sex = (ImageView) findViewById(R.id.iv_sex);
tv_username = (TextView) findViewById(R.id.tv_username);
tv_username1 = (TextView) findViewById(R.id.tv_username1);
tv_mygad = (TextView) findViewById(R.id.tv_mygad);
tv_sex = (TextView) findViewById(R.id.tv_sex);
tv_useinfo_adress = (TextView) findViewById(R.id.tv_useinfo_adress);
tv_useinfo_birthday = (TextView) findViewById(R.id.tv_useinfo_birthday);
tv_useinfo_qq = (TextView) findViewById(R.id.tv_useinfo_qq);
tv_useinfo_school = (TextView) findViewById(R.id.tv_useinfo_school);
tv_useinfo_gender = (TextView) findViewById(R.id.tv_useinfo_gender);
//跳转其他应用
linel_mycuoti = (LinearLayout) findViewById(R.id.linel_mycuoti);
linel_mynote = (LinearLayout) findViewById(R.id.linel_mynote);
linel_mycollege = (LinearLayout) findViewById(R.id.linel_mycollege);
linel_myclass = (LinearLayout) findViewById(R.id.linel_myclass);
}
private void initData() {
//加载个人信息
}
private void initLister() {
iv_imformatioan.setOnClickListener(this);
iv_look_card.setOnClickListener(this);
tv_edit_presoninfo.setOnClickListener(this);
iv_setting.setOnClickListener(this);
iv_sign.setOnClickListener(this);
iv_head.setOnClickListener(this);
linel_mycuoti.setOnClickListener(this);
linel_mynote.setOnClickListener(this);
linel_mycollege.setOnClickListener(this);
linel_myclass.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_imformatioan:
Intent intent = new Intent();
intent.setClass(MainActivity.this, FeedBackActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case R.id.iv_look_card:
Intent lookintent = new Intent();
lookintent.setClass(MainActivity.this, ElectronicCardLookInfoActivity.class);
startActivity(lookintent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case R.id.tv_edit_presoninfo:
Intent editintent = new Intent();
editintent.setClass(MainActivity.this, ChangePresonalInfoActivity.class);
startActivity(editintent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case R.id.iv_head:
HeadDialog.getInstance(this).show(getSupportFragmentManager(), "HeadDialog");
break;
case R.id.iv_setting:
mTopRightMenu = new TopRightMenu(MainActivity.this);
List<MenuItem> menuItems = new ArrayList<>();
menuItems.add(new MenuItem(R.mipmap.blank, "切换账户"));
menuItems.add(new MenuItem(R.mipmap.blank, "账户管理"));
mTopRightMenu
.setHeight(150) //默认高度480
.setWidth(320) //默认宽度wrap_content
.showIcon(showIcon) //显示菜单图标,默认为true
.dimBackground(dimBg) //背景变暗,默认为true
.needAnimationStyle(needAnim) //显示动画,默认为true
.setAnimationStyle(R.style.TRM_ANIM_STYLE) //默认为R.style.TRM_ANIM_STYLE
.setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() {
@Override
public void onMenuItemClick(int position) {
switch (position) {
case 0:
//清除数据
Intent settingintent = new Intent();
settingintent.setClass(MainActivity.this, LoginAndRegisterActivity.class);
startActivity(settingintent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
case 1:
Intent accontMintent = new Intent();
accontMintent.setClass(MainActivity.this, AccountManagementActivity.class);
startActivity(accontMintent);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
break;
}
}
})
.addMenuList(menuItems)
.showAsDropDown(iv_setting, -250, 0);
break;
case R.id.iv_sign:
new CircleDialog.Builder(this)
.setCanceledOnTouchOutside(false)
.setCancelable(true)
.setTitle("个性签名")
.setInputHint("请输入个性签名")
.setWidth(0.5f)
.configInput(new ConfigInput() {
@Override
public void onConfig(InputParams params) {
// params.inputBackgroundResourceId = R.drawable.bg_input;
}
})
.setNegative("取消", null)
.setPositiveInput("确定", new OnInputClickListener() {
@Override
public void onClick(String text, View v) {
if (text.equals("")) {
AlertUtils.showToast(MainActivity.this, "请输入个性签名");
} else {
tv_sign.setText(text);
}
}
})
.show();
break;
case R.id.linel_mycuoti:
AlertUtils.showToast(this, "hhahahah ");
break;
case R.id.linel_mynote:
AlertUtils.showToast(this, "hhahahah ");
break;
case R.id.linel_mycollege:
AlertUtils.showToast(this, "hhahahah ");
break;
case R.id.linel_myclass:
AlertUtils.showToast(this, "hhahahah ");
break;
case R.id.oktakephone:
AlertUtils.showToast(this, "hhahahah ");
break;
case R.id.canceltakephone:
AlertUtils.showToast(this, "hhahahah ");
break;
}
}
@Override
public void provinceOnItemClick(Context context, LayoutInflater inflater, ViewGroup container) {
View mView = inflater.inflate(R.layout.custom_adilog_lhead, container, false);
oktakephone = (TextView) mView.findViewById(R.id.oktakephone);
cancetakephone = (TextView) mView.findViewById(R.id.canceltakephone);
oktakephone.setOnClickListener(this);
cancetakephone.setOnClickListener(this);
}
}