Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/java/com/example/PersonalCenter/SearchServiceGet.java
#	app/src/main/res/values/strings.xml
master
hanxueqing 5 years ago
commit 174d6190c7

@ -14,11 +14,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".SearchEntryActivity" />
<activity android:name=".PersonalityCenterActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".RegisterActivity" />
<activity android:name="com.example.SearchCenter.SearchEntryActivity"/>
<activity android:name="com.example.PersonalCenter.Login_Register.LoginActivity"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

@ -0,0 +1,17 @@
package com.example.PersonalCenter;
import android.view.animation.LinearInterpolator;
public class JellyInterpolator extends LinearInterpolator {
private float factor;
public JellyInterpolator() {
this.factor = 0.15f;
}
@Override
public float getInterpolation(float input) {
return (float) (Math.pow(2, -10 * input)
* Math.sin((input - factor / 4) * (2 * Math.PI) / factor) + 1);
}
}

@ -1,27 +0,0 @@
//package com.example.PersonalCenter;
//
//import android.util.Log;
//
//public class Login {
//
// private String password;
// private String phonenumber;
// public Login(String phonenumber,String password){
//
// this.password = password;
// this.phonenumber = phonenumber;
//
// }
// public String connUser(){
// String infoString = WebServiceGet.executeHttpGet(phonenumber,password,"/Login");
//// if(infoString.equals("false")){
//// Log.i("Login","+++++++++++fail"+infoString);
//// }else {
//// Log.i("Login","+++++++++++successs"+infoString);
//// }
// //登录成功后返回用户名
// while(infoString==null){}
// Log.i("sucesss",infoString+"ha");
// return infoString;
// }
//}

