@Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    SherlockFragment fragment = getFragment();
    if (fragment != null) return fragment.onOptionsItemSelected(item);

    return super.onOptionsItemSelected(item);
  }
  @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;
  }
 @Override
 public SherlockFragment getItem(int i) {
   SherlockFragment fragment = new NewsItemDetailFragment();
   Bundle arguments = new Bundle();
   if (fromOnlineSearch) {
     arguments.putParcelable(NewsItemDetailFragment.ARG_ITEM_JO, newsItems.get(i));
   } else {
     arguments.putString(NewsItemDetailFragment.ARG_ITEM, newsItems.get(i).getUrlLink());
   }
   fragment.setArguments(arguments);
   return fragment;
 }
  @Override
  public void onStop() {

    getActivity().unregisterReceiver(mScreenTimeoutListener);

    super.onStop();
  }
 @Override
 public void onDestroyView() {
   Log.v(
       DetailsFragment.TAG,
       String.format("in DetailsFragment onDestroyView, view = ", mIndex) + getView());
   super.onDestroyView();
 }
Beispiel #6
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setRetainInstance(true);
   mReceiver = new DetachableResultReceiver(new Handler());
   mReceiver.setReceiver(this);
 }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menuInfo.toString();

    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    final Cursor show =
        getActivity()
            .getContentResolver()
            .query(
                Shows.buildShowUri(String.valueOf(info.id)),
                new String[] {Shows.FAVORITE, Shows.HIDDEN},
                null,
                null,
                null);
    show.moveToFirst();
    if (show.getInt(0) == 0) {
      menu.add(0, CONTEXT_FAVORITE_ID, 2, R.string.context_favorite);
    } else {
      menu.add(0, CONTEXT_UNFAVORITE_ID, 2, R.string.context_unfavorite);
    }
    if (show.getInt(1) == 0) {
      menu.add(0, CONTEXT_HIDE_ID, 3, R.string.context_hide);
    } else {
      menu.add(0, CONTEXT_UNHIDE_ID, 3, R.string.context_unhide);
    }
    show.close();

    menu.add(0, CONTEXT_CHECKIN_ID, 0, R.string.checkin);
    menu.add(0, CONTEXT_FLAG_NEXT_ID, 1, R.string.context_marknext);
    menu.add(0, CONTEXT_MANAGE_LISTS_ID, 4, R.string.list_item_manage);
    menu.add(0, CONTEXT_UPDATE_ID, 5, R.string.context_updateshow);
    menu.add(0, CONTEXT_DELETE_ID, 6, R.string.delete_show);
  }
Beispiel #8
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // init value
    sUserId = null;
    sPagesId = null;
    callback = new JSONObject();
    user = (User) getActivity().getApplicationContext();
    phraseManager = new PhraseManager(getActivity().getApplicationContext());
    colorView = new ColorView(getActivity().getApplicationContext());
    objProfileInfo = new UserProfile();

    Bundle extras = getActivity().getIntent().getExtras();
    if (extras != null) {
      if (getActivity().getIntent().hasExtra("user_id")) {
        sUserId = extras.getString("user_id");
        aboutme = extras.getString("aboutme");
        whomeet = extras.getString("whomeet");
        movies = extras.getString("movies");
        interests = extras.getString("interests");
        music = extras.getString("music");
      } else if (getActivity().getIntent().hasExtra("page_id")) {
        sPagesId = extras.getString("page_id");
      }
    }
    super.onCreate(savedInstanceState);
  }
 /** Detach from view. */
 @Override
 public void onDestroyView() {
   mContentShown = false;
   mIsContentEmpty = false;
   mProgressContainer = mContentContainer = mEmptyView = null;
   super.onDestroyView();
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    setRetainInstance(true);
    deliverModel();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    if (savedInstanceState != null) {
      mFile = savedInstanceState.getParcelable(FileDetailFragment.EXTRA_FILE);
      mAccount = savedInstanceState.getParcelable(FileDetailFragment.EXTRA_ACCOUNT);
    }

    View view = null;
    view = inflater.inflate(mLayout, container, false);
    mView = view;

    if (mLayout == R.layout.file_details_fragment) {
      mView.findViewById(R.id.fdKeepInSync).setOnClickListener(this);
      mView.findViewById(R.id.fdRenameBtn).setOnClickListener(this);
      mView.findViewById(R.id.fdDownloadBtn).setOnClickListener(this);
      mView.findViewById(R.id.fdOpenBtn).setOnClickListener(this);
      mView.findViewById(R.id.fdRemoveBtn).setOnClickListener(this);
      // mView.findViewById(R.id.fdShareBtn).setOnClickListener(this);
      mPreview = (ImageView) mView.findViewById(R.id.fdPreview);
    }

    updateFileDetails();
    return view;
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != 0) {
      if (requestCode == ACTIVITY_SELECT_IMAGE) {

        Uri selectedImage = data.getData();
        String[] filePathColumn = {MediaStore.Images.Media.DATA};

        Cursor cursor =
            getSherlockActivity()
                .getContentResolver()
                .query(selectedImage, filePathColumn, null, null, null);
        cursor.moveToFirst();

        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        String filePath = cursor.getString(columnIndex);
        cursor.close();

        Bitmap bm = BitmapFactory.decodeFile(filePath);

        new OtsuAsyncTask(this).execute(bm);
        // new SeqSegmAsyncTask(segmentationHandler).execute(bm.copy(bm.getConfig(), true));

        ImageView iv = ((ImageView) getView().findViewById(R.id.image));
        iv.setImageBitmap(bm);
        iv.invalidate();
      }
    }
    super.onActivityResult(requestCode, resultCode, data);
  }
