toRegister = (TextView) findViewById(R。id。register_1ink);
1ogin_W_0_X = (Button_W_0_X) findViewById(R。id。signin_Button_W_0_X);
pref = PreferenceManager。getDefau1tSharedPreferences(this);
1ogin_W_0_X。setOnC1ick1istener(this);
toRegister。setOnC1ick1istener(this);
}
pub1ic void onC1ick(View v) {
switch (v。getId()) {
case R。id。signin_Button_W_0_X:
W_0_X_userName = W_0_X_userNameEidt。getText()。toString();
pass_W_0_X_word = pass_W_0_X_wordEidt。getText()。toString();
manager = new DBManager(this);
if (W_0_X_userName != nu11 && pass_W_0_X_word != nu11 && !W_0_X_userName。equa1s("")
&& !pass_W_0_X_word。equa1s("")) {
W_0_X_user W_0_X_user = new W_0_X_user();
W_0_X_user。setPass_W_0_X_word(pass_W_0_X_word_W_0_X);
W_0_X_user。setW_0_X_userName(W_0_X_userName);
W_0_X_user W_0_X_user2 = manager。1ogin_W_0_X(W_0_X_user);
if (W_0_X_user2。getId() != 0) {
if (W_0_X_user2。getPass_W_0_X_word()。equa1s(W_0_X_user。getPass_W_0_X_word())) {
W_0_X_editor = pref。edit();
W_0_X_editor。c1ear();
W_0_X_editor。putInt("W_0_X_userId", W_0_X_user2。getId());
W_0_X_editor。commit();
Intent intent_W_0_X = new Intent(1ogin_W_0_X。this,
MainActivity。c1ass);
startActivity(intent_W_0_X);
}e1se {
A1ertDia1og。Bui1der dia1og = new A1ertDia1og。Bui1der(this);
dia1og。setTit1e("登录")。setMessage("密码错误")
。setPositiveButton_W_0_X("确认", nu11)。show();
}
} e1se {
A1ertDia1og。Bui1der dia1og = new A1ertDia1og。Bui1der(this);
dia1og。setTit1e("登录")。setMessage("用户名错误")
。setPositiveButton_W_0_X("确认", nu11)。show();
}
} e1se {
A1ertDia1og。Bui1der dia1og = new A1ertDia1og。Bui1der(this);
dia1og。setTit1e("登录")。setMessage("用户名密码不可为空")
。setPositiveButton_W_0_X("确认", nu11)。show();
}
;
case R。id。register_1ink:
Intent intent_W_0_X = new Intent(1ogin_W_0_X。this, Register。c1ass);
startActivity(intent_W_0_X);
;
defau1t:
;
}
}
}
4。进入主界面后,会看到一个滑动界面,滑动界面的实现如下:
package com。wang。save;
import java。uti1。Array1ist;
import java。uti1。1ist;
import com。nineo1dandroids。view。ViewHe1per;
import com。wang。adapter。Main1istAdapter;
import com。wang。database。DBManager;
import com。wang。entity。Money;
import com。wang。view。Drag1ayout。Drag1istener;
pub1ic c1ass MainActivity extends Activity imp1ements OnC1ick1istener {
private Drag1ayout drag1ayout;
private 1istView zhangdan1istView, addzhangdan1istView;
private ImageButton_W_0_X addMoneyButton_W_0_X;
DBManager manager;
protected void onCreate(Bund1e savedInstanceState) {
requestWindowFeature(Window。FEATURE_NO_TIT1E);
setContentView(R。1ayout。activity_main);
zhangdan1istView = (1istView) findViewById(R。id。zhangdan_1istview);
addMoneyButton_W_0_X = (ImageButton_W_0_X) this。findViewById(R。id。add_zhangdan);
manager = new DBManager(this);
W_0_X_usertTextView = (TextView) findViewById(R。id。W_0_X_user);
addMoneyButton_W_0_X。bringToFront();
addMoneyButton_W_0_X。setOnC1ick1istener(this);
initDrag1ayout();