Revision e9feb464
b/res/layout/contactrackspace.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout |
|
3 |
xmlns:android="http://schemas.android.com/apk/res/android" |
|
4 |
android:layout_width="fill_parent" |
|
5 |
android:layout_height="fill_parent" android:orientation="vertical"> |
|
6 |
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginTop="10dip" android:text="Contact US Support"></TextView> |
|
7 |
<Button android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:id="@+id/contact_us_button" android:text="877-934-0407"></Button> |
|
8 |
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginTop="10dip" android:text="Contact UK Support"></TextView> |
|
9 |
<Button android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:id="@+id/contact_uk_button" android:text="0800-083-3012"></Button> |
|
10 |
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginTop="10dip" android:text="Rackspace on Twitter"></TextView> |
|
11 |
<Button android:layout_height="wrap_content" android:layout_marginLeft="22dip" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:id="@+id/contact_twitter_button" android:text="Twitter"></Button> |
|
12 |
</LinearLayout> |
b/src/com/rackspacecloud/android/ContactActivity.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
|
6 | 6 |
import android.app.Activity; |
7 |
import android.content.Intent; |
|
8 |
import android.net.Uri; |
|
7 | 9 |
import android.os.Bundle; |
10 |
import android.util.Log; |
|
11 |
import android.view.View; |
|
12 |
import android.widget.Button; |
|
8 | 13 |
|
9 | 14 |
public class ContactActivity extends Activity{ |
10 | 15 |
|
11 | 16 |
ArrayList<String[]> contacts; |
17 |
private final String USNUMBER = "1-877-934-0407"; |
|
18 |
private final String UKNUMBER = "0800-083-3012"; |
|
19 |
private final String twitterAddress = "twitter.com/rackspace"; |
|
12 | 20 |
|
13 | 21 |
public void onCreate(Bundle savedInstanceState) { |
14 | 22 |
super.onCreate(savedInstanceState); |
15 |
// setContentView(R.layout.);
|
|
16 |
//registerForContextMenu(getListView());
|
|
23 |
setContentView(R.layout.contactrackspace);
|
|
24 |
setUpButtons();
|
|
17 | 25 |
} |
26 |
|
|
27 |
private void setUpButtons(){ |
|
28 |
|
|
29 |
Button usButton = (Button)findViewById(R.id.contact_us_button); |
|
30 |
usButton.setText(USNUMBER); |
|
31 |
usButton.setOnClickListener(new View.OnClickListener() { |
|
32 |
public void onClick(View v){ |
|
33 |
String phone = "tel:" + USNUMBER; |
|
34 |
Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse(phone)); |
|
35 |
startActivity(i); |
|
36 |
} |
|
37 |
}); |
|
38 |
|
|
39 |
Button ukButton = (Button)findViewById(R.id.contact_uk_button); |
|
40 |
ukButton.setText(UKNUMBER); |
|
41 |
ukButton.setOnClickListener(new View.OnClickListener() { |
|
42 |
public void onClick(View v){ |
|
43 |
String phone = "tel:" + UKNUMBER; |
|
44 |
Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse(phone)); |
|
45 |
startActivity(i); |
|
46 |
} |
|
47 |
}); |
|
48 |
|
|
49 |
Button twitterButton = (Button)findViewById(R.id.contact_twitter_button); |
|
50 |
twitterButton.setText(twitterAddress); |
|
51 |
twitterButton.setOnClickListener(new View.OnClickListener() { |
|
52 |
public void onClick(View v){ |
|
53 |
Log.d("info", "http://" + twitterAddress); |
|
54 |
Intent browse = new Intent(Intent.ACTION_VIEW , Uri.parse("http://mobile.twitter.com/rackspace")); |
|
55 |
startActivity(browse); |
|
56 |
|
|
57 |
} |
|
58 |
}); |
|
59 |
|
|
60 |
} |
|
18 | 61 |
|
19 | 62 |
} |
Also available in: Unified diff