/*codigo de animationDrawable, fondo que cambia en la pantalla principal*/
    // animacion asociada al linearLayout (tema 3 de Android - Dibujar en Android - pag 10)
    main_Layout = (LinearLayout) getActivity().findViewById(R.id.main_bg_layout);
    animacion_backgrounds =
        (AnimationDrawable) getActivity().getResources().getDrawable(R.anim.animacion_main_bg);

    // comprobacion si la version de android en la que se ejecuta es anterior a la
    // honeycomb(target16)
    // ya que setBackgroundDrawable es deprecated.
    if (Build.VERSION.SDK_INT <= 16) main_Layout.setBackgroundDrawable(animacion_backgrounds);
    else main_Layout.setBackground(animacion_backgrounds);

    new Handler()
        .postDelayed(
            new Runnable() {
              @Override
              public void run() {

                animacion_backgrounds.start();
              }
            },
            500);

    // cambiar typeface's a los botones de la pantalla principal
    main_eventos = (Button) getActivity().findViewById(R.id.main_eventos_button);
    main_eventos.setTypeface(robotoBoldCondensed);
    main_eventos.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            newContent = new Main_Eventos();

            if (newContent != null) {
              switchFragment(newContent);
            }
          }
        });

    main_sitios = (Button) getActivity().findViewById(R.id.main_sitios_visitados_button);
    main_sitios.setTypeface(robotoBoldCondensed);

    main_buscar = (Button) getActivity().findViewById(R.id.main_buscar_sitio_button);
    main_buscar.setTypeface(robotoBoldCondensed);
    main_buscar.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            ArrayList<LugaresDeInteres_Item> arrayListAllLugares =
                LugaresDeInteres_Data_Objects.AllTheLugaresDeInteres(getActivity());
            Main_FragmentActivity mFragmentActivity = (Main_FragmentActivity) getActivity();
            mFragmentActivity.onBuscarSeleccionado(arrayListAllLugares);
          }
        });

    main_descubre = (Button) getActivity().findViewById(R.id.main_descubre_button);
    main_descubre.setTypeface(robotoBoldCondensed);
    main_descubre.setOnClickListener(
        new OnClickListener() {
          // abrir el menu con el boton descubre valencia
          @Override
          public void onClick(View v) {
            if (slidingMenu.isShown())
              new Handler()
                  .postDelayed(
                      new Runnable() {

                        @Override
                        public void run() {
                          slidingMenu.toggle();
                        }
                      },
                      80);
          }
        });
  }

  private void switchFragment(Fragment newContent) {
    if (getActivity() == null) return;

    // comprueba si getActivity es una instancia de Main_FragmentActivity, la clase que va a
    // contener este fragment
    // llama al metodo de swtich para hacer el replace().
    if (getActivity() instanceof Main_FragmentActivity) {
      Main_FragmentActivity mFragmentActivity = (Main_FragmentActivity) getActivity();
      mFragmentActivity.switchContent(newContent);
    }
  }

  // Metodo del menu y el listener del menú	/*Menu  actionBarSherlock*/
  public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
    super.onCreateOptionsMenu(menu, menuInflater);
    menu.add(0, MAP, 0, "Ir al mapa")
        .setIcon(R.drawable.ic_location_place)
        .setShowAsAction(
            MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
  }
  @Override
  public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    inflater.inflate(R.menu.request_coins_fragment_options, menu);

    if (!checkForLocalApp()) menu.removeItem(2); // The "Request from local" menu entry.

    super.onCreateOptionsMenu(menu, inflater);
  }
Exemplo n.º 3
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    MenuItem create = menu.add("Create");
    create.setIcon(R.drawable.ic_menu_add2);
    create.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    SherlockFragment fragment = getFragment();
    if (fragment != null) fragment.onCreateOptionsMenu(menu, getSupportMenuInflater());

    boolean created = super.onCreateOptionsMenu(menu);
    menuCreated = true;
    return created;
  }
Exemplo n.º 5
0
  @Override
  public void onCreateOptionsMenu(
      com.actionbarsherlock.view.Menu menu, com.actionbarsherlock.view.MenuInflater inflater) {
    // disable search menu item
    MenuItem search = menu.findItem(R.id.actionBar_chat);
    search.setVisible(false);

    inflater.inflate(R.menu.slide_bar, menu);

    super.onCreateOptionsMenu(menu, inflater);
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // TODO Auto-generated method stub

    if (!mActivity.getSupportActionBar().isShowing()) {
      return;
    }

    mMenuUtils.addMenu(menu);

    super.onCreateOptionsMenu(menu, inflater);
  }
  @Override
  public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
    inflater.inflate(R.menu.request_coins_fragment_options, menu);

    final MenuItem shareItem = menu.findItem(R.id.request_coins_options_share);
    shareActionProvider = (ShareActionProvider) shareItem.getActionProvider();

    updateShareIntent();

    if (!checkForLocalApp()) menu.removeItem(2); // The "Request from local" menu entry.

    super.onCreateOptionsMenu(menu, inflater);
  }
