Compare commits

..

13 Commits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 KiB

Binary file not shown.

Binary file not shown.

@ -31,5 +31,15 @@
<option name="name" value="maven" />
<option name="url" value="https://dl.bintray.com/chaozhouzhang/maven" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="http://mvn.mob.com/android" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://plugins.gradle.org/m2/" />
</remote-repository>
</component>
</project>

@ -53,4 +53,57 @@ dependencies {
implementation 'com.yayandroid:LocationManager:2.0.4'
}
apply plugin: 'com.mob.sdk'
MobSDK {
appKey "333a5040d655e"
appSecret "5a716e21919710cf4bc052d1fe3c9a69"
// fp true//
ShareSDK {
loopShare true
devInfo {
SinaWeibo {
appKey "568898243"
appSecret "38a4f8204cc784f81f9f0daaf31e02e3"
callbackUri "http://www.sharesdk.cn"
}
Wechat {
appId "wx4868b35061f87885"
appSecret "64020361b8ec4c99936c0e3999a9f249"
userName "gh_afb25ac019c9"
path "pages/index/index.html?id=1"
withShareTicket true
miniprogramType 2
}
QQ {
appId "100371282"
appKey "aed9b0303e3ed1e27bae87c33761161d"
}
ShortMessage {
enable true
}
Douyin {
appKey "aw9ivykfjvi4hpwo"
appSecret "42b4caa6bda60bd49f05f06d0a4956e1"
}
WhatsApp {
enable true
}
WechatMoments {
appId "wx4868b35061f87885"
appSecret "64020361b8ec4c99936c0e3999a9f249"
}
WechatFavorite {
appId "wx4868b35061f87885"
appSecret "64020361b8ec4c99936c0e3999a9f249"
}
QZone {
appId "100371282"
appKey "aed9b0303e3ed1e27bae87c33761161d"
}
}
}
SMSSDK {}
}

@ -9,6 +9,14 @@
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<!--允许联网 -->
<uses-permission android:name="android.permission.INTERNET" />
<!--获取GSM2g、WCDMA联通3g等网络状态的信息 -->
@ -67,10 +75,14 @@
android:name=".activities.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<service android:name="com.amap.api.location.APSService"></service>
<!-- <provider-->
<!-- android:name="cn.bmob.v3.util.BmobContentProvider"-->
@ -95,7 +107,7 @@
</service>
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTask"
android:launchMode="singleTop"
>
<intent-filter>
@ -141,28 +153,54 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.SMS">
<activity android:name=".activities.Location_Activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.Location_Activity">
<activity android:name=".activities.CheckPermissionsActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.CheckPermissionsActivity">
<activity android:name=".activities.Location_BackGround_Activity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.Location_BackGround_Activity">
<activity android:name=".activities.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.RegisterActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.SignActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activities.CountryCodeActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

@ -0,0 +1,127 @@
package com.example.luyin.activities;
public class CharacterParser {
private static int[] pyvalue = new int[] {-20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032,
-20026, -20002, -19990, -19986, -19982, -19976, -19805, -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, -19739, -19728,
-19725, -19715, -19540, -19531, -19525, -19515, -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275, -19270, -19263, -19261,
-19249, -19243, -19242, -19238, -19235, -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006, -19003, -18996, -18977, -18961,
-18952, -18783, -18774, -18773, -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697, -18696, -18526, -18518, -18501, -18490,
-18478, -18463, -18448, -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201, -18184, -18183, -18181, -18012, -17997, -17988,
-17970, -17964, -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752, -17733, -17730, -17721, -17703, -17701, -17697, -17692,
-17683, -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427, -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733,
-16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470, -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423, -16419,
-16412, -16407, -16403, -16401, -16393, -16220, -16216, -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158, -16155, -15959,
-15958, -15944, -15933, -15920, -15915, -15903, -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659, -15652, -15640, -15631,
-15625, -15454, -15448, -15436, -15435, -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369, -15363, -15362, -15183, -15180,
-15165, -15158, -15153, -15150, -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121, -15119, -15117, -15110, -15109, -14941,
-14937, -14933, -14930, -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902, -14894, -14889, -14882, -14873, -14871, -14857,
-14678, -14674, -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429, -14407, -14399, -14384, -14379, -14368, -14355, -14353,
-14345, -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135, -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094,
-14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907, -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847, -13831,
-13658, -13611, -13601, -13406, -13404, -13400, -13398, -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343, -13340, -13329,
-13326, -13318, -13147, -13138, -13120, -13107, -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888, -12875, -12871, -12860,
-12858, -12852, -12849, -12838, -12831, -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556, -12359, -12346, -12320, -12300,
-12120, -12099, -12089, -12074, -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798, -11781, -11604, -11589, -11536, -11358,
-11340, -11339, -11324, -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041, -11038, -11024, -11020, -11019, -11018, -11014,
-10838, -10832, -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, -10519, -10331, -10329, -10328, -10322, -10315, -10309,
-10307, -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254};
public static String[] pystr = new String[] {"a", "ai", "an", "ang", "ao", "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi", "bian",
"biao", "bie", "bin", "bing", "bo", "bu", "ca", "cai", "can", "cang", "cao", "ce", "ceng", "cha", "chai", "chan", "chang", "chao", "che",
"chen", "cheng", "chi", "chong", "chou", "chu", "chuai", "chuan", "chuang", "chui", "chun", "chuo", "ci", "cong", "cou", "cu", "cuan",
"cui", "cun", "cuo", "da", "dai", "dan", "dang", "dao", "de", "deng", "di", "dian", "diao", "die", "ding", "diu", "dong", "dou", "du",
"duan", "dui", "dun", "duo", "e", "en", "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu", "ga", "gai", "gan", "gang",
"gao", "ge", "gei", "gen", "geng", "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun", "guo", "ha", "hai", "han", "hang",
"hao", "he", "hei", "hen", "heng", "hong", "hou", "hu", "hua", "huai", "huan", "huang", "hui", "hun", "huo", "ji", "jia", "jian",
"jiang", "jiao", "jie", "jin", "jing", "jiong", "jiu", "ju", "juan", "jue", "jun", "ka", "kai", "kan", "kang", "kao", "ke", "ken",
"keng", "kong", "kou", "ku", "kua", "kuai", "kuan", "kuang", "kui", "kun", "kuo", "la", "lai", "lan", "lang", "lao", "le", "lei", "leng",
"li", "lia", "lian", "liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu", "lv", "luan", "lue", "lun", "luo", "ma", "mai",
"man", "mang", "mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie", "min", "ming", "miu", "mo", "mou", "mu", "na", "nai",
"nan", "nang", "nao", "ne", "nei", "nen", "neng", "ni", "nian", "niang", "niao", "nie", "nin", "ning", "niu", "nong", "nu", "nv", "nuan",
"nue", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei", "pen", "peng", "pi", "pian", "piao", "pie", "pin", "ping", "po", "pu",
"qi", "qia", "qian", "qiang", "qiao", "qie", "qin", "qing", "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao", "re",
"ren", "reng", "ri", "rong", "rou", "ru", "ruan", "rui", "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sen", "seng", "sha",
"shai", "shan", "shang", "shao", "she", "shen", "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang", "shui", "shun",
"shuo", "si", "song", "sou", "su", "suan", "sui", "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te", "teng", "ti", "tian", "tiao",
"tie", "ting", "tong", "tou", "tu", "tuan", "tui", "tun", "tuo", "wa", "wai", "wan", "wang", "wei", "wen", "weng", "wo", "wu", "xi",
"xia", "xian", "xiang", "xiao", "xie", "xin", "xing", "xiong", "xiu", "xu", "xuan", "xue", "xun", "ya", "yan", "yang", "yao", "ye", "yi",
"yin", "ying", "yo", "yong", "you", "yu", "yuan", "yue", "yun", "za", "zai", "zan", "zang", "zao", "ze", "zei", "zen", "zeng", "zha",
"zhai", "zhan", "zhang", "zhao", "zhe", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu", "zhua", "zhuai", "zhuan", "zhuang", "zhui",
"zhun", "zhuo", "zi", "zong", "zou", "zu", "zuan", "zui", "zun", "zuo"};
private StringBuilder buffer;
private String resource;
private static CharacterParser characterParser = new CharacterParser();
public static CharacterParser getInstance() {
return characterParser;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
/** * 汉字转成ASCII码 * * @param chs * @return */
private int getChsAscii(String chs) {
int asc = 0;
try {
byte[] bytes = chs.getBytes("gb2312");
if (bytes == null || bytes.length > 2 || bytes.length <= 0) {
throw new RuntimeException("illegal resource string");
}
if (bytes.length == 1) {
asc = bytes[0];
}
if (bytes.length == 2) {
int hightByte = 256 + bytes[0];
int lowByte = 256 + bytes[1];
asc = (256 * hightByte + lowByte) - 256 * 256;
}
} catch (Exception e) {
System.out.println("ERROR:ChineseSpelling.class-getChsAscii(String chs)" + e);
}
return asc;
}
/** * 单字解析 * * @param str * @return */
public String convert(String str) {
String result = null;
int ascii = getChsAscii(str);
if (ascii > 0 && ascii < 160) {
result = String.valueOf((char) ascii);
} else {
for (int i = (pyvalue.length - 1); i >= 0; i--) {
if (pyvalue[i] <= ascii) {
result = pystr[i];
break;
}
}
}
return result;
}
/** * 词组解析 * * @param chs * @return */
public String getSelling(String chs) {
String key, value;
buffer = new StringBuilder();
for (int i = 0; i < chs.length(); i++) {
key = chs.substring(i, i + 1);
if (key.getBytes().length >= 2) {
value = (String) convert(key);
if (value == null) {
value = "unknown";
}
} else {
value = key;
}
buffer.append(value);
}
return buffer.toString();
}
public String getSpelling() {
return this.getSelling(this.getResource());
}
}

@ -0,0 +1,150 @@
package com.example.luyin.activities;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import java.util.Random;
/**
* Created by littlecurl 2018/6/24
*/
public class Code {
/**
*
* 0 o O
* 1 i I l L
* 6 b
* 9 q
* c C G
* t 线
*/
private static final char[] CHARS = {
'2', '3', '4', '5', '7', '8',
'a', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm',
'n', 'p', 'r', 's', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'D', 'E', 'F', 'H', 'J', 'K', 'M',
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};
private static com.example.luyin.activities.Code bmpCode;
public static com.example.luyin.activities.Code getInstance() {
if(bmpCode == null)
bmpCode = new com.example.luyin.activities.Code();
return bmpCode;
}
//default settings
//验证码默认随机数的个数
private static final int DEFAULT_CODE_LENGTH = 4;
//默认字体大小
private static final int DEFAULT_FONT_SIZE = 25;
//默认线条的条数
private static final int DEFAULT_LINE_NUMBER = 5;
//padding值
private static final int BASE_PADDING_LEFT = 10, RANGE_PADDING_LEFT = 15, BASE_PADDING_TOP = 15, RANGE_PADDING_TOP = 20;
//验证码的默认宽高
private static final int DEFAULT_WIDTH = 100, DEFAULT_HEIGHT = 40;
//settings decided by the layout xml
//canvas width and height
private int width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT;
//random word space and pading_top
private int base_padding_left = BASE_PADDING_LEFT, range_padding_left = RANGE_PADDING_LEFT,
base_padding_top = BASE_PADDING_TOP, range_padding_top = RANGE_PADDING_TOP;
//number of chars, lines; font size
private int codeLength = DEFAULT_CODE_LENGTH, line_number = DEFAULT_LINE_NUMBER, font_size = DEFAULT_FONT_SIZE;
//variables
private String code;
private int padding_left, padding_top;
private Random random = new Random();
//验证码图片
public Bitmap createBitmap() {
padding_left = 0;
Bitmap bp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bp);
code = createCode();
c.drawColor(Color.WHITE);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextSize(font_size);
//画验证码
for (int i = 0; i < code.length(); i++) {
randomTextStyle(paint);
randomPadding();
c.drawText(code.charAt(i) + "", padding_left, padding_top, paint);
}
//画线条
for (int i = 0; i < line_number; i++) {
drawLine(c, paint);
}
// c.save( Canvas.ALL_SAVE_FLAG );//保存
c.save();//保存
c.restore();//
return bp;
}
public String getCode() {
return code;
}
//生成验证码
private String createCode() {
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < codeLength; i++) {
buffer.append(CHARS[random.nextInt(CHARS.length)]);
}
return buffer.toString();
}
//画干扰线
private void drawLine(Canvas canvas, Paint paint) {
int color = randomColor();
int startX = random.nextInt(width);
int startY = random.nextInt(height);
int stopX = random.nextInt(width);
int stopY = random.nextInt(height);
paint.setStrokeWidth(1);
paint.setColor(color);
canvas.drawLine(startX, startY, stopX, stopY, paint);
}
//生成随机颜色
private int randomColor() {
return randomColor(1);
}
private int randomColor(int rate) {
int red = random.nextInt(256) / rate;
int green = random.nextInt(256) / rate;
int blue = random.nextInt(256) / rate;
return Color.rgb(red, green, blue);
}
//随机生成文字样式,颜色,粗细,倾斜度
private void randomTextStyle(Paint paint) {
int color = randomColor();
paint.setColor(color);
paint.setFakeBoldText(random.nextBoolean()); //true为粗体false为非粗体
float skewX = random.nextInt(11) / 10;
skewX = random.nextBoolean() ? skewX : -skewX;
paint.setTextSkewX(skewX); //float类型参数负数表示右斜整数左斜
//paint.setUnderlineText(true); //true为下划线false为非下划线
//paint.setStrikeThruText(true); //true为删除线false为非删除线
}
//随机生成padding值
private void randomPadding() {
padding_left += base_padding_left + random.nextInt(range_padding_left);
padding_top = base_padding_top + random.nextInt(range_padding_top);
}
}

