@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle parms = getIntent().getExtras();
    int sessionId = parms.getInt("sess_id");
    profileId = parms.getInt("prof_id");

    if (savedInstanceState != null) {
      sessionId = savedInstanceState.getInt("sess_id");
    }

    if (sessionId == 0) {
      loginFailure();
    } else {
      loadContext(sessionId);
    }
  }
  @Override
  public void finish() {
    ListActivity.info("finish mapping.");
    finishing.set(true);

    super.finish();
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.rss_reader);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    btnManage = (Button) findViewById(R.id.btn_manage);
    btnBrowse = (Button) findViewById(R.id.btn_browse);
    btnRefresh = (Button) findViewById(R.id.btn_refresh);
    btnSearch = (Button) findViewById(R.id.btn_search);

    btnManage.setOnClickListener(this);
    btnBrowse.setOnClickListener(this);
    btnRefresh.setOnClickListener(this);
    btnSearch.setOnClickListener(this);

    txtSearch = (EditText) findViewById(R.id.txt_search);

    init();

    boolean hasUpdate = false;
    try {
      hasUpdate = getIntent().getExtras().getBoolean("rss_update");
    } catch (NullPointerException e) {
      e.printStackTrace();
    }

    if (hasUpdate) {
      rssFeed = dbQuery.getUpdatedRssFeed();
      updateListView();
    } else loadData(null, true, false, true);
  }
 @Override
 public void onResume() {
   super.onResume();
   context = getApplicationContext();
   build();
   loaded();
 }
  @Override
  public void onPause() {
    ListActivity.info("pause mapping.");
    myLocationOverlay.disableCompass();
    disableLocation();

    super.onPause();
  }
  @Override
  public void onResume() {
    ListActivity.info("resume mapping.");
    myLocationOverlay.enableCompass();
    enableLocation();

    super.onResume();
  }
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     ListActivity.info("onKeyDown: not quitting app on back");
     MainActivity.switchTab(this, MainActivity.TAB_LIST);
     return true;
   }
   return super.onKeyDown(keyCode, event);
 }
 @Override
 public Object onRetainNonConfigurationInstance() {
   ListActivity.info("MappingActivity: onRetainNonConfigurationInstance");
   // save the map info
   state.oldCenter = mapView.getMapCenter();
   state.oldZoom = mapView.getZoomLevel();
   // return state class to copy data from
   return state;
 }
 @Override
 public Dialog onCreateDialog(int which) {
   switch (which) {
     case SSID_FILTER:
       return createSsidFilterDialog(this, "");
     default:
       ListActivity.error("unhandled dialog: " + which);
   }
   return null;
 }
 /**
  * When a user selects an item: - If it's a directory, load that directory. - If it's a file, open
  * the SheetMusicActivity.
  */
 @Override
 protected void onListItemClick(ListView parent, View view, int position, long id) {
   super.onListItemClick(parent, view, position, id);
   FileUri file = (FileUri) this.getListAdapter().getItem(position);
   if (file.isDirectory()) {
     this.loadDirectory(file.getUri().getPath());
     return;
   } else {
     ChooseSongActivity.openFile(file);
   }
 }
 private void enableLocation() {
   try {
     // force it to think it's own location listening is on
     myLocationOverlay.mLocationListener = new LocationListenerProxy(null);
     STATIC_LOCATION_LISTENER = myLocationOverlay;
     MainActivity.getListActivity(this).getGPSListener().setMapListener(myLocationOverlay);
     myLocationOverlay.enableMyLocation();
   } catch (Exception ex) {
     ListActivity.error("Could not enableLocation for maps: " + ex, ex);
   }
 }
 private static Location safelyGetLast(final Context context, final String provider) {
   Location retval = null;
   try {
     final LocationManager locationManager =
         (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
     retval = locationManager.getLastKnownLocation(provider);
   } catch (IllegalArgumentException ex) {
     ListActivity.info("exception getting last known location: " + ex);
   }
   return retval;
 }
 @Override
 public void onResume() {
   super.onResume();
   rootdir = Environment.getExternalStorageDirectory().getAbsolutePath();
   directoryView = (TextView) findViewById(R.id.directory);
   SharedPreferences settings = getPreferences(0);
   String lastBrowsedDirectory = settings.getString("lastBrowsedDirectory", null);
   if (lastBrowsedDirectory == null) {
     lastBrowsedDirectory = rootdir;
   }
   loadDirectory(lastBrowsedDirectory);
 }
Example #14
0
  /** Author Wagner */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result);

    // String searched = "CN";

    Bundle bundle = this.getIntent().getExtras();
    String searched = bundle.getString("search");

    CarregaLista(searched);
  }
  @Override
  public void onDestroy() {
    ListActivity.info("destroy mapping.");
    finishing.set(true);

    // save zoom
    final SharedPreferences prefs = this.getSharedPreferences(ListActivity.SHARED_PREFS, 0);
    final Editor edit = prefs.edit();
    edit.putInt(ListActivity.PREF_PREV_ZOOM, mapView.getZoomLevel());
    edit.commit();

    super.onDestroy();
  }
  private void setupMapView(final IGeoPoint oldCenter, final int oldZoom) {
    // view
    final RelativeLayout rlView = (RelativeLayout) this.findViewById(R.id.map_rl);

    // tryEvil();

    // possibly choose goog maps here
    mapView = new MapView(this, 256);

    if (mapView instanceof View) {
      ViewGroup.LayoutParams params =
          new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
      ((View) mapView).setLayoutParams(params);
    }

    if (mapView instanceof MapView) {
      final MapView osmMapView = (MapView) mapView;
      rlView.addView(osmMapView);
      osmMapView.setBuiltInZoomControls(true);
      osmMapView.setMultiTouchControls(true);

      // my location overlay
      myLocationOverlay = new MyLocationOverlay(getApplicationContext(), osmMapView);
      myLocationOverlay.setLocationUpdateMinTime(ListActivity.LOCATION_UPDATE_INTERVAL);
      myLocationOverlay.setDrawAccuracyEnabled(false);
      osmMapView.getOverlays().add(myLocationOverlay);

      final OpenStreetMapViewWrapper overlay = new OpenStreetMapViewWrapper(this);
      osmMapView.getOverlays().add(overlay);
    }

    // controller
    mapControl = mapView.getController();
    final IGeoPoint centerPoint = getCenter(this, oldCenter, previousLocation);
    int zoom = DEFAULT_ZOOM;
    if (oldZoom >= 0) {
      zoom = oldZoom;
    } else {
      final SharedPreferences prefs = getSharedPreferences(ListActivity.SHARED_PREFS, 0);
      zoom = prefs.getInt(ListActivity.PREF_PREV_ZOOM, zoom);
    }
    mapControl.setCenter(centerPoint);
    mapControl.setZoom(zoom);
    mapControl.setCenter(centerPoint);

    ListActivity.info("done setupMapView. zoom: " + zoom);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.mnu_exit:
        if (!isTaskRunning) finish();
        else
          Toast.makeText(RssReaderActivity.this, R.string.rss_keep_updating, Toast.LENGTH_SHORT)
              .show();
        break;
      case R.id.mnu_about:
        break;
      default:
        break;
    }
    return true;
  }
