Revision aeff0a62
b/AndroidManifest.xml | ||
---|---|---|
3 | 3 |
package="com.rackspacecloud.android" android:versionCode="1" |
4 | 4 |
android:versionName="1.0"> |
5 | 5 |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> |
6 |
<application android:name="AndroidCloudApplication" android:icon="@drawable/rackspace60"
|
|
7 |
android:label="@string/app_name"> |
|
6 |
<application android:name="AndroidCloudApplication" |
|
7 |
android:icon="@drawable/rackspace60" android:label="@string/app_name">
|
|
8 | 8 |
<activity android:name=".RackspaceCloudActivity" |
9 | 9 |
android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
10 | 10 |
<intent-filter> |
... | ... | |
20 | 20 |
</intent-filter> |
21 | 21 |
</activity> |
22 | 22 |
|
23 |
<activity android:name=".ListServersActivity" android:label="@string/app_name"
|
|
24 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
23 |
<activity android:name=".ListServersActivity" android:label="@string/app_name" |
|
24 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
25 | 25 |
<intent-filter> |
26 | 26 |
<action android:name="android.intent.action.MAIN" /> |
27 | 27 |
<category android:name="android.intent.category.APPLICATION" /> |
... | ... | |
29 | 29 |
</activity> |
30 | 30 |
|
31 | 31 |
<activity android:name=".AddServerActivity" android:label="@string/app_name" |
32 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
32 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
33 | 33 |
<intent-filter> |
34 | 34 |
<action android:name="android.intent.action.MAIN" /> |
35 | 35 |
<category android:name="android.intent.category.APPLICATION" /> |
36 | 36 |
</intent-filter> |
37 | 37 |
</activity> |
38 |
<activity android:name=".AddContainerActivity" android:label="@string/app_name"
|
|
39 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
38 |
<activity android:name=".AddContainerActivity" android:label="@string/app_name" |
|
39 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
40 | 40 |
<intent-filter> |
41 | 41 |
<action android:name="android.intent.action.MAIN" /> |
42 | 42 |
<category android:name="android.intent.category.APPLICATION" /> |
43 | 43 |
</intent-filter> |
44 | 44 |
</activity> |
45 | 45 |
|
46 |
<activity android:name=".ViewServerActivity" android:label="@string/app_name"
|
|
47 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
46 |
<activity android:name=".ViewServerActivity" android:label="@string/app_name" |
|
47 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
48 | 48 |
<intent-filter> |
49 | 49 |
<action android:name="android.intent.action.MAIN" /> |
50 | 50 |
<category android:name="android.intent.category.APPLICATION" /> |
51 | 51 |
</intent-filter> |
52 | 52 |
</activity> |
53 |
<activity android:name=".ViewServerActivity" android:label="@string/app_name"
|
|
54 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
53 |
<activity android:name=".ViewServerActivity" android:label="@string/app_name" |
|
54 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
55 | 55 |
<intent-filter> |
56 | 56 |
<action android:name="android.intent.action.MAIN" /> |
57 | 57 |
<category android:name="android.intent.category.APPLICATION" /> |
... | ... | |
79 | 79 |
</intent-filter> |
80 | 80 |
</activity> |
81 | 81 |
|
82 |
<activity android:name=".EnableCDNActivity" android:label="@string/app_name"
|
|
83 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
82 |
<activity android:name=".EnableCDNActivity" android:label="@string/app_name" |
|
83 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
84 | 84 |
<intent-filter> |
85 | 85 |
<action android:name="android.intent.action.MAIN" /> |
86 | 86 |
<category android:name="android.intent.category.APPLICATION" /> |
87 | 87 |
</intent-filter> |
88 | 88 |
</activity> |
89 |
|
|
90 |
<activity android:name=".ActivityChooser" android:label="@string/app_name"
|
|
91 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
92 |
<intent-filter>
|
|
93 |
<action android:name="android.intent.action.MAIN"/>
|
|
94 |
<category android:name="android.intent.category.APPLICATION"/>
|
|
95 |
</intent-filter>
|
|
96 |
</activity>
|
|
97 |
<activity android:name=".LoadBalancersActivity" android:label="@string/app_name"
|
|
98 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
99 |
<intent-filter>
|
|
100 |
<action android:name="android.intent.action.MAIN"/>
|
|
101 |
<category android:name="android.intent.category.APPLICATION"/>
|
|
102 |
</intent-filter>
|
|
103 |
</activity>
|
|
104 |
<activity android:name=".ListLoadBalancersActivity" android:label="@string/app_name"
|
|
105 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
106 |
<intent-filter>
|
|
107 |
<action android:name="android.intent.action.MAIN"/>
|
|
108 |
<category android:name="android.intent.category.APPLICATION"/>
|
|
109 |
</intent-filter>
|
|
110 |
</activity>
|
|
111 |
<activity android:name=".ViewLoadBalancerActivity" android:label="@string/app_name"
|
|
112 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
113 |
<intent-filter>
|
|
114 |
<action android:name="android.intent.action.MAIN"/>
|
|
115 |
<category android:name="android.intent.category.APPLICATION"/>
|
|
116 |
</intent-filter>
|
|
117 |
</activity>
|
|
118 |
|
|
119 |
|
|
89 |
|
|
90 |
<activity android:name=".ActivityChooser" android:label="@string/app_name" |
|
91 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
92 |
<intent-filter>
|
|
93 |
<action android:name="android.intent.action.MAIN" />
|
|
94 |
<category android:name="android.intent.category.APPLICATION" />
|
|
95 |
</intent-filter>
|
|
96 |
</activity>
|
|
97 |
<activity android:name=".LoadBalancersActivity"
|
|
98 |
android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
99 |
<intent-filter>
|
|
100 |
<action android:name="android.intent.action.MAIN" />
|
|
101 |
<category android:name="android.intent.category.APPLICATION" />
|
|
102 |
</intent-filter>
|
|
103 |
</activity>
|
|
104 |
<activity android:name=".ListLoadBalancersActivity"
|
|
105 |
android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
106 |
<intent-filter>
|
|
107 |
<action android:name="android.intent.action.MAIN" />
|
|
108 |
<category android:name="android.intent.category.APPLICATION" />
|
|
109 |
</intent-filter>
|
|
110 |
</activity>
|
|
111 |
<activity android:name=".ViewLoadBalancerActivity"
|
|
112 |
android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
|
113 |
<intent-filter>
|
|
114 |
<action android:name="android.intent.action.MAIN" />
|
|
115 |
<category android:name="android.intent.category.APPLICATION" />
|
|
116 |
</intent-filter>
|
|
117 |
</activity>
|
|
118 |
|
|
119 |
|
|
120 | 120 |
<activity android:name=".Preferences" android:label="@string/preference_name" /> |
121 | 121 |
<activity android:name=".BackupServerActivity"></activity> |
122 | 122 |
<activity android:name=".PasswordServerActivity"></activity> |
123 | 123 |
<activity android:name=".PingServerActivity"></activity> |
124 |
<activity android:name=".ListAccountsActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
124 |
<activity android:name=".ListAccountsActivity" |
|
125 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> |
|
125 | 126 |
<intent-filter> |
126 | 127 |
<action android:name="android.intent.action.MAIN" /> |
127 | 128 |
<category android:name="android.intent.category.LAUNCHER" /> |
128 | 129 |
</intent-filter> |
129 | 130 |
</activity> |
130 | 131 |
|
131 |
<activity android:name=".AddAccountActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
132 |
<activity android:name=".ContactActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
133 |
<activity android:name=".CreatePasswordActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
134 |
<activity android:name=".AddFileActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
135 |
<activity android:name=".ServerErrorActivity" android:theme="@android:style/Theme.Dialog" android:noHistory="true"></activity> |
|
132 |
<activity android:name=".AddAccountActivity" |
|
133 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
134 |
<activity android:name=".ContactActivity" |
|
135 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
136 |
<activity android:name=".CreatePasswordActivity" |
|
137 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
138 |
<activity android:name=".AddFileActivity" |
|
139 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
140 |
<activity android:name=".ServerErrorActivity" android:theme="@android:style/Theme.Dialog" |
|
141 |
android:noHistory="true"></activity> |
|
136 | 142 |
<activity android:name=".ErrorDetailsActivity"></activity> |
137 |
<activity android:name=".ConfirmResizeActivity" android:theme="@android:style/Theme.Dialog"></activity> |
|
138 |
|
|
143 |
<activity android:name=".ConfirmResizeActivity" |
|
144 |
android:theme="@android:style/Theme.Dialog"></activity> |
|
145 |
<activity android:name=".AddLoadBalancerActivity" |
|
146 |
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity> |
|
147 |
|
|
139 | 148 |
|
140 | 149 |
|
141 | 150 |
</application> |
b/res/layout-land/view_loadbalancer.xml | ||
---|---|---|
5 | 5 |
android:background="@drawable/rackbg_land"> |
6 | 6 |
<ImageView android:id="@+id/headerimage" |
7 | 7 |
android:layout_width="wrap_content" android:layout_height="80dip"/> |
8 |
<LinearLayout android:orientation="vertical" android:layout_height="wrap_content" android:background="@drawable/itemsbox_landscape" android:layout_width="fill_parent" android:paddingLeft="5dip" android:id="@+id/view_loadbalancer_layout"> |
|
9 |
<TextView android:text="LoadBalancer" android:textSize="20.0sp" android:gravity="fill_horizontal" android:layout_marginLeft="22dip" android:layout_height="wrap_content" android:scrollHorizontally="true" android:paddingBottom="10dip" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:layout_marginTop="30dip"></TextView> |
|
10 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_lb_id_layout"> |
|
11 |
<TextView android:text="ID: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
12 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_lb_id" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
13 |
</LinearLayout> |
|
14 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_name_layout"> |
|
15 |
<TextView android:text="ID: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
16 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_name" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
17 |
</LinearLayout> |
|
18 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_protocol_layout"> |
|
19 |
<TextView android:text="Protocol: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
20 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_protocol" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
21 |
</LinearLayout> |
|
22 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_port_layout"> |
|
23 |
<TextView android:text="Port: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
24 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_port" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
25 |
</LinearLayout> |
|
26 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_algorithm_layout"> |
|
27 |
<TextView android:text="Algorithm: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
28 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_algorithm" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
29 |
</LinearLayout> |
|
30 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_status_layout"> |
|
31 |
<TextView android:text="Status: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
32 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_status" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
33 |
</LinearLayout> |
|
34 |
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/view_islogging_layout"> |
|
35 |
<TextView android:text="Connection Logging: " android:layout_marginLeft="22dip" android:singleLine="false" android:layout_height="wrap_content" android:textStyle="bold" android:paddingLeft="5dip" android:layout_width="wrap_content"></TextView> |
|
36 |
<TextView android:gravity="fill_horizontal" android:id="@+id/view_islogging" android:layout_height="wrap_content" android:scrollHorizontally="true" android:paddingBottom="30dip" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent"></TextView> |
|
37 |
</LinearLayout> |
|
38 |
</LinearLayout> |
|
8 | 39 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
9 | 40 |
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> |
10 | 41 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
11 | 42 |
android:id="@+id/view_layout_layout" android:orientation="vertical" |
12 | 43 |
android:layout_width="fill_parent" android:layout_height="fill_parent"> |
13 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
14 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
|
15 |
android:layout_width="fill_parent" android:layout_height="wrap_content" |
|
16 |
android:paddingLeft="5dip" android:background="@drawable/itemsbox_landscape"> |
|
17 |
<TextView android:layout_height="wrap_content" |
|
18 |
android:layout_width="fill_parent" android:layout_marginLeft="22dip" |
|
19 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
20 |
android:gravity="fill_horizontal" android:textSize="20.0sp" |
|
21 |
android:textColor="#fff" android:layout_marginTop="30dip" |
|
22 |
android:paddingBottom="10dip" android:text="LoadBalancer" /> |
|
23 |
|
|
24 |
<!-- ID --> |
|
25 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
26 |
android:id="@+id/view_lb_id_layout" android:orientation="horizontal" |
|
27 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
28 |
<TextView android:layout_width="wrap_content" |
|
29 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
30 |
android:paddingLeft="5dip" android:text="ID: " android:singleLine="false" |
|
31 |
android:textStyle="bold" /> |
|
32 |
<TextView android:id="@+id/view_lb_id" |
|
33 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
34 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
35 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
36 |
</LinearLayout> |
|
37 |
<!-- Name --> |
|
38 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
39 |
android:id="@+id/view_name_layout" android:orientation="horizontal" |
|
40 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
41 |
<TextView android:layout_width="wrap_content" |
|
42 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
43 |
android:paddingLeft="5dip" android:text="ID: " android:singleLine="false" |
|
44 |
android:textStyle="bold" /> |
|
45 |
<TextView android:id="@+id/view_name" |
|
46 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
47 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
48 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
49 |
</LinearLayout> |
|
50 |
<!-- Protocol --> |
|
51 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
52 |
android:id="@+id/view_protocol_layout" android:orientation="horizontal" |
|
53 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
54 |
<TextView android:layout_width="wrap_content" |
|
55 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
56 |
android:paddingLeft="5dip" android:text="Protocol: " |
|
57 |
android:singleLine="false" android:textStyle="bold" /> |
|
58 |
<TextView android:id="@+id/view_protocol" |
|
59 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
60 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
61 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
62 |
</LinearLayout> |
|
63 |
<!-- Port --> |
|
64 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
65 |
android:id="@+id/view_port_layout" android:orientation="horizontal" |
|
66 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
67 |
<TextView android:layout_width="wrap_content" |
|
68 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
69 |
android:paddingLeft="5dip" android:text="Port: " |
|
70 |
android:singleLine="false" android:textStyle="bold" /> |
|
71 |
<TextView android:id="@+id/view_port" |
|
72 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
73 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
74 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
75 |
</LinearLayout> |
|
76 |
<!-- Algorithm --> |
|
77 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
78 |
android:id="@+id/view_algorithm_layout" android:orientation="horizontal" |
|
79 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
80 |
<TextView android:layout_width="wrap_content" |
|
81 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
82 |
android:paddingLeft="5dip" android:text="Algorithm: " |
|
83 |
android:singleLine="false" android:textStyle="bold" /> |
|
84 |
<TextView android:id="@+id/view_algorithm" |
|
85 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
86 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
87 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
88 |
</LinearLayout> |
|
89 |
<!-- Status --> |
|
90 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
91 |
android:id="@+id/view_status_layout" android:orientation="horizontal" |
|
92 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
93 |
<TextView android:layout_width="wrap_content" |
|
94 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
95 |
android:paddingLeft="5dip" android:text="Status: " |
|
96 |
android:singleLine="false" android:textStyle="bold" /> |
|
97 |
<TextView android:id="@+id/view_status" |
|
98 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
99 |
android:layout_marginRight="30dip" android:scrollHorizontally="true" |
|
100 |
android:gravity="fill_horizontal" android:textColor="#fff" /> |
|
101 |
</LinearLayout> |
|
102 |
<!-- ConnectionLogging --> |
|
103 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
104 |
android:id="@+id/view_islogging_layout" android:orientation="horizontal" |
|
105 |
android:layout_width="fill_parent" android:layout_height="wrap_content"> |
|
106 |
<TextView android:layout_width="wrap_content" |
|
107 |
android:layout_height="wrap_content" android:layout_marginLeft="22dip" |
|
108 |
android:paddingLeft="5dip" android:text="Connection Logging: " |
|
109 |
android:singleLine="false" android:textStyle="bold" /> |
|
110 |
<TextView android:id="@+id/view_islogging" |
|
111 |
android:layout_height="wrap_content" android:layout_width="fill_parent" |
|
112 |
android:layout_marginRight="30dip" android:paddingBottom="30dip" |
|
113 |
android:scrollHorizontally="true" android:gravity="fill_horizontal" |
|
114 |
android:textColor="#fff" /> |
|
115 |
</LinearLayout> |
|
116 |
</LinearLayout> |
|
117 | 44 |
<!-- VirtualIps --> |
118 | 45 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
119 | 46 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
b/res/layout/view_add_loadbalancer.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
3 |
android:id="@+id/view_loadbalncer_layout" android:orientation="vertical" |
|
4 |
android:layout_width="fill_parent" android:layout_height="fill_parent" |
|
5 |
android:background="@drawable/rack_bg_transparent"> |
|
6 |
<ImageView android:id="@+id/headerimage" |
|
7 |
android:layout_width="wrap_content" android:layout_height="80dip" /> |
|
8 |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
|
9 |
android:layout_width="fill_parent" android:layout_height="fill_parent" |
|
10 |
android:layout_weight="1"> |
|
11 |
<TableLayout android:layout_height="wrap_content" android:background="@drawable/itemsbox" android:layout_width="fill_parent" android:paddingLeft="5dip" android:id="@+id/view_loadbalancer_layout" android:paddingBottom="30dip"> |
|
12 |
<TextView android:text="LoadBalancer" android:textSize="20.0sp" android:gravity="fill_horizontal" android:layout_marginLeft="22dip" android:layout_height="wrap_content" android:scrollHorizontally="true" android:textColor="#fff" android:layout_marginRight="30dip" android:layout_width="fill_parent" android:layout_marginTop="30dip" android:paddingTop="10dip" android:layout_marginBottom="10dip"></TextView> |
|
13 |
<TableRow android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/edit_lb_name_layout"> |
|
14 |
<TextView android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip" android:text="Name"></TextView> |
|
15 |
<EditText android:layout_weight="1" android:layout_marginRight="20dip" android:id="@+id/edit_lb_name_text" android:layout_height="wrap_content" android:layout_width="wrap_content"> |
|
16 |
<requestFocus></requestFocus> |
|
17 |
</EditText> |
|
18 |
</TableRow> |
|
19 |
<TableRow android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/edit_protocol_layout"> |
|
20 |
<TextView android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip" android:text="Protocol"></TextView> |
|
21 |
<Spinner android:id="@+id/edit_protocol_spinner" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:layout_marginRight="20dip"></Spinner> |
|
22 |
</TableRow> |
|
23 |
<TableRow android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/edit_port_layout"> |
|
24 |
<TextView android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip" android:text="Port"></TextView> |
|
25 |
<EditText android:layout_weight="1" android:layout_marginRight="20dip" android:id="@+id/edit_port_text" android:layout_height="wrap_content" android:layout_width="wrap_content"></EditText> |
|
26 |
</TableRow> |
|
27 |
<TableRow android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/edit_vip_layout"> |
|
28 |
<TextView android:text="@string/virtual_ip_type" android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip"></TextView> |
|
29 |
<Spinner android:id="@+id/edit_vip_spinner" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:layout_marginRight="20dip"></Spinner> |
|
30 |
</TableRow> |
|
31 |
<TableRow android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/edit_algorithm_layout"> |
|
32 |
<TextView android:text="Algorithm" android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip"></TextView> |
|
33 |
<Spinner android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:layout_marginRight="20dip" android:id="@+id/edit_algorithm_spinner"></Spinner> |
|
34 |
</TableRow> |
|
35 |
<TableRow android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/edit_region_layout"> |
|
36 |
<TextView android:singleLine="false" android:layout_gravity="center_vertical" android:layout_marginLeft="22dip" android:textColor="#333" android:textStyle="bold" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="5dip" android:text="Region"></TextView> |
|
37 |
<Spinner android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:layout_marginRight="20dip" android:id="@+id/edit_region_spinner"></Spinner> |
|
38 |
</TableRow> |
|
39 |
</TableLayout> |
|
40 |
</ScrollView> |
|
41 |
<ImageView android:id="@+id/footerimage" |
|
42 |
android:layout_width="wrap_content" android:layout_height="25dip" /> |
|
43 |
</LinearLayout> |
b/res/layout/view_loadbalancer.xml | ||
---|---|---|
115 | 115 |
</LinearLayout> |
116 | 116 |
</LinearLayout> |
117 | 117 |
<!-- VirtualIps --> |
118 |
<Button android:layout_gravity="center" android:id="@+id/edit_loadbalancer_button" android:layout_height="wrap_content" android:text="Edit Load Balancer" android:layout_width="wrap_content"></Button> |
|
118 | 119 |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
119 | 120 |
android:id="@+id/view_loadbalancer_layout" android:orientation="vertical" |
120 | 121 |
android:layout_width="fill_parent" android:layout_height="wrap_content" |
b/res/menu/loadbalancers_list_menu.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<menu xmlns:android="http://schemas.android.com/apk/res/android"> |
|
3 |
<item android:id="@+id/add_loadbalancer" android:title="New Load Balancer" android:icon="@drawable/add_button" /> |
|
4 |
<item android:id="@+id/refresh" android:title="Refresh" android:icon="@drawable/refresh_button" /> |
|
5 |
</menu> |
b/res/values/strings.xml | ||
---|---|---|
52 | 52 |
<string name="contact_uk">0800-083-3012</string> |
53 | 53 |
<string name="contact_us">877-934-0407</string> |
54 | 54 |
<string name="confirm_resize">Confirming the resize will destroy the saved copy of your original server.</string> |
55 |
<string name="virtual_ip_type">Virtual\nIp Type</string> |
|
55 | 56 |
|
56 | 57 |
</resources> |
b/src/com/rackspace/cloud/loadbalancer/api/client/LoadBalancer.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import java.util.ArrayList; |
7 | 7 |
|
8 |
|
|
8 | 9 |
public class LoadBalancer extends Entity { |
9 | 10 |
|
10 | 11 |
private static final long serialVersionUID = 5994739895998309675L; |
... | ... | |
146 | 147 |
+ getName() + "\" id=\"" + getId() + "</loadBalancer>"; |
147 | 148 |
return xml; |
148 | 149 |
} |
149 |
|
|
150 | 150 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/client/Protocol.java | ||
---|---|---|
1 |
package com.rackspace.cloud.loadbalancer.api.client; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.TreeMap; |
|
5 |
|
|
6 |
public class Protocol extends Entity{ |
|
7 |
|
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
11 |
private static final long serialVersionUID = 9174031376597839482L; |
|
12 |
private static ArrayList<Protocol> protocols; |
|
13 |
private String name; |
|
14 |
private String port; |
|
15 |
|
|
16 |
/** |
|
17 |
* @param name the name to set |
|
18 |
*/ |
|
19 |
public void setName(String name) { |
|
20 |
this.name = name; |
|
21 |
} |
|
22 |
/** |
|
23 |
* @return the name |
|
24 |
*/ |
|
25 |
public String getName() { |
|
26 |
return name; |
|
27 |
} |
|
28 |
|
|
29 |
/** |
|
30 |
* @param port the port to set |
|
31 |
*/ |
|
32 |
public void setPort(String port) { |
|
33 |
this.port = port; |
|
34 |
} |
|
35 |
/** |
|
36 |
* @return the port |
|
37 |
*/ |
|
38 |
public String getPort() { |
|
39 |
return port; |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* @return the protocols |
|
44 |
*/ |
|
45 |
public static ArrayList<Protocol> getProtocols() { |
|
46 |
return protocols; |
|
47 |
} |
|
48 |
/** |
|
49 |
* @param protocols the protocols to set |
|
50 |
*/ |
|
51 |
public static void setProtocols(ArrayList<Protocol> protocols) { |
|
52 |
Protocol.protocols = protocols; |
|
53 |
} |
|
54 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/client/ProtocolManager.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package com.rackspace.cloud.loadbalancer.api.client; |
|
5 |
|
|
6 |
import java.io.IOException; |
|
7 |
import java.io.StringReader; |
|
8 |
import java.util.ArrayList; |
|
9 |
|
|
10 |
import javax.xml.parsers.FactoryConfigurationError; |
|
11 |
import javax.xml.parsers.ParserConfigurationException; |
|
12 |
import javax.xml.parsers.SAXParser; |
|
13 |
import javax.xml.parsers.SAXParserFactory; |
|
14 |
|
|
15 |
import org.apache.http.HttpResponse; |
|
16 |
import org.apache.http.client.ClientProtocolException; |
|
17 |
import org.apache.http.client.methods.HttpGet; |
|
18 |
import org.apache.http.impl.client.BasicResponseHandler; |
|
19 |
import org.xml.sax.InputSource; |
|
20 |
import org.xml.sax.SAXException; |
|
21 |
import org.xml.sax.XMLReader; |
|
22 |
|
|
23 |
import android.content.Context; |
|
24 |
import android.util.Log; |
|
25 |
|
|
26 |
import com.rackspace.cloud.files.api.client.CustomHttpClient; |
|
27 |
import com.rackspace.cloud.loadbalancer.api.parsers.ProtocolsXMLParser; |
|
28 |
import com.rackspace.cloud.servers.api.client.Account; |
|
29 |
|
|
30 |
public class ProtocolManager extends EntityManager { |
|
31 |
|
|
32 |
public ArrayList<Protocol> createList(Context context) { |
|
33 |
CustomHttpClient httpclient = new CustomHttpClient(context); |
|
34 |
HttpGet get = new HttpGet(Account.getAccount().getLoadBalancerDFWUrl() + Account.getAccount().getAccountId() + "/loadbalancers/protocols.xml"); |
|
35 |
ArrayList<Protocol> protocols = new ArrayList<Protocol>(); |
|
36 |
|
|
37 |
get.addHeader("X-Auth-Token", Account.getAccount().getAuthToken()); |
|
38 |
try { |
|
39 |
HttpResponse resp = httpclient.execute(get); |
|
40 |
BasicResponseHandler responseHandler = new BasicResponseHandler(); |
|
41 |
String body = responseHandler.handleResponse(resp); |
|
42 |
Log.d("info", body); |
|
43 |
|
|
44 |
if (resp.getStatusLine().getStatusCode() == 200) { |
|
45 |
ProtocolsXMLParser protocolsXMLParser = new ProtocolsXMLParser(); |
|
46 |
SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); |
|
47 |
XMLReader xmlReader = saxParser.getXMLReader(); |
|
48 |
xmlReader.setContentHandler(protocolsXMLParser); |
|
49 |
xmlReader.parse(new InputSource(new StringReader(body))); |
|
50 |
protocols = protocolsXMLParser.getProtocols(); |
|
51 |
} |
|
52 |
} catch (ClientProtocolException cpe) { |
|
53 |
cpe.printStackTrace(); |
|
54 |
// we'll end up with an empty list; that's good enough |
|
55 |
} catch (IOException e) { |
|
56 |
e.printStackTrace(); |
|
57 |
// we'll end up with an empty list; that's good enough |
|
58 |
} catch (ParserConfigurationException e) { |
|
59 |
e.printStackTrace(); |
|
60 |
// we'll end up with an empty list; that's good enough |
|
61 |
} catch (SAXException e) { |
|
62 |
e.printStackTrace(); |
|
63 |
// we'll end up with an empty list; that's good enough |
|
64 |
} catch (FactoryConfigurationError e) { |
|
65 |
e.printStackTrace(); |
|
66 |
// we'll end up with an empty list; that's good enough |
|
67 |
} |
|
68 |
|
|
69 |
return protocols; |
|
70 |
} |
|
71 |
|
|
72 |
} |
b/src/com/rackspace/cloud/loadbalancer/api/parsers/ProtocolsXMLParser.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package com.rackspace.cloud.loadbalancer.api.parsers; |
|
5 |
|
|
6 |
import java.util.ArrayList; |
|
7 |
|
|
8 |
import org.xml.sax.Attributes; |
|
9 |
import org.xml.sax.helpers.DefaultHandler; |
|
10 |
|
|
11 |
import android.util.Log; |
|
12 |
|
|
13 |
import com.rackspace.cloud.loadbalancer.api.client.Protocol; |
|
14 |
|
|
15 |
|
|
16 |
public class ProtocolsXMLParser extends DefaultHandler { |
|
17 |
private Protocol protocol; |
|
18 |
private ArrayList<Protocol> protocols; |
|
19 |
private StringBuffer currentData; |
|
20 |
|
|
21 |
public void startDocument() { |
|
22 |
} |
|
23 |
|
|
24 |
public void endDocument() { |
|
25 |
} |
|
26 |
|
|
27 |
public void startElement(String uri, String name, String qName, Attributes atts) { |
|
28 |
|
|
29 |
currentData = new StringBuffer(); |
|
30 |
if ("protocols".equals(name)) { |
|
31 |
protocols = new ArrayList<Protocol>(); |
|
32 |
} else if ("protocol".equals(name)) { |
|
33 |
protocol = new Protocol(); |
|
34 |
protocol.setName(atts.getValue("name")); |
|
35 |
protocol.setPort(atts.getValue("port")); |
|
36 |
} |
|
37 |
} |
|
38 |
|
|
39 |
public void endElement(String uri, String name, String qName) { |
|
40 |
if ("protocol".equals(name)) { |
|
41 |
if (protocols != null) { |
|
42 |
protocols.add(protocol); |
|
43 |
} |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
public void characters(char ch[], int start, int length) { |
|
48 |
Log.d("Rackspace-Cloud", "Characters: \""); |
|
49 |
for (int i = start; i < start + length; i++) { |
|
50 |
switch (ch[i]) { |
|
51 |
case '\\': |
|
52 |
Log.d("Rackspace-Cloud", "\\\\"); |
|
53 |
break; |
|
54 |
case '"': |
|
55 |
Log.d("Rackspace-Cloud", "\\\""); |
|
56 |
break; |
|
57 |
case '\n': |
|
58 |
Log.d("Rackspace-Cloud", "\\n"); |
|
59 |
break; |
|
60 |
case '\r': |
|
61 |
Log.d("Rackspace-Cloud", "\\r"); |
|
62 |
break; |
|
63 |
case '\t': |
|
64 |
Log.d("Rackspace-Cloud", "\\t"); |
|
65 |
break; |
|
66 |
default: |
|
67 |
Log.d("Rackspace-Cloud", String.valueOf(ch[i])); |
|
68 |
break; |
|
69 |
} |
|
70 |
} |
|
71 |
Log.d("Rackspace-Cloud", "\"\n"); |
|
72 |
|
|
73 |
|
|
74 |
for (int i = start; i < (start + length); i++) { |
|
75 |
currentData.append(ch[i]); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* @return the protocol |
|
81 |
*/ |
|
82 |
public Protocol getProtocol() { |
|
83 |
return protocol; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* @param protocol the protocol to set |
|
88 |
*/ |
|
89 |
public void setProtocol(Protocol protocol) { |
|
90 |
this.protocol = protocol; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* @return the protocols |
|
95 |
*/ |
|
96 |
public ArrayList<Protocol> getProtocols() { |
|
97 |
return protocols; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* @param protocols the protocols to set |
|
102 |
*/ |
|
103 |
public void setProtocols(ArrayList<Protocol> protocols) { |
|
104 |
this.protocols = protocols; |
|
105 |
} |
|
106 |
|
|
107 |
} |
b/src/com/rackspacecloud/android/AddLoadBalancerActivity.java | ||
---|---|---|
1 |
package com.rackspacecloud.android; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.Arrays; |
|
5 |
import java.util.Iterator; |
|
6 |
|
|
7 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancer; |
|
8 |
import com.rackspace.cloud.loadbalancer.api.client.Protocol; |
|
9 |
import com.rackspace.cloud.loadbalancer.api.client.ProtocolManager; |
|
10 |
import com.rackspace.cloud.servers.api.client.Image; |
|
11 |
|
|
12 |
import android.app.Activity; |
|
13 |
import android.app.AlertDialog; |
|
14 |
import android.content.Context; |
|
15 |
import android.content.DialogInterface; |
|
16 |
import android.os.AsyncTask; |
|
17 |
import android.os.Bundle; |
|
18 |
import android.util.Log; |
|
19 |
import android.view.View; |
|
20 |
import android.widget.AdapterView; |
|
21 |
import android.widget.AdapterView.OnItemSelectedListener; |
|
22 |
import android.widget.ArrayAdapter; |
|
23 |
import android.widget.EditText; |
|
24 |
import android.widget.Spinner; |
|
25 |
|
|
26 |
public class AddLoadBalancerActivity extends Activity implements OnItemSelectedListener { |
|
27 |
|
|
28 |
private Protocol[] protocols; |
|
29 |
private LoadBalancer loadBalancer; |
|
30 |
private Context context; |
|
31 |
private Spinner protocolSpinner; |
|
32 |
private EditText portText; |
|
33 |
private Protocol selectedProtocol; |
|
34 |
|
|
35 |
@Override |
|
36 |
public void onCreate(Bundle savedInstanceState) { |
|
37 |
super.onCreate(savedInstanceState); |
|
38 |
setContentView(R.layout.view_add_loadbalancer); |
|
39 |
restoreState(savedInstanceState); |
|
40 |
} |
|
41 |
|
|
42 |
private void restoreState(Bundle state) { |
|
43 |
context = getApplicationContext(); |
|
44 |
portText = (EditText)findViewById(R.id.edit_port_text); |
|
45 |
loadProtocolSpinner(); |
|
46 |
} |
|
47 |
|
|
48 |
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
|
49 |
if (parent == protocolSpinner) { |
|
50 |
selectedProtocol = protocols[position]; |
|
51 |
portText.setText(protocols[position].getPort()); |
|
52 |
} |
|
53 |
} |
|
54 |
|
|
55 |
public void onNothingSelected(AdapterView<?> parent) { |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
private void loadProtocolSpinner() { |
|
60 |
protocolSpinner = (Spinner) findViewById(R.id.edit_protocol_spinner); |
|
61 |
protocolSpinner.setOnItemSelectedListener(this); |
|
62 |
String protocolNames[] = new String[Protocol.getProtocols().size()]; |
|
63 |
protocols = new Protocol[Protocol.getProtocols().size()]; |
|
64 |
|
|
65 |
for(int i = 0; i < Protocol.getProtocols().size(); i++){ |
|
66 |
protocols[i] = Protocol.getProtocols().get(i); |
|
67 |
protocolNames[i] = Protocol.getProtocols().get(i).getName(); |
|
68 |
} |
|
69 |
|
|
70 |
ArrayAdapter<String> imageAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, protocolNames); |
|
71 |
imageAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
72 |
protocolSpinner.setAdapter(imageAdapter); |
|
73 |
} |
|
74 |
|
|
75 |
private void showAlert(String title, String message) { |
|
76 |
AlertDialog alert = new AlertDialog.Builder(this).create(); |
|
77 |
alert.setTitle(title); |
|
78 |
alert.setMessage(message); |
|
79 |
alert.setButton("OK", new DialogInterface.OnClickListener() { |
|
80 |
public void onClick(DialogInterface dialog, int which) { |
|
81 |
return; |
|
82 |
} }); |
|
83 |
alert.show(); |
|
84 |
} |
|
85 |
} |
b/src/com/rackspacecloud/android/ListAccountsActivity.java | ||
---|---|---|
10 | 10 |
import java.util.ArrayList; |
11 | 11 |
import java.util.TreeMap; |
12 | 12 |
|
13 |
import com.rackspace.cloud.loadbalancer.api.client.Protocol; |
|
14 |
import com.rackspace.cloud.loadbalancer.api.client.ProtocolManager; |
|
13 | 15 |
import com.rackspace.cloud.servers.api.client.Account; |
14 | 16 |
import com.rackspace.cloud.servers.api.client.Flavor; |
15 | 17 |
import com.rackspace.cloud.servers.api.client.FlavorManager; |
... | ... | |
65 | 67 |
onRestoreInstanceState(savedInstanceState); |
66 | 68 |
registerForContextMenu(getListView()); |
67 | 69 |
context = getApplicationContext(); |
68 |
// tabViewIntent = new Intent(this, TabViewActivity.class); |
|
69 | 70 |
tabViewIntent = new Intent(this, ActivityChooser.class); |
70 | 71 |
verifyPassword(); |
71 | 72 |
} |
... | ... | |
446 | 447 |
} |
447 | 448 |
} |
448 | 449 |
|
449 |
private class LoadFlavorsTask extends AsyncTask<Void, Void, ArrayList<Flavor>> {
|
|
450 |
private class LoadImagesTask extends AsyncTask<Void, Void, ArrayList<Image>> {
|
|
450 | 451 |
|
451 | 452 |
@Override |
452 |
protected ArrayList<Flavor> doInBackground(Void... arg0) {
|
|
453 |
return (new FlavorManager()).createList(true, context);
|
|
453 |
protected ArrayList<Image> doInBackground(Void... arg0) {
|
|
454 |
return (new ImageManager()).createList(true, context);
|
|
454 | 455 |
} |
455 | 456 |
|
456 | 457 |
@Override |
457 |
protected void onPostExecute(ArrayList<Flavor> result) {
|
|
458 |
protected void onPostExecute(ArrayList<Image> result) {
|
|
458 | 459 |
if (result != null && result.size() > 0) { |
459 |
TreeMap<String, Flavor> flavorMap = new TreeMap<String, Flavor>();
|
|
460 |
TreeMap<String, Image> imageMap = new TreeMap<String, Image>();
|
|
460 | 461 |
for (int i = 0; i < result.size(); i++) { |
461 |
Flavor flavor = result.get(i);
|
|
462 |
flavorMap.put(flavor.getId(), flavor);
|
|
462 |
Image image = result.get(i);
|
|
463 |
imageMap.put(image.getId(), image);
|
|
463 | 464 |
} |
464 |
Flavor.setFlavors(flavorMap); |
|
465 |
hideDialog(); |
|
466 |
startActivityForResult(tabViewIntent, 187); |
|
465 |
Image.setImages(imageMap); |
|
466 |
new LoadProtocolsTask().execute((Void[]) null); |
|
467 | 467 |
} else { |
468 | 468 |
hideDialog(); |
469 |
showAlert("Login Failure", "There was a problem loading server flavors. Please try again.");
|
|
469 |
showAlert("Login Failure", "There was a problem loading server images. Please try again.");
|
|
470 | 470 |
} |
471 | 471 |
} |
472 | 472 |
} |
473 |
|
|
474 |
private class LoadProtocolsTask extends AsyncTask<Void, Void, ArrayList<Protocol>> { |
|
473 | 475 |
|
474 |
private class LoadImagesTask extends AsyncTask<Void, Void, ArrayList<Image>> { |
|
476 |
@Override |
|
477 |
protected ArrayList<Protocol> doInBackground(Void... arg0) { |
|
478 |
return (new ProtocolManager()).createList(context); |
|
479 |
} |
|
480 |
|
|
481 |
@Override |
|
482 |
protected void onPostExecute(ArrayList<Protocol> result) { |
|
483 |
if (result != null && result.size() > 0) { |
|
484 |
Protocol.setProtocols(result); |
|
485 |
new LoadFlavorsTask().execute((Void[]) null); |
|
486 |
} else { |
|
487 |
showAlert("Login Failure", "There was a problem loading load balancer protocols. Please try again."); |
|
488 |
} |
|
489 |
} |
|
490 |
} |
|
491 |
|
|
492 |
private class LoadFlavorsTask extends AsyncTask<Void, Void, ArrayList<Flavor>> { |
|
475 | 493 |
|
476 | 494 |
@Override |
477 |
protected ArrayList<Image> doInBackground(Void... arg0) {
|
|
478 |
return (new ImageManager()).createList(true, context);
|
|
495 |
protected ArrayList<Flavor> doInBackground(Void... arg0) {
|
|
496 |
return (new FlavorManager()).createList(true, context);
|
|
479 | 497 |
} |
480 | 498 |
|
481 | 499 |
@Override |
482 |
protected void onPostExecute(ArrayList<Image> result) {
|
|
500 |
protected void onPostExecute(ArrayList<Flavor> result) {
|
|
483 | 501 |
if (result != null && result.size() > 0) { |
484 |
TreeMap<String, Image> imageMap = new TreeMap<String, Image>();
|
|
502 |
TreeMap<String, Flavor> flavorMap = new TreeMap<String, Flavor>();
|
|
485 | 503 |
for (int i = 0; i < result.size(); i++) { |
486 |
Image image = result.get(i);
|
|
487 |
imageMap.put(image.getId(), image);
|
|
504 |
Flavor flavor = result.get(i);
|
|
505 |
flavorMap.put(flavor.getId(), flavor);
|
|
488 | 506 |
} |
489 |
Image.setImages(imageMap);
|
|
490 |
new LoadFlavorsTask().execute((Void[]) null);
|
|
491 |
//startActivity(tabViewIntent);
|
|
507 |
Flavor.setFlavors(flavorMap);
|
|
508 |
hideDialog();
|
|
509 |
startActivityForResult(tabViewIntent, 187);
|
|
492 | 510 |
} else { |
493 | 511 |
hideDialog(); |
494 |
showAlert("Login Failure", "There was a problem loading server images. Please try again.");
|
|
512 |
showAlert("Login Failure", "There was a problem loading server flavors. Please try again.");
|
|
495 | 513 |
} |
496 | 514 |
} |
497 | 515 |
} |
b/src/com/rackspacecloud/android/ListLoadBalancersActivity.java | ||
---|---|---|
12 | 12 |
import android.os.Bundle; |
13 | 13 |
import android.util.Log; |
14 | 14 |
import android.view.LayoutInflater; |
15 |
import android.view.Menu; |
|
16 |
import android.view.MenuInflater; |
|
17 |
import android.view.MenuItem; |
|
15 | 18 |
import android.view.View; |
16 | 19 |
import android.view.ViewGroup; |
17 | 20 |
import android.view.WindowManager; |
... | ... | |
23 | 26 |
|
24 | 27 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancer; |
25 | 28 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancerManager; |
29 |
import com.rackspace.cloud.loadbalancer.api.client.Protocol; |
|
30 |
import com.rackspace.cloud.loadbalancer.api.client.ProtocolManager; |
|
26 | 31 |
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException; |
27 | 32 |
|
28 | 33 |
public class ListLoadBalancersActivity extends ListActivity { |
29 | 34 |
|
35 |
private final int ADD_LOAD_BALANCER_CODE = 22; |
|
30 | 36 |
private LoadBalancer[] loadBalancers; |
31 | 37 |
private Context context; |
32 | 38 |
ProgressDialog pDialog; |
... | ... | |
98 | 104 |
setListAdapter(new LoadBalancerAdapter()); |
99 | 105 |
} |
100 | 106 |
} |
107 |
|
|
108 |
@Override |
|
109 |
public boolean onCreateOptionsMenu(Menu menu) { |
|
110 |
super.onCreateOptionsMenu(menu); |
|
111 |
MenuInflater inflater = getMenuInflater(); |
|
112 |
inflater.inflate(R.menu.loadbalancers_list_menu, menu); |
|
113 |
return true; |
|
114 |
} |
|
115 |
|
|
116 |
@Override |
|
117 |
public boolean onOptionsItemSelected(MenuItem item) { |
|
118 |
switch (item.getItemId()) { |
|
119 |
case R.id.add_loadbalancer: |
|
120 |
startActivityForResult( |
|
121 |
new Intent(this, AddLoadBalancerActivity.class), ADD_LOAD_BALANCER_CODE); // arbitrary number never used again |
|
122 |
return true; |
|
123 |
case R.id.refresh: |
|
124 |
loadBalancers = null; |
|
125 |
loadLoadBalancers(); |
|
126 |
return true; |
|
127 |
} |
|
128 |
return false; |
|
129 |
} |
|
101 | 130 |
|
102 | 131 |
protected void showDialog() { |
103 | 132 |
pDialog = new ProgressDialog(this, R.style.NewDialog); |
b/src/com/rackspacecloud/android/ViewLoadBalancerActivity.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package com.rackspacecloud.android; |
5 | 5 |
|
6 |
import java.util.ArrayList; |
|
7 |
|
|
8 | 6 |
import android.app.Activity; |
9 | 7 |
import android.app.AlertDialog; |
10 | 8 |
import android.app.ProgressDialog; |
11 | 9 |
import android.content.Context; |
12 | 10 |
import android.content.DialogInterface; |
11 |
import android.content.Intent; |
|
13 | 12 |
import android.os.AsyncTask; |
14 | 13 |
import android.os.Bundle; |
15 | 14 |
import android.util.Log; |
15 |
import android.view.View; |
|
16 |
import android.view.View.OnClickListener; |
|
16 | 17 |
import android.view.WindowManager; |
17 | 18 |
import android.view.ViewGroup.LayoutParams; |
19 |
import android.widget.Button; |
|
18 | 20 |
import android.widget.ProgressBar; |
19 | 21 |
import android.widget.TextView; |
20 | 22 |
|
21 | 23 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancer; |
22 | 24 |
import com.rackspace.cloud.loadbalancer.api.client.LoadBalancerManager; |
23 | 25 |
import com.rackspace.cloud.loadbalancers.api.client.http.LoadBalancersException; |
24 |
import com.rackspace.cloud.servers.api.client.Account; |
|
25 | 26 |
|
26 | 27 |
public class ViewLoadBalancerActivity extends Activity { |
28 |
|
|
29 |
private final int EDIT_LOAD_BALANCER_CODE = 23; |
|
27 | 30 |
private LoadBalancer loadBalancer; |
28 | 31 |
private LoadBalancer returnLoadBalancer; |
29 | 32 |
private Context context; |
... | ... | |
51 | 54 |
loadBalancer = (LoadBalancer) state.getSerializable("loadBalancer"); |
52 | 55 |
} |
53 | 56 |
new LoadLoadBalancerTask().execute((Void[]) null); |
57 |
setUpButtons(); |
|
58 |
} |
|
59 |
|
|
60 |
private void setUpButtons(){ |
|
61 |
Button editLoadBalancer = (Button)findViewById(R.id.edit_loadbalancer_button); |
|
62 |
editLoadBalancer.setOnClickListener(new OnClickListener() { |
|
63 |
|
|
64 |
@Override |
|
65 |
public void onClick(View v) { |
|
66 |
//Intent editLoadBalancerIntent = new Intent(context, EditLoadBalancerActivity.class); |
|
67 |
//editLoadBalancerIntent.putExtra("loadBalancer", loadBalancer); |
|
68 |
//startActivityForResult(editLoadBalancerIntent, EDIT_LOAD_BALANCER_CODE); |
|
69 |
} |
|
70 |
|
|
71 |
}); |
|
54 | 72 |
} |
55 | 73 |
|
56 | 74 |
private void loadLoadBalancerData() { |
Also available in: Unified diff