Skip to content

Commit

Permalink
add searchview
Browse files Browse the repository at this point in the history
  • Loading branch information
xpbtmusic committed Feb 1, 2013
1 parent 1d5a45e commit 09f13bf
Show file tree
Hide file tree
Showing 31 changed files with 655 additions and 630 deletions.
Binary file removed bin/MyNews.apk
Binary file not shown.
320 changes: 161 additions & 159 deletions bin/R.txt

Large diffs are not rendered by default.

Binary file removed bin/classes.dex
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/MainActivity.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$drawable.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$id.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$integer.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$interpolator.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$layout.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$menu.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$raw.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$string.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$style.class
Binary file not shown.
Binary file modified bin/classes/com/example/mynews/R$styleable.class
Binary file not shown.
Binary file modified bin/classes/com/slidingmenu/lib/R$drawable.class
Binary file not shown.
Binary file modified bin/classes/org/holoeverywhere/R$drawable.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions bin/jarlist.cache

This file was deleted.

Binary file removed bin/res/drawable-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/drawable-ldpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/drawable-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/res/drawable-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed bin/resources.ap_
Binary file not shown.
320 changes: 161 additions & 159 deletions gen/com/example/mynews/R.java

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions gen/com/slidingmenu/lib/R.java

Large diffs are not rendered by default.

304 changes: 152 additions & 152 deletions gen/org/holoeverywhere/R.java

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>

<string name="app_name">MyNews</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="search_hint_text">搜索</string>

</resources>
</resources>
26 changes: 26 additions & 0 deletions src/com/example/mynews/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.app.Fragment;


import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.widget.SearchView;
import com.example.mynews.pageindicator.TestFragmentAdapter;
import com.example.mynews.utils.StringUtils;
import com.viewpagerindicator.TitlePageIndicator;

import android.os.Bundle;
Expand All @@ -25,6 +30,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_titles_bottom);
mAdapter = new TestFragmentAdapter(getSupportFragmentManager());


mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
Expand All @@ -47,7 +53,27 @@ protected void onCreate(Bundle savedInstanceState) {
public void replaceFragment(Fragment fragment) {
replaceFragment(fragment, null);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Used to put dark icons on light action bar
boolean isLight = true;

//Create the search view
SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
searchView.setQueryHint(StringUtils.getString(this, R.string.search_hint_text));

// menu.add("Search")
// .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search)
// .setActionView(searchView)
// .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
menu.add("Search")
.setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search)
.setActionView(searchView)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

return true;
}
public void replaceFragment(Fragment fragment, String backStackName) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content, fragment);
Expand Down

0 comments on commit 09f13bf

Please sign in to comment.