diff --git a/src/A Multimodal Multi-Party Dataset for Emotion Recognition in Conversations.pdf b/src/A Multimodal Multi-Party Dataset for Emotion Recognition in Conversations.pdf deleted file mode 100644 index 289a99b..0000000 Binary files a/src/A Multimodal Multi-Party Dataset for Emotion Recognition in Conversations.pdf and /dev/null differ diff --git a/src/AndroidApp/.idea/AndroidApp.iml b/src/AndroidApp/.idea/AndroidApp.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/src/AndroidApp/.idea/AndroidApp.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/.idea/misc.xml b/src/AndroidApp/.idea/misc.xml new file mode 100644 index 0000000..82efee1 --- /dev/null +++ b/src/AndroidApp/.idea/misc.xml @@ -0,0 +1,20 @@ + + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/.idea/modules.xml b/src/AndroidApp/.idea/modules.xml new file mode 100644 index 0000000..3e28a09 --- /dev/null +++ b/src/AndroidApp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/.idea/workspace.xml b/src/AndroidApp/.idea/workspace.xml new file mode 100644 index 0000000..c2cd714 --- /dev/null +++ b/src/AndroidApp/.idea/workspace.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1524884716802 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.gitignore b/src/AndroidApp/Tbot/.gitignore new file mode 100644 index 0000000..39fb081 --- /dev/null +++ b/src/AndroidApp/Tbot/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/src/AndroidApp/Tbot/.idea/compiler.xml b/src/AndroidApp/Tbot/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/copyright/profiles_settings.xml b/src/AndroidApp/Tbot/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/gradle.xml b/src/AndroidApp/Tbot/.idea/gradle.xml new file mode 100644 index 0000000..3bd0088 --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/misc.xml b/src/AndroidApp/Tbot/.idea/misc.xml new file mode 100644 index 0000000..4c9d020 --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/misc.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/modules.xml b/src/AndroidApp/Tbot/.idea/modules.xml new file mode 100644 index 0000000..1f18dad --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/modules.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/.idea/runConfigurations.xml b/src/AndroidApp/Tbot/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/src/AndroidApp/Tbot/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/app/.gitignore b/src/AndroidApp/Tbot/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/src/AndroidApp/Tbot/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/src/AndroidApp/Tbot/app/build.gradle b/src/AndroidApp/Tbot/app/build.gradle new file mode 100644 index 0000000..2351f11 --- /dev/null +++ b/src/AndroidApp/Tbot/app/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + buildToolsVersion "26.0.2" + defaultConfig { + applicationId "me.wshuo.tbot" + minSdkVersion 18 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:26.1.0' + compile 'com.android.support:design:26.1.0' + compile 'com.android.support:support-v4:26.1.0' + compile 'com.android.support:support-vector-drawable:26.1.0' + testCompile 'junit:junit:4.12' +} diff --git a/src/AndroidApp/Tbot/app/proguard-rules.pro b/src/AndroidApp/Tbot/app/proguard-rules.pro new file mode 100644 index 0000000..5094c45 --- /dev/null +++ b/src/AndroidApp/Tbot/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in D:\programs\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/src/AndroidApp/Tbot/app/src/androidTest/java/me/wshuo/tbot/ExampleInstrumentedTest.java b/src/AndroidApp/Tbot/app/src/androidTest/java/me/wshuo/tbot/ExampleInstrumentedTest.java new file mode 100644 index 0000000..6f31994 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/androidTest/java/me/wshuo/tbot/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package me.wshuo.tbot; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext(){ + throw new MyOwnRuntimeException("My Message"); //write by ljw + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("me.wshuo.tbot", appContext.getPackageName()); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/AndroidManifest.xml b/src/AndroidApp/Tbot/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..d490081 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AppCompatPreferenceActivity.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AppCompatPreferenceActivity.java new file mode 100644 index 0000000..719acd1 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AppCompatPreferenceActivity.java @@ -0,0 +1,109 @@ +package me.wshuo.tbot; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.preference.PreferenceActivity; +import android.support.annotation.LayoutRes; +import android.support.annotation.Nullable; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatDelegate; +import android.support.v7.widget.Toolbar; +import android.view.MenuInflater; +import android.view.View; +import android.view.ViewGroup; + +/** + * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls + * to be used with AppCompat. + */ +public abstract class AppCompatPreferenceActivity extends PreferenceActivity { + + private AppCompatDelegate mDelegate; + + @Override + protected void onCreate(Bundle savedInstanceState) { + getDelegate().installViewFactory(); + getDelegate().onCreate(savedInstanceState); + super.onCreate(savedInstanceState); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + getDelegate().onPostCreate(savedInstanceState); + } + + public ActionBar getSupportActionBar() { + return getDelegate().getSupportActionBar(); + } + + public void setSupportActionBar(@Nullable Toolbar toolbar) { + getDelegate().setSupportActionBar(toolbar); + } + + @Override + public MenuInflater getMenuInflater() { + return getDelegate().getMenuInflater(); + } + + @Override + public void setContentView(@LayoutRes int layoutResID) { + getDelegate().setContentView(layoutResID); + } + + @Override + public void setContentView(View view) { + getDelegate().setContentView(view); + } + + @Override + public void setContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().setContentView(view, params); + } + + @Override + public void addContentView(View view, ViewGroup.LayoutParams params) { + getDelegate().addContentView(view, params); + } + + @Override + protected void onPostResume() { + super.onPostResume(); + getDelegate().onPostResume(); + } + + @Override + protected void onTitleChanged(CharSequence title, int color) { + super.onTitleChanged(title, color); + getDelegate().setTitle(title); + } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + getDelegate().onConfigurationChanged(newConfig); + } + + @Override + protected void onStop() { + super.onStop(); + getDelegate().onStop(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + getDelegate().onDestroy(); + } + + public void invalidateOptionsMenu() { + getDelegate().invalidateOptionsMenu(); + } + + private AppCompatDelegate getDelegate() { + if (mDelegate == null) { + mDelegate = AppCompatDelegate.create(this, null); + } + return mDelegate; + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AudioCall.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AudioCall.java new file mode 100644 index 0000000..b6ef982 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/AudioCall.java @@ -0,0 +1,36 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class AudioCall extends AppCompatActivity { + + public Button btnAudioReturn; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_audio_call); + btnAudioReturn = (Button) findViewById(R.id.btnAudioReturn); + btnAudioReturn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Audio_to_Menu = new Intent(AudioCall.this, Menu.class); + startActivity(intent_Audio_to_Menu); + finish(); + } + }); + } + + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Audio_to_Menu = new Intent(AudioCall.this, Menu.class); + startActivity(intent_Audio_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Falldown.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Falldown.java new file mode 100644 index 0000000..a6ec384 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Falldown.java @@ -0,0 +1,35 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class Falldown extends AppCompatActivity { + + public Button btnFallReturn; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_falldown); + btnFallReturn = (Button) findViewById(R.id.btnFallReturn); + btnFallReturn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Fall_to_Menu = new Intent(Falldown.this, Menu.class); + startActivity(intent_Fall_to_Menu); + finish(); + } + }); + } + + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Fall_to_Menu = new Intent(Falldown.this, Menu.class); + startActivity(intent_Fall_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/IPConnect.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/IPConnect.java new file mode 100644 index 0000000..dfbd4c4 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/IPConnect.java @@ -0,0 +1,36 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class IPConnect extends AppCompatActivity { + + public Button btnIPConnect; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_ipconnect); + btnIPConnect = (Button) findViewById(R.id.btnIPConnect); + btnIPConnect.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_IP_to_Menu = new Intent(IPConnect.this, Menu.class); + startActivity(intent_IP_to_Menu); + finish(); + } + }); + } + + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_IP_to_Menu = new Intent(IPConnect.this, Menu.class); + startActivity(intent_IP_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Login.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Login.java new file mode 100644 index 0000000..bc1b73f --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Login.java @@ -0,0 +1,185 @@ +package me.wshuo.tbot; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.Toast; + +public class Login extends Activity { //登录界面活动 + + public int pwdresetFlag=0; + private EditText mAccount; //用户名编辑 + private EditText mPwd; //密码编辑 + private Button mRegisterButton; //注册按钮 + private Button mLoginButton; //登录按钮 + private Button mCancleButton; //注销按钮 + private CheckBox mRememberCheck; + + private SharedPreferences login_sp; + private String userNameValue,passwordValue; + + private View loginView; //登录 + private View loginSuccessView; + private TextView loginSuccessShow; + private TextView mChangepwdText; + private UserDataManager mUserDataManager; //用户数据管理类 + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.login); + //通过id找到相应的控件 + mAccount = (EditText) findViewById(R.id.login_edit_account); + mPwd = (EditText) findViewById(R.id.login_edit_pwd); + mRegisterButton = (Button) findViewById(R.id.login_btn_register); + mLoginButton = (Button) findViewById(R.id.login_btn_login); + mCancleButton = (Button) findViewById(R.id.login_btn_cancle); + loginView=findViewById(R.id.login_view); + loginSuccessView=findViewById(R.id.login_success_view); + loginSuccessShow=(TextView) findViewById(R.id.login_success_show); + + mChangepwdText = (TextView) findViewById(R.id.login_text_change_pwd); + + mRememberCheck = (CheckBox) findViewById(R.id.Login_Remember); + + login_sp = getSharedPreferences("userInfo", 0); + //String name=login_sp.getString("USER_NAME", ""); + String pwd = getEncryptedPass();//write by ljw + String pwd =login_sp.getString("PASSWORD", ""); + + boolean choseRemember =login_sp.getBoolean("mRememberCheck", false); + boolean choseAutoLogin =login_sp.getBoolean("mAutologinCheck", false); + //如果上次选了记住密码,那进入登录页面也自动勾选记住密码,并填上用户名和密码 + if(choseRemember){ + mAccount.setText(name); + mPwd.setText(pwd); + mRememberCheck.setChecked(true); + } + + mRegisterButton.setOnClickListener(mListener); //采用OnClickListener方法设置不同按钮按下之后的监听事件 + mLoginButton.setOnClickListener(mListener); + mCancleButton.setOnClickListener(mListener); + mChangepwdText.setOnClickListener(mListener); + + ImageView image = (ImageView) findViewById(R.id.logo); //使用ImageView显示logo + image.setImageResource(R.drawable.logo); + + if (mUserDataManager == null) { + mUserDataManager = new UserDataManager(this); + mUserDataManager.openDataBase(); //建立本地数据库 + } + } + OnClickListener mListener = new OnClickListener() { //不同按钮按下的监听事件选择 + public void onClick(View v) { + switch (v.getId()) { + case R.id.login_btn_register: //登录界面的注册按钮 + Intent intent_Login_to_Register = new Intent(Login.this,Register.class) ; //切换Login Activity至User Activity + startActivity(intent_Login_to_Register); + finish(); + break; + case R.id.login_btn_login: //登录界面的登录按钮 + login(); + break; + case R.id.login_btn_cancle: //登录界面的注销按钮 + cancel(); + break; + case R.id.login_text_change_pwd: //登录界面的密码重置按钮 + Intent intent_Login_to_reset = new Intent(Login.this,Resetpwd.class) ; //切换Login Activity至User Activity + startActivity(intent_Login_to_reset); + finish(); + break; + } + } + }; + + public void login() {//登录按钮监听事件 + if (isUserNameAndPwdValid()) { + String userName = mAccount.getText().toString().trim();//获取当前输入的用户名和密码信息 + String userPwd = mPwd.getText().toString().trim(); + SharedPreferences.Editor editor =login_sp.edit(); + int result=mUserDataManager.findUserByNameAndPwd(userName, userPwd); + if(result==1){//返回1说明用户名和密码均正确 + //保存用户名和密码 + editor.putString("USER_NAME", userName); + editor.putString("PASSWORD", userPwd); + //是否记住密码 + if(mRememberCheck.isChecked()){ + editor.putBoolean("mRememberCheck", true); + }else{ + editor.putBoolean("mRememberCheck", false); + } + editor.apply(); + Intent intent = new Intent(Login.this,Welcome.class) ;//切换Login Activity至User Activity + startActivity(intent); + finish(); + Toast.makeText(this, getString(R.string.login_success),Toast.LENGTH_SHORT).show();//登录成功提示 + }else if(result==0){ + Toast.makeText(this, getString(R.string.login_fail),Toast.LENGTH_SHORT).show(); //登录失败提示 + } + } + } + public void cancel() { //注销 + if (isUserNameAndPwdValid()) { + String userName = mAccount.getText().toString().trim(); //获取当前输入的用户名和密码信息 + String userPwd = mPwd.getText().toString().trim(); + int result=mUserDataManager.findUserByNameAndPwd(userName, userPwd); + if(result==1){ //返回1说明用户名和密码均正确 +// Intent intent = new Intent(Login.this,User.class) ; //切换Login Activity至User Activity +// startActivity(intent); + Toast.makeText(this, getString(R.string.cancel_success),Toast.LENGTH_SHORT).show();//登录成功提示 + mPwd.setText(""); + mAccount.setText(""); + mUserDataManager.deleteUserDatabyname(userName); + }else if(result==0){ + Toast.makeText(this, getString(R.string.cancel_fail),Toast.LENGTH_SHORT).show(); //登录失败提示 + } + } + + } + + public boolean isUserNameAndPwdValid() { + if (mAccount.getText().toString().trim().equals("")) { + Toast.makeText(this, getString(R.string.account_empty), + Toast.LENGTH_SHORT).show(); + return false; + } else if (mPwd.getText().toString().trim().equals("")) { + Toast.makeText(this, getString(R.string.pwd_empty), + Toast.LENGTH_SHORT).show(); + return false; + } + return true; + } + + @Override + protected void onResume() { + if (mUserDataManager == null) { + mUserDataManager = new UserDataManager(this); + mUserDataManager.openDataBase(); + } + super.onResume(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + } + + @Override + protected void onPause() { + if (mUserDataManager != null) { + mUserDataManager.closeDataBase(); + mUserDataManager = null; + } + super.onPause(); + } + +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MedicineAlert.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MedicineAlert.java new file mode 100644 index 0000000..2153510 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MedicineAlert.java @@ -0,0 +1,34 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class MedicineAlert extends AppCompatActivity { + + public Button btnAlertReturn; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_medicine_alert); + btnAlertReturn = (Button) findViewById(R.id.btnAlertReturn); + btnAlertReturn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Alert_to_Menu = new Intent(MedicineAlert.this, Menu.class); + startActivity(intent_Alert_to_Menu); + finish(); + } + }); + } + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Alert_to_Menu = new Intent(MedicineAlert.this, Menu.class); + startActivity(intent_Alert_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Menu.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Menu.java new file mode 100644 index 0000000..06f1b90 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Menu.java @@ -0,0 +1,107 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class Menu extends AppCompatActivity { + + //write by ljw 没必要改 + public Button btnMenuReturn; + public Button getBtnMenuReturn(){return btnMenuReturn;} + public void setBtnMenuReturn(Button btnMenuReturn){this.btnMenuReturn=btnMenuReturn;} + + public Button btnFall; + public Button getBtnFall(){return btnFall;} + public void setBtnFall(Button btnFall){this.btnFall=btnFall;} + + public Button btnAlert; + public Button getBtnAlert(){return btnAlert;} + public void setBtnAlert(Button btnAlert){this.btnAlert=btnAlert;} + + public Button btnAudio; + public Button getBtnAudio(){return btnAudio;} + public void setBtnAudio(Button btnAudio){this.btnAudio=btnAudio;} + + public Button btnVideo; + public Button getBtnVideo(){return btnVideo;} + public void setBtnVideo(Button btnVideo){this.btnVideo=btnVideo;} + + public Button btnSetting; + public Button getBtnSetting(){return btnSetting;} + public void setBtnSetting(Button btnSetting){this.btnSetting=btnSetting;} + + public Button btnControl; + public Button getBtnControl(){return btnControl;} + public void setBtnControl(Button btnControl){this.btnControl=btnControl;} + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_menu); + btnMenuReturn = (Button) findViewById(R.id.btnMenuReturn); + btnFall = (Button)findViewById(R.id.btnFall); + btnAlert = (Button)findViewById(R.id.btnAlert); + btnAudio = (Button)findViewById(R.id.btnAudio); + btnVideo = (Button)findViewById(R.id.btnVideo); + btnSetting = (Button)findViewById(R.id.btnSetting); + btnControl = (Button)findViewById(R.id.btnControl); + + btnMenuReturn.setOnClickListener(mListener); + btnFall.setOnClickListener(mListener); + btnAlert.setOnClickListener(mListener); + btnAudio.setOnClickListener(mListener); + btnVideo.setOnClickListener(mListener); + btnSetting.setOnClickListener(mListener); + btnControl.setOnClickListener(mListener); + } + + View.OnClickListener mListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.btnMenuReturn: + Intent intent_Return = new Intent(Menu.this, IPConnect.class); + startActivity(intent_Return); + finish(); + break; + case R.id.btnFall: + Intent intent_Falldown = new Intent(Menu.this, Falldown.class); + startActivity(intent_Falldown); + finish(); + break; + case R.id.btnAlert: + Intent intent_Alert = new Intent(Menu.this, MedicineAlert.class); + startActivity(intent_Alert); + finish(); + break; + case R.id.btnAudio: + Intent intent_Audio = new Intent(Menu.this, AudioCall.class); + startActivity(intent_Audio); + finish(); + break; + case R.id.btnVideo: + Intent intent_Video = new Intent(Menu.this, VideoObserve.class); + startActivity(intent_Video); + finish(); + break; + case R.id.btnSetting: + Intent intent_Setting = new Intent(Menu.this, Settings.class); + startActivity(intent_Setting); + finish(); + break; + case R.id.btnControl: + Intent intent_Control = new Intent(Menu.this, MotionControl.class); + startActivity(intent_Control); + finish(); + break; + default: + break; + } + + } + + }; + +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MotionControl.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MotionControl.java new file mode 100644 index 0000000..9a7e8e5 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/MotionControl.java @@ -0,0 +1,34 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class MotionControl extends AppCompatActivity { + + public Button btnMotionReturn; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_motion_control); + btnMotionReturn = (Button) findViewById(R.id.btnMotionReturn); + btnMotionReturn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Motion_to_Menu = new Intent(MotionControl.this, Menu.class); + startActivity(intent_Motion_to_Menu); + finish(); + } + }); + } + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Motion_to_Menu = new Intent(MotionControl.this, Menu.class); + startActivity(intent_Motion_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/PreferenceSettings.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/PreferenceSettings.java new file mode 100644 index 0000000..7a3d378 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/PreferenceSettings.java @@ -0,0 +1,13 @@ +package me.wshuo.tbot; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class PreferenceSettings extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_preference_settings); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Register.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Register.java new file mode 100644 index 0000000..105e9a5 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Register.java @@ -0,0 +1,102 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +public class Register extends AppCompatActivity { + private EditText mAccount; //用户名编辑 + private EditText mPwd; //密码编辑 + private EditText mPwdCheck; //密码编辑 + private Button mSureButton; //确定按钮 + private Button mCancelButton; //取消按钮 + private UserDataManager mUserDataManager; //用户数据管理类 + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.register); + mAccount = (EditText) findViewById(R.id.resetpwd_edit_name); + mPwd = (EditText) findViewById(R.id.resetpwd_edit_pwd_old); + mPwdCheck = (EditText) findViewById(R.id.resetpwd_edit_pwd_new); + + mSureButton = (Button) findViewById(R.id.register_btn_sure); + mCancelButton = (Button) findViewById(R.id.register_btn_cancel); + + mSureButton.setOnClickListener(m_register_Listener); //注册界面两个按钮的监听事件 + mCancelButton.setOnClickListener(m_register_Listener); + + if (mUserDataManager == null) { + mUserDataManager = new UserDataManager(this); + mUserDataManager.openDataBase(); //建立本地数据库 + } + + } + View.OnClickListener m_register_Listener = new View.OnClickListener() { //不同按钮按下的监听事件选择 + public void onClick(View v) { + switch (v.getId()) { + case R.id.register_btn_sure: //确认按钮的监听事件 + register_check(); + break; + case R.id.register_btn_cancel: //取消按钮的监听事件,由注册界面返回登录界面 + Intent intent_Register_to_Login = new Intent(Register.this,Login.class) ; //切换User Activity至Login Activity + startActivity(intent_Register_to_Login); + finish(); + break; + default: + break; + } + } + }; + public void register_check() { //确认按钮的监听事件 + if (isUserNameAndPwdValid()) { + String userName = mAccount.getText().toString().trim(); + String userPwd = mPwd.getText().toString().trim(); + String userPwdCheck = mPwdCheck.getText().toString().trim(); + //检查用户是否存在 + int count=mUserDataManager.findUserByName(userName); + //用户已经存在时返回,给出提示文字 + if(count>0){ + Toast.makeText(this, getString(R.string.name_already_exist, userName),Toast.LENGTH_SHORT).show(); + return ; + } + if(userPwd.equals(userPwdCheck)==false){ //两次密码输入不一样 + Toast.makeText(this, getString(R.string.pwd_not_the_same),Toast.LENGTH_SHORT).show(); + return ; + } else { + UserData mUser = new UserData(userName, userPwd); + mUserDataManager.openDataBase(); + long flag = mUserDataManager.insertUserData(mUser); //新建用户信息 + if (flag == -1) { + Toast.makeText(this, getString(R.string.register_fail),Toast.LENGTH_SHORT).show(); + }else{ + Toast.makeText(this, getString(R.string.register_success),Toast.LENGTH_SHORT).show(); + Intent intent_Register_to_Login = new Intent(Register.this,Login.class) ; //切换User Activity至Login Activity + startActivity(intent_Register_to_Login); + finish(); + } + } + } + } + public boolean isUserNameAndPwdValid() { + //write by ljw + String myString = null; + if (mAccount.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.account_empty), + Toast.LENGTH_SHORT).show(); + return false; + } else if (mPwd.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.pwd_empty), + Toast.LENGTH_SHORT).show(); + return false; + }else if(mPwdCheck.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.pwd_check_empty), + Toast.LENGTH_SHORT).show(); + return false; + } + return true; + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Resetpwd.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Resetpwd.java new file mode 100644 index 0000000..230ff33 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Resetpwd.java @@ -0,0 +1,122 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +public class Resetpwd extends AppCompatActivity { + private EditText mAccount; //用户名编辑 + private EditText mPwd_old; //密码编辑 + private EditText mPwd_new; //密码编辑 + private EditText mPwdCheck; //密码编辑 + private Button mSureButton; //确定按钮 + private Button mCancelButton; //取消按钮 + private UserDataManager mUserDataManager; //用户数据管理类 + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.resetpwd); +// layout.setOrientation(RelativeLayout.VERTICAL). + mAccount = (EditText) findViewById(R.id.resetpwd_edit_name); + mPwd_old = (EditText) findViewById(R.id.resetpwd_edit_pwd_old); + mPwd_new = (EditText) findViewById(R.id.resetpwd_edit_pwd_new); + mPwdCheck = (EditText) findViewById(R.id.resetpwd_edit_pwd_check); + + mSureButton = (Button) findViewById(R.id.resetpwd_btn_sure); + mCancelButton = (Button) findViewById(R.id.resetpwd_btn_cancel); + + mSureButton.setOnClickListener(m_resetpwd_Listener); //注册界面两个按钮的监听事件 + mCancelButton.setOnClickListener(m_resetpwd_Listener); + //mCancelButton.setOnClickListener(m_resetpwd_Listener); + + if (mUserDataManager == null) { + mUserDataManager = new UserDataManager(this); + mUserDataManager.openDataBase(); //建立本地数据库 + } + + } + View.OnClickListener m_resetpwd_Listener = new View.OnClickListener() { //不同按钮按下的监听事件选择 + public void onClick(View v) { + switch (v.getId()) { + case R.id.resetpwd_btn_sure: //确认按钮的监听事件 + resetpwd_check(); + break; + case R.id.resetpwd_btn_cancel: //取消按钮的监听事件,由注册界面返回登录界面 + Intent intent_Resetpwd_to_Login = new Intent(Resetpwd.this,Login.class) ; //切换Resetpwd Activity至Login Activity + startActivity(intent_Resetpwd_to_Login); + finish(); + break; + default: + break; + } + } + }; + public void resetpwd_check() { //确认按钮的监听事件 + if (isUserNameAndPwdValid()) { + String userName = mAccount.getText().toString().trim(); + String userPwd_old = mPwd_old.getText().toString().trim(); + String userPwd_new = mPwd_new.getText().toString().trim(); + String userPwdCheck = mPwdCheck.getText().toString().trim(); + int result=mUserDataManager.findUserByNameAndPwd(userName, userPwd_old); + if(result==1){ //返回1说明用户名和密码均正确,继续后续操作 + if(userPwd_new.equals(userPwdCheck)==false){ //两次密码输入不一样 + Toast.makeText(this, getString(R.string.pwd_not_the_same),Toast.LENGTH_SHORT).show(); + return ; + } else { + UserData mUser = new UserData(userName, userPwd_new); + mUserDataManager.openDataBase(); + boolean flag = mUserDataManager.updateUserData(mUser); + if (flag == false) { + Toast.makeText(this, getString(R.string.resetpwd_fail),Toast.LENGTH_SHORT).show(); + }else{ + + Toast.makeText(this, getString(R.string.resetpwd_success),Toast.LENGTH_SHORT).show(); + + mUser.pwdresetFlag=1; + Intent intent_Register_to_Login = new Intent(Resetpwd.this,Login.class) ; //切换User Activity至Login Activity + startActivity(intent_Register_to_Login); + finish(); + } + } + }else if(result==0){ //返回0说明用户名和密码不匹配,重新输入 + Toast.makeText(this, getString(R.string.pwd_not_fit_user),Toast.LENGTH_SHORT).show(); + return; + } + + + + + } + } + public boolean isUserNameAndPwdValid() { + String myString = null; + String userName = mAccount.getText().toString().trim(); + //检查用户是否存在 + int count=mUserDataManager.findUserByName(userName); + //用户不存在时返回,给出提示文字 + if(count<=0){ + Toast.makeText(this, getString(R.string.name_not_exist, userName),Toast.LENGTH_SHORT).show(); + return false; + } + if (mAccount.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.account_empty),Toast.LENGTH_SHORT).show(); + return false; + } else if (mPwd_old.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.pwd_empty),Toast.LENGTH_SHORT).show(); + return false; + } else if (mPwd_new.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.pwd_new_empty),Toast.LENGTH_SHORT).show(); + return false; + }else if(mPwdCheck.getText().toString().trim().equals(myString)) { + Toast.makeText(this, getString(R.string.pwd_check_empty),Toast.LENGTH_SHORT).show(); + return false; + } + return true; + } + +} + diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Settings.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Settings.java new file mode 100644 index 0000000..a525905 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Settings.java @@ -0,0 +1,283 @@ +package me.wshuo.tbot; + + +import android.annotation.TargetApi; +import android.content.Context; +import android.content.Intent; +import android.content.res.Configuration; +import android.media.Ringtone; +import android.media.RingtoneManager; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.support.v7.app.ActionBar; +import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.RingtonePreference; +import android.text.TextUtils; +import android.view.MenuItem; + +import java.util.List; + +/** + * A {@link PreferenceActivity} that presents a set of application settings. On + * handset devices, settings are presented as a single list. On tablets, + * settings are split by category, with category headers shown to the left of + * the list of settings. + *

+ * See + * Android Design: Settings for design guidelines and the Settings + * API Guide for more information on developing a Settings UI. + */ +public class Settings extends AppCompatPreferenceActivity { + /** + * A preference value change listener that updates the preference's summary + * to reflect its new value. + */ + private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object value) { + String stringValue = value.toString(); + + if (preference instanceof ListPreference) { + // For list preferences, look up the correct display value in + // the preference's 'entries' list. + ListPreference listPreference = (ListPreference) preference; + int index = listPreference.findIndexOfValue(stringValue); + + // Set the summary to reflect the new value. + preference.setSummary( + index >= 0 + ? listPreference.getEntries()[index] + : null); + + } else if (preference instanceof RingtonePreference) { + // For ringtone preferences, look up the correct display value + // using RingtoneManager. + if (TextUtils.isEmpty(stringValue)) { + // Empty values correspond to 'silent' (no ringtone). + preference.setSummary(R.string.pref_ringtone_silent); + + } else { + Ringtone ringtone = RingtoneManager.getRingtone( + preference.getContext(), Uri.parse(stringValue)); + + if (ringtone == null) { + // Clear the summary if there was a lookup error. + preference.setSummary(null); + } else { + // Set the summary to reflect the new ringtone display + // name. + String name = ringtone.getTitle(preference.getContext()); + preference.setSummary(name); + } + } + + } else { + // For all other preferences, set the summary to the value's + // simple string representation. + preference.setSummary(stringValue); + } + return true; + } + }; + + /** + * Helper method to determine if the device has an extra-large screen. For + * example, 10" tablets are extra-large. + */ + private static boolean isXLargeTablet(Context context) { + return (context.getResources().getConfiguration().screenLayout + & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE; + } + + /** + * Binds a preference's summary to its value. More specifically, when the + * preference's value is changed, its summary (line of text below the + * preference title) is updated to reflect the value. The summary is also + * immediately updated upon calling this method. The exact display format is + * dependent on the type of preference. + * + * @see #sBindPreferenceSummaryToValueListener + */ + private static void bindPreferenceSummaryToValue(Preference preference) { + // Set the listener to watch for value changes. + preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); + + // Trigger the listener immediately with the preference's + // current value. + sBindPreferenceSummaryToValueListener.onPreferenceChange(preference, + PreferenceManager + .getDefaultSharedPreferences(preference.getContext()) + .getString(preference.getKey(), "")); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setupActionBar(); + } + + /** + * Set up the {@link android.app.ActionBar}, if the API is available. + */ + private void setupActionBar() { + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + // Show the Up button in the action bar. + actionBar.setDisplayHomeAsUpEnabled(true); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean onIsMultiPane() { + return isXLargeTablet(this); + } + + /** + * {@inheritDoc} + */ + @Override + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + public void onBuildHeaders(List

target) { + loadHeadersFromResource(R.xml.pref_headers, target); + } + + /** + * This method stops fragment injection in malicious applications. + * Make sure to deny any unknown fragments here. + */ + protected boolean isValidFragment(String fragmentName) { + //write by ljw + if (PreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (GeneralPreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (DataSyncPreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (NotificationPreferenceFragment.equals(fragmentName.class().getName())) + return true; + /* + return PreferenceFragment.class.getName().equals(fragmentName) + || GeneralPreferenceFragment.class.getName().equals(fragmentName) + || DataSyncPreferenceFragment.class.getName().equals(fragmentName) + || NotificationPreferenceFragment.class.getName().equals(fragmentName); + */ + } +/* if (PreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (GeneralPreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (DataSyncPreferenceFragment.equals(fragmentName.class().getName())) + return true; + if (NotificationPreferenceFragment.equals(fragmentName.class().getName())) + return true; + write by ljw +*/ + /** + * This fragment shows general preferences only. It is used when the + * activity is showing a two-pane settings UI. + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + public static class GeneralPreferenceFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.pref_general); + setHasOptionsMenu(true); + + // Bind the summaries of EditText/List/Dialog/Ringtone preferences + // to their values. When their values change, their summaries are + // updated to reflect the new value, per the Android Design + // guidelines. + bindPreferenceSummaryToValue(findPreference("example_text")); + bindPreferenceSummaryToValue(findPreference("example_list")); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == android.R.id.home) { + startActivity(new Intent(getActivity(), Settings.class)); + return true; + } + return super.onOptionsItemSelected(item); + } + } + + /** + * This fragment shows notification preferences only. It is used when the + * activity is showing a two-pane settings UI. + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + public static class NotificationPreferenceFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.pref_notification); + setHasOptionsMenu(true); + + // Bind the summaries of EditText/List/Dialog/Ringtone preferences + // to their values. When their values change, their summaries are + // updated to reflect the new value, per the Android Design + // guidelines. + bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone")); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == android.R.id.home) { + startActivity(new Intent(getActivity(), Settings.class)); + return true; + } + return super.onOptionsItemSelected(item); + } + } + + /** + * This fragment shows data and sync preferences only. It is used when the + * activity is showing a two-pane settings UI. + */ + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + public static class DataSyncPreferenceFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.pref_data_sync); + setHasOptionsMenu(true); + + // Bind the summaries of EditText/List/Dialog/Ringtone preferences + // to their values. When their values change, their summaries are + // updated to reflect the new value, per the Android Design + // guidelines. + bindPreferenceSummaryToValue(findPreference("sync_frequency")); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == android.R.id.home) { + startActivity(new Intent(getActivity(), Settings.class)); + return true; + } + return super.onOptionsItemSelected(item); + } + } + + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Setting_to_Menu = new Intent(Settings.this, Menu.class); + startActivity(intent_Setting_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/User.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/User.java new file mode 100644 index 0000000..089644f --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/User.java @@ -0,0 +1,26 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.widget.Button; + +public class User extends AppCompatActivity { + private Button mReturnButton; //没有使用到 + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.user); + mReturnButton = (Button)findViewById(R.id.returnback); + + } + public void back_to_login(View view) { + //setContentView(R.layout.login); + Intent intent3 = new Intent(User.this,Login.class) ; + startActivity(intent3); + finish(); + + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserData.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserData.java new file mode 100644 index 0000000..b06d047 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserData.java @@ -0,0 +1,49 @@ +package me.wshuo.tbot; +/** + * Created by FoolishFan on 2016/7/14. + */ + +public class UserData { + private String userName; //用户名 + private String userPwd; //用户密码 + private int userId; //用户ID号 + public int pwdresetFlag=0; + //获取用户名 + public String getUserName() { //获取用户名 + return userName; + } + //设置用户名 + public void setUserName(String userName) { //输入用户名 + this.userName = userName; + } + //获取用户密码 + public String getUserPwd() { //获取用户密码 + return userPwd; + } + //设置用户密码 + public void setUserPwd(String userPwd) { //输入用户密码 + this.userPwd = userPwd; + } + //获取用户id + public int getUserId() { //获取用户ID号 + return userId; + } + //设置用户id + public void setUserId(int userId) { //设置用户ID号 + this.userId = userId; + } + + /* public UserData(String userName, String userPwd, int userId) { //用户信息 + super(); + this.userName = userName; + this.userPwd = userPwd; + this.userId = userId; + }*/ + + public UserData(String userName, String userPwd) { //这里只采用用户名和密码 + super(); + this.userName = userName; + this.userPwd = userPwd; + } + +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserDataManager.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserDataManager.java new file mode 100644 index 0000000..535a8f5 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/UserDataManager.java @@ -0,0 +1,157 @@ +package me.wshuo.tbot; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.SQLException; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.util.Log; + +public class UserDataManager { //用户数据管理类 + //一些宏定义和声明 + private static final String TAG = "UserDataManager"; + private static final String DB_NAME = "user_data"; + private static final String TABLE_NAME = "users"; + public static final String ID = "_id"; + public static final String USER_NAME = "user_name"; + //public static final String USER_PWD = "user_pwd"; + public static final String USER_PWD = getEncryptedPass();//write by ljw +// public static final String SILENT = "silent"; +// public static final String VIBRATE = "vibrate"; + private static final int DB_VERSION = 2; + private Context mContext = null; + + //创建用户book表 + private static final String DB_CREATE = "CREATE TABLE " + TABLE_NAME + " (" + + ID + " integer primary key," + USER_NAME + " varchar," + + USER_PWD + " varchar" + ");"; + + private SQLiteDatabase mSQLiteDatabase = null; + private DataBaseManagementHelper mDatabaseHelper = null; + + //DataBaseManagementHelper继承自SQLiteOpenHelper + private static class DataBaseManagementHelper extends SQLiteOpenHelper { + + DataBaseManagementHelper(Context context) { + super(context, DB_NAME, null, DB_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + Log.i(TAG,"db.getVersion()="+db.getVersion()); + db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME + ";"); + db.execSQL(DB_CREATE); + Log.i(TAG, "db.execSQL(DB_CREATE)"); + Log.e(TAG, DB_CREATE); + } + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + Log.i(TAG, "DataBaseManagementHelper onUpgrade"); + onCreate(db); + } + } + + public UserDataManager(Context context) { + mContext = context; + Log.i(TAG, "UserDataManager construction!"); + } + //打开数据库 + public void openDataBase() throws SQLException { + mDatabaseHelper = new DataBaseManagementHelper(mContext); + mSQLiteDatabase = mDatabaseHelper.getWritableDatabase(); + } + //关闭数据库 + public void closeDataBase() throws SQLException { + mDatabaseHelper.close(); + } + //添加新用户,即注册 + public long insertUserData(UserData userData) { + String userName=userData.getUserName(); + String userPwd=userData.getUserPwd(); + ContentValues values = new ContentValues(); + values.put(USER_NAME, userName); + values.put(USER_PWD, userPwd); + return mSQLiteDatabase.insert(TABLE_NAME, ID, values); + } + //更新用户信息,如修改密码 + public boolean updateUserData(UserData userData) { + //int id = userData.getUserId(); + String userName = userData.getUserName(); + String userPwd = userData.getUserPwd(); + ContentValues values = new ContentValues(); + values.put(USER_NAME, userName); + values.put(USER_PWD, userPwd); + return mSQLiteDatabase.update(TABLE_NAME, values,null, null) > 0; + //return mSQLiteDatabase.update(TABLE_NAME, values, ID + "=" + id, null) > 0; + } + // + public Cursor fetchUserData(int id) throws SQLException { + Cursor mCursor = mSQLiteDatabase.query(false, TABLE_NAME, null, ID + + "=" + id, null, null, null, null, null); + if (mCursor != null) { + mCursor.moveToFirst(); //找到了用户数据所在的条目,游标移动到该条数据开始处 + } + return mCursor; + } + // + public Cursor fetchAllUserDatas() { + return mSQLiteDatabase.query(TABLE_NAME, null, null, null, null, null, + null); + } + //根据id删除用户 + public boolean deleteUserData(int id) { + return mSQLiteDatabase.delete(TABLE_NAME, ID + "=" + id, null) > 0; + } + //根据用户名注销 + public boolean deleteUserDatabyname(String name) { + return mSQLiteDatabase.delete(TABLE_NAME, USER_NAME + "=" + name, null) > 0; + } + //删除所有用户 + public boolean deleteAllUserDatas() { + return mSQLiteDatabase.delete(TABLE_NAME, null, null) > 0; + } + + //???? + public String getStringByColumnName(String columnName, int id) { + Cursor mCursor = fetchUserData(id); + int columnIndex = mCursor.getColumnIndex(columnName); + String columnValue = mCursor.getString(columnIndex); + mCursor.close(); + return columnValue; + } + // + + public boolean updateUserDataById(String columnName, int id, + String columnValue) { + ContentValues values = new ContentValues(); + values.put(columnName, columnValue); + return mSQLiteDatabase.update(TABLE_NAME, values, ID + "=" + id, null) > 0; + } + //根据用户名找用户,可以判断注册时用户名是否已经存在 + public int findUserByName(String userName){ + Log.i(TAG,"findUserByName , userName="+userName); + int result=0; + Cursor mCursor=mSQLiteDatabase.query(TABLE_NAME, null, USER_NAME+"="+userName, null, null, null, null); + if(mCursor!=null){ + result=mCursor.getCount(); + mCursor.close(); + Log.i(TAG,"findUserByName , result="+result); + } + return result; + } + //根据用户名和密码找用户,用于登录 + public int findUserByNameAndPwd(String userName,String pwd){ + Log.i(TAG,"findUserByNameAndPwd"); + int result=0; + Cursor mCursor=mSQLiteDatabase.query(TABLE_NAME, null, USER_NAME+"="+userName+" and "+USER_PWD+"="+pwd, + null, null, null, null); + if(mCursor!=null){ + result=mCursor.getCount(); + mCursor.close(); + Log.i(TAG,"findUserByNameAndPwd , result="+result); + } + return result; + } + +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/VideoObserve.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/VideoObserve.java new file mode 100644 index 0000000..d33bf51 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/VideoObserve.java @@ -0,0 +1,35 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class VideoObserve extends AppCompatActivity { + + public Button btnVideoReturn; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_video_observe); + btnVideoReturn = (Button)findViewById(R.id.btnVideoReturn); + btnVideoReturn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Video_to_Menu = new Intent(VideoObserve.this, Menu.class); + startActivity(intent_Video_to_Menu); + finish(); + } + }); + } + + @Override + public void onBackPressed() {//当点击后退键时执行该函数 + + super.onBackPressed(); + Intent intent_Video_to_Menu = new Intent(VideoObserve.this, Menu.class); + startActivity(intent_Video_to_Menu); + finish(); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Welcome.java b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Welcome.java new file mode 100644 index 0000000..7d09903 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/java/me/wshuo/tbot/Welcome.java @@ -0,0 +1,26 @@ +package me.wshuo.tbot; + +import android.content.Intent; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; + +public class Welcome extends AppCompatActivity { + + public Button btnWelcome; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_welcome); + btnWelcome = (Button)findViewById(R.id.btnWelcome); + btnWelcome.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent_Welcome_to_IPConnect = new Intent(Welcome.this, IPConnect.class); + startActivity(intent_Welcome_to_IPConnect); + finish(); + } + }); + } +} diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/button_style.xml b/src/AndroidApp/Tbot/app/src/main/res/drawable/button_style.xml new file mode 100644 index 0000000..82c1e3f --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/res/drawable/button_style.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_info_black_24dp.xml b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_info_black_24dp.xml new file mode 100644 index 0000000..34b8202 --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_info_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 0000000..e3400cf --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_sync_black_24dp.xml b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_sync_black_24dp.xml new file mode 100644 index 0000000..5a283aa --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/res/drawable/ic_sync_black_24dp.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/ip.png b/src/AndroidApp/Tbot/app/src/main/res/drawable/ip.png new file mode 100644 index 0000000..1829fe2 Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/ip.png differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/logo.jpg b/src/AndroidApp/Tbot/app/src/main/res/drawable/logo.jpg new file mode 100644 index 0000000..49936c4 Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/logo.jpg differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/w1.png b/src/AndroidApp/Tbot/app/src/main/res/drawable/w1.png new file mode 100644 index 0000000..d48d35b Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/w1.png differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/w2.png b/src/AndroidApp/Tbot/app/src/main/res/drawable/w2.png new file mode 100644 index 0000000..57050e3 Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/w2.png differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/w3.png b/src/AndroidApp/Tbot/app/src/main/res/drawable/w3.png new file mode 100644 index 0000000..cdbf764 Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/w3.png differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/drawable/w4.png b/src/AndroidApp/Tbot/app/src/main/res/drawable/w4.png new file mode 100644 index 0000000..84b9984 Binary files /dev/null and b/src/AndroidApp/Tbot/app/src/main/res/drawable/w4.png differ diff --git a/src/AndroidApp/Tbot/app/src/main/res/layout/activity_audio_call.xml b/src/AndroidApp/Tbot/app/src/main/res/layout/activity_audio_call.xml new file mode 100644 index 0000000..934f95f --- /dev/null +++ b/src/AndroidApp/Tbot/app/src/main/res/layout/activity_audio_call.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/hidden.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/hidden.xml new file mode 100644 index 0000000..28b0414 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/hidden.xml @@ -0,0 +1,4 @@ + + + diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history.xml new file mode 100644 index 0000000..ffa8d6f --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_cell.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_cell.xml new file mode 100644 index 0000000..4688e25 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_cell.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_detail.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_detail.xml new file mode 100644 index 0000000..d51fbb9 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/history_detail.xml @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app.xml new file mode 100644 index 0000000..c2a93ed --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_list.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_list.xml new file mode 100644 index 0000000..d4f9574 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_list.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_purchase_item.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_purchase_item.xml new file mode 100644 index 0000000..f9ca899 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_purchase_item.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_store.xml b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_store.xml new file mode 100644 index 0000000..cccaf05 --- /dev/null +++ b/src/AndroidApp/android_remocons/rocon_remocon/src/main/res/layout/in_app_store.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + +