Ejemplo n.º 1
0
 @Override
 protected void onPreExecute() {
   final SherlockFragmentActivity activity = getSherlockActivity();
   if (activity != null) {
     activity.setSupportProgressBarIndeterminateVisibility(true);
   }
 }
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  private void onShareEpisode(ShareMethod shareMethod) {
    // Episode of this fragment is always the first item in the cursor
    final Cursor episode = (Cursor) mAdapter.getItem(0);
    final SherlockFragmentActivity activity = getSherlockActivity();
    if (episode != null && activity != null) {
      Bundle shareData = new Bundle();
      String episodestring = ShareUtils.onCreateShareString(activity, episode);
      String sharestring = getString(R.string.share_checkout);
      sharestring += " \"" + episode.getString(DetailsQuery.SHOW_TITLE);
      sharestring += " - " + episodestring + "\"";
      shareData.putString(ShareItems.EPISODESTRING, episodestring);
      shareData.putString(ShareItems.SHARESTRING, sharestring);
      shareData.putInt(ShareItems.EPISODE, episode.getInt(DetailsQuery.NUMBER));
      shareData.putInt(ShareItems.SEASON, episode.getInt(DetailsQuery.SEASON));
      shareData.putInt(ShareItems.TVDBID, episode.getInt(DetailsQuery.REF_SHOW_ID));

      // IMDb id
      String imdbId = episode.getString(DetailsQuery.IMDBID);
      if (TextUtils.isEmpty(imdbId)) {
        // fall back to show IMDb id
        imdbId = episode.getString(DetailsQuery.SHOW_IMDBID);
      }
      shareData.putString(ShareItems.IMDBID, imdbId);

      // don't close cursor!
      // episode.close();

      ShareUtils.onShareEpisode(activity, shareData, shareMethod);

      // invalidate the options menu so a potentially new
      // quick share action is displayed
      activity.invalidateOptionsMenu();
    }
  }
  /*
   * Map methods
   */
  public static void staticOnMarkerClick(
      SherlockFragmentActivity mActivity,
      GoogleMap map,
      Marker marker,
      OnDetailsClick onDetailsClickImplementation) {
    String id = marker.getTitle();

    List<LocatedObject> list = MapManager.ClusteringHelper.getFromGridId(id);

    if (list == null || list.isEmpty()) {
      return;
    }

    if (list.size() > 1 && map.getCameraPosition().zoom == map.getMaxZoomLevel()) {
      AlertRoadsInfoDialog infoDialog = new AlertRoadsInfoDialog(onDetailsClickImplementation);
      Bundle args = new Bundle();
      args.putSerializable(AlertRoadsInfoDialog.ARG_ALERTSLIST, (ArrayList) list);
      infoDialog.setArguments(args);
      infoDialog.show(mActivity.getSupportFragmentManager(), "dialog");
    } else if (list.size() > 1) {
      map.animateCamera(
          CameraUpdateFactory.newLatLngZoom(
              marker.getPosition(), map.getCameraPosition().zoom + 1));
      MapManager.fitMapWithOverlays(list, map);
    } else {
      AlertRoadLoc alert = (AlertRoadLoc) list.get(0);
      AlertRoadsInfoDialog infoDialog = new AlertRoadsInfoDialog(onDetailsClickImplementation);
      Bundle args = new Bundle();
      args.putSerializable(AlertRoadsInfoDialog.ARG_ALERT, alert);
      infoDialog.setArguments(args);
      infoDialog.show(mActivity.getSupportFragmentManager(), "dialog");
    }
  }
 public TabsAdapter(SherlockFragmentActivity activity, ViewPager pager) {
   super(activity.getSupportFragmentManager());
   mContext = activity;
   mActionBar = activity.getSupportActionBar();
   mViewPager = pager;
   mViewPager.setAdapter(this);
   mViewPager.setOnPageChangeListener(this);
 }
Ejemplo n.º 5
0
 public void dismissDialog(SherlockFragmentActivity activity) {
   Fragment prev = activity.getSupportFragmentManager().findFragmentByTag(getTag());
   if (prev != null) {
     FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
     ft.remove(prev);
     ft.commit();
   }
 }