Beispiel #13
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // init loader
    getLoaderManager().initLoader(0, null, this);
  }
    /*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 onResume() {
   super.onResume();
   mDownloadHelper.onActivityResume();
   mDownloadHelper.startDownloading(null, false);
   mRemoteImageLoader.onActivityResume();
 }
Beispiel #16
0
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		
		// Get our GUI elements.
		searchButton = (Button)getSherlockActivity().findViewById(R.id.button_search);
		searchEdit = (EditText)getSherlockActivity().findViewById(R.id.edit_search);
		
		searchEdit.setTextColor(0xfff0641e);

		searchProgress = (ProgressBar)getSherlockActivity().findViewById(R.id.progress_search);
		
		// Create a listener for keyboard "enter" button.
		OnEditorActionListener listener = new OnEditorActionListener() {
		    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
		        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
		        	// Simulate click on the search button.
		            searchButton.performClick();
		            return true;
		        }
		        return false;
		    }
		};
		// Add our newly created listener to the text field.
		searchEdit.setOnEditorActionListener(listener);
	}
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (getArguments().containsKey(ARG_ITEM_ID)) {
     mItem = Profile.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
   }
 }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   final ActionBar actionBar = getSherlockActivity().getSupportActionBar();
   actionBar.setTitle("Nested fragment");
   actionBar.setSubtitle(String.valueOf(mTimestamp));
 }
Beispiel #19
0
 // アプリを止めたら
 @Override
 public void onPause() {
   if (mLocationManager != null) {
     mLocationManager.removeUpdates(this);
   }
   super.onPause();
 }
Beispiel #20
0
 public void switchTo(Class className, Bundle bundle, String tag) {
   FragmentTransaction ft = fm.beginTransaction();
   Fragment mFragement = SherlockFragment.instantiate(this, className.getName(), bundle);
   ft.replace(R.id.layout_container, mFragement, tag);
   ft.addToBackStack(null);
   ft.commit();
 }
  @Override
  public void onViewCreated(final View view, final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    amountCalculatorLink.setExchangeDirection(config.getLastExchangeDirection());
    amountCalculatorLink.requestFocus();
  }
Beispiel #22
0
 // changing manually to skip adding to back stack
 @Override
 public void paypalNetworkUnavailable() {
   FragmentTransaction ft = fm.beginTransaction();
   Fragment mFragement = SherlockFragment.instantiate(this, OrderSummary.class.getName(), null);
   ft.replace(R.id.layout_container, mFragement);
   ft.commit();
 }
  @Override
  public void onPrepareOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub
    menu.removeItem(2);

    super.onPrepareOptionsMenu(menu);
  }
 @Override
 public void onDetach() {
   super.onDetach();
   this.retainedLifecycle =
       true; // past this point if this is retained then this value will stay true
   // if it goes back to false then we recreated the fragment
 }
Beispiel #25
0
 // changing manually to skip adding to back stack
 @Override
 public void paymentSuccessful() {
   FragmentTransaction ft = fm.beginTransaction();
   Fragment mFragement = SherlockFragment.instantiate(this, ServerUpload.class.getName(), null);
   ft.replace(R.id.layout_container, mFragement, "SERVER_UPLOAD");
   ft.commit();
 }
  @Override
  public void onAttach(Activity a) {

    parent = a;

    super.onAttach(a);
  }
Beispiel #27
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // get settings
    getSortAndFilterSettings();

    // prepare view adapter
    int resIdStar =
        Utils.resolveAttributeToResourceId(getSherlockActivity().getTheme(), R.attr.drawableStar);
    int resIdStarZero =
        Utils.resolveAttributeToResourceId(getSherlockActivity().getTheme(), R.attr.drawableStar0);
    mAdapter = new SlowAdapter(getActivity(), null, 0, resIdStar, resIdStarZero, this);

    // setup grid view
    mGrid = (GridView) getView().findViewById(R.id.gridViewShows);
    mGrid.setAdapter(mAdapter);
    mGrid.setOnItemClickListener(this);
    registerForContextMenu(mGrid);

    // start loading data
    getLoaderManager().initLoader(LOADER_ID, null, this);

    // listen for some settings changes
    PreferenceManager.getDefaultSharedPreferences(getActivity())
        .registerOnSharedPreferenceChangeListener(mPrefsListener);

    setHasOptionsMenu(true);
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   View view = inflater.inflate(mLayout, container, false);
   return view;
 }
Beispiel #29
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   context = getSherlockActivity();
   preferences = PreferenceManager.getDefaultSharedPreferences(getSherlockActivity());
   new AsyncSystemRequirement().execute();
 }
 /*
  * @Override public void onSaveInstanceState(Bundle out) {
  * super.onSaveInstanceState(out); out.putParcelableArrayList("classList",
  * classList); }
  */
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (fetch != null) {
     fetch.cancel(true);
   }
 }