Browse Source

Added string resources and fixed display of DetailedTweetActivity

tokugawa 5 years ago
parent
commit
e398045a18

+ 62
- 43
HW5/res/layout/activity_detailed_tweet.xml View File

@@ -1,60 +1,79 @@
1
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
1
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 2
     xmlns:tools="http://schemas.android.com/tools"
3
+    android:id="@+id/LinearLayout1"
3 4
     android:layout_width="match_parent"
4 5
     android:layout_height="match_parent"
6
+    android:orientation="vertical"
5 7
     android:paddingBottom="@dimen/activity_vertical_margin"
6 8
     android:paddingLeft="@dimen/activity_horizontal_margin"
7 9
     android:paddingRight="@dimen/activity_horizontal_margin"
8 10
     android:paddingTop="@dimen/activity_vertical_margin"
9 11
     tools:context=".DetailedTweetActivity" >
10 12
 
11
-    <TextView
12
-        android:id="@+id/txtDetailUsername"
13
-        android:layout_width="wrap_content"
13
+    <LinearLayout
14
+        android:layout_width="match_parent"
14 15
         android:layout_height="wrap_content"
15
-        android:layout_alignParentTop="true"
16
-        android:layout_centerHorizontal="true"
17
-        android:text="TextView" />
16
+        android:layout_weight="1"
17
+        android:orientation="vertical" >
18 18
 
19
-    <ImageView
20
-        android:id="@+id/imgDetailBackground"
21
-        android:layout_width="wrap_content"
22
-        android:layout_height="wrap_content"
23
-        android:layout_below="@+id/txtDetailUsername"
24
-        android:layout_centerHorizontal="true" />
19
+        <TextView
20
+            android:id="@+id/txtDetailUsername"
21
+            android:layout_width="wrap_content"
22
+            android:layout_height="wrap_content"
23
+            android:layout_gravity="center_horizontal"
24
+            android:text="@string/default_text" />
25 25
 
26
-    <TextView
27
-        android:id="@+id/txtDetailTweet"
28
-        android:layout_width="wrap_content"
29
-        android:layout_height="wrap_content"
30
-        android:layout_alignLeft="@+id/txtDetailUsername"
31
-        android:layout_below="@+id/imgDetailBackground"
32
-        android:text="TextView" />
26
+        <ImageView
27
+            android:id="@+id/imgDetailBackground"
28
+            android:layout_width="fill_parent"
29
+            android:layout_height="wrap_content"
30
+            android:layout_gravity="center_horizontal"
31
+            android:padding="5dp"
32
+            android:scaleType="fitStart" />
33 33
 
34
-    <Button
35
-        android:id="@+id/btnDetailBack"
36
-        android:layout_width="wrap_content"
37
-        android:layout_height="wrap_content"
38
-        android:layout_alignParentBottom="true"
39
-        android:layout_alignParentLeft="true"
40
-        android:layout_alignParentRight="true"
41
-        android:onClick="onClickBack"
42
-        android:text="Button" />
43
-
44
-    <TextView
45
-        android:id="@+id/txtFavoritesCount"
46
-        android:layout_width="wrap_content"
34
+    </LinearLayout>
35
+
36
+    <LinearLayout
37
+        android:layout_width="match_parent"
47 38
         android:layout_height="wrap_content"
48
-        android:layout_alignRight="@+id/txtDetailTweet"
49
-        android:layout_below="@+id/txtDetailTweet"
50
-        android:text="TextView" />
39
+        android:orientation="vertical" >
40
+
41
+        <TextView
42
+            android:id="@+id/txtDetailTweet"
43
+            android:layout_width="wrap_content"
44
+            android:layout_height="wrap_content"
45
+            android:layout_gravity="center_horizontal"
46
+            android:text="@string/default_text" />
51 47
 
52
-    <TextView
53
-        android:id="@+id/txtRetweetCount"
54
-        android:layout_width="wrap_content"
48
+        <TextView
49
+            android:id="@+id/txtFavoritesCount"
50
+            android:layout_width="wrap_content"
51
+            android:layout_height="wrap_content"
52
+            android:layout_gravity="center_horizontal"
53
+            android:text="@string/default_text" />
54
+
55
+        <TextView
56
+            android:id="@+id/txtRetweetCount"
57
+            android:layout_width="wrap_content"
58
+            android:layout_height="wrap_content"
59
+            android:layout_gravity="center_horizontal"
60
+            android:text="@string/default_text" />
61
+
62
+    </LinearLayout>
63
+
64
+    <LinearLayout
65
+        android:layout_width="match_parent"
55 66
         android:layout_height="wrap_content"