@ -0,0 +1,252 @@
package com.example.PersonalCenter.Login_Register;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.example.PersonalCenter.JellyInterpolator;
import com.example.Util.ReturnData;
import com.example.Util.User;
import com.example.Util.cmkgWebServiceGet;
import com.example.Util.publicStringUtil;
import com.example.cmknowledgegraph.R;
import java.lang.ref.WeakReference;
public class LoginActivity extends AppCompatActivity implements View.OnClickListener {
private TextView mBtnLogin;
private View progress;
private View mInputLayout;
private float mWidth, mHeight;
private LinearLayout mName, mPsw;
private final LoginHandler loginHandler = new LoginHandler(this);
//静态内部类,防止内存泄漏
public static class LoginHandler extends Handler{
private final WeakReference<LoginActivity> weakReference;
LoginHandler(LoginActivity activity){
this.weakReference = new WeakReference<LoginActivity>(activity);
}
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
LoginActivity loginActivity = (LoginActivity) weakReference.get();
Bundle bundle = msg.getData();
ReturnData messageJSON = (ReturnData) bundle.getSerializable("msg");
String ReturnUsername = (String) messageJSON.getData();
User.setLogin(true);
User.getUser().setUsername(ReturnUsername);
try {
Thread.sleep(300);
loginActivity.finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login);
initView();
}
public void initView(){
mBtnLogin = (TextView) findViewById(R.id.main_btn_login);
progress = findViewById(R.id.layout_progress);
mInputLayout = findViewById(R.id.input_layout);
mName = (LinearLayout) findViewById(R.id.id_edit);
mPsw = (LinearLayout) findViewById(R.id.password_edit);
//给登录设置监听
//给登陆功能设置设置监听
mBtnLogin.setOnClickListener(this);
}
@Override
public void onClick(View v) {
//异步处理消息请求
int viewID = v.getId();
switch (viewID){
case R.id.main_btn_login:
//登录
//根据监听的不同内容,来改变响应状态
// 计算出控件的高与宽
mWidth = mBtnLogin.getMeasuredWidth();
mHeight = mBtnLogin.getMeasuredHeight();
// 隐藏输入框
mName.setVisibility(View.INVISIBLE);
mPsw.setVisibility(View.INVISIBLE);
//调入动画
inputAnimator(mInputLayout, mWidth, mHeight);
//如果登录成功
//获取手机号和密码
EditText phonenumberEditText = (EditText) mName.getChildAt(1);
EditText passwordEditText = (EditText) mPsw.getChildAt(1);
if(phonenumberEditText==null||phonenumberEditText.getText().toString().equals("")){
//请输入用户名
Toast.makeText(this, "请输入电话号码", Toast.LENGTH_SHORT).show();
}else if(passwordEditText==null||passwordEditText.getText().toString().equals("")){
//请输入密码
Toast.makeText(this, "请输入密码", Toast.LENGTH_SHORT).show();
}else{
String phonenumber = phonenumberEditText.getText().toString();
String password = passwordEditText.getText().toString();
if(phonenumber.length()!=11){
Toast.makeText(this,"请输入11位电话号码",Toast.LENGTH_SHORT).show();
}else {
// 基本没错误,就要请求登陆了
new Thread(new Runnable() {
@Override
public void run() {
String argslogin = "phonenumber="+phonenumber+"&password="+password;
ReturnData retuData = cmkgWebServiceGet.executeHttpGet(argslogin, publicStringUtil.loginURL);
Log.i("returndat--", "-----" + retuData);
Message m = new Message();
Bundle b = new Bundle();
b.putSerializable("msg",retuData);
m.setData(b);
loginHandler.sendMessage(m);
}
}).start();
}
}
break;
case R.id.main_title:
//注册
}
}
//设置输入框动画效果
private void inputAnimator(final View view, float w, float h){
AnimatorSet set = new AnimatorSet();
ValueAnimator animator = ValueAnimator.ofFloat(0, w);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (Float) animation.getAnimatedValue();
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view
.getLayoutParams();
params.leftMargin = (int) value;
params.rightMargin = (int) value;
view.setLayoutParams(params);
}
});
ObjectAnimator animator2 = ObjectAnimator.ofFloat(mInputLayout,
"scaleX", 1f, 0.5f);
set.setDuration(1000);
set.setInterpolator(new AccelerateDecelerateInterpolator());
set.playTogether(animator, animator2);
set.start();
set.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
/**
*
*/
progress.setVisibility(View.VISIBLE);
progressAnimator(progress);
mInputLayout.setVisibility(View.INVISIBLE);
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
}
private void progressAnimator(final View view) {
PropertyValuesHolder animator = PropertyValuesHolder.ofFloat("scaleX",
0.5f, 1f);
PropertyValuesHolder animator2 = PropertyValuesHolder.ofFloat("scaleY",
0.5f, 1f);
ObjectAnimator animator3 = ObjectAnimator.ofPropertyValuesHolder(view,
animator, animator2);
animator3.setDuration(1000);
animator3.setInterpolator(new JellyInterpolator());
animator3.start();
}
//登录错误,恢复初始状态
private void recovery() {
progress.setVisibility(View.GONE);
mInputLayout.setVisibility(View.VISIBLE);
mName.setVisibility(View.VISIBLE);
mPsw.setVisibility(View.VISIBLE);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mInputLayout.getLayoutParams();
params.leftMargin = 0;
params.rightMargin = 0;
mInputLayout.setLayoutParams(params);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(mInputLayout, "scaleX", 0.5f,1f );
animator2.setDuration(500);
animator2.setInterpolator(new AccelerateDecelerateInterpolator());
animator2.start();
}
}