Ejemplo n.º 6
0
  public void showDialog(SherlockFragmentActivity activity) {
    Fragment prev = activity.getSupportFragmentManager().findFragmentByTag("dialog");
    FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
    if (prev != null) {
      ft.remove(prev);
    }
    ft.addToBackStack(null);

    this.show(ft, "dialog");
  }
  public void performActionWithDialogFragment(
      SherlockFragmentActivity activity, DialogFragment dialogFragment) {

    FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
    Fragment prev = activity.getSupportFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
      ft.remove(prev);
    }
    ft.addToBackStack(null);
    dialogFragment.show(ft, "dialog");
  }
  public void showFragment(Context context) {
    SherlockFragmentActivity activity = (SherlockFragmentActivity) context;
    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    FragmentTransaction fragTransaction = fragmentManager.beginTransaction();
    Fragment formulaEditorFragment =
        fragmentManager.findFragmentByTag(FormulaEditorFragment.FORMULA_EDITOR_FRAGMENT_TAG);
    fragTransaction.hide(formulaEditorFragment);

    fragTransaction.show(this);
    fragTransaction.commit();
  }
Ejemplo n.º 9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    picturePosition = getIntent().getIntExtra(POSITION, 0);
    int mode = getIntent().getIntExtra(MODE, 0);

    setContentView(R.layout.ac_scale);
    Log.w("Position:" + picturePosition);

    pager = (ViewPager) findViewById(R.id.pager);

    adapter = new BigScreenAdapter(this, getSupportFragmentManager(), mode);
    pager.setAdapter(adapter);

    pager.setCurrentItem(picturePosition);

    // add save action bar item

    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.DISPLAY_HOME_AS_UP);
    actionBar.setDisplayHomeAsUpEnabled(true);
    String stringExtra = getIntent().getStringExtra(AcAuthor.NAME);
    if (stringExtra != null) {
      actionBar.setTitle(stringExtra);
    }
    //        actionBar.setIcon(R.drawable.icon_v2_small);
    registerReceiver();
  }
Ejemplo n.º 10
0
  public TabListener(SherlockFragmentActivity activity, String tag, Class<T> clz, Bundle args) {
    mActivity = activity;
    mTag = tag;
    mClass = clz;
    mArgs = args;

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state.  If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    mFragment = mActivity.getSupportFragmentManager().findFragmentByTag(mTag);
    if (mFragment != null && !mFragment.isDetached()) {
      FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
      ft.detach(mFragment);
      ft.commit();
    }
  }
Ejemplo n.º 11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_screen);

    stylefont = Typeface.createFromAsset(getAssets(), AppConstants.fontStyle);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle("About");

    fontActionBar(actionBar.getTitle().toString());

    actionBar.setIcon(android.R.drawable.ic_menu_info_details);

    if (isNetworkAvailable()) {
      new GetAbout(this).execute();
    } else {
      Toast.makeText(this, "Please check your internet connection", Toast.LENGTH_SHORT).show();
    }
    about = (TextView) findViewById(R.id.about_text);
    developed = (TextView) findViewById(R.id.developed);
    developed.setTypeface(stylefont);
    about.setTypeface(stylefont);
  }
Ejemplo n.º 12
0
 @Override
 protected void onStart() {
   super.onStart();
   CarListFragment listFrag =
       (CarListFragment) getSupportFragmentManager().findFragmentById(R.id.carListFragment);
   listFrag.setSelectedCarListner(this);
 }
Ejemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //	Toast.makeText(this, "onCreate ", Toast.LENGTH_SHORT).show();
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_map);
    // Show the Up button in the action bar.
    setupActionBar();

    // Getting Google Play availability status
    int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());

    // Showing status
    if (status != ConnectionResult.SUCCESS) { // Google Play Services are
      // not available

      int requestCode = 10;
      Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
      dialog.show();

    } else { // Google Play Services are available
      // Getting reference to the SupportMapFragment of activity_main.xml
      SupportMapFragment fm =
          (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

      // Getting GoogleMap object from the fragment
      googleMap = fm.getMap();

      // Enabling MyLocation Layer of Google Map
      googleMap.setMyLocationEnabled(true);

      googleMap.setOnInfoWindowClickListener(this);
    }
  }
Ejemplo n.º 14
0
 @Override
 public void onDestroy() {
   if (adview != null) {
     adview.destroy();
   }
   super.onDestroy();
 }
Ejemplo n.º 15
0
  /** Set Design of ActionBar */
  @Override
  protected void onStart() {
    super.onStart();
    ActionBar actionBar = this.getSupportActionBar();
    actionBar.setSubtitle(R.string.app_subtitle);

    // add WebserverFragment when enabled in preferences
    if (PreferenceHelper.getWebserverEnabled(this)) {
      FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();

      mWebserverFragment = new WebserverFragment();
      // replace container in view with fragment
      fragmentTransaction.replace(R.id.base_activity_webserver_container, mWebserverFragment);
      fragmentTransaction.commit();
    } else {
      // when disabled in preferences remove fragment if existing
      if (mWebserverFragment != null) {
        FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction();

        fragmentTransaction.remove(mWebserverFragment);
        fragmentTransaction.commit();

        mWebserverFragment = null;
      }
    }
  }
Ejemplo n.º 16
0
 @Override
 protected void onPostExecute(List<SearchResult> result) {
   final SherlockFragmentActivity activity = getSherlockActivity();
   if (activity != null) {
     activity.setSupportProgressBarIndeterminateVisibility(false);
   }
   if (result == null) {
     Toast.makeText(mContext.getApplicationContext(), R.string.search_error, Toast.LENGTH_LONG)
         .show();
   } else if (result.isEmpty()) {
     Toast.makeText(mContext.getApplicationContext(), R.string.no_results, Toast.LENGTH_LONG)
         .show();
   } else {
     setSearchResults(result);
   }
 }
Ejemplo n.º 17
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
      case FILE_SELECT_CODE:
        if (resultCode == RESULT_OK) {
          imageSharing(data, "image");
        }
        break;
      case CAMERA_REQUEST:
        if (resultCode == RESULT_OK) {
          imageSharing(data, "image");
        }
        break;
      case VIDEO_REQUEST:
        if (resultCode == RESULT_OK) {
          imageSharing(data, "video");
        }
        break;
      case AUDIO_REQUEST:
        if (resultCode == RESULT_OK) {
          imageSharing(data, "audio");
        }
        break;
      case REQUEST_CONTACT_NUMBER:
        Log.d("REQUEST_CONTACT_NUMBER", "called");
        if (data != null) {
          handlecontactBrowseData(data);
        }
    }
  }
Ejemplo n.º 18
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   unregisterReceiver(broadcastReceiver_socket_userStatus);
   unregisterReceiver(broadcastReceiver_lost);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mapa_establecimientos);

    ActionBar ab = getSupportActionBar();
    ab.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);

    mapa = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    Bundle bundle = getIntent().getExtras();
    String municipio = bundle.getString("municipio");

    nombreMunicipio = (TextView) findViewById(R.id.nombreMunicipio);
    nombreMunicipio.setText(Utilities.getCamelCase(municipio));

    String nombre = bundle.getString("nombre");

    ctx = this;

    if (nombre == null) initMapaTodos(municipio);
    else initMapaUno();
    initClickMarker();
  }
Ejemplo n.º 20
0
 @Override
 protected void onDestroy() {
   // Workaround until there's a way to detach the Activity from Crouton while
   // there are still some in the Queue.
   Crouton.clearCroutonsForActivity(this);
   super.onDestroy();
 }
Ejemplo n.º 21
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   // Partly from http://stackoverflow.com/a/5069354
   unbindDrawables(((ViewGroup) findViewById(android.R.id.content)).getChildAt(0));
   System.gc();
 }
Ejemplo n.º 22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setContentView(R.layout.activity_country);

    this.webImageManager = WebImageManager.getInstance(this);

    this.selectedCountry = null;

    this.listFragment =
        (CountryListFragment) this.getSupportFragmentManager().findFragmentById(R.id.list);
    this.detailsFragment = null;

    this.layoutDualPane = this.findViewById(R.id.details) != null;

    if (savedInstanceState != null) {
      Country country = savedInstanceState.getParcelable(CountryActivity.INSTANCE_STATE_COUNTRY);

      if (country != null) {

        if (this.layoutDualPane) {
          this.selectCountry(country);
        } else {
          this.selectedCountry = country;
        }
      }
    }
  }
