Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,160 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||||
|
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="net.micode.notes"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="0.1" >
|
||||||
|
|
||||||
|
<!--uses-sdk android:minSdkVersion="14" /-->
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
|
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:icon="@drawable/icon_app"
|
||||||
|
android:label="@string/app_name" >
|
||||||
|
<activity
|
||||||
|
android:name=".ui.NotesListActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/NoteTheme"
|
||||||
|
|
||||||
|
android:windowSoftInputMode="adjustPan" >
|
||||||
|
<!--android:uiOptions="splitActionBarWhenNarrow"-->
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.NoteEditActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@style/NoteTheme" >
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/text_note" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/call_note" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.INSERT_OR_EDIT" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/text_note" />
|
||||||
|
<data android:mimeType="vnd.android.cursor.item/call_note" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEARCH" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.searchable"
|
||||||
|
android:resource="@xml/searchable" />
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.PassWordEditActivity"
|
||||||
|
android:theme="@style/NoteActionBarStyle">
|
||||||
|
<intent-filter>
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="net.micode.notes.data.NotesProvider"
|
||||||
|
android:authorities="micode_notes"
|
||||||
|
android:multiprocess="true" />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".widget.NoteWidgetProvider_2x"
|
||||||
|
android:label="@string/app_widget2x2" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
|
||||||
|
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/widget_2x_info" />
|
||||||
|
</receiver>
|
||||||
|
<receiver
|
||||||
|
android:name=".widget.NoteWidgetProvider_4x"
|
||||||
|
android:label="@string/app_widget4x4" >
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
|
||||||
|
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/widget_4x_info" />
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver android:name=".ui.AlarmInitReceiver" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name="net.micode.notes.ui.AlarmReceiver"
|
||||||
|
android:process=":remote" >
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.AlarmAlertActivity"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="net.micode.notes.ui.NotesPreferenceActivity"
|
||||||
|
android:label="@string/preferences_title"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:theme="@android:style/Theme.Holo.Light" >
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name="net.micode.notes.gtask.remote.GTaskSyncService"
|
||||||
|
android:exported="false" >
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.app.default_searchable"
|
||||||
|
android:value=".ui.NoteEditActivity" />
|
||||||
|
</application>
|
||||||
|
</manifest>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login_press"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="登录" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/register_press"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="注册" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="请再次确认是否下载云端库数据,"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="本地便签会因此被覆盖。"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="账号:"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/user_account_login"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="密码:"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/user_password_login"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:password="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="登录"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/login_ret"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="返回" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="账号:"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/user_account"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="密码:"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/user_password"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:password="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="确认密码:"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/user_password_asked"
|
||||||
|
android:layout_width="150dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:password="true"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/set_account"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="注册"/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/set_account_ret"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="返回"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,48 @@
|
|||||||
|
package net.micode.notes.account;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.telecom.Call;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import net.micode.notes.R;
|
||||||
|
import net.micode.notes.ui.NotesListActivity;
|
||||||
|
|
||||||
|
public class BeginViewActivity extends Activity {
|
||||||
|
Button loginButton;//登录注册按钮
|
||||||
|
Button registerButton;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.begin_view);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert an introduction when user firstly use this application
|
||||||
|
*/
|
||||||
|
loginButton=(Button)findViewById(R.id.login_press);
|
||||||
|
registerButton=(Button)findViewById(R.id.register_press);
|
||||||
|
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//转到登录
|
||||||
|
Intent intent = new Intent(BeginViewActivity.this, LoginActivity.class);
|
||||||
|
intent.setAction("android.intent.action.CALLr");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
registerButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//转到注册
|
||||||
|
Intent intent = new Intent(BeginViewActivity.this, RegisterActivity.class);
|
||||||
|
intent.setAction("android.intent.action.CALLr");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package net.micode.notes.account;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import net.micode.notes.R;
|
||||||
|
import net.micode.notes.ui.NotesListActivity;
|
||||||
|
|
||||||
|
public class LoginActivity extends Activity {
|
||||||
|
EditText userAccount;//账号密码
|
||||||
|
EditText userPassword;
|
||||||
|
Button loginButton;//登录按钮
|
||||||
|
Button loginReturn;//返回上一级
|
||||||
|
String user_account;
|
||||||
|
String user_password;
|
||||||
|
boolean isSuccess=false;//判断登录是否成功
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
System.out.println("运行到LoginActivity了");
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.login_edit);
|
||||||
|
userAccount=(EditText) findViewById(R.id.user_account_login);
|
||||||
|
userPassword=(EditText) findViewById(R.id.user_password_login);
|
||||||
|
loginButton=(Button)findViewById(R.id.login_account);
|
||||||
|
loginReturn=(Button)findViewById(R.id.login_ret);
|
||||||
|
loginButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//获取输入密码 账号
|
||||||
|
user_account=userAccount.getText().toString();
|
||||||
|
user_password=userPassword.getText().toString();
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
System.out.println("运行到run了");
|
||||||
|
isSuccess=DBConnection.login(user_account,user_password);
|
||||||
|
if (isSuccess){
|
||||||
|
System.out.println("登录成功");
|
||||||
|
Intent intent = new Intent(LoginActivity.this, NotesListActivity.class);
|
||||||
|
intent.putExtra("user_account",user_account);
|
||||||
|
intent.putExtra("user_password",user_password);//将账号密码传递到NotesListActivity中
|
||||||
|
intent.setAction("android.intent.action.CALLr");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("登录失败");
|
||||||
|
userAccount.setText("");//清空
|
||||||
|
userPassword.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
loginReturn=(Button)findViewById(R.id.login_ret);
|
||||||
|
loginReturn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(LoginActivity.this,BeginViewActivity.class);
|
||||||
|
intent.setAction("android.intent.action.MAIN");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
package net.micode.notes.account;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import net.micode.notes.R;
|
||||||
|
|
||||||
|
public class RegisterActivity extends Activity {
|
||||||
|
|
||||||
|
EditText userAccount;//注册账号密码
|
||||||
|
EditText userPassword;//
|
||||||
|
EditText userPasswordAsked;
|
||||||
|
Button setAccount;//注册确认按钮
|
||||||
|
Button registerReturn;//注册返回上一级
|
||||||
|
static String user_account="张三";//默认注册的账号密码
|
||||||
|
static String user_password="123";
|
||||||
|
static String user_password_asked;
|
||||||
|
Boolean isSuccess=false;//判断是否注册成功
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
System.out.println("运行到RegisterActivity了");
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.register_edit);
|
||||||
|
|
||||||
|
/**if (savedInstanceState == null) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
System.out.println("运行到zhe了");
|
||||||
|
//不知道作用
|
||||||
|
/**getWindow().setSoftInputMode(
|
||||||
|
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
|
||||||
|
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
//*/
|
||||||
|
/**new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
System.out.println("运行到run了");
|
||||||
|
DBConnection.link(user_account,user_password);
|
||||||
|
}
|
||||||
|
}).start();*/
|
||||||
|
userAccount=(EditText) findViewById(R.id.user_account);
|
||||||
|
userPassword=(EditText) findViewById(R.id.user_password);
|
||||||
|
userPasswordAsked=(EditText)findViewById(R.id.user_password_asked);
|
||||||
|
setAccount=(Button)findViewById(R.id.set_account);
|
||||||
|
setAccount.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
//获取输入密码 账号
|
||||||
|
user_account=userAccount.getText().toString();
|
||||||
|
user_password=userPassword.getText().toString();
|
||||||
|
user_password_asked=userPasswordAsked.getText().toString();
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
isSuccess=DBConnection.register(user_account,user_password,user_password_asked);
|
||||||
|
if (isSuccess){
|
||||||
|
System.out.println("注册成功");
|
||||||
|
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
|
||||||
|
intent.setAction("android.intent.action.CALLr");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("注册失败");
|
||||||
|
userAccount.setText("");//清空
|
||||||
|
userPassword.setText("");
|
||||||
|
userPasswordAsked.setText("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
registerReturn=(Button)findViewById(R.id.set_account_ret);
|
||||||
|
registerReturn.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(RegisterActivity.this,BeginViewActivity.class);
|
||||||
|
intent.setAction("android.intent.action.MAIN");
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**public static boolean link(String account, String pwd){
|
||||||
|
System.out.println(account);
|
||||||
|
System.out.println(pwd);
|
||||||
|
Connection connection=null;
|
||||||
|
try {
|
||||||
|
//1、加载驱动
|
||||||
|
Class.forName("com.mysql.jdbc.Driver").newInstance();
|
||||||
|
System.out.println("驱动加载成功!!!");
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//2、获取与数据库的连接
|
||||||
|
connection = DriverManager.getConnection(url, user, password);
|
||||||
|
System.out.println("连接数据库成功!!!");
|
||||||
|
//3.sql语句
|
||||||
|
String sql = "INSERT INTO driver (id, name) VALUES ( '24100413', 'ljy')";
|
||||||
|
//4.获取用于向数据库发送sql语句的ps
|
||||||
|
PreparedStatement ps=connection.prepareStatement(sql);
|
||||||
|
ps.execute(sql);
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if(connection!=null){
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
}
|
Loading…
Reference in new issue