@ -1,4 +1,4 @@
package com.example.cmknowledgegraph;
package com.example.PersonalCenter;
import android.content.Intent;
import android.os.Bundle;
@ -6,10 +6,13 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import androidx.fragment.app.Fragment;
import com.example.PersonalCenter.Login_Register.LoginActivity;
import com.example.Util.User;
import com.example.cmknowledgegraph.R;
public class PersonContent extends Fragment {
@ -26,9 +29,9 @@ public class PersonContent extends Fragment {
login_pc_btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//跳转到LoginActivity
if(!LoginActivity.isLogin){
if(!User.isLogin){
Intent intent=new Intent();
intent.setClass(getActivity(),LoginActivity.class);
intent.setClass(getActivity(), LoginActivity.class);
startActivity(intent);
}
}
@ -38,9 +41,9 @@ public class PersonContent extends Fragment {
@Override
public void onResume() {
super.onResume();
if(LoginActivity.isLogin){
if(User.isLogin){
Button longin_pc_btn=(Button) getActivity().findViewById(R.id.login_pc_button);
longin_pc_btn.setText("Hello"+LoginActivity.username);
longin_pc_btn.setText("Hello"+User.getUser().getUsername());
}
//高血压

@ -1,20 +0,0 @@
//package com.example.PersonalCenter;
//
//public class Register {
// String phonenumber;
// String username;
// String password;
// public Register(String phonenumber, String username, String password){
// this.phonenumber = phonenumber;
// this.username = username;
// this.password = password;
// }
// public boolean regist(){
// String regRet = WebServicePost.execuHttpPost(username, phonenumber, password,"/Register");
// if(regRet.equals("true")){
// return true;
// }else {
// return false;
// }
// }
//}

@ -1,47 +0,0 @@
//package com.example.PersonalCenter;
//
//import android.util.Log;
//
//import com.hankcs.hanlp.HanLP;
//
//import java.lang.reflect.Array;
//import java.util.ArrayList;
//import java.util.HashSet;
//import java.util.List;
//import java.util.Set;
//
//public class Search {
// public String sickname;
// public Search(String sickname){
// this.sickname = sickname;
// }
//
// public List<Set<String>> search(){
// Log.i("search","sick执行了");
// //找出对应的8个关键字
// List<String> keywordList = HanLP.extractKeyword(sickname,8);
//
// //针对每一个sickname来查找一下能不能够找到相应的名字
// Set<String> mediciesSet = new HashSet<String>();
// Set<String> reasonsSet = new HashSet<String>();
// for(String i: keywordList){
// Log.i("关键词提取",i+"ha");
// String resq = SearchServiceGet.executeSearchGet(i,"/Search");
// String resq="dd";
// if(!resq.equals("fail")) {
// String[] me_rea = resq.split("-");
// String[] medicines = me_rea[0].split("\\|");
// for(String j: medicines) mediciesSet.add(j);
// String[] reasons = me_rea[1].split("\\|");
// for(String j: reasons) reasonsSet.add(j);
//
// }
// }
// List<Set<String>> a = new ArrayList<Set<String>>();
// a.add(mediciesSet);
// a.add(reasonsSet);
// return a;
//
//
// }
//}

@ -1,138 +0,0 @@
package com.example.PersonalCenter;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
public class SearchServiceGet {
public static ArrayList<String> content=new ArrayList<String>();//存储数据内容
public static String name_back;
public static boolean SearchSuccess=false;
public static int code;
public static void executeSearchGet(String name){
HttpURLConnection connection = null;
InputStream in = null;
String address="/rest/cmkg/question/hello";
String Url = "http://114.116.199.154:5000/cmkg"+address;
String path = Url + "?name="+name;
URL url = null;
try {
url = new URL(path);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(100000);//建立连接超时
connection.setReadTimeout(80000);//传输数据超时
in = connection.getInputStream();
BufferedReader reader = null;//输入流
String line = "";//读取返回的每一行
StringBuilder response = new StringBuilder();
try {
reader = new BufferedReader(new InputStreamReader(in));
while((line = reader.readLine()) != null) {
response.append(line);
}
//这时候response就是一个连续字符串了吧
Log.i("response+++++",response+"返回值");
System.out.println(response.toString());
//开始解析返回的数据
// JSONObject jo=JSONObject.fromObject(response.toString());
org.json.JSONObject jo = null;
try {
jo = new org.json.JSONObject(response.toString());
} catch (JSONException e) {
e.printStackTrace();
}
try {
code=jo.getInt("code");
} catch (JSONException e) {
e.printStackTrace();
}
System.out.println("code="+code);
if(code!=0){ //查询成功,在开始解析数据
System.out.println("code==@@@@@@@@@@20"+code);
try {
name_back=jo.getString("msg");//查询的主语
} catch (JSONException e) {
e.printStackTrace();
}
//把data看作一个JSONObject无论里面由多少元素都转换为JSONArray存在数组里
JSONObject jo_data= null;
try {
jo_data = jo.getJSONObject("data");
if(jo_data==null) System.out.println(("jo_data==null"));
else System.out.println("jo_data!=null");
} catch (JSONException e) {
e.printStackTrace();
}
// JSONArray data_arr=new JSONArray();
ArrayList<String> datas=new ArrayList<String>();
try {
// jo_data.toJSONArray(data_arr);
datas.add(jo_data.toString());
// data_arr=jo.getJSONArray("data");
// System.out.println("data_arr======"+data_arr.length());
} catch (Exception e) {
e.printStackTrace();
}
//遍历data_arr把里面的数据放入ArrayList<String> content里
for(int i=0;i<datas.size();i++){
try {
content.add(datas.get(i));
} catch (Exception e) {
e.printStackTrace();
}
}
SearchSuccess=true;//查找成功标志
}
// return content;
} catch (IOException e) {
e.printStackTrace();
}finally {
if(reader!=null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// return "";
}
public static void exxcuteTest(String name){
code=100;
name_back="糖尿病";
content.add("莲子粥");
content.add("推拿法");
content.add("大蒜蒸西瓜");
content.add("红枣糕");
// content.add("00");
}
}

@ -90,7 +90,7 @@ public class SearchContent extends Fragment {
@Override
public void run() {
ReturnData response = cmkgWebServiceGet.executeHttpGet(inputContentArgs,publicStringUtil.questionSearchURL);
// SearchServiceGet.exxcuteTest(inputContent);
//构建消息将消息交给handle处理
Message m = new Message();
Bundle bundle = new Bundle();
@ -105,8 +105,6 @@ public class SearchContent extends Fragment {
}
}).start();
// SearchServiceGet.exxcuteTest(inputContent);
// //执行到这里已经把data里的数据取出来了或没有但是都要跳转页面到SearchEntryActivity页面
}
});

@ -0,0 +1,94 @@
package com.example.Util;
/*
* User
*
*
*
* */
public class User {
private static User user;//保存某一个用户
private String phonenumber;
private String username;
private String region;
private String sex;
private Long age;
public static boolean isLogin = false;//是否登录
private User(){}
public static synchronized User getUser(){
if (user==null){
user = new User();
}
return user;
}
public static void setUser(String phonenumber, String username, String region, String sex, Long age) {
user.setAge(age);
user.setRegion(region);
user.setPhonenumber(phonenumber);
user.setUsername(username);
user.setSex(sex);
}
//设置登录状态
public static void setLogin(boolean login) {
isLogin = login;
}
//获取登录状态
public static boolean isLogin() {
return isLogin;
}
//注销
public static void logoff(){
user.setAge(null);
user.setRegion(null);
user.setPhonenumber(null);
user.setUsername(null);
user.setSex(null);
user = null;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public void setUsername(String username) {
this.username = username;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setSex(String sex) {
this.sex = sex;
}
public void setAge(Long age) {
this.age = age;
}
public String getPhonenumber() {
return phonenumber;
}
public String getUsername() {
return username;
}
public String getSex() {
return sex;
}
public Long getAge() {
return age;
}
}

@ -24,6 +24,7 @@ public class cmkgWebServiceGet {
InputStream in = null;
String path = publicStringUtil.cmkgTomcatURL+address+args;
Log.i("path-=",path);
URL url = null;
try {
url = new URL(path);

@ -1,114 +0,0 @@
package com.example.cmknowledgegraph;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
//import com.example.PersonalCenter.Login;
public class LoginActivity extends AppCompatActivity {
public static String username;
public static int usersuccess = 0;
public static boolean isLogin=false;//登录属性true登陆成功false未登录
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
final EditText tel_edit=findViewById(R.id.id_edit);
final EditText password_edit=findViewById(R.id.password_edit);
/**
* (int)(string)
*/
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.activity_personality_center, null);
final Button welcom_btn= layout.findViewById(R.id.welcom_btn);
final Button login_btn=findViewById(R.id.login_btn);
login_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(tel_edit==null||tel_edit.getText().toString().equals("")){
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
builder.setTitle("登录失败");// 设置标题
builder.setMessage("请输入电话号码");// 为对话框设置内容
builder.create().show();// 使用show()方法显示对话框
}else if(password_edit==null||password_edit.getText().toString().equals("")){
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
builder.setTitle("登录失败");// 设置标题
builder.setMessage("请输入密码");// 为对话框设置内容
builder.create().show();// 使用show()方法显示对话框
}else {
//获取手机号和密码
String tel = tel_edit.getText().toString().trim();
String password = password_edit.getText().toString();
//调用数据库类中的方法进行登录
// boolean isLogin= OperaSchema.longin(tel,password);//原来的数据库
// final Login login = new Login(tel, password);
//
// new Thread(new Runnable() {
// @Override
// public void run() {
// LoginActivity.username = login.connUser();
// LoginActivity.usersuccess = 1;
// Log.i("登录", "登录有没有问题" + username + "oooo");
//
// }
// }).start();
// 气虚质怎噩梦治
/**
*
*
*/
while (LoginActivity.usersuccess == 0) {
Log.i("suersuer======", "dkie" + LoginActivity.usersuccess);
}
if (!LoginActivity.username.equals("")) {
//改变个人中心的登录状态,
isLogin=true;
finish();//返回个人中心Activity
//刷新个人中心Activity
Log.i("成功", "成功了");
} else {//登陆失败提醒
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
builder.setTitle("登陆提醒");// 设置标题
builder.setMessage("登陆失败");// 为对话框设置内容
builder.create().show();// 使用show()方法显示对话框
Log.i("失败", "失败了");
}
LoginActivity.username = "";
LoginActivity.usersuccess = 0;
}
}
});
//TextView注册跳转
TextView register_text=findViewById(R.id.register_text);
register_text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//跳转到注册页面
// Intent intent=new Intent();
// intent.setClass(LoginActivity.this,RegisterActivity.class);
// startActivity(intent);
}
});
}
}

@ -2,6 +2,7 @@ package com.example.cmknowledgegraph;
import android.os.Bundle;
import com.example.PersonalCenter.PersonContent;
import com.example.cmknowledgegraph.MainContent;
import com.example.SearchCenter.SearchContent;
import com.google.android.material.bottomnavigation.BottomNavigationView;

@ -1,22 +0,0 @@
package com.example.cmknowledgegraph;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class PersonalityCenterActivity extends AppCompatActivity {
@SuppressLint("LongLogTag")
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i("PersonalityCenterActivity","个人中心");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_personality_center);
}
}