@ -1,7 +1,10 @@
package com.example.luyin.activities;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -9,46 +12,295 @@ import android.widget.EditText;
import android.widget.Toast;
import com.example.luyin.services.EmergencyPeople;
import com.example.luyin.R;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.datatype.BmobDate;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
public class Contact extends Activity {
private int n = 0;
private String m = "";
private String str = "";
private AlertDialog alertDialog2;
public int initial = 0;
// private String[] items = {};
SharedPreferences prefs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contact);
//Toast.makeText(Contact.this, "短信发送完成", Toast.LENGTH_LONG).show();
prefs = getSharedPreferences("userlogin", MODE_PRIVATE);
}
public void confirm(View view){
EditText phoneNumber1=(EditText)findViewById(R.id.phonenumber);
String phoneNumber2=phoneNumber1.getText().toString();
public void confirm(View view) {
EditText phoneNumber1 = (EditText) findViewById(R.id.phonenumber);
String phoneNumber2 = phoneNumber1.getText().toString();
EmergencyPeople people = new EmergencyPeople();
people.setPhoneNumber(phoneNumber2);
EditText name1=(EditText)findViewById(R.id.contact);
String name2=name1.getText().toString();
EmergencyPeople people1 = new EmergencyPeople();
people1.setPhoneNumber(phoneNumber2);
people1.setName(name2);
Log.e("ss", "confirm: "+ people1.getName() );
Log.e("bb", "confirm: "+people1.getPhoneNumber());
people1.save(new SaveListener<String>() {
EditText name1 = (EditText) findViewById(R.id.contact);
String name2 = name1.getText().toString();
// String Sign = Sign_Bmob;
if(name2.equals("")||phoneNumber2.equals("")){
Toast.makeText(getApplicationContext(), "不能为空", Toast.LENGTH_SHORT).show();
}else if (isChinaPhoneLegal(phoneNumber2)==false){
Toast.makeText(getApplicationContext(), "请输入正确的手机号码", Toast.LENGTH_SHORT).show();
}
else {
EmergencyPeople people1 = new EmergencyPeople();
people1.setPhoneNumber(phoneNumber2);
people1.setName(name2);
people1.setUserSign(LoginActivity.Sign_Bmob);
Log.e("ss", "confirm: " + people1.getName());
Log.e("bb", "confirm: " + people1.getPhoneNumber());
people1.save(new SaveListener<String>() {
@Override
public void done(String s, BmobException e) {
if (e == null) {
Toast.makeText(getApplicationContext(), "添加联系人成功", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "添加失败", Toast.LENGTH_LONG).show();
}
}
});
// Toast.makeText(Contact.this, "已添加紧急联系人",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Contact.this, MainActivity.class);
startActivity(intent);
}
}
public void loadData(View view) {
BmobQuery<EmergencyPeople> bmobQuery = new BmobQuery<EmergencyPeople>();
bmobQuery.findObjects(new FindListener<EmergencyPeople>() {
@Override
public void done(String s, BmobException e) {
if(e==null){
Toast.makeText(getApplicationContext(),"添加联系人成功",Toast.LENGTH_LONG).show();
}else{
Toast.makeText(getApplicationContext(),"添加失败",Toast.LENGTH_LONG).show();
public void done(List<EmergencyPeople> list, BmobException e) {
if (e == null) {
n = list.size();
// Log.i("1", "111111111111111111111");
// System.out.println(n);
// m = String.valueOf(n);
// Log.i("FUCK",m );
// String str = "";
// for (int i = 0; i < n; i++) {
// str = str + station[i].getName() + " " + station[i].getId() + " " + station[i].getLineId() + "号线\n";
// System.out.println(station[i].getName() + "," + station[i].getId() + "," + station[i].getLineId());
// }
}
else {
System.out.println(e.getErrorCode());
// Log.i("FUCK YOU" ,"done: ");
}
}
});
// Toast.makeText(Contact.this, "已添加紧急联系人",Toast.LENGTH_SHORT).show();
//单选提示框
final String[] items = {"Struts2", "Spring", "Hibernate", "Mybatis", "Spring MVC"};
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("紧急联系人");
alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int index) {
Toast.makeText(Contact.this, items[index], Toast.LENGTH_SHORT).show();
}
});
alertBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
//TODO 业务逻辑代码
Intent intent = new Intent(Contact.this,MainActivity.class);
// 关闭提示框
alertDialog2.dismiss();
}
});
alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO 业务逻辑代码
// 关闭提示框
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();
}
public void large(View view) throws ParseException {
String createdAt = "2018-11-23 10:30:00";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date createdAtDate = sdf.parse(createdAt);
BmobDate bmobCreatedAtDate = new BmobDate(createdAtDate);
// String str1,str2,str3;
BmobQuery<EmergencyPeople> categoryBmobQuery = new BmobQuery<>();
// categoryBmobQuery.addWhereGreaterThan("createdAt", bmobCreatedAtDate);
categoryBmobQuery.addWhereEqualTo("UserSign",LoginActivity.Sign_Bmob);
categoryBmobQuery.findObjects(new FindListener<EmergencyPeople>() {
@Override
public void done(List<EmergencyPeople> object, BmobException e) {
if (e == null) {
n = object.size();
// m = String.valueOf(n);
// Log.i("FUCK",object.get(1).getName() );
// Log.i("1", "11111111111111110000000");
final String[] items = new String[n];
for(int i=0;i<n;i++){
items[i] = object.get(i).getName();
// str1 = object.get(i).getName();
}
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(Contact.this);
alertBuilder.setTitle("紧急联系人");
alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int index) {
if(index >=0 )
{
initial = index;
}
// Toast.makeText(Contact.this, items[index], Toast.LENGTH_SHORT).show();
// Log.i("CNNNNMMMMMMMMMMMMMM", MainActivity.number);
}
});
alertBuilder.setPositiveButton("设为紧急联系人", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
//TODO 业务逻辑代码
// Log.i("qwrtyuio1211431313131", items[index]);
MainActivity.number = object.get(initial).getPhoneNumber();
Toast.makeText(Contact.this, "已设为紧急联系人",Toast.LENGTH_SHORT).show();
// 关闭提示框
alertDialog2.dismiss();
}
});
alertBuilder.setNegativeButton("删除", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
// TODO 业务逻辑代码
EmergencyPeople people1 = new EmergencyPeople();
people1.delete(object.get(initial).getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(Contact.this, "已删除",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(Contact.this, "删除失败",Toast.LENGTH_SHORT).show();
}
}
});
Toast.makeText(Contact.this, "已删除",Toast.LENGTH_SHORT).show();
// 关闭提示框
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();
// Log.i("1dghcvbnnc999999999999", items[1]);
} else {
Log.e("BMOB", e.toString());
// Log.i("2", "222222222222222222222");
}
}
});
// AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
// alertBuilder.setTitle("紧急联系人");
//
// alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
//
// @Override
// public void onClick(DialogInterface arg0, int index) {
// Toast.makeText(Contact.this, items[index], Toast.LENGTH_SHORT).show();
// }
// });
// alertBuilder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
//
// @Override
// public void onClick(DialogInterface arg0, int arg1) {
// //TODO 业务逻辑代码
//
// // 关闭提示框
// alertDialog2.dismiss();
// }
// });
// alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
//
// @Override
// public void onClick(DialogInterface arg0, int arg1) {
// // TODO 业务逻辑代码
//
// // 关闭提示框
// alertDialog2.dismiss();
// }
// });
// alertDialog2 = alertBuilder.create();
// alertDialog2.show();
}
public void logOut(View view){
Intent intent=new Intent(Contact.this,LoginActivity.class);
//将缓存置空
SharedPreferences.Editor editor = prefs.edit();
editor.putString("account", "");
editor.putString("password", "");
editor.putString("name","");
editor.commit();
startActivity(intent);
finish();
Toast toast=Toast.makeText(Contact.this,"您已退出登录",Toast.LENGTH_SHORT);
toast.show();
}
public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
// ^ 匹配输入字符串开始的位置
// \d 匹配一个或多个数字,其中 \ 要转义,所以是 \\d
// $ 匹配输入字符串结尾的位置
String regExp = "^((13[0-9])|(14[5,7,9])|(15[0-3,5-9])|(166)|(17[3,5,6,7,8])" +
"|(18[0-9])|(19[8,9]))\\d{8}$";
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(str);
return m.matches();
}
}
}

