Skip to content

Commit 8cdbaf9

Browse files
committed
Get rid or mesgedittext entirely - its causing bugs.
1 parent f82cd10 commit 8cdbaf9

File tree

6 files changed

+31
-105
lines changed

6 files changed

+31
-105
lines changed

FinchFramework/src/com/finchframework/finch/views/MesgEditText.java

Lines changed: 0 additions & 87 deletions
This file was deleted.

FinchVideo/AndroidManifest.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
23
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
34
package="com.oreilly.demo.android.pa.finchvideo"
45
android:versionCode="1"
56
android:versionName="1.0">
7+
8+
<uses-permission android:name="android.permission.INTERNET"/>
9+
610
<application android:icon="@drawable/icon"
711
android:label="@string/app_name"
812
android:debuggable="true">
@@ -13,20 +17,18 @@
1317
android:authorities="com.oreilly.demo.android.pa.finchvideo.SimpleFinchVideo"
1418
/>
1519
<activity android:name=".FinchVideoActivity"
16-
android:label="@string/finch_video_app_name" >
20+
android:label="@string/finch_video_app_name">
1721
<intent-filter>
18-
<action android:name="android.intent.action.MAIN" />
19-
<category android:name="android.intent.category.LAUNCHER" />
22+
<action android:name="android.intent.action.MAIN"/>
23+
<category android:name="android.intent.category.LAUNCHER"/>
2024
</intent-filter>
2125
</activity>
2226
<activity android:name=".SimpleFinchVideoActivity"
2327
android:label="Simple Video Activity">
2428
<intent-filter>
25-
<action android:name="android.intent.action.MAIN" />
26-
<category android:name="android.intent.category.LAUNCHER" />
29+
<action android:name="android.intent.action.MAIN"/>
30+
<category android:name="android.intent.category.LAUNCHER"/>
2731
</intent-filter>
2832
</activity>
2933
</application>
30-
<uses-permission android:name="android.permission.INTERNET" />
31-
<uses-sdk android:minSdkVersion="7" />
3234
</manifest>

FinchVideo/project.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-14
12-
android.library.reference.1=../FinchFramework
11+
target=android-17
12+

FinchVideo/res/layout/video_query_activity.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@
2020
android:layout_gravity="center_horizontal"
2121
android:background="@color/medium_gray"
2222
>
23-
<com.finchframework.finch.views.MesgEditText
23+
<EditText
2424
android:id="@+id/video_search_box"
2525
android:width="0px"
2626
android:height="40px"
2727
android:layout_weight="1"
2828
android:layout_width="wrap_content"
2929
android:layout_height="wrap_content"
30-
android:text="@string/finch_video_search"
3130
android:lines="1"
3231
android:singleLine="true"
3332
/>

FinchVideo/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<string name="finch_video_app_name">Finch Video</string>
44
<string name="finch_video_update_content">Update Content</string>
55
<string name="finch_video_search">Search Videos</string>
6-
<string name="app_name">YouTube Video Example</string>
6+
<string name="app_name">FinchVideo</string>
77

88
<string name="simple_insert_text">Insert</string>
99
<string name="title">Title</string>

FinchVideo/src/com/oreilly/demo/android/pa/finchvideo/FinchVideoActivity.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.graphics.BitmapFactory;
99
import android.net.Uri;
1010
import android.os.Bundle;
11+
import android.text.Editable;
1112
import android.util.Log;
1213
import android.view.KeyEvent;
1314
import android.view.View;
@@ -18,7 +19,6 @@
1819
import android.widget.SimpleCursorAdapter;
1920
import android.widget.TextView;
2021
import com.finchframework.finch.Finch;
21-
import com.finchframework.finch.views.MesgEditText;
2222
import com.oreilly.demo.android.pa.finchvideo.provider.FinchVideo;
2323

2424
import java.io.FileNotFoundException;
@@ -33,7 +33,7 @@
3333
public class FinchVideoActivity extends Activity {
3434
SimpleCursorAdapter mAdapter;
3535

36-
private MesgEditText mSearchText;
36+
private EditText mSearchText;
3737

3838
@Override
3939
public void onCreate(Bundle savedInstanceState) {
@@ -83,8 +83,7 @@ public boolean setViewValue(View view, Cursor cursor, int i) {
8383

8484
searchList.setAdapter(mAdapter);
8585

86-
mSearchText = (MesgEditText) findViewById(R.id.video_search_box);
87-
mSearchText.setMesgText(r.getString(R.string.finch_video_search));
86+
mSearchText = (EditText) findViewById(R.id.video_search_box);
8887
mSearchText.setOnEditorActionListener(
8988
new EditText.OnEditorActionListener() {
9089
@Override
@@ -137,15 +136,28 @@ void setThumbResource(View view, Cursor cursor) {
137136

138137
// sends the query to the finch video content provider
139138
void query() {
140-
if (!mSearchText.searchEmpty()) {
139+
String searchText = getText();
140+
if (!searchEmpty(searchText)) {
141141
String queryString =
142142
FinchVideo.Videos.QUERY_PARAM_NAME + "=" +
143-
Uri.encode(mSearchText.getText().toString());
143+
Uri.encode(searchText.toString());
144144
Uri queryUri =
145145
Uri.parse(FinchVideo.Videos.CONTENT_URI + "?" +
146146
queryString);
147147
Cursor c = managedQuery(queryUri, null, null, null, null);
148148
mAdapter.changeCursor(c);
149149
}
150150
}
151+
152+
private String getText() {
153+
Editable editable = mSearchText.getText();
154+
if (editable != null) {
155+
return editable.toString();
156+
}
157+
return null;
158+
}
159+
160+
private boolean searchEmpty(String text) {
161+
return (text != null) && ("".equals(text));
162+
}
151163
}

0 commit comments

Comments
 (0)