@ -1,102 +0,0 @@
//package com.example.cmknowledgegraph;
//
//import android.content.DialogInterface;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.View;
//import android.widget.Button;
//import android.widget.EditText;
//
//import androidx.appcompat.app.AlertDialog;
//import androidx.appcompat.app.AppCompatActivity;
//
//import com.example.PersonalCenter.Register;
//
//
//public class RegisterActivity extends AppCompatActivity {
// public static int regester = 0;
// public static boolean isRegister;
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_register);
//
// final EditText tel_edit=findViewById(R.id.tel_register_edit);
// final EditText password_edit=findViewById(R.id.password_register_edit);
// final EditText nickname_edit=findViewById(R.id.nickname_register_edit);
//
// /**
// * 注册按钮传递参数手机号int密码(string),昵称(string)
// */
// Button register =findViewById(R.id.register_btn);
// register.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// if(tel_edit==null||tel_edit.getText().toString().equals("")){
// AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
// builder.setTitle("注册失败");// 设置标题
// builder.setMessage("请输入电话号码");// 为对话框设置内容
// builder.create().show();// 使用show()方法显示对话框
// }else if (password_edit==null||password_edit.getText().toString().equals("")){
// AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
// builder.setTitle("注册失败");// 设置标题
// builder.setMessage("请输入密码");// 为对话框设置内容
// builder.create().show();// 使用show()方法显示对话框
// }else if(nickname_edit==null||nickname_edit.getText().toString().equals("")){
// AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
// builder.setTitle("注册失败");// 设置标题
// builder.setMessage("请输入用户名");// 为对话框设置内容
// builder.create().show();// 使用show()方法显示对话框
// }else {
// //获取手机号,密码,昵称
// String tel = tel_edit.getText().toString().trim();
// String password = password_edit.getText().toString();
// String NickName = nickname_edit.getText().toString();
// //调用数据库类方法进行注册
//// boolean isRegister= OperaSchema.register(tel,NickName,password);//原来的数据连接
// final Register register = new Register(tel, NickName, password);
//
// new Thread(new Runnable() {
// @Override
// public void run() {
// RegisterActivity.isRegister = register.regist();
// Log.i("hahaaha", "注册成功了吗" + isRegister);
// RegisterActivity.regester = 1;
// }
// }).start();
// while (RegisterActivity.regester == 0) {
// Log.i("rererer======", "dsd" + RegisterActivity.regester);
// }
// if (RegisterActivity.isRegister) {
// //注册成功,对话框提醒
// AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
// builder.setTitle("注册提醒");// 设置标题
// // builder.setIcon(R.drawable.ic_launcher);//设置图标
// builder.setMessage("注册成功");// 为对话框设置内容
// builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
//
// @Override
// public void onClick(DialogInterface arg0, int arg1) {
// // TODO Auto-generated method stub
// //返回登录页面
// finish();
// }
// });
// builder.create().show();// 使用show()方法显示对话框
// } else {//注册失败
// //注册失败提醒
// Log.i("zh==-----==--==", "kidoosloe");
// AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this);
// builder.setTitle("注册提醒");// 设置标题
// // builder.setIcon(R.drawable.ic_launcher);//设置图标
// builder.setMessage("注册失败");// 为对话框设置内容
// builder.create().show();
// }
// RegisterActivity.regester = 0;
// RegisterActivity.isRegister = false;
// }
//
// }
// });
// }
//}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="5dip"/>
<solid android:color="#ffffff"/>
</shape>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<corners android:radius="60dip" />
<solid android:color="#ffffff" />
</shape>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
>
<corners android:radius="50dip"/>
<stroke
android:width="1dip"
android:color="#ffffff" />
</shape>

