android:theme="@android:style/Theme.Holo"
android:screenOrientation="portrait"
android:configChanges="touchscreen|keyboard"
- android:launchMode="standard"
- android:uiOptions="splitActionBarWhenNarrow" >
+ android:uiOptions="splitActionBarWhenNarrow"
+ android:launchMode="standard">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
+ </activity>
+
+ <activity
+ android:label="@string/app_name"
+ android:name=".MobiAdsSettings"
+ android:screenOrientation="portrait"
+ android:configChanges="touchscreen|keyboard"
+ android:theme="@android:style/Theme.Holo"
+ android:launchMode="standard"
+ android:description="@string/app_description">
+ <intent-filter >
+ <action android:name="android.intent.action.MOBIADSSETTINGS" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
</activity>
+
+
<activity
android:label="@string/app_name"
android:name=".MobiAdsLoginActivity"
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
- public static final int wheelnotification=0x7f020001;
+ public static final int ic_menu_login=0x7f020001;
+ public static final int ic_menu_settings_holo_light=0x7f020002;
+ public static final int wheelnotification=0x7f020003;
}
public static final class id {
public static final int ads_entry_icon=0x7f070000;
public static final int frameLayout2=0x7f070007;
public static final int list_frag=0x7f070003;
public static final int login_button=0x7f070008;
- public static final int menu_gus=0x7f07000c;
- public static final int menu_gusa=0x7f07000d;
- public static final int menu_gusas=0x7f07000e;
- public static final int menu_gusass=0x7f070010;
- public static final int menu_gusasss=0x7f07000f;
- public static final int menu_prueba=0x7f07000b;
- public static final int menu_save=0x7f07000a;
- public static final int menuadsremove=0x7f070009;
+ public static final int menuads_login=0x7f070009;
+ public static final int menuads_settings=0x7f07000a;
public static final int password=0x7f070006;
- public static final int selectedmenuads=0x7f070011;
+ public static final int selectedmenu_remove=0x7f07000b;
public static final int username=0x7f070005;
}
public static final class layout {
public static final int desc=0x7f05001d;
public static final int encoded_web_service=0x7f05001c;
public static final int error_dialog_connection_error=0x7f050005;
- public static final int error_dialog_no_local_ads=0x7f05001f;
+ public static final int error_dialog_no_local_ads=0x7f050021;
public static final int error_dialog_userpwd_error=0x7f050006;
public static final int header_bar=0x7f050000;
+ public static final int menuads_login=0x7f050020;
public static final int menuads_remove=0x7f05001e;
+ public static final int menuads_settings=0x7f05001f;
public static final int new_ads=0x7f050001;
public static final int password=0x7f050008;
public static final int remote_service_content_empty_notification=0x7f050015;
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/menuadsremove"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:titleCondensed="@string/menuads_remove"
+ <item android:id="@+id/menuads_login"
+ android:icon="@drawable/ic_menu_login"
+ android:title="@string/menuads_login"
+ android:titleCondensed="@string/menuads_login"
android:showAsAction="ifRoom|withText"
android:alphabeticShortcut="string"
android:numericShortcut="string"
android:checkable="false"
android:visible="true"
android:enabled="true" />
- <item android:id="@+id/menu_save"
- android:icon="@android:drawable/ic_menu_save"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
- <item android:id="@+id/menu_prueba"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
- <item android:id="@+id/menu_gus"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
-
- <item android:id="@+id/menu_gusa"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
- <item android:id="@+id/menu_gusas"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
- <item android:id="@+id/menu_gusasss"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
+ <item android:id="@+id/menuads_settings"
+ android:icon="@drawable/ic_menu_settings_holo_light"
+ android:title="@string/menuads_settings"
+ android:titleCondensed="@string/menuads_settings"
android:visible="true"
- android:showAsAction="ifRoom|withText" />
-
-
- <item android:id="@+id/menu_gusass"
- android:icon="@android:drawable/ic_menu_upload"
- android:title="@string/menuads_remove"
- android:visible="true"
- android:showAsAction="ifRoom|withText" />
+ android:checkable="false"
+ android:enabled="false"
+ android:showAsAction="ifRoom|withText"/>
<!-- I want overflow menu button if there is no room: android:showAsAction="ifRoom|withText" -->
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/selectedmenuads"
- android:icon="@android:drawable/ic_menu_upload"
+ <item android:id="@+id/selectedmenu_remove"
+ android:icon="@android:drawable/ic_menu_delete"
android:title="@string/menuads_remove"
android:titleCondensed="@string/menuads_remove"
android:showAsAction="never"
<string name="encoded_web_service">UTF-8</string>
<string name="desc">description</string>
<string name="menuads_remove">Remove</string>
+ <string name="menuads_settings">Settings</string>
+ <string name="menuads_login">Login</string>
<string name="error_dialog_no_local_ads">You have no downloaded ads.</string>
</resources>
\ No newline at end of file
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
final List<NameValuePair> formParams = new ArrayList<NameValuePair>(2);
-
- Cookie.setCookie("prueba");
-
-// httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, getResources().getString(R.string.encoded_web_service));
-// httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, getResources().getString(R.string.user_agent_web_service));
-// httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
-// //TODO: RESTful Web Service must use JSON instead of signin array :(
-// formParams.add(new BasicNameValuePair("signin[username]", username.getText().toString()));
-// formParams.add(new BasicNameValuePair("signin[password]", password.getText().toString()));
-// try {
-// httpEntity = new UrlEncodedFormEntity(formParams, getResources().getString(R.string.encoded_web_service));
-// httpPost.setEntity(httpEntity);
-// httpResponse = httpClient.execute(httpPost);
-// } catch (UnsupportedEncodingException e) {
-// Log.e(TAG, "Error while encoding POST parameters.", e);
-// return;
-// } catch (ClientProtocolException e) {
-// Log.e(TAG, "Error while executing HTTP client connection.", e);
-// createErrorDialog(R.string.error_dialog_connection_error);
-// return;
-// } catch (IOException e) {
-// Log.e(TAG, "Error while executing HTTP client connection.", e);
-// createErrorDialog(R.string.error_dialog_connection_error);
-// return;
-// } finally {
-// httpClient.getConnectionManager().shutdown();
-// }
-//
-// if (httpResponse != null) {
-// switch (httpResponse.getStatusLine().getStatusCode()) {
-// case HttpStatus.SC_OK:
-// String cookie = httpResponse.getLastHeader(SETCOOKIEFIELD).getValue();
-// if (cookie != null) {
-// cookie = cookie.split(";")[0];
-// //Go to the next activity
-// StrictMode.setThreadPolicy(currentPolicy);
-// Cookie.setCookie(cookie);
-// this.finish();
-// } else {
-// Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!");
-// createErrorDialog(R.string.error_dialog_connection_error);
-// }
-// break;
-// case HttpStatus.SC_UNAUTHORIZED:
-// //Username or password is incorrect
-// createErrorDialog(R.string.error_dialog_userpwd_error);
-// break;
-// case HttpStatus.SC_BAD_REQUEST:
-// //What the heck are you doing?
-// createErrorDialog(R.string.error_dialog_userpwd_error);
-// break;
-// default:
-// Log.e(TAG, "Error while retrieving the HTTP status line.");
-// createErrorDialog(R.string.error_dialog_connection_error);
-// break;
-// }
-// }
-// else {
-// Log.e(TAG, "No response? This should never have happened.");
-// createErrorDialog(R.string.error_dialog_connection_error);
-// }
+
+ httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, getResources().getString(R.string.encoded_web_service));
+ httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, getResources().getString(R.string.user_agent_web_service));
+ httpClient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
+ //TODO: RESTful Web Service must use JSON instead of signin array :(
+ formParams.add(new BasicNameValuePair("signin[username]", username.getText().toString()));
+ formParams.add(new BasicNameValuePair("signin[password]", password.getText().toString()));
+ try {
+ httpEntity = new UrlEncodedFormEntity(formParams, getResources().getString(R.string.encoded_web_service));
+ httpPost.setEntity(httpEntity);
+ httpResponse = httpClient.execute(httpPost);
+ } catch (UnsupportedEncodingException e) {
+ Log.e(TAG, "Error while encoding POST parameters.", e);
+ return;
+ } catch (ClientProtocolException e) {
+ Log.e(TAG, "Error while executing HTTP client connection.", e);
+ createErrorDialog(R.string.error_dialog_connection_error);
+ return;
+ } catch (IOException e) {
+ Log.e(TAG, "Error while executing HTTP client connection.", e);
+ createErrorDialog(R.string.error_dialog_connection_error);
+ return;
+ } finally {
+ httpClient.getConnectionManager().shutdown();
+ }
+
+ if (httpResponse != null) {
+ switch (httpResponse.getStatusLine().getStatusCode()) {
+ case HttpStatus.SC_OK:
+ String cookie = httpResponse.getLastHeader(SETCOOKIEFIELD).getValue();
+ if (cookie != null) {
+ cookie = cookie.split(";")[0];
+ //Go to the next activity
+ StrictMode.setThreadPolicy(currentPolicy);
+ Cookie.setCookie(cookie);
+ this.finish();
+ } else {
+ Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!");
+ createErrorDialog(R.string.error_dialog_connection_error);
+ }
+ break;
+ case HttpStatus.SC_UNAUTHORIZED:
+ //Username or password is incorrect
+ createErrorDialog(R.string.error_dialog_userpwd_error);
+ break;
+ case HttpStatus.SC_BAD_REQUEST:
+ //What the heck are you doing?
+ createErrorDialog(R.string.error_dialog_userpwd_error);
+ break;
+ default:
+ Log.e(TAG, "Error while retrieving the HTTP status line.");
+ createErrorDialog(R.string.error_dialog_connection_error);
+ break;
+ }
+ }
+ else {
+ Log.e(TAG, "No response? This should never have happened.");
+ createErrorDialog(R.string.error_dialog_connection_error);
+ }
}
public void onClickLocalAds(View v) {
package de.android.mobiads;
+import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
+import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
+import de.android.mobiads.list.MobiAdsList.MobiAdsListFragment;
-public class MobiAdsPreferences extends PreferenceFragment {
+public class MobiAdsPreferences extends Activity {
@Override
- public void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Load the preferences from an XML resource
- addPreferencesFromResource(R.xml.preferences);
+ FragmentManager fm = getFragmentManager();
+
+ // Create the list fragment and add it as our sole content.
+ if (fm.findFragmentById(android.R.id.content) == null) {
+ MobiAdsListFragment list = new MobiAdsListFragment();
+ fm.beginTransaction().add(android.R.id.content, list).commit();
+ }
+
+
}
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
+ public static class MobiAdsPreferencesFragment extends PreferenceFragment {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.preferences);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
- CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started");
- checkBoxPreference.setChecked(isMyServiceRunning());
- checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+ CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started");
+ checkBoxPreference.setChecked(isMyServiceRunning());
+ checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
- if (checkBoxPreference.isChecked()) {
- Intent intent = new Intent(getActivity(), MobiAdsService.class);
- intent.putExtra("cookie", Cookie.getCookie());
- getActivity().startService(intent);
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
+ if (checkBoxPreference.isChecked()) {
+ Intent intent = new Intent(getActivity(), MobiAdsService.class);
+ intent.putExtra("cookie", Cookie.getCookie());
+ getActivity().startService(intent);
+ }
+ else {
+ getActivity().stopService(new Intent(getActivity(), MobiAdsService.class));
+ }
+ return false;
}
- else {
- getActivity().stopService(new Intent(getActivity(), MobiAdsService.class));
+ });
+ }
+
+ private boolean isMyServiceRunning() {
+ ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (MobiAdsService.class.getName().equals(service.service.getClassName())) {
+ return true;
}
- return false;
}
- });
- }
-
- private boolean isMyServiceRunning() {
- ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
- for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
- if (MobiAdsService.class.getName().equals(service.service.getClassName())) {
- return true;
- }
- }
- return false;
- }
+ return false;
+ }
+ }
}
--- /dev/null
+package de.android.mobiads;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningServiceInfo;
+import android.app.FragmentManager;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.PreferenceFragment;
+
+public class MobiAdsSettings extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ FragmentManager fm = getFragmentManager();
+
+ // Create the list fragment and add it as our sole content.
+ if (fm.findFragmentById(android.R.id.content) == null) {
+ MobiAdsSettingsFragment list = new MobiAdsSettingsFragment();
+ fm.beginTransaction().add(android.R.id.content, list).commit();
+ }
+
+
+ }
+
+ public static class MobiAdsSettingsFragment extends PreferenceFragment {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.preferences);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ CheckBoxPreference checkBoxPreference = (CheckBoxPreference) findPreference("service_started");
+ checkBoxPreference.setChecked(isMyServiceRunning());
+ checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ CheckBoxPreference checkBoxPreference = (CheckBoxPreference) preference;
+ if (checkBoxPreference.isChecked()) {
+ Intent intent = new Intent(getActivity(), MobiAdsService.class);
+ intent.putExtra("cookie", Cookie.getCookie());
+ getActivity().startService(intent);
+ }
+ else {
+ getActivity().stopService(new Intent(getActivity(), MobiAdsService.class));
+ }
+ return false;
+ }
+ });
+ }
+
+ private boolean isMyServiceRunning() {
+ ActivityManager manager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
+ for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
+ if (MobiAdsService.class.getName().equals(service.service.getClassName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
if (Cookie.getCookie() != null || isMyServiceRunning()) {
bar.addTab(bar.newTab()
.setText("Control Panel")
- .setTabListener(new TabListener<MobiAdsPreferences>(
- this, "controlpanel", MobiAdsPreferences.class)));
+ .setTabListener(new TabListener<MobiAdsPreferences.MobiAdsPreferencesFragment>(
+ this, "controlpanel", MobiAdsPreferences.MobiAdsPreferencesFragment.class)));
}
bar.addTab(bar.newTab()
if ((Cookie.getCookie() != null) && (getActionBar().getTabCount() == 2)) {
getActionBar().addTab(getActionBar().newTab()
.setText("Control Panel")
- .setTabListener(new TabListener<MobiAdsPreferences>(
- this, "controlpanel", MobiAdsPreferences.class)), 1);
+ .setTabListener(new TabListener<MobiAdsPreferences.MobiAdsPreferencesFragment>(
+ this, "controlpanel", MobiAdsPreferences.MobiAdsPreferencesFragment.class)), 1);
}
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Respond to clicks on the actions in the CAB
switch (item.getItemId()) {
- case R.id.menuadsremove:
+ case R.id.selectedmenu_remove:
SparseBooleanArray itemsPositions = getListView().getCheckedItemPositions();
Collection<AdsEntry> aux = new ArrayList<AdsEntry>(mAdapter.getCount());
for (int i=0; i< itemsPositions.size(); i++) {
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
- case R.id.menuadsremove:
+ case R.id.selectedmenu_remove:
removeAd(info.position);
return true;
default:
import android.app.Notification;
import android.app.NotificationManager;
import android.content.AsyncTaskLoader;
+import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.widget.SearchView;
import android.widget.SearchView.OnQueryTextListener;
import android.widget.TextView;
+import de.android.mobiads.Cookie;
import de.android.mobiads.MobiAdsService;
import de.android.mobiads.R;
import de.android.mobiads.provider.Indexer;
public class MobiAdsList extends Activity {
+ Menu mMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final ActionBar bar = getActionBar();
+ final ActionBar actionBar = getActionBar();
- bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
- bar.setTitle(getResources().getString(R.string.header_bar));
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
+ actionBar.setTitle(getResources().getString(R.string.header_bar));
+ //actionBar.setDisplayHomeAsUpEnabled(true);
+
FragmentManager fm = getFragmentManager();
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- return super.onOptionsItemSelected(item);
+ super.onOptionsItemSelected(item);
+ Intent intent = null;
+ switch (item.getItemId()) {
+ case R.id.menuads_settings:
+ intent = new Intent("android.intent.action.MOBIADS").
+ setComponent(new ComponentName("de.android.mobiads", "de.android.mobiads.MobiAdsSettings"));
+ this.startActivity(intent);
+ return true;
+ case R.id.menuads_login:
+ intent = new Intent("android.intent.action.MOBIADS").
+ setComponent(new ComponentName("de.android.mobiads", "de.android.mobiads.MobiAdsLoginActivity"));
+ this.startActivity(intent);
+ return true;
+ default:
+ return false;
+ }
}
@Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- return super.onPrepareOptionsMenu(menu);
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ super.onPrepareOptionsMenu(menu);
+ MenuItem item = menu.findItem(R.id.menuads_settings);
+ item.getIcon().setAlpha(70);
+ mMenu = menu;
+ return true;
}
@Override
return true;
}
+
+ public void onOptionsMenuClosed(Menu menu) {
+ super.onOptionsMenuClosed(menu);
+ }
+
+ //Si doy al boton pa tras pasa por onCreateOptionsMenu y onPrepareOptionsMenu
+ //Si doy al boton home solo pasa por onResume
+ //:/
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+// if (Cookie.getCookie() != null) {
+// MenuItem item = mMenu.findItem(R.id.menuads_settings);
+// item.getIcon().setAlpha(255);
+// item = mMenu.findItem(R.id.menuads_settings);
+// item.setEnabled(true);
+// item = mMenu.findItem(R.id.menuads_login);
+// item.setEnabled(false);
+// item.setVisible(false);
+// }
+ }
/**
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
// Respond to clicks on the actions in the CAB
switch (item.getItemId()) {
- case R.id.selectedmenuads:
+ case R.id.selectedmenu_remove:
SparseBooleanArray itemsPositions = getListView().getCheckedItemPositions();
Collection<AdsEntry> aux = new ArrayList<AdsEntry>(mAdapter.getCount());
for (int i=0; i< itemsPositions.size(); i++) {
setEmptyText("No downloaded Ads.");
// We have a menu item to show in action bar.
- setHasOptionsMenu(false);
+ setHasOptionsMenu(true);
mAdapter = new AdsEntryAdapter(getActivity(), R.layout.ads_entry_list_item);
/**
* When setHasOptionsMenu(true) we populate the action bar with this menu. It is merged to the
- * current action bar menu (if there is no)
+ * current action bar menu (if there is no one)
*/
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// Place an action bar item for searching.
MenuItem item = menu.add("Search");
item.setIcon(android.R.drawable.ic_menu_search);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+ item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
SearchView sv = new SearchView(getActivity());
sv.setOnQueryTextListener(this);
item.setActionView(sv);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_menu_upload);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
- item = menu.add("Login");
- item.setIcon(android.R.drawable.ic_lock_power_off);
- item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-
}
@Override