@ -0,0 +1,34 @@
package com.example.luyin.activities;
/**
*
*/
public class Country {
private String country;
private String countryCode;
private String sortLetters; //显示数据拼音的首字母
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountryCode() {
return countryCode;
}
public void setCountryCode(String countryCode) {
this.countryCode = countryCode;
}
public String getSortLetters() {
return sortLetters;
}
public void setSortLetters(String sortLetters) {
this.sortLetters = sortLetters;
}
}

@ -0,0 +1,112 @@
package com.example.luyin.activities;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.SectionIndexer;
import android.widget.TextView;
import com.example.luyin.R;
import java.util.List;
public class CountryAdapter extends BaseAdapter implements SectionIndexer {
private List<Country> list = null;
private Context mContext;
public CountryAdapter(Context mContext, List<Country> list) {
this.mContext = mContext;
this.list = list;
}
/**
* ListView,ListView
*
* @param list
*/
public void updateListView(List<Country> list) {
this.list = list;
notifyDataSetChanged();
}
public int getCount() {
return this.list.size();
}
public Object getItem(int position) {
return list.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View view, ViewGroup arg2) {
/**得到手机通讯录联系人信息**/
ViewHolder viewHolder;
Country mContent=list.get(position);
if (view == null) {
viewHolder = new ViewHolder();
view = LayoutInflater.from(mContext).inflate(R.layout.item_country, null);
viewHolder.tvTitle = (TextView) view.findViewById(R.id.title);
viewHolder.tvLetter = (TextView) view.findViewById(R.id.catalog);
viewHolder.number = (TextView) view.findViewById(R.id.number);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
//根据position获取分类的首字母的Char ascii值
int section = getSectionForPosition(position);
//如果当前位置等于该分类首字母的Char的位置 ,则认为是第一次出现
if (position == getPositionForSection(section)) {
viewHolder.tvLetter.setVisibility(View.VISIBLE);
viewHolder.tvLetter.setText(mContent.getSortLetters());
} else {
viewHolder.tvLetter.setVisibility(View.GONE);
}
viewHolder.tvTitle.setText(this.list.get(position).getCountry());
viewHolder.number.setText(this.list.get(position).getCountryCode());
return view;
}
final static class ViewHolder {
TextView tvLetter;
TextView tvTitle;
TextView number;
}
/**
* ListViewChar ascii
*/
public int getSectionForPosition(int position) {
return list.get(position).getSortLetters().charAt(0);
}
/**
* Char ascii
*/
public int getPositionForSection(int section) {
for (int i = 0; i < getCount(); i++) {
String sortStr = list.get(i).getSortLetters();
char firstChar = sortStr.toUpperCase().charAt(0);
if (firstChar == section) {
return i;
}
}
return -1;
}
@Override
public Object[] getSections() {
return null;
}
}

@ -0,0 +1,100 @@
package com.example.luyin.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.example.luyin.R;
import java.util.ArrayList;
import java.util.Collections;
import cn.smssdk.SMSSDK;
/**
*
* Created by donkor
*/
public class CountryCodeActivity extends Activity {
private SideBar sideBar;
private TextView dialog;
private ListView sortListView;
private CountryAdapter countryAdapter;
private Button btnBack;
private ArrayList<Country> countryList;
/**
* ListView
*/
private CountryPinyinComparator pinyinComparator;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_country_code);
// SMSSDK.initSDK(this, "167cf953112d0", "538346cc0f97e65a042adfec13badc72");
pinyinComparator = new CountryPinyinComparator();
sideBar = (SideBar) findViewById(R.id.sidrbar);
dialog = (TextView) findViewById(R.id.dialog);
sideBar.setTextView(dialog);
sortListView = (ListView) findViewById(R.id.country_lvcountry);
btnBack = (Button) findViewById(R.id.btnBack);
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CountryCodeActivity.this.finish();
}
});
GetCountryList list = new GetCountryList();
countryList = list.getCountry(SMSSDK.getGroupedCountryList());
// Log.e("asd", "zone.size(): " + zone.size());
// 根据a-z进行排序源数据
Collections.sort(countryList, pinyinComparator);
// adapter = new SortAdapter(getActivity(), SourceDateList);
countryAdapter = new CountryAdapter(CountryCodeActivity.this, countryList);
sortListView.setAdapter(countryAdapter);
// 设置右侧触摸监听
sideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
@Override
public void onTouchingLetterChanged(String s) {
//该字母首次出现的位置
int position = countryAdapter.getPositionForSection(s.charAt(0));
if (position != -1) {
sortListView.setSelection(position);
}
}
});
sortListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent mIntent = new Intent(CountryCodeActivity.this, MainActivity.class);
Bundle b = new Bundle();
String country = countryList.get(position).getCountry();
String countryCode = countryList.get(position).getCountryCode().replace("+","");
b.putString("country", country);
b.putString("countryCode", countryCode);
mIntent.putExtras(b);
CountryCodeActivity.this.setResult(1, mIntent);
CountryCodeActivity.this.finish();
}
});
}
}

@ -0,0 +1,17 @@
package com.example.luyin.activities;
import java.util.Comparator;
public class CountryPinyinComparator implements Comparator<Country> {
public int compare(Country o1, Country o2) {
if (o1.getSortLetters().equals("@")
|| o2.getSortLetters().equals("#")) {
return -1;
} else if (o1.getSortLetters().equals("#")
|| o2.getSortLetters().equals("@")) {
return 1;
} else {
return o1.getSortLetters().compareTo(o2.getSortLetters());
}
}
}

