simplify visible actionbar icons

This commit is contained in:
Andrew Dolgov 2014-10-30 15:17:15 +03:00
parent f62363bc96
commit 3dc5a9668f
4 changed files with 12 additions and 95 deletions

View File

@ -27,7 +27,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.SearchView;
import android.widget.TextView;
import com.google.gson.Gson;
@ -759,7 +758,7 @@ public class OnlineActivity extends CommonActivity {
startActivityForResult(intent, 0);
return true;
case R.id.search:
if (hf != null && isCompatMode()) {
if (hf != null) {
Dialog dialog = new Dialog(this);
final EditText edit = new EditText(this);
@ -1582,45 +1581,7 @@ public class OnlineActivity extends CommonActivity {
m_headlinesActionMode.finish();
}
}
if (!isCompatMode()) {
SearchView searchView = (SearchView) search.getActionView();
if (searchView != null) {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
private String query = "";
@Override
public boolean onQueryTextSubmit(String query) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
.findFragmentByTag(FRAG_HEADLINES);
if (frag != null) {
frag.setSearchQuery(query);
this.query = query;
}
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (newText.equals("") && !newText.equals(this.query)) {
HeadlinesFragment frag = (HeadlinesFragment) getSupportFragmentManager()
.findFragmentByTag(FRAG_HEADLINES);
if (frag != null) {
frag.setSearchQuery(newText);
this.query = newText;
}
}
return false;
}
});
}
}
}
}
}
protected void refresh(boolean includeHeadlines) {

View File

@ -23,7 +23,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.SearchView;
import android.widget.TextView;
import org.fox.ttrss.CommonActivity;
@ -281,7 +280,7 @@ public class OfflineActivity extends CommonActivity {
switchOnline();
return true;
case R.id.search:
if (ohf != null && isCompatMode()) {
if (ohf != null) {
Dialog dialog = new Dialog(this);
final EditText edit = new EditText(this);
@ -622,47 +621,7 @@ public class OfflineActivity extends CommonActivity {
article.close();
}
}
if (!isCompatMode()) {
MenuItem search = m_menu.findItem(R.id.search);
SearchView searchView = (SearchView) search.getActionView();
if (searchView != null) {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
private String query = "";
@Override
public boolean onQueryTextSubmit(String query) {
OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getSupportFragmentManager()
.findFragmentByTag(FRAG_HEADLINES);
if (frag != null) {
frag.setSearchQuery(query);
this.query = query;
}
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (newText.equals("") && !newText.equals(this.query)) {
OfflineHeadlinesFragment frag = (OfflineHeadlinesFragment) getSupportFragmentManager()
.findFragmentByTag(FRAG_HEADLINES);
if (frag != null) {
frag.setSearchQuery(newText);
this.query = newText;
}
}
return false;
}
});
}
}
}
}
}
private void switchOnline() {

View File

@ -14,13 +14,13 @@
<item
android:id="@+id/subscribe_to_feed"
android:icon="@drawable/ic_new_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/subscribe_to_feed"/>
<item
android:id="@+id/show_feeds"
android:icon="@drawable/ic_list_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/menu_all_feeds"/>
<item
android:id="@+id/go_offline"
@ -45,9 +45,8 @@
android:title="@string/update_headlines"/>
<item
android:id="@+id/search"
app:actionViewClass="android.widget.SearchView"
android:icon="@drawable/ic_search_light"
app:showAsAction="ifRoom|collapseActionView"
app:showAsAction="ifRoom"
android:title="@string/search"/>
<item
android:id="@+id/headlines_mark_as_read"
@ -56,7 +55,7 @@
android:title="@string/headlines_mark_as_read"/>
<item
android:id="@+id/headlines_select"
app:showAsAction="ifRoom"
app:showAsAction=""
android:icon="@drawable/ic_select_all_light"
android:title="@string/headlines_select"/>
@ -138,7 +137,7 @@
<item
android:id="@+id/set_unread"
android:icon="@drawable/ic_read_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/article_set_unread"/>
</group>

View File

@ -10,15 +10,13 @@
<item
android:id="@+id/show_feeds"
android:icon="@drawable/ic_list_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/menu_all_feeds"/>
</group>
<group android:id="@+id/menu_group_headlines" >
<item
android:id="@+id/search"
app:actionViewClass="android.widget.SearchView"
android:icon="@drawable/ic_search_light"
app:showAsAction="ifRoom|collapseActionView"
android:title="@string/search"/>
<item
android:id="@+id/headlines_mark_as_read"
@ -28,7 +26,7 @@
<item
android:id="@+id/headlines_select"
android:icon="@drawable/ic_select_all_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/headlines_select"/>
<item
android:id="@+id/headlines_view_mode"
@ -81,7 +79,7 @@
<item
android:id="@+id/set_unread"
android:icon="@drawable/ic_read_light"
app:showAsAction="ifRoom"
app:showAsAction=""
android:title="@string/article_set_unread"/>
<item
android:id="@+id/catchup_above"