打通导游电话

chengzhenyu vor 8 Jahren
Ursprung
Commit
bb222981b8

+ 10 - 0
app/src/main/java/ai/pai/client/activity/MainActivity.java

@@ -6,6 +6,7 @@ import android.content.Context;
6 6
 import android.content.Intent;
7 7
 import android.content.ServiceConnection;
8 8
 import android.graphics.Color;
9
+import android.net.Uri;
9 10
 import android.os.Bundle;
10 11
 import android.os.IBinder;
11 12
 import android.support.design.widget.NavigationView;
@@ -86,6 +87,7 @@ public class MainActivity extends AppCompatActivity
86 87
         drawerToggle.setOnClickListener(this);
87 88
         findViewById(R.id.floating_btn_add).setOnClickListener(this);
88 89
         findViewById(R.id.floating_btn_scan).setOnClickListener(this);
90
+        findViewById(R.id.floating_btn_call).setOnClickListener(this);
89 91
     }
90 92
 
91 93
     @Override
@@ -139,6 +141,14 @@ public class MainActivity extends AppCompatActivity
139 141
             case R.id.nav_photo_groups:
140 142
                 startActivity(new Intent(MainActivity.this, GroupListActivity.class));
141 143
                 break;
144
+            case R.id.floating_btn_call:
145
+                String tmp = "15901049735";
146
+                Uri uri=Uri.parse("tel:"+tmp);
147
+                Intent intent=new Intent();
148
+                intent.setAction(Intent.ACTION_CALL);
149
+                intent.setData(uri);
150
+                startActivity(intent);
151
+                break;
142 152
             default:
143 153
                 break;
144 154
         }

BIN
app/src/main/res/drawable-xhdpi/call_guide.png


+ 13 - 2
app/src/main/res/layout/app_bar_main.xml

@@ -7,6 +7,7 @@
7 7
 
8 8
     <include layout="@layout/content_main" />
9 9
 
10
+
10 11
     <ImageButton
11 12
         android:id="@+id/floating_btn_add"
12 13
         android:layout_width="56dp"
@@ -15,7 +16,7 @@
15 16
         android:layout_marginRight="8dp"
16 17
         android:layout_marginBottom="6dp"
17 18
         android:layout_marginTop="3dp"
18
-        android:background="@drawable/floating_add_selector" />
19
+        android:background="@drawable/floating_add_selector"/>
19 20
 
20 21
     <ImageButton
21 22
         android:id="@+id/floating_btn_scan"
@@ -24,6 +25,16 @@
24 25
         android:layout_gravity="bottom|end"
25 26
         android:layout_marginRight="8dp"
26 27
         android:layout_marginBottom="66dp"
27
-        android:background="@drawable/floating_qrscan_selector" />
28
+        android:background="@drawable/floating_qrscan_selector"/>
29
+
30
+    <ImageButton
31
+        android:id="@+id/floating_btn_call"
32
+        android:layout_width="56dp"
33
+        android:layout_height="56dp"
34
+        android:layout_gravity="bottom|end"
35
+        android:layout_marginRight="8dp"
36
+        android:layout_marginBottom="124dp"
37
+        android:background="@drawable/call_guide"/>
38
+
28 39
 
29 40
 </android.support.design.widget.CoordinatorLayout>