Ejemplo n.º 23
0
  /**
   * Handle result from applying when clicked on notification
   * http://stackoverflow.com/questions/1198558
   * /how-to-send-parameters-from-a-notification-click-to-an-activity BaseActivity launchMode is set
   * to SingleTop for this in AndroidManifest
   */
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Log.d(Constants.TAG, "onNewIntent");

    // if a notification is clicked after applying was done, the following is processed
    Bundle extras = intent.getExtras();
    if (extras != null) {
      if (extras.containsKey(EXTRA_APPLYING_RESULT)) {
        int result = extras.getInt(EXTRA_APPLYING_RESULT);
        Log.d(Constants.TAG, "Result from intent extras: " + result);

        // download failed because of url
        String numberOfSuccessfulDownloads = null;
        if (extras.containsKey(EXTRA_NUMBER_OF_SUCCESSFUL_DOWNLOADS)) {
          numberOfSuccessfulDownloads = extras.getString(EXTRA_NUMBER_OF_SUCCESSFUL_DOWNLOADS);
          Log.d(
              Constants.TAG,
              "Applying information from intent extras: " + numberOfSuccessfulDownloads);
        }

        ResultHelper.showDialogBasedOnResult(mActivity, result, numberOfSuccessfulDownloads);
      }
    }
  }
Ejemplo n.º 24
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      setTheme(R.style.Theme_Sherlock_Light);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.footer);

    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setOnPageChangeListener(onPageChangeListener);
    viewPager.setAdapter(new PagerAdapters(getSupportFragmentManager()));

    actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    actionBar.setDisplayShowTitleEnabled(true);

    Tab tab = actionBar.newTab().setText("Categories").setTabListener(new TabListnr());

    actionBar.addTab(tab);

    tab = actionBar.newTab().setText("My Posts").setTabListener(new TabListnr());

    actionBar.addTab(tab);
  }
Ejemplo n.º 25
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   outState.putParcelableArrayList("allTapItem", allTapItem);
   outState.putParcelableArrayList("allToiletItem", allToiletItem);
   outState.putParcelableArrayList("allFoodItem", allFoodItem);
   super.onSaveInstanceState(outState);
 }
Ejemplo n.º 26
0
  // Code from Stackoverflow to reduce memory problems
  // onDestroy() and unbindDrawables() methods taken from
  // http://stackoverflow.com/a/6779067
  @Override
  protected void onDestroy() {
    super.onDestroy();

    unbindDrawables(findViewById(R.id.SoundrecorderActivityRoot));
    System.gc();
  }
Ejemplo n.º 27
0
  /* Request updates at startup */
  @Override
  protected void onResume() {
    super.onResume();
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    //	Toast.makeText(this, "onResume ", Toast.LENGTH_SHORT).show();
    // Getting LocationManager object from System Service
    initializeLocationManager();

    if (provider != null) {
      //	Toast.makeText(this, "onResume -> clear map", Toast.LENGTH_SHORT).show();
      googleMap.clear();

      // every 2 seconds and 100 meters
      locationManager.requestLocationUpdates(provider, 2000, Constants.minDistance, this);

      // Getting Current Location
      Location location = locationManager.getLastKnownLocation(provider);
      if (location != null) {
        setMyLocationOnMapNoZoom(location);
        //				if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
        //					addMyLocationMarker();
        //				}
      } else {
        showLocationNotFoundAlertToUser();
      }
      populateMarkedContent();
    } else {
      showLocationServiceDisabledAlertToUser();
    }
  }
Ejemplo n.º 28
0
 @Override
 protected void onResume() {
   super.onResume();
   Varios.clearAllNotifications = false;
   AppEventsLogger.activateApp(this, getString(R.string.facebook_app_id));
   EasyTracker.getInstance(this).activityStart(this);
 }
Ejemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // If we get created for the first time we get our data from the intent
    Bundle data = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();
    session = (Session) data.getSerializable(Session.IDENTIFIER);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ActionBar.Tab tab =
        getSupportActionBar()
            .newTab()
            .setText(R.string.info)
            .setTabListener(
                new TabListener<NodeListFragment>(this, "NodeList", NodeListFragment.class));
    actionBar.addTab(tab);

    if (session.getResult() != null) {
      tab =
          getSupportActionBar()
              .newTab()
              .setText(R.string.Result)
              .setTabListener(new TabListener<InfoFragment>(this, "Info", InfoFragment.class));
      actionBar.addTab(tab);
    }

    if (savedInstanceState != null)
      getSupportActionBar()
          .selectTab(getSupportActionBar().getTabAt(savedInstanceState.getInt("Tab", 0)));
  }
  @Override
  public void onDestroy() {
    super.onDestroy();

    m_readableDb.close();
    m_writableDb.close();
  }