@ -1,91 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".LoginActivity">
android:background="#7adfb8"
tools:context=".LoginActivity" >
<!--登录的页面-->
<include
android:id="@+id/main_title"
layout="@layout/title_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_marginLeft="60dp">
android:layout_below="@+id/main_title"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv_avatar_login"
android:layout_width="70dip"
android:layout_height="70dip"
android:layout_gravity="center_horizontal"
android:src="@drawable/project_detail_cir" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账号"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="20dp"
android:textColor="#35302D"/>
<EditText
android:id="@+id/id_edit"
android:layout_width="250dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:inputType="number"/>
android:layout_marginTop="5dip"
android:gravity="center"
android:text="FIREFLY FOREST"
android:textColor="#ffffff"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="60dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="20dp"
android:textColor="#8B4513"/>
<EditText
android:id="@+id/password_edit"
android:layout_width="250dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:inputType="textPassword"/>
android:gravity="center"
android:text="SHOW YOUR IDEAS"
android:textColor="#ffffff"
android:textSize="16sp" />
</LinearLayout>
<Button
android:id="@+id/login_btn"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:text="登录"
android:textSize="20dp"
android:background="#FFDAB9"
android:layout_marginTop="30dp"
android:layout_marginLeft="70dp"/>
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="忘记密码?"
android:textSize="15dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="70dp"
android:textColor="#8B4513"/>
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<include
android:id="@+id/input_layout"
android:layout_width="match_parent"
android:layout_height="250dip"
layout="@layout/input_layout" />
<include
android:id="@+id/layout_progress"
android:layout_width="match_parent"
android:layout_height="130dip"
layout="@layout/layout_progress"
android:visibility="gone" />
<TextView
android:id="@+id/register_text"
android:id="@+id/main_btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textSize="17dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="180dp"
android:textColor="#8B4513"/>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/login_pic"/>
android:layout_below="@+id/input_layout"
android:layout_centerInParent="true"
android:layout_marginTop="15dip"
android:background="@drawable/text_bg"
android:gravity="center"
android:paddingBottom="2dip"
android:paddingLeft="15dip"
android:paddingRight="15dip"
android:paddingTop="2dip"
android:text="Login"
android:textColor="#ffffff"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