@ -0,0 +1,116 @@
package com.example.luyin.activities;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
/**
* Created by littlecurl 2018/6/24
*/
public class DBOpenHelper extends SQLiteOpenHelper {
/**
* AndroidSDKdb
*/
private SQLiteDatabase db;
/**
* context
* 1
* super(context,"db_test",null,1);
*
*
* db = getReadableDatabase();
*/
public DBOpenHelper(Context context){
super(context,"oldman",null,1);
db = getReadableDatabase();
}
/**
* class DBOpenHelper extends SQLiteOpenHelper
* abstract SQLiteOpenHelper abstract
* DBOpenHelper abstract
*
*
* onCreate()onUpgrade()
* @param db
*/
@Override
public void onCreate(SQLiteDatabase db){
db.execSQL("CREATE TABLE IF NOT EXISTS oldman(" +
"_id integer PRIMARY KEY AUTOINCREMENT," +
"phonenumber varchar(20),"+
"password varchar(20),"+
"name varchar(20)," +
"sex varchar(2)," +
"birth varchar(20),"+
"healthstate varchar(20),"+
"address varchar(50)," +
"idcard text)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
db.execSQL("DROP TABLE IF EXISTS user");
onCreate(db);
}
/**
*
*
* add()
* delete()
* update()
* getAllData()
*/
public void add(String phonenumber, String password, String name, String sex, String birth, String healthstate, String address, String idcard){
db.execSQL("INSERT INTO oldman (phonenumber,password,name,sex,birth,healthstate,address,idcard) VALUES(?,?,?,?,?,?,?,?)",new Object[]{phonenumber,password,name,sex,birth,healthstate,address,idcard});
}
public void delete(String phonenumber, String password){
db.execSQL("DELETE FROM oldman WHERE phonenumber = AND password ="+phonenumber+password);
}
public void updatepsd(String password){
db.execSQL("UPDATE oldman SET password = ?",new Object[]{password});
}
public void updateinfo(String name, String sex, String birth, String healthstate, String address, int _id){
db.execSQL("UPDATE oldman SET name=?,sex=?,birth=?,healthstate=?,address=? WHERE _id=?",new Object[]{name,sex,birth,healthstate,address,_id});
}
/**
*
* user
* 使
* ArrayListlist
*
* 使Cursor
* Android
* Cursor"表名"5null
* "name DESC"
* while
* list
* @return
*/
public ArrayList<User> getAllData(){
ArrayList<User> list = new ArrayList<User>();
Cursor cursor = db.query("oldman",null,null,null,null,null,"name DESC");
while(cursor.moveToNext()){
int _id=cursor.getInt(cursor.getColumnIndex("_id"));
String phonenumber = cursor.getString(cursor.getColumnIndex("phonenumber"));
String password = cursor.getString(cursor.getColumnIndex("password"));
String name = cursor.getString(cursor.getColumnIndex("name"));
String sex = cursor.getString(cursor.getColumnIndex("sex"));
String birth = cursor.getString(cursor.getColumnIndex("birth"));
String healthstate = cursor.getString(cursor.getColumnIndex("healthstate"));
String address = cursor.getString(cursor.getColumnIndex("address"));
String idcard = cursor.getString(cursor.getColumnIndex("idcard"));
list.add(new User(_id,phonenumber,password,name,sex,birth,healthstate,address,idcard));
}
return list;
}
}

@ -0,0 +1,55 @@
package com.example.luyin.activities;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import cn.smssdk.SMSSDK;
public class GetCountryList {
private HashMap<Character, ArrayList<String[]>> first;
private ArrayList<String[]> second;
// String countyList="\n";
private ArrayList<Country> dataList;
// 汉字转换成拼音的类
private CharacterParser characterParser;
@SuppressWarnings("rawtypes")
public ArrayList<Country> getCountry(HashMap<Character, ArrayList<String[]>> list){
//实例化汉字转拼音类
characterParser = CharacterParser.getInstance();
dataList=new ArrayList<>();
first = SMSSDK.getGroupedCountryList();
Set set=first.keySet();
for(Object obj : set){
// System.out.println("第一层"+first.get(obj));
second=first.get(obj);
// System.out.println("第二层"+second);
for(int i = 0;i<second.toArray().length;i++){
Country country=new Country();
String[] thirst =second.get(i);
country.setCountry(thirst[0]);
country.setCountryCode("+"+thirst[1]);
//汉字转换成拼音
String pinyin = characterParser.getSelling(thirst[0]);
String sortString = pinyin.substring(0, 1).toUpperCase();
// 正则表达式,判断首字母是否是英文字母
if (sortString.matches("[A-Z]")) {
country.setSortLetters(sortString.toUpperCase().toUpperCase());
} else {
country.setSortLetters("#");
}
dataList.add(country);
// System.out.println("第三层"+thirst);
// System.out.println("实际数据"+thirst[0]+"国家"+thirst[1]);
// String str=thirst[0]+"----------"+thirst[1]+"区域号\n";
// countyList = countyList+str;
}
}
return dataList;
}
}

@ -0,0 +1,173 @@
package com.example.luyin.activities;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
//import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.luyin.R;
import java.util.ArrayList;
public class LoginActivity extends AppCompatActivity implements View.OnClickListener{
SharedPreferences prefs;
int idman=0;
private DBOpenHelper mDBOpenHelper;
private TextView mTvLoginactivityRegister;
private RelativeLayout mRlLoginactivityTop;
private EditText mEtLoginactivityUsername;
private EditText mEtLoginactivityPassword;
private LinearLayout mLlLoginactivityTwo;
private Button mBtLoginactivityLogin;
private ImageView iv_loginactivity_back;
private TextView mtv_loginactivity_check;
public static String Sign_Bmob = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login);
initView();
mDBOpenHelper = new DBOpenHelper(this);
prefs = getSharedPreferences("userlogin", MODE_PRIVATE);
String prefsphonenumber=prefs.getString("account","");
String prefpassword=prefs.getString("password","");
//Log.i("test999login","temp"+prefsphonenumber+prefpassword);
if(!(prefsphonenumber.equals("")||prefpassword.equals(""))){
login(prefsphonenumber,prefpassword);
}
}
private void initView() {
// 初始化控件
mBtLoginactivityLogin = findViewById(R.id.bt_loginactivity_login);
mTvLoginactivityRegister = findViewById(R.id.tv_loginactivity_register);
mRlLoginactivityTop = findViewById(R.id.rl_loginactivity_top);
mEtLoginactivityUsername = findViewById(R.id.et_loginactivity_username);
mEtLoginactivityPassword = findViewById(R.id.et_loginactivity_password);
mLlLoginactivityTwo = findViewById(R.id.ll_loginactivity_two);
iv_loginactivity_back=findViewById(R.id.iv_loginactivity_back);
mtv_loginactivity_check = findViewById(R.id.tv_loginactivity_check);
// 设置点击事件监听器
mBtLoginactivityLogin.setOnClickListener(this);
mTvLoginactivityRegister.setOnClickListener(this);
iv_loginactivity_back.setOnClickListener(this);
mtv_loginactivity_check.setOnClickListener(this);
}
public void onClick(View view) {
switch (view.getId()) {
// 跳转到注册界面
case R.id.tv_loginactivity_register:
Intent intent=new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
finish();
break;
/**
*
*
* EditText
* String name = mEtLoginactivityUsername.getText().toString().trim();
* String password = mEtLoginactivityPassword.getText().toString().trim();
* ,
* if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(password))
* for
* if (name.equals(user.getName()) && password.equals(user.getPassword()))
* match = truebreak
* match = false
*
*
*
* Intent intent = new Intent(this, MainActivity.class);
* startActivity(intent);
* finish();//销毁此Activity
*/
case R.id.bt_loginactivity_login:
String phonenumber = mEtLoginactivityUsername.getText().toString().trim();
String password = mEtLoginactivityPassword.getText().toString().trim();
login(phonenumber,password);
break;
case R.id.iv_loginactivity_back:
Intent intent2=new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent2);
finish();
break;
case R.id.tv_loginactivity_check:
Intent intent3=new Intent(LoginActivity.this, SignActivity.class);
startActivity(intent3);
finish();
break;
}
}
public void login(String phonenumber, String password){
if (!TextUtils.isEmpty(phonenumber) && !TextUtils.isEmpty(password)) {
ArrayList<User> data = mDBOpenHelper.getAllData();
boolean match = false;
for (int i = 0; i < data.size(); i++) {
User user = data.get(i);
if (phonenumber.equals(user.getPhonenumber()) && password.equals(user.getPassword())) {
match = true;
savePreferences(phonenumber,password,user.getName(),user.getSex());
idman=user.get_id();
Sign_Bmob = user.getPhonenumber();
break;
} else {
match = false;
}
}
if (match) {
Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, Contact.class);
intent.putExtra("idman",idman);
startActivity(intent);
finish();//销毁此Activity
} else {
Toast.makeText(this, "用户名或密码不正确,请重新输入", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(this, "请输入你的用户名或密码", Toast.LENGTH_SHORT).show();
}
}
void savePreferences(String phonenumber, String password, String name, String sex){
SharedPreferences.Editor editor = prefs.edit();
editor.putString("account", phonenumber);
editor.putString("password", password);
editor.putString("name", name);
editor.putString("sex", sex);
editor.apply();
}
}

