Skip to content

Commit

Permalink
Merge branch 'search'
Browse files Browse the repository at this point in the history
  • Loading branch information
aanoaa committed Jan 21, 2011
2 parents c0a93e0 + c6646e6 commit 021ae01
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
27 changes: 19 additions & 8 deletions apps/android/res/layout/list_complex.xml
Expand Up @@ -5,18 +5,29 @@
android:orientation="vertical"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:paddingLeft="15dip"
>
android:paddingLeft="15dip">
<TextView
android:id="@+id/list_complex_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<TextView
android:id="@+id/list_complex_caption"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
android:orientation="horizontal">
<TextView
android:id="@+id/list_complex_caption_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:textSize="12sp" />
<TextView
android:id="@+id/list_complex_caption_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:autoLink="all"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
2 changes: 2 additions & 0 deletions apps/android/res/values/strings.xml
Expand Up @@ -30,6 +30,8 @@
<string name="title_format3">%1$s - IRC Log Viewer</string>
<string name="title_format_search">%1$s - Search Result</string>

<string name="temp"><b>good</b></string>

<string name="no_search_result">no logs for %1$s</string>
<string name="no_mention_result">no mention for %1$s</string>
<string name="who_to_mention">mention for %1$s</string>
Expand Down
Expand Up @@ -63,7 +63,7 @@ private void handleIntent(Intent intent) {
return;
}

search(cursor);
search(cursor);
} else if (Intent.ACTION_VIEW.equals(action)) {
Uri uri = intent.getData();
String date = intent.getStringExtra("date");
Expand Down Expand Up @@ -125,19 +125,19 @@ private void search(Cursor cursor) {
category = new LinkedList<Map<String,?>>();
}

category.add(createItem(PROJECTION, new String[] { new StringBuilder().append(id).toString(), time, nickname, message }));
category.add(createItem(PROJECTION, new String[] { new StringBuilder().append(id).toString(), time, nickname, message }));

String nextDate = "";
if (cursor.isLast()) {
adapter.addSection(date, new SimpleAdapter(this, category, R.layout.list_complex, new String[] { Logs.NICKNAME, Logs.MESSAGE }, new int[] { R.id.list_complex_title, R.id.list_complex_caption }));
adapter.addSection(date, new SimpleAdapter(this, category, R.layout.list_complex, new String[] { Logs.NICKNAME, Logs.CREATED_ON, Logs.MESSAGE }, new int[] { R.id.list_complex_title, R.id.list_complex_caption_title, R.id.list_complex_caption_content }));
} else {
if (cursor.moveToNext()) {
nextDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date((long) cursor.getInt(cursor.getColumnIndex(Logs.CREATED_ON)) * 1000));
cursor.moveToPrevious();
}

if (!nextDate.equals(date)) {
adapter.addSection(date, new SimpleAdapter(this, category, R.layout.list_complex, new String[] { Logs.NICKNAME, Logs.MESSAGE }, new int[] { R.id.list_complex_title, R.id.list_complex_caption }));
adapter.addSection(date, new SimpleAdapter(this, category, R.layout.list_complex, new String[] { Logs.NICKNAME, Logs.CREATED_ON, Logs.MESSAGE }, new int[] { R.id.list_complex_title, R.id.list_complex_caption_title, R.id.list_complex_caption_content }));
}
}

Expand Down

0 comments on commit 021ae01

Please sign in to comment.