Example #18
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.tv_tab_layout:
       {
         TabActivity.start(this);
         break;
       }
     case R.id.tv_list_layout:
       {
         ListActivity.start(this);
         break;
       }
     default:
       {
       }
   }
 }
Example #19
0
  @Override
  public void onClick(View v) {

    try {
      int i = Integer.parseInt(textView.getText().toString());
      switch (v.getId()) {
        case R.id.up_button:
          textView.setText("" + (i + 1));
          break;
        case R.id.down_button:
          textView.setText("" + (i - 1));
          break;
        case R.id.new_activity_button:
          ListActivity.start(this);
          break;
        case R.id.fragment_button:
          FragmentActivity.start(this);
          break;
        default:
      }
    } catch (IllegalArgumentException e) {
      textView.setText("I Broke :(");
    }
  }
        public void handleMessage(Message msg) {
          super.handleMessage(msg);

          try {
            prog.dismiss();
          } catch (
              IllegalArgumentException
                  e) { // this may happen due to race conditions on activity shutdown?
            e.printStackTrace();
          }
          switch (msg.what) {
            case QH_OK:
              buildView();
              break;
            case QH_EMPTY:
              doAlert(null, "Server gave an unexpected response (no signon acknowledgement?)");
              break;
            case QH_ERR_OFX:
              {
                OfxError e = (OfxError) msg.obj;
                switch (e.getErrorCode()) {
                    // case StatusResponse.STATUS_ERROR: // General error (ERROR)
                    // case StatusResponse.STATUS_MFA_REQUIRED: // User credentials are correct, but
                    // further authentication required (ERROR)
                    // case StatusResponse.STATUS_MFA_INVALID: // MFACHALLENGEA contains invalid
                    // information (ERROR)
                  case StatusResponse
                      .STATUS_FI_INVALID: // <FI> Missing or Invalid in <SONRQ> (ERROR)
                    doAlert(e, "Server is rejecting connection details (FI_ID or FI_ORG)");
                    break;
                    // case StatusResponse.STATUS_PINCH_NEEDED: // Must change USERPASS (INFO)
                  case StatusResponse
                      .STATUS_AUTHTOKEN_REQUIRED: // OFX server requires AUTHTOKEN in signon during
                                                  // the next session (ERROR)
                  case StatusResponse
                      .STATUS_BAD_LOGIN: // Signon invalid (see section 2.5.1) (ERROR)
                  case StatusResponse.STATUS_AUTHTOKEN_INVALID: // AUTHTOKEN invalid (ERROR)
                    loginFailure();
                    break;
                  case StatusResponse.STATUS_ACCT_BUSY: // Customer account already in use (ERROR)
                    doAlert(e, "Your account is currently in use");
                    break;
                  case StatusResponse.STATUS_ACCT_LOCKED: // USERPASS Lockout (ERROR)
                    doAlert(e, "Your account has been locked");
                    break;
                    // case StatusResponse.STATUS_EMPTY_REQUEST: // Empty signon transaction not
                    // supported (ERROR)
                    // case StatusResponse.STATUS_PINCH_REQUIRED: // Signon invalid without
                    // supporting pin change request (ERROR)
                    // case StatusResponse.STATUS_CLIENTUID_REJECTED: // CLIENTUID error (ERROR)
                  case StatusResponse
                      .STATUS_CALL_US: // User should contact financial institution (ERROR)
                    doAlert(e, "Please contact your financial institution");
                    break;
                  default:
                    doAlert(e, "Server refused the login");
                    break;
                }
              }

            case QH_ERR_HTTP:
            case QH_ERR_TIMEOUT:
            case QH_ERR_CONN:
            case QH_ERR_SSL:
              doRetryableAlert((Exception) msg.obj, "Unable to connect to server");
              break;

            default:
              doAlert((Exception) msg.obj, OfxProfile.exceptionComment((Exception) msg.obj));
              break;
          }
        }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   if (this.session != null) outState.putInt("sess_id", this.session.ID);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 }
 @Override
 public void onDestroy() {
   dbQuery.closeDB();
   super.onDestroy();
 }
  public static Dialog createSsidFilterDialog(final Activity activity, final String prefix) {
    final Dialog dialog = new Dialog(activity);

    dialog.setContentView(R.layout.filterdialog);
    dialog.setTitle("SSID Filter");

    ListActivity.info("make new dialog");
    final SharedPreferences prefs = activity.getSharedPreferences(ListActivity.SHARED_PREFS, 0);
    final EditText regex = (EditText) dialog.findViewById(R.id.edit_regex);
    regex.setText(prefs.getString(prefix + ListActivity.PREF_MAPF_REGEX, ""));

    final CheckBox invert =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.showinvert, prefix + ListActivity.PREF_MAPF_INVERT, false);
    final CheckBox open =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.showopen, prefix + ListActivity.PREF_MAPF_OPEN, true);
    final CheckBox wep =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.showwep, prefix + ListActivity.PREF_MAPF_WEP, true);
    final CheckBox wpa =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.showwpa, prefix + ListActivity.PREF_MAPF_WPA, true);
    final CheckBox cell =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.showcell, prefix + ListActivity.PREF_MAPF_CELL, true);
    final CheckBox enabled =
        MainActivity.prefSetCheckBox(
            activity, dialog, R.id.enabled, prefix + ListActivity.PREF_MAPF_ENABLED, true);

    Button ok = (Button) dialog.findViewById(R.id.ok_button);
    ok.setOnClickListener(
        new OnClickListener() {
          public void onClick(final View buttonView) {
            try {
              final Editor editor = prefs.edit();
              editor.putString(prefix + ListActivity.PREF_MAPF_REGEX, regex.getText().toString());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_INVERT, invert.isChecked());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_OPEN, open.isChecked());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_WEP, wep.isChecked());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_WPA, wpa.isChecked());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_CELL, cell.isChecked());
              editor.putBoolean(prefix + ListActivity.PREF_MAPF_ENABLED, enabled.isChecked());
              editor.commit();
              dialog.dismiss();
            } catch (Exception ex) {
              // guess it wasn't there anyways
              ListActivity.info("exception dismissing filter dialog: " + ex);
            }
          }
        });

    Button cancel = (Button) dialog.findViewById(R.id.cancel_button);
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(final View buttonView) {
            try {
              regex.setText(prefs.getString(prefix + ListActivity.PREF_MAPF_REGEX, ""));
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.showinvert, prefix + ListActivity.PREF_MAPF_INVERT, false);
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.showopen, prefix + ListActivity.PREF_MAPF_OPEN, true);
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.showwep, prefix + ListActivity.PREF_MAPF_WEP, true);
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.showwpa, prefix + ListActivity.PREF_MAPF_WPA, true);
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.showcell, prefix + ListActivity.PREF_MAPF_CELL, true);
              MainActivity.prefSetCheckBox(
                  activity, dialog, R.id.enabled, prefix + ListActivity.PREF_MAPF_ENABLED, true);

              dialog.dismiss();
            } catch (Exception ex) {
              // guess it wasn't there anyways
              ListActivity.info("exception dismissing filter dialog: " + ex);
            }
          }
        });

    return dialog;
  }
 @Override
 public void onCreate(Bundle state) {
   super.onCreate(state);
   setContentView(R.layout.file_browser);
   setTitle("MidiSheetMusic: Browse Files");
 }