@ -25,10 +25,12 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.provider.Settings;
import android.telephony.SmsManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
@ -122,11 +124,31 @@ public class MainActivity extends Activity implements SensorEventListener {
private SharedPreferences mSharedPreferences;
public static String number = null;
private int isBackgroundStart = 0;
private Button isBack = null;
// private int flag = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//重新加载启动页的时候判断是否已经加载过一次
if (!isTaskRoot()) {
Intent intent = getIntent();
if (intent != null) {
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
}
setContentView(R.layout.activity_main);
button = (Button)findViewById(R.id.getLocation);
@ -139,6 +161,43 @@ public class MainActivity extends Activity implements SensorEventListener {
}
});
start=(TextView) findViewById(R.id.start);
isBack = (Button)findViewById(R.id.play);
// isBack.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// if(flag==0){
// isBack.setText("开启后台检测");
// flag = 1;
// }else{
// isBack.setText("关闭后台检测");
// flag = 0;
// }
//
// }
// });
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.WAKE_LOCK,
Manifest.permission.INTERNET,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_APN_SETTINGS,
Manifest.permission.SEND_SMS
},0x1001);
}
if (Build.VERSION.SDK_INT >= 23) {
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, 1);
} else {
//TODO do something you need
}
}
sensorManager=(SensorManager) getSystemService(SENSOR_SERVICE);
@ -152,6 +211,11 @@ public class MainActivity extends Activity implements SensorEventListener {
locationClient.startLocation();
// getCurrentLocationLatLng();
// Bmob.resetDomain("http://open-vip.bmob.cn/8/");
// Bmob.resetDomain("http://penzhuang.luyin.com/8/");
// Bmob.resetDomain("https://open3.bmob.cn");
// Bmob.resetDomain("http://pengzhuang.cn/8/");
// Bmob.resetDomain("http://pengzhuang.xyz/8/");
Bmob.initialize(this,"f7635857d1eedd1e8949b0ca0d5324de"); //添加bmob数据库
//初始化语音
StringBuffer param = new StringBuffer();
@ -164,29 +228,48 @@ public class MainActivity extends Activity implements SensorEventListener {
mTts = SpeechSynthesizer.createSynthesizer(this, mTtsInitListener);
mSharedPreferences = getSharedPreferences(TtsSettings.PREFER_NAME, Activity.MODE_PRIVATE);
// sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI);
// isBackgroundStart = 1;
}
public void stop(View view) {
Toast.makeText(MainActivity.this, "程序已结束", Toast.LENGTH_SHORT).show();
finish();
}
// public void stop(View view) {
// Toast.makeText(MainActivity.this, "程序已结束", Toast.LENGTH_SHORT).show();
// finish();
// }
public void getLocation(View view){
}
public void play(View view) {
Toast.makeText(MainActivity.this, "程序开始", Toast.LENGTH_SHORT).show();
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI);
}
public void contact(View view) {
Intent intent = new Intent(MainActivity.this, Contact.class);
startActivity(intent);
//finish();
if(isBackgroundStart==1){
isBackgroundStart = 0;
isBack.setText("开启后台检测");
Toast.makeText(MainActivity.this, "后台检测已关闭", Toast.LENGTH_SHORT).show();
sensorManager.unregisterListener(this);
}else {
isBack.setText("关闭后台检测");
isBackgroundStart = 1;
Toast.makeText(MainActivity.this, "后台检测已开启", Toast.LENGTH_SHORT).show();
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI);
}
}
// public void contact(View view) {
// Intent intent = new Intent(MainActivity.this, Contact.class);
// startActivity(intent);
// //finish();
// }
public void voice(View view) {
Intent intent = new Intent(MainActivity.this, VoiceActivity.class);
startActivity(intent);
@ -204,9 +287,14 @@ public class MainActivity extends Activity implements SensorEventListener {
startActivity(intent);
//finish();
}
public void Login(View view) {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
//finish();
}
private void showToast(String msg) {
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
private void showTip(final String str){
@ -229,12 +317,15 @@ public class MainActivity extends Activity implements SensorEventListener {
@Override
protected void onStop() {
// TODO Auto-generated method stub
sensorManager.unregisterListener(this); //传感器的解除绑定
// sensorManager.unregisterListener(this); //传感器的解除绑定
super.onStop();
isBackgroundStart = 0;
}
@SuppressLint("HandlerLeak")
@Override
@ -261,13 +352,24 @@ public class MainActivity extends Activity implements SensorEventListener {
setParam();
int code = mTts.startSpeaking(getString(R.string.crash), mTtsListener);
mOffTextView = new TextView(this);
// mDialog = new Dialog(MainActivity.this);
// mDialog.setTitle(getString(R.string.crash));
// mDialog.setCancelable(false);
// mDialog.setView(mOffTextView);
// final AlertDialog.Builder alterDiaglog = new AlertDialog.Builder(this);
mDialog = new AlertDialog.Builder(this)
.setTitle(getString(R.string.crash))
.setCancelable(false)
.setView(mOffTextView)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
//点击确定后的操作
public void onClick(DialogInterface dialog, int id) {
mOffTime.cancel();
mTts.stopSpeaking();
vibrator.cancel();
@ -288,6 +390,11 @@ public class MainActivity extends Activity implements SensorEventListener {
}
})
.create();
if (Build.VERSION.SDK_INT>=26) {//8.0新特性
mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
}else{
mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
mDialog.show();
mDialog.setCanceledOnTouchOutside(false);
@ -369,7 +476,7 @@ public class MainActivity extends Activity implements SensorEventListener {
// Intent intent = getIntent();
// String content = intent.getStringExtra("location");
String content = LocationLLLL;
String number = "18577348433";
if (TextUtils.isEmpty(number)) {
showToast("请输入手机号");
@ -547,8 +654,14 @@ public class MainActivity extends Activity implements SensorEventListener {
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mIsExit) {
this.finish();
// this.finish();
// 调用moveTaskToBack可以让程序退出到后台运行false表示只对主界面生效true表示任何界面都可以生效。
moveTaskToBack(false);
if(isBackgroundStart==1)
{
Log.i("后台检测", "onKeyDown: 1111111111111111111");
sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI);
}
} else {
Toast.makeText(this, "再按一次退出", Toast.LENGTH_SHORT).show();
mIsExit = true;
@ -564,6 +677,21 @@ public class MainActivity extends Activity implements SensorEventListener {
return super.onKeyDown(keyCode, event);
}
// public boolean onKeyDown(int keyCode, KeyEvent event) {
// if (keyCode == KeyEvent.KEYCODE_BACK) {
// moveTaskToBack(false);
// return true;
// }
// return super.onKeyDown(keyCode, event);
// }
@Override
public void onBackPressed() {
moveTaskToBack(false);
super.onBackPressed();
}
/**
*
*/
@ -726,4 +854,7 @@ public class MainActivity extends Activity implements SensorEventListener {
mTts.destroy();
}
}
}

@ -0,0 +1,186 @@
package com.example.luyin.activities;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.example.luyin.services.EmergencyPeople;
import com.example.luyin.services.User_Bmob;
import androidx.appcompat.app.AppCompatActivity;
import com.example.luyin.R;
import java.util.ArrayList;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{
SharedPreferences prefs;
private String realCode;
private DBOpenHelper mDBOpenHelper;
private Button mBtRegisteractivityRegister;
private RelativeLayout mRlRegisteractivityTop;
private ImageView mIvRegisteractivityBack;
private LinearLayout mLlRegisteractivityBody;
private EditText mEtRegisteractivityUsername;
private EditText mEtRegisteractivityPassword1;
private EditText mEtRegisteractivityPassword2;
private EditText mEtRegisteractivityPhonecodes;
private ImageView mIvRegisteractivityShowcode;
private RelativeLayout mRlRegisteractivityBottom;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
initView();
mDBOpenHelper = new DBOpenHelper(this);
prefs = getSharedPreferences("userlogin", MODE_PRIVATE);
//将验证码用图片的形式显示出来
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
realCode = Code.getInstance().getCode().toLowerCase();
}
private void initView(){
mBtRegisteractivityRegister = findViewById(R.id.bt_registeractivity_register);
mRlRegisteractivityTop = findViewById(R.id.rl_registeractivity_top);
mIvRegisteractivityBack = findViewById(R.id.iv_registeractivity_back);
mLlRegisteractivityBody = findViewById(R.id.ll_registeractivity_body);
mEtRegisteractivityUsername = findViewById(R.id.et_registeractivity_username);
mEtRegisteractivityPassword1 = findViewById(R.id.et_registeractivity_password1);
mEtRegisteractivityPassword2 = findViewById(R.id.et_registeractivity_password2);
mEtRegisteractivityPhonecodes = findViewById(R.id.et_registeractivity_phoneCodes);
mIvRegisteractivityShowcode = findViewById(R.id.iv_registeractivity_showCode);
mRlRegisteractivityBottom = findViewById(R.id.rl_registeractivity_bottom);
/**
*
* top
*/
mIvRegisteractivityBack.setOnClickListener(this);
mIvRegisteractivityShowcode.setOnClickListener(this);
mBtRegisteractivityRegister.setOnClickListener(this);
}
public void onClick(View view) {
int idman=0;
switch (view.getId()) {
case R.id.iv_registeractivity_back: //返回登录页面
Intent intent1 = new Intent(this, LoginActivity.class);
startActivity(intent1);
finish();
break;
case R.id.iv_registeractivity_showCode: //改变随机验证码的生成
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
realCode = Code.getInstance().getCode().toLowerCase();
break;
case R.id.bt_registeractivity_register: //注册按钮
//获取用户输入的用户名、密码、验证码
String phonenumber = mEtRegisteractivityUsername.getText().toString().trim();
String password = mEtRegisteractivityPassword1.getText().toString().trim();
String password2=mEtRegisteractivityPassword2.getText().toString().trim();
String phoneCode = mEtRegisteractivityPhonecodes.getText().toString().toLowerCase();
//电话号码和密码注册检测
boolean canRegister=false;
String telRegex = "[1][3456789]\\d{9}";
if(TextUtils.isEmpty(phonenumber)){
Toast toast= Toast.makeText(com.example.luyin.activities.RegisterActivity.this,"电话号码不能为空", Toast.LENGTH_SHORT);
toast.show();
}
else if(!phonenumber.matches(telRegex)){
Toast toast= Toast.makeText(com.example.luyin.activities.RegisterActivity.this,"电话号码格式不正确,请重新输入", Toast.LENGTH_SHORT);
toast.show();
}
else if(!password.equals(password2)){
Toast toast= Toast.makeText(com.example.luyin.activities.RegisterActivity.this,"两次的密码不一致", Toast.LENGTH_SHORT);
toast.show();
}
else{
canRegister=true;
}
//注册验证
if (canRegister && !TextUtils.isEmpty(password) && !TextUtils.isEmpty(phoneCode) ) {
if (phoneCode.equals(realCode)) {
//将用户名和密码加入到数据库中
mDBOpenHelper.add(phonenumber, password,phonenumber,"男","1970/01/01","健康","您还未填写地址","");
ArrayList<User> data = mDBOpenHelper.getAllData();
for (int i = 0; i < data.size(); i++) {
User user = data.get(i);
if (phonenumber.equals(user.getPhonenumber()) && password.equals(user.getPassword())) {
idman=user.get_id();
savePreferences(phonenumber,password,user.getName(),user.getSex());
}
}
// Intent intent2 = new Intent(this, ManinfoshowActivity.class);
// intent2.putExtra("idman",idman);
// startActivity(intent2);
finish();
Toast.makeText(this, "验证通过,注册成功", Toast.LENGTH_SHORT).show();
//存到数据库
User_Bmob people1 = new User_Bmob();
people1.setNameOrPhone(phonenumber);
people1.setpassword(password);
people1.save(new SaveListener<String>() {
@Override
public void done(String s, BmobException e) {
if (e == null) {
// Toast.makeText(getApplicationContext(), "添加联系人成功", Toast.LENGTH_LONG).show();
} else {
// Toast.makeText(getApplicationContext(), "添加失败", Toast.LENGTH_LONG).show();
}
}
});
} else {
Toast.makeText(this, "验证码错误,注册失败", Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(this, "未完善信息,注册失败", Toast.LENGTH_SHORT).show();
}
break;
}
}
void savePreferences(String phonenumber, String password, String name, String sex){
SharedPreferences.Editor editor = prefs.edit();
editor.putString("account", phonenumber);
editor.putString("password", password);
editor.putString("name", name);
editor.putString("sex", sex);
editor.apply();
}
}

@ -1,60 +0,0 @@
package com.example.luyin.activities;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;
import com.example.luyin.R;
public class SMS extends Activity {
private EditText mNumberText;
private EditText mContentText;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(getString(R.string.app_name));
setContentView(R.layout.activity_sms);
mNumberText = (EditText)this.findViewById(R.id.number);//找到number
mContentText = (EditText)this.findViewById(R.id.msg_content);
}
public void SEND(View view) {
//String content = mContentText.getText().toString();
//String number = mNumberText.getText().toString();
String content = "尼玛1111111111111111";
String number = "18577348433";
if(TextUtils.isEmpty(number)){
showToast("请输入手机号");
return;
}
if(TextUtils.isEmpty(content)){
showToast("请输入内容");
return;
}
ArrayList<String> messages = SmsManager.getDefault().divideMessage(content);
for(String text : messages){
SmsManager.getDefault().sendTextMessage(number, null, text, null, null);
}
showToast("success");
}
private void showToast(String msg) {
Toast.makeText(SMS.this, msg, Toast.LENGTH_LONG).show();
}
}

@ -0,0 +1,165 @@
package com.example.luyin.activities;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.luyin.R;
public class SecurityCodeView extends RelativeLayout {
private EditText editText;
private TextView[] TextViews;
private StringBuffer stringBuffer = new StringBuffer();
private int count = 6;
private String inputContent;
public SecurityCodeView(Context context) {
this(context, null);
}
public SecurityCodeView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SecurityCodeView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TextViews = new TextView[6];
View.inflate(context, R.layout.view_security_code, this);
editText = (EditText) findViewById(R.id.item_edittext);
TextViews[0] = (TextView) findViewById(R.id.item_code_iv1);
TextViews[1] = (TextView) findViewById(R.id.item_code_iv2);
TextViews[2] = (TextView) findViewById(R.id.item_code_iv3);
TextViews[3] = (TextView) findViewById(R.id.item_code_iv4);
TextViews[4] = (TextView) findViewById(R.id.item_code_iv5);
TextViews[5] = (TextView) findViewById(R.id.item_code_iv6);
editText.setCursorVisible(false);//将光标隐藏
setListener();
}
private void setListener() {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
//重点 如果字符不为""时才进行操作
if (!editable.toString().equals("")) {
if (stringBuffer.length() > 5) {
//当文本长度大于5位时edittext置空
editText.setText("");
return;
} else {
//将文字添加到StringBuffer中
stringBuffer.append(editable);
editText.setText("");//添加后将EditText置空 造成没有文字输入的错局
// Log.e("TAG", "afterTextChanged: stringBuffer is " + stringBuffer);
count = stringBuffer.length();//记录stringbuffer的长度
inputContent = stringBuffer.toString();
if (stringBuffer.length() == 6) {
//文字长度位4 则调用完成输入的监听
if (inputCompleteListener != null) {
inputCompleteListener.inputComplete();
}
}
}
for (int i = 0; i < stringBuffer.length(); i++) {
TextViews[i].setText(String.valueOf(inputContent.charAt(i)));
TextViews[i].setBackgroundResource(R.mipmap.bg_verify_press);
}
}
}
});
editText.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DEL
&& event.getAction() == KeyEvent.ACTION_DOWN) {
if (onKeyDelete()) return true;
return true;
}
return false;
}
});
}
public boolean onKeyDelete() {
if (count == 0) {
count = 6;
return true;
}
if (stringBuffer.length() > 0) {
//删除相应位置的字符
stringBuffer.delete((count - 1), count);
count--;
// Log.e(TAG, "afterTextChanged: stringBuffer is " + stringBuffer);
inputContent = stringBuffer.toString();
TextViews[stringBuffer.length()].setText("");
TextViews[stringBuffer.length()].setBackgroundResource(R.mipmap.bg_verify);
if (inputCompleteListener != null)
inputCompleteListener.deleteContent(true);//有删除就通知manger
}
return false;
}
/**
*
*/
public void clearEditText() {
stringBuffer.delete(0, stringBuffer.length());
inputContent = stringBuffer.toString();
for (int i = 0; i < TextViews.length; i++) {
TextViews[i].setText("");
TextViews[i].setBackgroundResource(R.mipmap.bg_verify);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return super.onKeyDown(keyCode, event);
}
private InputCompleteListener inputCompleteListener;
public void setInputCompleteListener(InputCompleteListener inputCompleteListener) {
this.inputCompleteListener = inputCompleteListener;
}
public interface InputCompleteListener {
void inputComplete();
void deleteContent(boolean isDelete);
}
/**
*
*
* @return
*/
public String getEditContent() {
return inputContent;
}
}