@ -18,6 +18,7 @@
android:layout_marginLeft="80dp"
android:layout_marginTop="10dp"
android:paddingBottom="15dp"
android:elevation="10dp"
android:text="糖尿病怎么办"
android:textColor="#C0C0C0"
android:textSize="40px"

@ -0,0 +1,71 @@
<?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="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dip"
android:background="@drawable/radius_drawable_bg"
android:orientation="vertical"
android:padding="20dip" >
<LinearLayout
android:id="@+id/id_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/paw_code" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:background="#00000000"
android:hint="请输入手机号"
android:textColor="@color/cyan"
android:padding="5dip"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="10px"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:background="#eeeeee" />
<LinearLayout
android:id="@+id/password_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/paw_left" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:background="#00000000"
android:hint="密码"
android:inputType="textPassword"
android:padding="5dip"
android:textSize="16sp"
android:textColor="@color/cyan"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,23 @@
<?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="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="20dip"
android:background="@drawable/rotate_layout_bg"
android:orientation="vertical"
android:padding="10dip" >
<ProgressBar
android:id="@+id/progressBar2"
android:layout_width="wrap_content"
android:layout_margin="10dip"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dip"
android:gravity="center_vertical"
android:padding="10dip" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textSize="20sp"
android:text="Sign up"
/>
</RelativeLayout>

