// Path: app/src/main/java/com/yan/mobilesafe/activity/ChooseContacts.java
// public class ChooseContacts extends AppCompatActivity {
//     ListView contactsView;
//     ArrayAdapter<String> adapter;
//     List<String> contactsList = new ArrayList<String>();
//     private String name;
//     private String number;
// 
//     @TargetApi(Build.VERSION_CODES.KITKAT)
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.choose_contacts_layout);
// 
//         //透明状态栏
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//         //透明导航栏
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//         contactsView = (ListView) findViewById(R.id.contacts_view);
//         adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, contactsList);
//         contactsView.setAdapter(adapter);
//         readContacts();
// 
//         contactsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//             @Override
//             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                 String chickNumber = adapter.getItem(position);
//                 chickNumber = chickNumber.substring(chickNumber.indexOf("\n") + 1, chickNumber.length());
// 
//                 Intent intent = new Intent();
//                 intent.putExtra("phoneNumber", chickNumber);
//                 setResult(Activity.RESULT_OK, intent);   //回调返回手机号码
//                 finish();
//             }
//         });
//     }
// 
//     private void readContacts() {
//         Cursor cursor = null;
//         cursor = getContentResolver().query(
//                 ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
//         assert cursor != null;
//         while (cursor.moveToNext()) {
//             //获取联系人名字
//             name = cursor.getString(cursor.getColumnIndex(
//                     ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
//             ));
//             //获取联系人手机号
//             number = cursor.getString(cursor.getColumnIndex(
//                     ContactsContract.CommonDataKinds.Phone.NUMBER
//             ));
//             contactsList.add(name + "\n" + number);
//         }
//         cursor.close();
//     }
// }
// 
// Path: app/src/main/java/com/yan/mobilesafe/utils/ToastUtils.java
// public class ToastUtils {
//     public static void showToast(final Activity context, final String string){
//         if ("main".equals(Thread.currentThread().getName())){ //判断是否为主线程
//             Toast.makeText(context,string,Toast.LENGTH_SHORT).show();
//         }else {
//             context.runOnUiThread(new Runnable() { //如果不是，就用该方法使其在ui线程中运行
//                 @Override
//                 public void run() {
//                     Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
//                 }
//             });
//         }
// 
//     }
// }


import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.yan.mobilesafe.R;
import com.yan.mobilesafe.activity.ChooseContacts;
import com.yan.mobilesafe.utils.ToastUtils;
package com.yan.mobilesafe.activity.Setup;




/**
 * 第三个设置向导页
 * Created by yan on 2015/11/22.
 */
public class SetupActivity3 extends AppCompatActivity {

    private EditText inputNumber;
    private SharedPreferences sharedPreferences;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setup3);
        Button next = (Button) findViewById(R.id.next);
// Path: app/src/main/java/com/yan/mobilesafe/activity/ChooseContacts.java
// public class ChooseContacts extends AppCompatActivity {
//     ListView contactsView;
//     ArrayAdapter<String> adapter;
//     List<String> contactsList = new ArrayList<String>();
//     private String name;
//     private String number;
// 
//     @TargetApi(Build.VERSION_CODES.KITKAT)
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.choose_contacts_layout);
// 
//         //透明状态栏
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//         //透明导航栏
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
//         contactsView = (ListView) findViewById(R.id.contacts_view);
//         adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, contactsList);
//         contactsView.setAdapter(adapter);
//         readContacts();
// 
//         contactsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//             @Override
//             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                 String chickNumber = adapter.getItem(position);
//                 chickNumber = chickNumber.substring(chickNumber.indexOf("\n") + 1, chickNumber.length());
// 
//                 Intent intent = new Intent();
//                 intent.putExtra("phoneNumber", chickNumber);
//                 setResult(Activity.RESULT_OK, intent);   //回调返回手机号码
//                 finish();
//             }
//         });
//     }
// 
//     private void readContacts() {
//         Cursor cursor = null;
//         cursor = getContentResolver().query(
//                 ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
//         assert cursor != null;
//         while (cursor.moveToNext()) {
//             //获取联系人名字
//             name = cursor.getString(cursor.getColumnIndex(
//                     ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME
//             ));
//             //获取联系人手机号
//             number = cursor.getString(cursor.getColumnIndex(
//                     ContactsContract.CommonDataKinds.Phone.NUMBER
//             ));
//             contactsList.add(name + "\n" + number);
//         }
//         cursor.close();
//     }
// }
// 
// Path: app/src/main/java/com/yan/mobilesafe/utils/ToastUtils.java
// public class ToastUtils {
//     public static void showToast(final Activity context, final String string){
//         if ("main".equals(Thread.currentThread().getName())){ //判断是否为主线程
//             Toast.makeText(context,string,Toast.LENGTH_SHORT).show();
//         }else {
//             context.runOnUiThread(new Runnable() { //如果不是，就用该方法使其在ui线程中运行
//                 @Override
//                 public void run() {
//                     Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
//                 }
//             });
//         }
// 
//     }
// }


// Path: app/src/main/java/com/yan/mobilesafe/activity/Setup/SetupActivity3.java
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.yan.mobilesafe.R;
import com.yan.mobilesafe.activity.ChooseContacts;
import com.yan.mobilesafe.utils.ToastUtils;

package com.yan.mobilesafe.activity.Setup;




/**
 * 第三个设置向导页
 * Created by yan on 2015/11/22.
 */
public class SetupActivity3 extends AppCompatActivity {

    private EditText inputNumber;
    private SharedPreferences sharedPreferences;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setup3);
        Button next = (Button) findViewById(R.id.next);
        Button back = (Button) findViewById(R.id.back);