@ -0,0 +1,150 @@
package com.example.luyin.activities;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import com.example.luyin.R;
public class SideBar extends View {
// 触摸事件
private OnTouchingLetterChangedListener onTouchingLetterChangedListener;
// 26个字母
public static String[] b = {"A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z", "#"};
private int choose = -1;// 选中
private Paint paint = new Paint();
private TextView mTextDialog;
public SideBar(Context context) {
super(context);
}
public SideBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SideBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void setTextView(TextView mTextDialog) {
this.mTextDialog = mTextDialog;
}
/**
*
*/
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 获取焦点改变背景颜色.
int height = getHeight();// 获取对应高度
int width = getWidth(); // 获取对应宽度
int singleHeight = height / b.length;// 获取每一个字母的高度
DisplayMetrics dm = new DisplayMetrics();
dm = getResources().getDisplayMetrics();
int screenWidth = dm.widthPixels; // 屏幕宽像素480px
int screenHeight = dm.heightPixels; // 屏幕高像素800px
for (int i = 0; i < b.length; i++) {
paint.setColor(Color.rgb(11,181,94));
paint.setTypeface(Typeface.DEFAULT_BOLD);
paint.setAntiAlias(true);
if (screenWidth == 720 && screenHeight == 1280) {
paint.setTextSize(22);
} else if (screenWidth == 1536 && screenHeight == 2560) {
paint.setTextSize(50);
} else {
paint.setTextSize(35);
}
float xPos = width / 2 - paint.measureText(b[i]) / 2;
float yPos = singleHeight * i + singleHeight;
// 选中的状态
if (i == choose) {
paint.setColor(Color.parseColor("#ffffff"));
paint.setFakeBoldText(true);
Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(),
R.mipmap.show_toast_bg);
canvas.drawBitmap(bitmap, width / 6, singleHeight * i + singleHeight / 5, paint);
}
// x坐标等于中间-字符串宽度的一半.
canvas.drawText(b[i], xPos, yPos, paint);
paint.reset();// 重置画笔
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
final int action = event.getAction();
final float y = event.getY();// 点击y坐标
final int oldChoose = choose;
final OnTouchingLetterChangedListener listener = onTouchingLetterChangedListener;
final int c = (int) (y / getHeight() * b.length);// 点击y坐标所占总高度的比例*b数组的长度就等于点击b中的个数.
switch (action) {
case MotionEvent.ACTION_UP:
setBackgroundDrawable(new ColorDrawable(0x00000000));
choose = -1;//
invalidate();
if (mTextDialog != null) {
mTextDialog.setVisibility(View.INVISIBLE);
}
break;
default:
// setBackgroundResource(R.mipmap.show_toast_bg);
if (oldChoose != c) {
if (c >= 0 && c < b.length) {
if (listener != null) {
listener.onTouchingLetterChanged(b[c]);
}
if (mTextDialog != null) {
mTextDialog.setText(b[c]);
mTextDialog.setVisibility(View.VISIBLE);
}
choose = c;
invalidate();
}
}
break;
}
return true;
}
/**
*
*
* @param onTouchingLetterChangedListener
*/
public void setOnTouchingLetterChangedListener(
OnTouchingLetterChangedListener onTouchingLetterChangedListener) {
this.onTouchingLetterChangedListener = onTouchingLetterChangedListener;
}
/**
*
*
* @author coder
*/
public interface OnTouchingLetterChangedListener {
public void onTouchingLetterChanged(String s);
}
}