56
-        android:layout_alignLeft="@+id/txtFavoritesCount"
57
-        android:layout_below="@+id/txtFavoritesCount"
58
-        android:text="TextView" />
67
+        android:layout_gravity="bottom"
68
+        android:orientation="vertical" >
69
+
70
+        <Button
71
+            android:id="@+id/btnDetailBack"
72
+            android:layout_width="fill_parent"
73
+            android:layout_height="wrap_content"
74
+            android:onClick="onClickBack"
75
+            android:text="@string/back_button" />
76
+
77
+    </LinearLayout>
59 78
 
60
-</RelativeLayout>
79
+</LinearLayout>

+ 5
- 4
HW5/res/layout/activity_main.xml View File

@@ -25,16 +25,17 @@
25 25
             android:layout_width="0dp"
26 26
             android:layout_height="wrap_content"
27 27
             android:layout_weight="1"
28
-            android:text="View Saved News"
29
-            android:onClick="onViewSaved" />
28
+            android:onClick="onViewSaved"
29
+            android:text="@string/view_saved_news_button" />
30 30
 
31 31
         <Button
32 32
             android:id="@+id/btnClearSaved"
33 33
             android:layout_width="0dp"
34 34
             android:layout_height="wrap_content"
35 35
             android:layout_weight="1"
36
-            android:text="Clear Saved News"
37
-            android:onClick="onClearSaved" />
36
+            android:onClick="onClearSaved"
37
+            android:text="@string/clear_saved_news_button" />
38
+
38 39
     </LinearLayout>
39 40
 
40 41
 </RelativeLayout>

+ 1
- 1
HW5/res/layout/news_site.xml View File

@@ -10,7 +10,7 @@
10 10
         android:layout_height="wrap_content"
11 11
         android:layout_gravity="center_horizontal"
12 12
         android:padding="15dp"
13
-        android:text="Large Text"
13
+        android:text="@string/default_text"
14 14
         android:textAppearance="?android:attr/textAppearanceLarge" />
15 15
 
16 16
 </LinearLayout>

+ 2
- 2
HW5/res/layout/saved_tweets_list.xml View File

@@ -22,7 +22,7 @@
22 22
         android:layout_alignParentTop="true"
23 23
         android:layout_toRightOf="@+id/imgProfileImage"
24 24
         android:padding="5dp"
25
-        android:text="TextView" />
25
+        android:text="@string/default_text" />
26 26
 
27 27
     <TextView
28 28
         android:id="@+id/txtTweetInfo"
@@ -32,7 +32,7 @@
32 32
         android:layout_below="@+id/txtTweetText"
33 33
         android:layout_toLeftOf="@+id/imgIsRetweet"
34 34
         android:padding="5dp"
35
-        android:text="TextView" />
35
+        android:text="@string/default_text" />
36 36
 
37 37
     <ImageView
38 38
         android:id="@+id/imgIsRetweet"

+ 2
- 2
HW5/res/layout/tweet_list.xml View File

@@ -22,7 +22,7 @@
22 22
         android:layout_alignParentTop="true"
23 23
         android:layout_toRightOf="@+id/imgProfileImage"
24 24
         android:padding="5dp"
25
-        android:text="TextView" />
25
+        android:text="@string/default_text" />
26 26
 
27 27
     <TextView
28 28
         android:id="@+id/txtTweetInfo"
@@ -32,7 +32,7 @@
32 32
         android:layout_below="@+id/txtTweetText"
33 33
         android:layout_toLeftOf="@+id/imgIsRetweet"
34 34
         android:padding="5dp"
35
-        android:text="TextView" />
35
+        android:text="@string/default_text" />
36 36
 
37 37
     <ImageButton
38 38
         android:id="@+id/ibtnSaveTweet"

+ 4
- 0
HW5/res/values/strings.xml View File

@@ -7,5 +7,9 @@
7 7
     <string name="title_activity_tweets_list">TweetsListActivity</string>
8 8
     <string name="title_activity_detailed_tweet">DetailedTweetActivity</string>
9 9
     <string name="title_activity_saved_news">SavedNewsActivity</string>
10
+    <string name="view_saved_news_button">View Saved News</string>
11
+    <string name="clear_saved_news_button">Clear Saved News</string>
12
+    <string name="default_text">Default</string>
13
+    <string name="back_button">Back</string>
10 14
 
11 15
 </resources>

+ 1
- 0
HW5/src/edu/uncc/itcs4180/hw5/MainActivity.java View File

@@ -54,6 +54,7 @@ public class MainActivity extends Activity {
54 54
 	protected void onCreate(Bundle savedInstanceState) {
55 55
 		super.onCreate(savedInstanceState);
56 56
 		setContentView(R.layout.activity_main);
57
+		getActionBar().setTitle("My News Tweets!");
57 58
 		dm = new DataManager(this);
58 59
 		//dm.saveTweet(new SavedTweet(0, "apple", "Stuff about an apple", "00:00:12", ""));
59 60
 		

Loading…
Cancel
Save