Exemplo n.º 8
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    menu.add(Menu.NONE, MENU_ID_CHANGE_STATIONS, 0, "Change station")
        .setIcon(R.drawable.ic_shuffle)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(Menu.NONE, MENU_ITEM_HISTORY, 0, "History")
        .setIcon(R.drawable.ic_history)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    super.onCreateOptionsMenu(menu, inflater);
  }
Exemplo n.º 9
0
  // オプションメニューの追加
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    /*
    	//ツイッターログイン
    	MenuItem tw_login = menu.add(0, tw_login_menu_id, Menu.NONE, getString(R.string.tw_setting));
    	tw_login.setIcon(android.R.drawable.ic_menu_preferences);
    	tw_login.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    */
    // IPPログイン
    MenuItem ipp_login = menu.add(0, ipp_login_menu_id, Menu.NONE, getString(R.string.ipp_login));
    ipp_login.setIcon(android.R.drawable.ic_menu_preferences);
    ipp_login.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    // リロード
    MenuItem reload = menu.add(0, reload_menu_id, Menu.NONE, getString(R.string.comment_reload));
    reload.setIcon(android.R.drawable.ic_menu_preferences);
    reload.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    // 追加読み込み
    MenuItem addget = menu.add(0, addget_menu_id, Menu.NONE, getString(R.string.additionalGet));
    addget.setIcon(android.R.drawable.ic_menu_preferences);
    addget.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);

    // ストレス変更
    /*
    MenuItem stress_change = menu.add(0, stress_change_menu_id, Menu.NONE, getString(R.string.stress_change));
    stress_change.setIcon(android.R.drawable.ic_menu_preferences);
    stress_change.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    */

    // 近くに限る
    nearMenu = menu.add(0, near_menu_id, Menu.NONE, getString(R.string.near));
    nearMenu.setIcon(android.R.drawable.ic_menu_compass);
    // near.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); アクションバー上にアイコンで表示

    nearMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); // ドロップダウンのメニューに表示
  }
Exemplo n.º 10
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   super.onCreateOptionsMenu(menu, inflater);
   inflater.inflate(R.menu.chat_fragment_menu, menu);
 }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.frag1act1, menu);
    com.actionbarsherlock.view.MenuItem menucart = menu.findItem(R.id.menu_cart);
    menucart.setVisible(true);
    /*
       menucart.setOnMenuItemClickListener(new OnMenuItemClickListener() {

    	@Override
    	public boolean onMenuItemClick(MenuItem arg0) {
    		Intent inten = new Intent (getActivity() , ShoppingCartActivity.class);
    		startActivity(inten);
    		return false;
    	}
    }); */

    SearchView searchView = new SearchView(getActivity());

    searchView.setQueryHint("Search Product");
    searchView.setOnQueryTextListener(
        new OnQueryTextListener() {

          @Override
          public boolean onQueryTextSubmit(String searchtext) {
            String text = searchtext.toString().toLowerCase(Locale.getDefault());
            if (text.length() <= 0) {
              t.setVisibility(View.INVISIBLE);
              listview.setVisibility(View.VISIBLE);
              adapter.filter(text);
            } else {
              adapter.filter(text);
              if (adapter == null || adapter.isEmpty()) {
                t.setVisibility(View.VISIBLE);
                listview.setVisibility(View.INVISIBLE);
              } else {
                t.setVisibility(View.INVISIBLE);
                listview.setVisibility(View.VISIBLE);
              }
            }
            return true;
          }

          @Override
          public boolean onQueryTextChange(String searchtext) {
            String text = searchtext.toString().toLowerCase(Locale.getDefault());
            if (text.length() <= 0) {
              t.setVisibility(View.INVISIBLE);
              listview.setVisibility(View.VISIBLE);
              adapter.filter(text);
            } else {
              adapter.filter(text);
              if (adapter == null || adapter.isEmpty()) {
                t.setVisibility(View.VISIBLE);
                listview.setVisibility(View.INVISIBLE);
              } else {
                t.setVisibility(View.INVISIBLE);
                listview.setVisibility(View.VISIBLE);
              }
            }
            return false;
          }
        });

    menu.add("Search Products")
        .setIcon(R.drawable.ic_action_search)
        .setActionView(searchView)
        .setShowAsAction(
            MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
  }
Exemplo n.º 12
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   if (wifiNetwork.getSupportState() != Keygen.UNSUPPORTED)
     inflater.inflate(R.menu.share_keys, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }
Exemplo n.º 13
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.share_keys, menu);
   super.onCreateOptionsMenu(menu, inflater);
 }