@ -0,0 +1,275 @@
package com.example.luyin.activities;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.luyin.R;
import com.example.luyin.services.EmergencyPeople;
import com.example.luyin.services.User_Bmob;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
public class SignActivity extends Activity implements OnClickListener {
private Button btnSendMsg, btnSubmitCode;
private EditText etPhoneNumber, etCode,etPassword;
private TextView tvCountryCode;
private String countryCode="86";
private int i = 60;//倒计时
SharedPreferences prefs;
private String phonenumber = null;
private String password = null;
private String phoneNum;
private String BmobPassWord;
private DBOpenHelper mDBOpenHelper;
private int n = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign);
// etPassword = (EditText) findViewById(R.id.etPassword);
etPhoneNumber = (EditText) findViewById(R.id.etPhoneNumber);
etCode = (EditText) findViewById(R.id.etCode);
btnSendMsg = (Button) findViewById(R.id.btnSendMsg);
btnSubmitCode = (Button) findViewById(R.id.btnSubmitCode);
tvCountryCode = (TextView) findViewById(R.id.tvCountryCode);
btnSendMsg.setOnClickListener(this);
btnSubmitCode.setOnClickListener(this);
tvCountryCode.setOnClickListener(this);
prefs = getSharedPreferences("userlogin", MODE_PRIVATE);
mDBOpenHelper = new DBOpenHelper(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.WAKE_LOCK,
Manifest.permission.INTERNET,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_APN_SETTINGS
},0x1001);
}
// 启动短信验证sdk
// SMSSDK.initSDK(Sign22.this, "196e511258800", "ba98d7e9aa85eaa323cb4dc60435fd16");
//initSDK方法是短信SDK的入口需要传递您从MOB应用管理后台中注册的SMSSDK的应用AppKey和AppSecrete如果填写错误后续的操作都将不能进行
EventHandler eventHandler = new EventHandler() {
@Override
public void afterEvent(int event, int result, Object data) {
Message msg = new Message();
msg.arg1 = event;
msg.arg2 = result;
msg.obj = data;
handler.sendMessage(msg);
}
};
//注册回调监听接口
SMSSDK.registerEventHandler(eventHandler);
}
Handler handler = new Handler() {
public void handleMessage(Message msg) {
if (msg.what == -1) {
btnSendMsg.setText(i + " s");
} else if (msg.what == -2) {
btnSendMsg.setText("重新发送");
btnSendMsg.setClickable(true);
i = 60;
} else {
int event = msg.arg1;
int result = msg.arg2;
Object data = msg.obj;
Log.e("asd", "event=" + event + " result=" + result + " ---> result=-1 success , result=0 error");
if (result == SMSSDK.RESULT_COMPLETE) {
// 短信注册成功后返回MainActivity,然后提示
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
// 提交验证码成功,调用注册接口,之后直接登录
//当号码来自短信注册页面时调用登录注册接口
//当号码来自绑定页面时调用绑定手机号码接口
Toast.makeText(getApplicationContext(), "短信验证成功",
Toast.LENGTH_SHORT).show();
// phonenumber = prefs.getString("phonenumber","");
// password = prefs.getString("password","");
// BmobQuery<User_Bmob> categoryBmobQuery = new BmobQuery<>();
// categoryBmobQuery.addWhereEqualTo("NameOrPhone",phoneNum);
// categoryBmobQuery.findObjects(new FindListener<User_Bmob>() {
// @Override
// public void done(List<User_Bmob> object, BmobException e) {
// if (e == null) {
// BmobPassWord = object.get(0).getpassword();
// }else {
// Log.e("BMOB", e.toString());
// }
// }
// });
ArrayList<User> DBdata = mDBOpenHelper.getAllData();
for (int i = 0; i < DBdata.size(); i++) {
User user = DBdata.get(i);
if (phoneNum.equals(user.getPhonenumber()) ) {
BmobPassWord = user.getPassword();
savePreferences(phoneNum,BmobPassWord,user.getName(),user.getSex());
// idman=user.get_id();
// Sign_Bmob = user.getPhonenumber();
break;
} else {
}
}
Intent intent = new Intent(SignActivity.this, Contact.class);
// intent.putExtra("idman",idman);
LoginActivity.Sign_Bmob = phoneNum;
startActivity(intent);
finish();//销毁此Activity
} else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
Toast.makeText(getApplicationContext(), "验证码已经发送",
Toast.LENGTH_SHORT).show();
} else {
((Throwable) data).printStackTrace();
Toast.makeText( getApplicationContext(),"请检查网络连接", Toast.LENGTH_SHORT).show();
}
} else if (result == SMSSDK.RESULT_ERROR) {
try {
Throwable throwable = (Throwable) data;
throwable.printStackTrace();
JSONObject object = new JSONObject(throwable.getMessage());
String des = object.optString("detail");//错误描述
int status = object.optInt("status");//错误代码
if (status > 0 && !TextUtils.isEmpty(des)) {
Log.e("asd", "des: " + des);
Toast.makeText(SignActivity.this, des, Toast.LENGTH_SHORT).show();
return;
}
} catch (Exception e) {
//do something
}
}
}
}
};
@Override
public void onClick(View v) {
phoneNum = etPhoneNumber.getText().toString().trim();
switch (v.getId()) {
case R.id.btnSendMsg:
if (TextUtils.isEmpty(phoneNum)) {
Toast.makeText(getApplicationContext(), "手机号码不能为空",
Toast.LENGTH_SHORT).show();
return;
}
SMSSDK.getVerificationCode(countryCode, phoneNum);
btnSendMsg.setClickable(false);
//开始倒计时
new Thread(new Runnable() {
@Override
public void run() {
for (; i > 0; i--) {
handler.sendEmptyMessage(-1);
if (i <= 0) {
break;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
handler.sendEmptyMessage(-2);
}
}).start();
break;
case R.id.btnSubmitCode:
String code = etCode.getText().toString().trim();
if (TextUtils.isEmpty(phoneNum)) {
Toast.makeText(getApplicationContext(), "手机号码不能为空",
Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(code)) {
Toast.makeText(getApplicationContext(), "验证码不能为空",
Toast.LENGTH_SHORT).show();
return;
}
SMSSDK.submitVerificationCode(countryCode, phoneNum, code);
break;
case R.id.tvCountryCode:
Intent intent = new Intent(SignActivity.this, CountryCodeActivity.class);
startActivityForResult(intent, 0);
break;
case R.id.iv_maillogin_back:
Intent intent1 = new Intent(this, LoginActivity.class);
startActivity(intent1);
finish();
default:
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
// 销毁回调监听接口
SMSSDK.unregisterAllEventHandler();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (data == null)
return;
Bundle bundle = data.getExtras();
String country = bundle.getString("country");
countryCode = bundle.getString("countryCode");
if (resultCode == 1) {
tvCountryCode.setText(country + " + " + countryCode);
}
}
void savePreferences(String phonenumber, String password, String name, String sex){
SharedPreferences.Editor editor = prefs.edit();
editor.putString("account", phonenumber);
editor.putString("password", password);
editor.putString("name", name);
editor.putString("sex", sex);
editor.apply();
}
}

@ -0,0 +1,114 @@
package com.example.luyin.activities;
/**
* Created by littlecurl 2018/6/24
*/
public class User {
private int _id;
private String phonenumber;
private String password;
private String name;
private String sex;
private String birth;
private String healthstate;
private String address;
private String idcard;
//密码
public User(int _id, String phonenumber, String password, String name, String sex, String birth, String healthstate, String address, String idcard) {
this._id=_id;
this.phonenumber = phonenumber;
this.password = password;
this.name = name;
this.sex = sex;
this.birth = birth;
this.healthstate = healthstate;
this.address = address;
this.idcard = idcard;
}
public int get_id() {
return _id;
}
public void set_id(int _id) {
this._id = _id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getBirth() {
return birth;
}
public void setBirth(String birth) {
this.birth = birth;
}
public String getHealthstate() {
return healthstate;
}
public void setHealthstate(String healthstate) {
this.healthstate = healthstate;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
@Override
public String toString() {
return "User{" +
"name='" + name + '\'' +
", password='" + password + '\'' +
'}';
}
}

@ -6,6 +6,7 @@ public class EmergencyPeople extends BmobObject {
private String name;
private String phoneNumber;
private String UserSign;
public String getName(){
return name;
@ -19,4 +20,10 @@ public class EmergencyPeople extends BmobObject {
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber=phoneNumber;
}
public String getUserSign(){
return UserSign;
}
public void setUserSign(String UserSign) {
this.UserSign = UserSign;
}
}

@ -0,0 +1,25 @@
package com.example.luyin.services;
import cn.bmob.v3.BmobObject;
public class User_Bmob extends BmobObject {
private String NameOrPhone;
private String password;
public String getNameOrPhone(){
return NameOrPhone;
}
public void setNameOrPhone(String NameOrPhone) {
this.NameOrPhone = NameOrPhone;
}
public String getpassword() {
return password;
}
public void setpassword(String password) {
this.password=password;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--默认情况下是一个带圆角,蓝色背景,白色边框的矩形-->
<!--第二种方法-->
<item android:state_window_focused="false">
<shape android:shape="rectangle">
<!--圆角-->
<corners android:radius="5dp" />
<!--填充颜色-->
<solid android:color="@color/colorPrimary" />
<!--描边-->
<stroke android:width="1dp" android:color="#fff" />
</shape>
</item>
<!--单击时是一个带圆角,绿色背景,白色边框的矩形-->
<item android:state_pressed="true">
<shape android:shape="rectangle">
<!--圆角-->
<corners android:radius="5dp" />
<!--填充颜色-->
<solid android:color="#008B8B" />
<!--描边-->
<stroke android:width="1dp" android:color="#fff" />
</shape>
</item>
</selector>

@ -18,6 +18,7 @@
<EditText
android:id="@+id/contact"
android:hint="联系人姓名"
android:layout_width="150dp"
android:layout_height="wrap_content" />
</LinearLayout>
@ -34,6 +35,7 @@
<EditText
android:id="@+id/phonenumber"
android:layout_width="150dp"
android:hint="手机号码"
android:layout_height="wrap_content" />
</LinearLayout>
@ -42,7 +44,25 @@
android:layout_height="wrap_content"
android:onClick="confirm"
android:text="确定"
android:text="添加紧急联系人"
android:textColor="#0A0AF4"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="large"
android:layout_marginTop="50dp"
android:text="查看紧急联系人"
android:textColor="#0A0AF4"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="logOut"
android:layout_marginTop="50dp"
android:text="退出登录"
android:textColor="#0A0AF4"/>

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/titleBackground"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<Button
android:id="@+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:drawablePadding="10dp"
android:gravity="center|left"
android:paddingLeft="10dp"
android:text="返回"
android:textAllCaps="false"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_weight="1"
android:gravity="center"
android:text="国家"
android:textColor="@android:color/black"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.3dp"
android:background="@android:color/darker_gray" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/country_lvcountry"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:scrollbars="none"
android:divider="@null"
android:fastScrollEnabled="true" />
<TextView
android:id="@+id/dialog"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:background="@mipmap/show_toast_bg"
android:gravity="center"
android:textColor="#ffffffff"
android:textSize="30sp"
android:visibility="invisible" />
<com.example.luyin.activities.SideBar
android:id="@+id/sidrbar"
android:layout_width="33dp"
android:layout_height="match_parent"
android:layout_gravity="right|center" />
</FrameLayout>
</LinearLayout>

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="紧急联系人:"/>
<EditText
android:id="@+id/contact"
android:layout_width="150dp"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="联系方式:"/>
<EditText
android:id="@+id/phonenumber"
android:layout_width="150dp"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="confirm"
android:text="确定"
android:textColor="#0000ff"/>
</LinearLayout>

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#eeeeee"
tools:context=".activities.LoginActivity">
<RelativeLayout
android:id="@+id/rl_loginactivity_top"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/colorPrimary" >
<ImageView
android:id="@+id/iv_loginactivity_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_left_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:clickable="true"
android:onClick="onClick"
/>
<TextView
android:id="@+id/tv_loginactivity_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登录"
android:textColor="#fff"
android:textSize="20dp"
android:layout_toRightOf="@+id/iv_loginactivity_back"
android:layout_centerVertical="true"
android:gravity="center"
/>
<TextView
android:id="@+id/tv_loginactivity_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textColor="#fff"
android:textSize="15dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:clickable="true"
android:onClick="onClick"
/>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_loginactivity_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/rl_loginactivity_top"
android:layout_marginTop="200dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_loginactivity_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"/>
<EditText
android:id="@+id/et_loginactivity_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="手机号"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_loginactivity_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"/>
<EditText
android:id="@+id/et_loginactivity_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="登录密码"
android:inputType="textPassword"/>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/bt_loginactivity_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_loginactivity_two"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/selector_loginactivity_button"
android:text="登录"
android:textColor="#fff"
android:gravity="center"
android:onClick="onClick"
/>
<TextView
android:id="@+id/tv_loginactivity_forget"
android:text="忘记密码"
android:textColor="@color/RoyalBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginVertical="50dp"
android:layout_below="@+id/bt_loginactivity_login"
android:layout_alignLeft="@+id/bt_loginactivity_login"
/>
<TextView
android:id="@+id/tv_loginactivity_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="短信验证码登录"
android:textColor="@color/RoyalBlue"
android:layout_marginRight="50dp"
android:layout_marginVertical="50dp"
android:layout_below="@+id/bt_loginactivity_login"
android:layout_alignRight="@+id/bt_loginactivity_login"
/>
</RelativeLayout>

@ -19,6 +19,7 @@
android:textColor="#F60202"/>
<Button
android:id="@+id/play"
android:layout_width="match_parent"
@ -26,41 +27,11 @@
android:onClick="play"
android:text="开"
android:text="开启后台检测"
android:textColor="#0000ff"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="contact"
android:text="添加紧急联系人"
android:textColor="#0000ff"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="发短信"
android:textColor="#0000ff"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="stop"
android:text="退出"
android:textColor="#00ff00"/>
<Button
android:id="@+id/getLocation"
@ -108,7 +79,17 @@
android:text="微信求助"
android:textColor="#FF003B"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="Login"
android:text="登录"
android:textColor="#FF003B"/>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/user_sign"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.luyin.activities.RegisterActivity"
android:background="#eeeeee"
>
<RelativeLayout
android:id="@+id/rl_registeractivity_top"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/colorPrimary"
>
<ImageView
android:id="@+id/iv_registeractivity_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_left_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:clickable="true"
android:onClick="onClick"
/>
<TextView
android:id="@+id/tv_registeractivity_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textColor="#fff"
android:textSize="20dp"
android:layout_toRightOf="@+id/iv_registeractivity_back"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
/>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_registeractivity_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/rl_registeractivity_top"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<!-- 第一个文本编辑框 输入用户名 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_registeractivity_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"/>
<EditText
android:id="@+id/et_registeractivity_username"
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint="请输入手机号"
android:gravity="center_vertical"
android:layout_marginLeft="10dp"
/>
</LinearLayout>
<!-- 第二个文本编辑框 输入密码 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_registeractivity_password1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"/>
<EditText
android:id="@+id/et_registeractivity_password1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:layout_marginLeft="10dp"
android:inputType="textPassword"
android:hint="请输入密码" />
</LinearLayout>
<!-- 第三个文本编辑框 再次输入密码 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_registeractivity_password2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"/>
<EditText
android:id="@+id/et_registeractivity_password2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:hint="请再次输入密码"
android:gravity="center_vertical"
android:layout_marginLeft="10dp"
android:inputType="textPassword"
/>
</LinearLayout>
<!-- 验证码部分 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- 第四个文本编辑框 输入验证码 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_registeractivity_phoneCodes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="验证码:"/>
<EditText
android:id="@+id/et_registeractivity_phoneCodes"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="请输入4位验证码" />
<ImageView
android:id="@+id/iv_registeractivity_showCode"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_weight="1.5"
android:clickable="true"
android:onClick="onClick"
android:layout_marginTop="-10dp"
/>
</LinearLayout>
</LinearLayout>
<!-- 注册按钮 -->
<Button
android:id="@+id/bt_registeractivity_register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:background="@drawable/selector_loginactivity_button"
android:textColor="#fff"
android:text="注册"
android:onClick="onClick"
android:layout_marginTop="40dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/rl_registeractivity_bottom"
android:layout_marginTop="10dp"
>
<TextView
android:layout_centerInParent="true"
android:text="注册即代表同意《用户协议》"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_loginactivity_top"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/colorPrimary" >
<ImageView
android:id="@+id/iv_maillogin_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_left_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:clickable="true"
android:onClick="onClick"
/>
<TextView
android:id="@+id/tv_loginactivity_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="短信验证"
android:textColor="#fff"
android:textSize="20dp"
android:layout_toRightOf="@+id/iv_loginactivity_back"
android:layout_centerVertical="true"
android:gravity="center"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="180dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="国 家:"
android:textColor="#222222"
android:textSize="16sp" />
<TextView
android:id="@+id/tvCountryCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="中国 +86"
android:padding="10dp"
android:textColor="#0000ff"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="手机号:"
android:textColor="#222222"
android:textSize="16sp" />
<EditText
android:id="@+id/etPhoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@null"
android:drawablePadding="10dp"
android:hint="请输入手机号"
android:inputType="phone"
android:lines="0"
android:maxLength="20"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:textColor="@android:color/black"
android:textColorHint="#cccccc"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="验证码:"
android:textColor="#222222"
android:textSize="16sp" />
<EditText
android:id="@+id/etCode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="请输入验证码"
android:inputType="phone"
android:lines="0"
android:maxLength="6"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:textColor="@android:color/black"
android:textColorHint="#cccccc"
android:textSize="16sp" />
<Button
android:id="@+id/btnSendMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:background="@android:color/darker_gray"
android:text="获取验证码"
android:textColor="#0000ff"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@android:color/darker_gray" />
<Button
android:id="@+id/btnSubmitCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:background="@android:color/darker_gray"
android:gravity="center"
android:text="验证注册"
android:textColor="#0000ff"
android:textSize="15sp" />
</LinearLayout>

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/catalog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/titleBackground"
android:paddingBottom="5dp"
android:paddingLeft="15dp"
android:paddingTop="5dp"
android:text="A"
android:textColor="@android:color/black"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="horizontal"
android:paddingLeft="23dp"
android:paddingBottom="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="hhhh"
android:textColor="@android:color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="hhhh"
android:layout_marginLeft="10dp"
android:textColor="@android:color/black"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="40dp">
<EditText
android:id="@+id/edit_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入邮箱账号"/>
<EditText
android:id="@+id/edit_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:inputType="numberPassword"
android:hint="设置密码"/>
<EditText
android:id="@+id/edit_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:inputType="numberPassword"
android:hint="确认密码"/>
<Button
android:id="@+id/btn_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="立即注册"
android:textColor="@android:color/white"
android:textSize="20sp"/>
</LinearLayout>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="40dp">
<EditText
android:id="@+id/et_phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入手机号码"
android:cursorVisible="false"/>
<Button
android:id="@+id/btn_get_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="获取验证码"/>
</LinearLayout>

@ -0,0 +1,71 @@
<?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="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="47dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="5">
<TextView
android:id="@+id/item_code_iv1"
style="@style/text_editStyle" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/item_code_iv2"
style="@style/text_editStyle" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/item_code_iv3"
style="@style/text_editStyle" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/item_code_iv4"
style="@style/text_editStyle" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/item_code_iv5"
style="@style/text_editStyle" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/item_code_iv6"
style="@style/text_editStyle" />
</LinearLayout>
<EditText
android:id="@+id/item_edittext"
android:layout_width="match_parent"
android:layout_height="46dp"
android:background="@android:color/transparent"
android:inputType="number" />
</RelativeLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- <color name="colorPrimary">#6200EE</color>-->
<!-- <color name="colorPrimaryDark">#3700B3</color>-->
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<!-- <color name="colorAccent">#03DAC5</color>-->
<!-- &lt;!&ndash; 画面背景色 &ndash;&gt;-->
@ -30,7 +30,54 @@
<color name="title_color">#0f8ec5</color>
<color name="content_color">#737373</color>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="LimeGreen">#32CD32</color>
<color name="SpringGreen">#3CB371</color>
<color name="greenyellow">#adff2f</color>
<color name="yellowgreen">#9acd32</color>
<color name="colorAccent">#D81B60</color>
<color name="DarkOrchid">#9932CC</color>
<color name="RoyalBlue">#4169E1</color>
<color name="DoderBlue">#1E90FF</color>
<color name="powderblue">#afeeee</color>
<color name="turquoise">#40e0d0</color>
<color name="DarkKhaki">#BDB76B</color>
<color name="Gold">#FFD700</color>
<color name="Beige">#F5F5DC</color>
<color name="LightGoldenrodYellow">#FAFAD2</color>
<color name="DarkOrange">#FF8C00</color>
<color name="LightCoral">#F08080</color>
<color name="orangered">#ff4500</color>
<color name="crimson">#dc143c</color>
<color name="deeppink">#ff1493</color>
<color name="fuchsia">#ff00ff</color>
<color name="palevioletred">#db7093</color>
<color name="plum">#dda0dd</color>
<color name="IndianRed">#CD5C5C</color>
<color name="DarkRed">#8B0000</color>
<color name="orchid">#da70d6</color>
<color name="LightSlateGray">#778899</color>
<color name="DimGray">#696969</color>
<color name="NavajoWhite">#FFDEAD</color>
<color name="black">#000000</color>
<color name="color_mainframe_top">#20B2AA</color>
<!-- <color name="colorPrimary">#6200EE</color>-->
<!-- <color name="colorPrimaryDark">#3700B3</color>-->
<!-- <color name="colorAccent">#03DAC5</color>-->
<!-- 画面背景色 -->
<!-- <drawable name="layout_backgroud">#000000</drawable>-->
<!-- 分割线背景色 -->
<!-- <drawable name="line_background">#161823</drawable>-->
<!-- <color name="white">#FFFFFF</color>-->
<!-- <color name="white">#ffffff</color>-->
<color name="color_minefragment_top">#20B2AA</color>
<color name="titleBackground">#f8f8f8</color>
<color name="background">#f2f2f2</color>
</resources>

@ -26,6 +26,16 @@
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Translucent</item>
</style>
<style name="text_editStyle" >
<item name="android:layout_height">47dp</item>
<item name="android:layout_width">47dp</item>
<item name="android:background">@mipmap/bg_verify</item>
<item name="android:gravity">center</item>
<item name="android:textColor">#0090FF</item>
<item name="android:textSize">18sp</item>
</style>
</resources>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="LimeGreen">#32CD32</color>
<color name="SpringGreen">#3CB371</color>
<color name="greenyellow">#adff2f</color>
<color name="yellowgreen">#9acd32</color>
<color name="colorAccent">#D81B60</color>
<color name="DarkOrchid">#9932CC</color>
<color name="RoyalBlue">#4169E1</color>
<color name="DoderBlue">#1E90FF</color>
<color name="powderblue">#afeeee</color>
<color name="turquoise">#40e0d0</color>
<color name="DarkKhaki">#BDB76B</color>
<color name="Gold">#FFD700</color>
<color name="Beige">#F5F5DC</color>
<color name="LightGoldenrodYellow">#FAFAD2</color>
<color name="DarkOrange">#FF8C00</color>
<color name="LightCoral">#F08080</color>
<color name="orangered">#ff4500</color>
<color name="crimson">#dc143c</color>
<color name="deeppink">#ff1493</color>
<color name="fuchsia">#ff00ff</color>
<color name="palevioletred">#db7093</color>
<color name="plum">#dda0dd</color>
<color name="IndianRed">#CD5C5C</color>
<color name="DarkRed">#8B0000</color>
<color name="orchid">#da70d6</color>
<color name="LightSlateGray">#778899</color>
<color name="DimGray">#696969</color>
<color name="NavajoWhite">#FFDEAD</color>
<color name="black">#000000</color>
<color name="white">#ffffff</color>
<color name="color_minefragment_top">#20B2AA</color>
</resources>

@ -9,6 +9,8 @@ buildscript {
'cn.bmob.android:bmob-sdk:3.7.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.mob.sdk:MobSDK:+"
}
}
@ -16,8 +18,12 @@ allprojects {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {url 'https://dl.bintray.com/chaozhouzhang/maven' }
maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" }
maven {url "http://mvn.mob.com/android"}
}
}

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<DevInfor>
<SinaWeibo AppKey="568898243" AppSecret="38a4f8204cc784f81f9f0daaf31e02e3" RedirectUrl="http://www.sharesdk.cn" />
<TencentWeibo Enable="false" />
<Douban Enable="false" />
<QZone AppId="100371282" AppKey="aed9b0303e3ed1e27bae87c33761161d" />
<Renren Enable="false" />
<KaiXin Enable="false" />
<Facebook Enable="false" />
<Twitter Enable="false" />
<Evernote Enable="false" />
<FourSquare Enable="false" />
<GooglePlus Enable="false" />
<Instagram Enable="false" />
<LinkedIn Enable="false" />
<Tumblr Enable="false" />
<Email Enable="false" />
<ShortMessage Enable="true" />
<Wechat AppId="wx4868b35061f87885" AppSecret="64020361b8ec4c99936c0e3999a9f249" userName="gh_afb25ac019c9" path="pages/index/index.html?id=1" WithShareTicket="true" MiniprogramType="2" />
<WechatMoments AppId="wx4868b35061f87885" AppSecret="64020361b8ec4c99936c0e3999a9f249" />
<QQ AppId="100371282" AppKey="aed9b0303e3ed1e27bae87c33761161d" />
<Instapaper Enable="false" />
<Pocket Enable="false" />
<YouDao Enable="false" />
<Pinterest Enable="false" />
<Flickr Enable="false" />
<Dropbox Enable="false" />
<VKontakte Enable="false" />
<WechatFavorite AppId="wx4868b35061f87885" AppSecret="64020361b8ec4c99936c0e3999a9f249" />
<Yixin Enable="false" />
<YixinMoments Enable="false" />
<Mingdao Enable="false" />
<Line Enable="false" />
<WhatsApp Enable="true" />
<KakaoTalk Enable="false" />
<KakaoStory Enable="false" />
<FacebookMessenger Enable="false" />
<Alipay Enable="false" />
<AlipayMoments Enable="false" />
<Dingding Enable="false" />
<Youtube Enable="false" />
<Meipai Enable="false" />
<Telegram Enable="false" />
<Cmcc Enable="false" />
<Reddit Enable="false" />
<Telecom Enable="false" />
<Accountkit Enable="false" />
<Douyin AppKey="aw9ivykfjvi4hpwo" AppSecret="42b4caa6bda60bd49f05f06d0a4956e1" />
<Wework Enable="false" />
<HWAccount Enable="false" />
<Oasis Enable="false" />
<XMAccount Enable="false" />
<SnapChat Enable="false" />
<Kuaishou Enable="false" />
<Littleredbook Enable="false" />
<Watermelonvideo Enable="false" />
<Tiktok Enable="false" />
</DevInfor>
Loading…
Cancel
Save