Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add search term in craiglist acttivity.

  • Loading branch information...
commit 56227b82ebef1ba6fba686a31e3604d8d767d768 1 parent f22731c
@dodyg authored
View
4 AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.silverkeytech.android_rivers"
- android:versionCode="9"
- android:versionName="1.14">
+ android:versionCode="10"
+ android:versionName="1.15">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
View
2  assets/craigslist_cities
@@ -93,7 +93,7 @@ buh,574,http://bucharest.craigslist.org,romania,Romania,*Europe*
bwk,570,http://brunswick.craigslist.org,brunswick,Georgia,*US*
bzn,658,http://bozeman.craigslist.org,bozeman,Montana,*US*
cae,101,http://columbia.craigslist.org,columbia,South Carolina,*US*
-cai,162,http://cairo.craigslist.org,egypt,Egypt,*Africa*
+cai,162,http://cairo.craigslist.org,cairo,Egypt,*Africa*
cak,251,http://akroncanton.craigslist.org,akron / canton,Ohio,*US*
cam,312,http://cambridge.craigslist.co.uk,"cambridge, UK",United Kingdom,*Europe*
can,409,http://guangzhou.craigslist.com.cn,guangzhou,China,"*Asia, Pacific and Middle East*"
View
9 res/layout/craigslist_listing.xml
@@ -22,11 +22,18 @@
android:layout_height="wrap_content"
/>
+ <EditText
+ android:id="@+id/craigslist_listing_keywords"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
+ </EditText>
+
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
- <Button android:id="@+id/craigslist_listing__go_btn"
+ <Button android:id="@+id/craigslist_listing_go_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
View
16 src/com/silverkeytech/android_rivers/creators/CraigslistListingActivity.kt
@@ -17,6 +17,8 @@ import com.silverkeytech.android_rivers.addBookmarkOption
import com.silverkeytech.android_rivers.saveBookmark
import com.silverkeytech.android_rivers.getStoredPref
import com.silverkeytech.android_rivers.db.checkIfUrlAlreadyBookmarked
+import android.widget.EditText
+import android.util.Log
public class CraigslistListingActivity (): Activity(){
class object {
@@ -59,6 +61,9 @@ public class CraigslistListingActivity (): Activity(){
val categoryList = findViewById(R.id.craigslist_listing_category)!! as Spinner
categoryList.setAdapter(adapter)
+ val search = findViewById(R.id.craigslist_listing_keywords)!! as EditText
+ search.setHint(this.getString(R.string.optional_search_term))
+
val bookmark = findViewById(R.id.craigslist_listing_bookmark_btn)!! as Button
bookmark.setEnabled(false)
@@ -70,7 +75,7 @@ public class CraigslistListingActivity (): Activity(){
}
}
- val go = findViewById(R.id.craigslist_listing__go_btn)!! as Button
+ val go = findViewById(R.id.craigslist_listing_go_btn)!! as Button
go.setOnClickListener {
val input = completion.getText().toString()
@@ -85,7 +90,14 @@ public class CraigslistListingActivity (): Activity(){
val catPosition = categoryList.getSelectedItemPosition()
val categoryCode = categories.get(catPosition).code
- feedUrl = "$cityUrl/$categoryCode/index.rss"
+ val term = search.getText().toString()
+
+ if (term.isNullOrEmpty())
+ feedUrl = "$cityUrl/$categoryCode/index.rss"
+ else
+ feedUrl = "$cityUrl/search/$categoryCode?format=rss&query=$term"
+
+ Log.d(TAG, "Fetching $feedUrl")
DownloadFeedAsync(this, false)
.executeOnComplete {
Please sign in to comment.
Something went wrong with that request. Please try again.