@ -3,11 +3,12 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="accent_color">#3F51B5</color>
<color name="text_black">#000000</color>
<!-- A light Holo shade of blue -->
<color name="navigationBarColor">@android:color/black</color>
<color name="drawerArrowColor">@android:color/white</color>
<color name="cyan">#00BCD4</color>
<!-- A light Holo shade of blue -->
<color name="holo_blue_light">#ff33b5e5</color>
<!-- A light Holo shade of gray -->
<color name="holo_gray_light">#33999999</color>

@ -1,4 +1,3 @@
<resources>
<string name="app_name">CMKnowledgeGraph</string>
<string name="associate">你可能感兴趣</string>
<!-- <string name="app_name">CMKnowledgeGraph</string>-->
</resources>

@ -1,13 +1,51 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">-->
<!-- &lt;!&ndash; Customize your theme here. &ndash;&gt;-->
<!-- <item name="colorPrimary">#ffffff</item>-->
<!-- <item name="colorPrimaryDark">#ffffff</item>-->
<!-- <item name="colorAccent">#ffffff</item>-->
<!-- </style>-->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
<!-- Customize your theme here. -->
<!-- <item name="colorPrimary">@color/colorPrimary</item>-->
<!-- <item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
<!-- <item name="colorAccent">@color/colorAccent</item>-->
<item name="android:textColorPrimary">@android:color/white</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:windowTranslucentStatus" tools:targetApi="21">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Toolbar Theme / Apply white arrow -->
<item name="colorControlNormal">@android:color/white</item>
<item name="actionBarTheme">@style/AppTheme.ActionBarTheme</item>
<!-- Material Theme -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">@color/accent_color</item>
<item name="android:navigationBarColor" tools:targetApi="21">@color/navigationBarColor</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>
</style>
<style name="AppTheme.ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<!-- White arrow -->
<item name="colorControlNormal">@android:color/white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/drawerArrowColor</item>
</style>
<style name="scores_item_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>

Loading…
Cancel
Save