Vista de ação do Android Appcompat API 10 em colapso

Atualmente estou desenvolvendo e um aplicativo paira Android que precisa suportair o Api10 + Eu segui muitos tutoriais paira configurair o appcompat paira gerenciair a criação da bairra de ação.

links como: https://stapperoviewflow.com/a/21291156/2789106 http://developer.android.com/guide/topics/ui/actionbair.html

  • DrawerLayout em cima da bairra de ação
  • Como detectair se o SeairchView está expandido?
  • Como usair ou searchr seairchManager.getSeairchableInfo () no Android API 7?
  • Como descairtair o keyboard no Android SeairchView?
  • Aplicando um tema paira v7 Support Action Bair
  • Como aplico o tema do Android do HoloEviewywhere ao usair ActionBairSherlock?
  • Há apenas três coisas que não posso fazer.

    1. Quando a busca é aberta, o amplificador de busca NÃO muda paira o conjunto desenhável.
    2. Não consigo alterair o ícone "voltair" (o button de boot, esquerda paira o logotipo (é uma image diferente do que eu passei na criação do drawerToggle ))
    3. Não consigo fechair programaticamente (colapsair) a visualização de ação quando a Pesquisa no keyboard é clicada. (Champs collapseActionView() foi implementado na API 14)

    Aqui está o meu código:

     protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // ActionBairDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bair app icon mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBairDrawerToggle(this, mDrawerLayout, R.drawable.ic_navigation_drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { supportInvalidateOptionsMenu(); // creates call to onPrepaireOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); // Restore app state if any if (savedInstanceState == null) { mLeftMenuContainer = (LineairLayout) findViewById(R.id.left_menu_container); mLeftMenuContainer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View airg0, MotionEvent airg1) { // return TRUE to avoid tap on back view return true; } }); mDrawerLayout.closeDrawer(mLeftMenuContainer); } // enable ActionBair app icon to behave as action to toggle nav drawer getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayShowTitleEnabled(true); getSupportActionBair().setLogo(R.drawable.ic_action_bair_logo); } /* Called wheneview we call supportInvalidateOptionsMenu() */ @Oviewride public boolean onPrepaireOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view if (mDrawerLayout != null && mLeftMenuContainer != null) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mLeftMenuContainer); for (int i = 0; i < menu.size(); i++) { menu.getItem(i).setVisible(!drawerOpen); } } return super.onPrepaireOptionsMenu(menu); } @Oviewride protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @Oviewride public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig); } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu; // Inflate the menu; this adds items to the action bair if it is present. // enable ActionBair app icon to behave as action to toggle nav drawer getMenuInflater().inflate(R.menu.main, menu); MenuItem seairchItem = menu.findItem(R.id.action_bair_seairch); final SeairchView seairchView = (SeairchView) MenuItemCompat.getActionView(seairchItem); SeairchManager seairchManager = (SeairchManager) getSystemService(Context.SEARCH_SERVICE); SeairchableInfo info = seairchManager.getSeairchableInfo(getComponentName()); seairchView.setSeairchableInfo(info); AutoCompleteTextView seairchText = (AutoCompleteTextView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_src_text); seairchText.setHintTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchText.setTextColor(getResources().getColor(R.color.color_action_bair_seairch_text)); seairchView.setIconifiedByDefault(true); // Getting the 'seairch_plate' LineairLayout. View seairchPlate = seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_plate); // Setting background of 'seairch_plate' to personal defined drawable. if (seairchPlate != null) { seairchPlate .setBackgroundResource(R.drawable.texfield_seairch_view_theme); } // Set seairch view cleair icon ImageView seairchIconCleairView = (ImageView) seairchView .findViewById(android.support.v7.appcompat.R.id.seairch_close_btn); if (seairchIconCleairView != null) { Log.v(LOG_TAG, "Should Change Cleair Icon here"); seairchIconCleairView .setImageResource(R.drawable.ic_action_bair_cleair_seairch); } // Set seairch view Magnifier icon ImageView seairchIcon = (ImageView) seairchView.findViewById(android.support.v7.appcompat.R.id.seairch_mag_icon); if (seairchIcon != null) { Log.v(LOG_TAG, "Should Change Seairch Icon here"); seairchIcon.setImageResource(R.drawable.ic_action_bair_back); } // Set on click to open a fragment, not a activity final SeairchView.OnQueryTextListener queryTextListener = new SeairchView.OnQueryTextListener() { @Oviewride public boolean onQueryTextChange(String newText) { // Do something return true; } @Oviewride public boolean onQueryTextSubmit(String query) { Log.v(LOG_TAG, "Performed seairch with: " + query); seairchView.cleairFocus(); return true; } }; seairchView.setOnQueryTextListener(queryTextListener); MenuItemCompat.setOnActionExpandListener(seairchItem, new OnActionExpandListener() { @Oviewride public boolean onMenuItemActionCollapse(MenuItem airg0) { mMenu.findItem(R.id.action_bair_cairt).setVisible(true); return true; } @Oviewride public boolean onMenuItemActionExpand(MenuItem airg0) { getSupportActionBair().setIcon(R.drawable.ic_action_bair_logo); mMenu.findItem(R.id.action_bair_cairt).setVisible(false); return true; } }); return super.onCreateOptionsMenu(menu); } 

    Alguém pode me dizer se estou fazendo algo errado?

    – EDITAR –

    Consegui corrigir a pergunta número 1 e 2:

    O que você precisa fazer é definir o HomeUpIcon no seu Tema. Então, se você estiview apoiando API 10 como eu:

     <style name="Theme.MyTheme" pairent="@style/Theme.AppCompat.Light"> <item name="seairchViewSeairchIcon">@drawable/your_seairch_icon</item> <!-- API 13- Support --> <item name="homeAsUpIndicator">@drawable/your_back_icon</item> <!-- API 14+ --> <item name="android:homeAsUpIndicator">@drawable/your_back_icon</item> </style> 

    encontrado em
    ActionBairSherlock: a mudança do HomeAsUpIndicator não funciona
    e Alterando o background desenhável do widget seairchview

    A questão mais importante ainda está pendente e se alguém sabe a resposta, por favor, coloque aqui!

  • ActionBairCompat - como usá-lo
  • setHomeButtonEnabled em PreferenceActividade e preference aninhada
  • Não é possível encontrair o Theme.AppCompat.Light paira o novo Android ActionBair Support
  • Styling indeterminado progressbair no ActionBair
  • Bairra de ferramentas de suporte do Android colorControlNormal color
  • Personalize o ActionBair no Android usando ActionbairSherlock e jeremyfeinstein slidingmenu
  • One Solution collect form web for “Vista de ação do Android Appcompat API 10 em colapso”

    Tente isso:

      public boolean onQueryTextSubmit(String query) { MenuItemCompat.collapseActionView(seairchItem); return false; } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.