基本操作完善

This commit is contained in:
zengfantian 2015-02-13 17:11:17 +08:00
parent ca84956370
commit cd3a9c460e
3 changed files with 63 additions and 7 deletions

View File

@ -1,27 +1,59 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frame_root" android:id="@+id/frame_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"
tools:context=".sample.basic.BasicTestActivity" > tools:context=".sample.basic.BasicTestActivity" >
<Button <Button
android:id="@+id/btn_opengps" android:id="@+id/btn_opengps"
style="@style/accountButtonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
android:background="@color/orange" android:background="@color/orange"
android:text="@string/btn_opengps" /> android:text="@string/btn_opengps" />
<Button <Button
android:id="@+id/btn_call" android:id="@+id/btn_call"
style="@style/accountButtonStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_below="@id/btn_opengps" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_margin="5dp"
android:background="@color/cornflowerblue" android:background="@color/cornflowerblue"
android:text="@string/btn_call" /> android:text="@string/btn_call" />
</RelativeLayout> <Button
android:id="@+id/btn_contact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@color/cornflowerblue"
android:text="@string/btn_contact" />
<Button
android:id="@+id/btn_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@color/cornflowerblue"
android:text="@string/btn_setting" />
<Button
android:id="@+id/btn_carema"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@color/cornflowerblue"
android:text="@string/btn_carema" />
<Button
android:id="@+id/btn_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@color/cornflowerblue"
android:text="@string/btn_photo" />
</LinearLayout>

View File

@ -64,6 +64,10 @@
<!-- 基本操作示例(开始) --> <!-- 基本操作示例(开始) -->
<string name="btn_opengps">强制打开GPS</string> <string name="btn_opengps">强制打开GPS</string>
<string name="btn_call">直接拨打电话</string> <string name="btn_call">直接拨打电话</string>
<string name="btn_photo">照片选择界面</string>
<string name="btn_carema">启动照相机</string>
<string name="btn_setting">到系统设置界面</string>
<string name="btn_contact">到联系人选择界面</string>
<!-- 基本操作示例(结束) --> <!-- 基本操作示例(结束) -->
<!-- DrawerLayout抽屉菜单示例开始 --> <!-- DrawerLayout抽屉菜单示例开始 -->

View File

@ -17,7 +17,7 @@ import com.zftlive.android.tools.ToolPhone;
*/ */
public class BasicTestActivity extends BaseActivity implements View.OnClickListener{ public class BasicTestActivity extends BaseActivity implements View.OnClickListener{
private Button btn_opengps, btn_call; private Button btn_opengps, btn_call,btn_contact,btn_setting,btn_carema,btn_photo;
@Override @Override
public int bindLayout() { public int bindLayout() {
@ -28,9 +28,17 @@ public class BasicTestActivity extends BaseActivity implements View.OnClickListe
public void initView(View view) { public void initView(View view) {
btn_opengps = (Button) findViewById(R.id.btn_opengps); btn_opengps = (Button) findViewById(R.id.btn_opengps);
btn_opengps.setOnClickListener(this); btn_opengps.setOnClickListener(this);
btn_call = (Button) findViewById(R.id.btn_call); btn_call = (Button) findViewById(R.id.btn_call);
btn_call.setOnClickListener(this); btn_call.setOnClickListener(this);
btn_contact = (Button) findViewById(R.id.btn_contact);
btn_contact.setOnClickListener(this);
btn_setting = (Button) findViewById(R.id.btn_setting);
btn_setting.setOnClickListener(this);
btn_carema = (Button) findViewById(R.id.btn_carema);
btn_carema.setOnClickListener(this);
btn_photo = (Button) findViewById(R.id.btn_photo);
btn_photo.setOnClickListener(this);
} }
@Override @Override
@ -57,6 +65,18 @@ public class BasicTestActivity extends BaseActivity implements View.OnClickListe
case R.id.btn_call: case R.id.btn_call:
ToolPhone.callPhone(this, "10086"); ToolPhone.callPhone(this, "10086");
break; break;
case R.id.btn_contact:
ToolPhone.toChooseContactsList(getContext(), 99);
break;
case R.id.btn_setting:
ToolPhone.toSettingActivity(getContext());
break;
case R.id.btn_carema:
ToolPhone.toCameraActivity(getContext(), 88);
break;
case R.id.btn_photo:
ToolPhone.toImagePickerActivity(getContext(), 77);
break;
default: default:
break; break;
} }