Example usage for android.content Intent getBooleanExtra

List of usage examples for android.content Intent getBooleanExtra

Introduction

In this page you can find the example usage for android.content Intent getBooleanExtra.

Prototype

public boolean getBooleanExtra(String name, boolean defaultValue) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:at.ac.tuwien.detlef.activities.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    Log.d(TAG, String.format("onActivityResult(%d, %d, %s)", requestCode, resultCode, data));

    if (data == null) {
        return;/*from  w  w w. j a  va2s .co m*/
    }

    if (data.getBooleanExtra(EXTRA_REFRESH_FEED_LIST, false)
            || data.getBooleanExtra(PODCAST_ADD_REFRESH_FEED_LIST, false)) {

        if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = new Bundle();
            if (data.getBooleanExtra(PODCAST_ADD_REFRESH_FEED_LIST, false)) {
                bundle.putBoolean(PODCAST_ADD_REFRESH_FEED_LIST, true);
            } else {
                bundle.putBoolean(EXTRA_REFRESH_FEED_LIST, true);
            }
            onRefreshPressed(bundle);
        } else {
            if (data.getBooleanExtra(EXTRA_REFRESH_FEED_LIST, false)) {
                Toast.makeText(this, getString(R.string.you_can_refresh_your_podcasts_later), Toast.LENGTH_LONG)
                        .show();
            }
        }
    }

}

From source file:com.germainz.identiconizer.services.IdenticonCreationService.java

@Override
protected void onHandleIntent(Intent intent) {
    startForeground(SERVICE_NOTIFICATION_ID, createNotification());
    // If a predefined contacts list is provided, use it directly.
    // contactsList is set when this service is started from ContactsListActivity.
    if (intent.hasExtra("contactsList")) {
        ArrayList<ContactInfo> contactsList = intent.getParcelableArrayListExtra("contactsList");
        processContacts(contactsList);//from   w w w .  ja  va  2  s.c o  m
    } else {
        // If updateExisting is set to false, only contacts without a picture will get a new one.
        // Otherwise, even those that have an identicon set will get a new one. The latter is useful
        // when changing identicon styles, but is a waste of time when we're starting this service
        // after a new contact has been added. In that case, we just want the new contact to get his
        // identicon.
        boolean updateExisting = intent.getBooleanExtra("updateExisting", true);
        processContacts(updateExisting);
    }
    if (mUpdateErrors.size() > 0 || mInsertErrors.size() > 0)
        createNotificationForError();
    LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("CONTACTS_UPDATED"));
    getContentResolver().notifyChange(ContactsContract.Data.CONTENT_URI, null);
    stopForeground(true);
}

From source file:ch.blinkenlights.android.vanilla.LibraryActivity.java

/**
 * Called by LibraryAdapters when a row has been clicked.
 *
 * @param rowData The data for the row that was clicked.
 *//*from  w  w  w.  jav a 2s. co m*/
public void onItemClicked(Intent rowData) {
    int action = mDefaultAction;
    if (action == ACTION_LAST_USED)
        action = mLastAction;

    boolean tryExpand = action == ACTION_EXPAND || action == ACTION_EXPAND_OR_PLAY_ALL;
    if (tryExpand && rowData.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false)) {
        onItemExpanded(rowData);
    } else if (action != ACTION_DO_NOTHING) {
        if (action == ACTION_EXPAND) {
            // default to playing when trying to expand something that can't
            // be expanded
            action = ACTION_PLAY;
        } else if (action == ACTION_EXPAND_OR_PLAY_ALL) {
            action = ACTION_PLAY_ALL;
        } else if (action == ACTION_PLAY_OR_ENQUEUE) {
            action = (mState & PlaybackService.FLAG_PLAYING) == 0 ? ACTION_PLAY : ACTION_ENQUEUE;
        }
        pickSongs(rowData, action);
    }
}

From source file:com.hmsoft.weargoproremote.services.WearMessageHandlerService.java

@Override
public boolean handleMessage(Message msg) {
    Intent intent = (Intent) msg.obj;

    final String action = intent.getAction();
    final String message = intent.getStringExtra(EXTRA_MESSAGE);
    final byte[] data = intent.getByteArrayExtra(EXTRA_DATA);

    long startTime = System.currentTimeMillis();

    switch (action) {
    case ACTION_HANDLE_MESSAGE_FROM_WEAR:
        if (!mStopped)
            handleMessage(message, data);
        break;//  ww w  .j a va2 s .  c o  m
    case ACTION_SEND_MESSAGE_TO_WEAR:
        sendToWearable(message, data);
        break;
    case ACTION_STOP:
        boolean sendStopMsg = !intent.getBooleanExtra(EXTRA_DONT_SEND_STOP_TO_WEAR, false);
        if (sendStopMsg)
            sendToWearable(WearMessages.MESSAGE_STOP, null);
        handleMessage(WearMessages.MESSAGE_DISCONNECT, null);
        break;
    }

    if (BuildConfig.DEBUG) {
        long time = System.currentTimeMillis() - startTime;
        Logger.debug(TAG, "Message %s handled in %ds (%d)", message, time / 1000, time);
    }

    return true;
}

From source file:com.granita.tasks.notification.NotificationActionIntentService.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
@Override/*  w w  w . ja v a 2  s  .  com*/
protected void onHandleIntent(Intent intent) {
    mAuthority = getString(R.string.org_dmfs_tasks_authority);

    final String action = intent.getAction();
    final Context context = this;

    if (intent.hasExtra(EXTRA_NOTIFICATION_ID)) {
        Uri taskUri = intent.getData();
        int notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1);

        NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
        notificationManager.cancel(notificationId);

        if (ACTION_COMPLETE.equals(action)) {
            markCompleted(taskUri);

        } else if (intent.hasExtra(EXTRA_TASK_DUE) && intent.hasExtra(EXTRA_TIMEZONE)) {
            long due = intent.getLongExtra(EXTRA_TASK_DUE, -1);
            String tz = intent.getStringExtra(EXTRA_TIMEZONE);
            boolean allDay = intent.getBooleanExtra(EXTRA_ALLDAY, false);
            if (ACTION_DELAY_1H.equals(action)) {
                Time time = new Time(tz);
                time.set(due);
                time.allDay = false;
                time.hour++;
                time.normalize(true);
                delayTask(taskUri, time);
            } else if (ACTION_DELAY_1D.equals(action)) {
                if (tz == null) {
                    tz = "UTC";
                }
                Time time = new Time(tz);
                time.set(due);
                time.allDay = allDay;
                time.monthDay++;
                time.normalize(true);
                delayTask(taskUri, time);
            }

        }

    } else if (intent.hasExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION)) {

        /*
         * Grab the alarm from the intent. Since the remote AlarmManagerService fills in the Intent to add some extra data, it must unparcel the
         * NotificationAction object. It throws a ClassNotFoundException when unparcelling. To avoid this, do the marshalling ourselves.
         */
        final NotificationAction notificationAction;
        final byte[] data = intent.getByteArrayExtra(NotificationActionUtils.EXTRA_NOTIFICATION_ACTION);
        if (data != null) {
            final Parcel in = Parcel.obtain();
            in.unmarshall(data, 0, data.length);
            in.setDataPosition(0);
            notificationAction = NotificationAction.CREATOR.createFromParcel(in,
                    NotificationAction.class.getClassLoader());
        } else {
            return;
        }

        if (NotificationActionUtils.ACTION_UNDO.equals(action)) {
            NotificationActionUtils.cancelUndoTimeout(context, notificationAction);
            NotificationActionUtils.cancelUndoNotification(context, notificationAction);
            resendNotification(notificationAction);
        } else if (ACTION_COMPLETE.equals(action)) {
            // All we need to do is switch to an Undo notification
            NotificationActionUtils.createUndoNotification(context, notificationAction);
            NotificationActionUtils.registerUndoTimeout(this, notificationAction);
        } else {
            if (NotificationActionUtils.ACTION_UNDO_TIMEOUT.equals(action)
                    || NotificationActionUtils.ACTION_DESTRUCT.equals(action)) {
                // Process the action
                NotificationActionUtils.cancelUndoTimeout(this, notificationAction);
                NotificationActionUtils.processUndoNotification(this, notificationAction);
                processDesctructiveNotification(notificationAction);
            }
        }
    }

}

From source file:com.rickendirk.rsgwijzigingen.ZoekService.java

@Override
protected void onHandleIntent(Intent intent) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    boolean clusters_enabled = sp.getBoolean("pref_cluster_enabled", true);
    boolean alleenBijWifi = sp.getBoolean("pref_auto_zoek_wifi", false);
    boolean isAchtergrond = intent.getBooleanExtra("isAchtergrond", false);
    if (alleenBijWifi && isAchtergrond) {
        ConnectivityManager conManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo nwInfo = conManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        if (!nwInfo.isConnectedOrConnecting()) {
            //Later weer proberen: nu geen wifi
            setAlarmIn20Min();/*  ww  w.j a v  a 2  s. c om*/
            return;
        }
    }
    Wijzigingen wijzigingen = checkerNieuw(clusters_enabled);
    //Tracken dat er is gezocht
    OwnApplication application = (OwnApplication) getApplication();
    Tracker tracker = application.getDefaultTracker();

    if (isAchtergrond) {
        tracker.send(
                new HitBuilders.EventBuilder().setCategory("Acties").setAction("Zoeken_achtergrond").build());
        sendNotification(wijzigingen);
    } else {
        tracker.send(
                new HitBuilders.EventBuilder().setCategory("Acties").setAction("Zoeken_voorgrond").build());
        boolean isFoutMelding = wijzigingen.isFoutmelding();
        if (!isFoutMelding)
            wijzigingen.saveToSP(this);
        broadcastResult(wijzigingen, clusters_enabled);
    }
}

From source file:cd.education.data.collector.android.activities.GeoPointMapActivity.java

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

    if (savedInstanceState != null) {
        mLocationCount = savedInstanceState.getInt(LOCATION_COUNT);
    }/*  ww w. j a v  a2s.  c  o  m*/

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.geopoint_layout);

    Intent intent = getIntent();

    mLocationAccuracy = GeoPointWidget.DEFAULT_LOCATION_ACCURACY;
    if (intent != null && intent.getExtras() != null) {
        if (intent.hasExtra(GeoPointWidget.LOCATION)) {
            double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION);
            mLatLng = new LatLng(location[0], location[1]);
        }
        if (intent.hasExtra(GeoPointWidget.ACCURACY_THRESHOLD)) {
            mLocationAccuracy = intent.getDoubleExtra(GeoPointWidget.ACCURACY_THRESHOLD,
                    GeoPointWidget.DEFAULT_LOCATION_ACCURACY);
        }
        mCaptureLocation = !intent.getBooleanExtra(GeoPointWidget.READ_ONLY, false);
        mRefreshLocation = mCaptureLocation;
    }

    /* Set up the map and the marker */
    mMarkerOption = new MarkerOptions();
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    mMap.setOnMarkerDragListener(this);

    mLocationStatus = (TextView) findViewById(R.id.location_status);

    /*Zoom only if there's a previous location*/
    if (mLatLng != null) {
        mLocationStatus.setVisibility(View.GONE);
        mMarkerOption.position(mLatLng);
        mMarker = mMap.addMarker(mMarkerOption);
        mRefreshLocation = false; // just show this position; don't change it...
        mMarker.setDraggable(mCaptureLocation);
        mZoomed = true;
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mLatLng, 16));
    }

    mCancelLocation = (Button) findViewById(R.id.cancel_location);
    mCancelLocation.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Collect.getInstance().getActivityLogger().logInstanceAction(this, "cancelLocation", "cancel");
            finish();
        }
    });

    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    // make sure we have a good location provider before continuing
    List<String> providers = mLocationManager.getProviders(true);
    for (String provider : providers) {
        if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) {
            mGPSOn = true;
        }
        if (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER)) {
            mNetworkOn = true;
        }
    }
    if (!mGPSOn && !mNetworkOn) {
        Toast.makeText(getBaseContext(), getString(R.string.provider_disabled_error), Toast.LENGTH_SHORT)
                .show();
        finish();
    }

    if (mGPSOn) {
        Location loc = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (loc != null) {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(GPS) lat: " + loc.getLatitude() + " long: " + loc.getLongitude()
                    + " acc: " + loc.getAccuracy());
        } else {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(GPS) null location");
        }
    }

    if (mNetworkOn) {
        Location loc = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
        if (loc != null) {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(Network) lat: " + loc.getLatitude() + " long: " + loc.getLongitude()
                    + " acc: " + loc.getAccuracy());
        } else {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(Network) null location");
        }
    }

    mAcceptLocation = (Button) findViewById(R.id.accept_location);
    if (mCaptureLocation) {
        mAcceptLocation.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Collect.getInstance().getActivityLogger().logInstanceAction(this, "acceptLocation", "OK");
                returnLocation();
            }
        });
        mMap.setOnMapLongClickListener(this);
    } else {
        mAcceptLocation.setVisibility(View.GONE);
    }

    mReloadLocation = (Button) findViewById(R.id.reload_location);
    if (mCaptureLocation) {
        mReloadLocation.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mRefreshLocation = true;
                mReloadLocation.setVisibility(View.GONE);
                mLocationStatus.setVisibility(View.VISIBLE);
                if (mGPSOn) {
                    mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                            GeoPointMapActivity.this);
                }
                if (mNetworkOn) {
                    mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,
                            GeoPointMapActivity.this);
                }
            }

        });
        mReloadLocation.setVisibility(!mRefreshLocation ? View.VISIBLE : View.GONE);
    } else {
        mReloadLocation.setVisibility(View.GONE);
    }

    // Focuses on marked location
    mShowLocation = ((Button) findViewById(R.id.show_location));
    mShowLocation.setVisibility(View.VISIBLE);
    mShowLocation.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Collect.getInstance().getActivityLogger().logInstanceAction(this, "showLocation", "onClick");
            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mLatLng, 16));
        }
    });
    mShowLocation.setClickable(mMarker != null);

}

From source file:com.mpower.clientcollection.activities.GeoPointMapActivity.java

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

    if (savedInstanceState != null) {
        mLocationCount = savedInstanceState.getInt(LOCATION_COUNT);
    }//from w w  w . j av  a 2s  .  co  m

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.geopoint_layout);

    Intent intent = getIntent();

    mLocationAccuracy = GeoPointWidget.DEFAULT_LOCATION_ACCURACY;
    if (intent != null && intent.getExtras() != null) {
        if (intent.hasExtra(GeoPointWidget.LOCATION)) {
            double[] location = intent.getDoubleArrayExtra(GeoPointWidget.LOCATION);
            mLatLng = new LatLng(location[0], location[1]);
        }
        if (intent.hasExtra(GeoPointWidget.ACCURACY_THRESHOLD)) {
            mLocationAccuracy = intent.getDoubleExtra(GeoPointWidget.ACCURACY_THRESHOLD,
                    GeoPointWidget.DEFAULT_LOCATION_ACCURACY);
        }
        mCaptureLocation = !intent.getBooleanExtra(GeoPointWidget.READ_ONLY, false);
        mRefreshLocation = mCaptureLocation;
    }

    /* Set up the map and the marker */
    mMarkerOption = new MarkerOptions();
    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    mMap.setOnMarkerDragListener(this);

    mLocationStatus = (TextView) findViewById(R.id.location_status);

    /*Zoom only if there's a previous location*/
    if (mLatLng != null) {
        mLocationStatus.setVisibility(View.GONE);
        mMarkerOption.position(mLatLng);
        mMarker = mMap.addMarker(mMarkerOption);
        mRefreshLocation = false; // just show this position; don't change it...
        mMarker.setDraggable(mCaptureLocation);
        mZoomed = true;
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mLatLng, 16));
    }

    mCancelLocation = (Button) findViewById(R.id.cancel_location);
    mCancelLocation.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            ClientCollection.getInstance().getActivityLogger().logInstanceAction(this, "cancelLocation",
                    "cancel");
            finish();
        }
    });

    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    // make sure we have a good location provider before continuing
    List<String> providers = mLocationManager.getProviders(true);
    for (String provider : providers) {
        if (provider.equalsIgnoreCase(LocationManager.GPS_PROVIDER)) {
            mGPSOn = true;
        }
        if (provider.equalsIgnoreCase(LocationManager.NETWORK_PROVIDER)) {
            mNetworkOn = true;
        }
    }
    if (!mGPSOn && !mNetworkOn) {
        Toast.makeText(getBaseContext(), getString(R.string.provider_disabled_error), Toast.LENGTH_SHORT)
                .show();
        finish();
    }

    if (mGPSOn) {
        Location loc = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (loc != null) {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(GPS) lat: " + loc.getLatitude() + " long: " + loc.getLongitude()
                    + " acc: " + loc.getAccuracy());
        } else {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(GPS) null location");
        }
    }

    if (mNetworkOn) {
        Location loc = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
        if (loc != null) {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(Network) lat: " + loc.getLatitude() + " long: " + loc.getLongitude()
                    + " acc: " + loc.getAccuracy());
        } else {
            InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis()
                    + " lastKnownLocation(Network) null location");
        }
    }

    mAcceptLocation = (Button) findViewById(R.id.accept_location);
    if (mCaptureLocation) {
        mAcceptLocation.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                ClientCollection.getInstance().getActivityLogger().logInstanceAction(this, "acceptLocation",
                        "OK");
                returnLocation();
            }
        });
        mMap.setOnMapLongClickListener(this);
    } else {
        mAcceptLocation.setVisibility(View.GONE);
    }

    mReloadLocation = (Button) findViewById(R.id.reload_location);
    if (mCaptureLocation) {
        mReloadLocation.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                mRefreshLocation = true;
                mReloadLocation.setVisibility(View.GONE);
                mLocationStatus.setVisibility(View.VISIBLE);
                if (mGPSOn) {
                    mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                            GeoPointMapActivity.this);
                }
                if (mNetworkOn) {
                    mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,
                            GeoPointMapActivity.this);
                }
            }

        });
        mReloadLocation.setVisibility(!mRefreshLocation ? View.VISIBLE : View.GONE);
    } else {
        mReloadLocation.setVisibility(View.GONE);
    }

    // Focuses on marked location
    mShowLocation = ((Button) findViewById(R.id.show_location));
    mShowLocation.setVisibility(View.VISIBLE);
    mShowLocation.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            ClientCollection.getInstance().getActivityLogger().logInstanceAction(this, "showLocation",
                    "onClick");
            mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mLatLng, 16));
        }
    });
    mShowLocation.setClickable(mMarker != null);

}

From source file:com.retroteam.studio.retrostudio.EditorLandscape.java

/**
 * How to handle a result when we come back from the measure.
 * @param requestCode/*from  w w  w  . ja  v  a 2 s  .c o m*/
 * @param resultCode
 * @param data
 */

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // Check which request we're responding to
    if (requestCode == 123) {
        // Make sure the request was successful
        if (resultCode == RESULT_OK) {
            //Uri thedata = data.getData();
            theproject = (Project) data.getSerializableExtra("Project");
            //redrawMe(theproject);
            updateMe(data.getBooleanExtra("HasNotes", false), data.getIntExtra("trackNum", 0),
                    data.getIntExtra("measureNum", 0), data.getIntExtra("guiSNAP", 0),
                    (ArrayList<int[]>) data.getSerializableExtra("filledNotes"));
        }
    }
}

From source file:key.secretkey.MainActivity.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        switch (requestCode) {
        //                case GitActivity.REQUEST_CLONE:
        //                    // if we get here with a RESULT_OK then it's probably OK :)
        //                    settings.edit().putBoolean("repository_initialized", true).apply();
        //                    break;
        case PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY:
            // if went from decrypt->edit and user saved changes, we need to commit
            if (data.getBooleanExtra("needCommit", false)) {
                //                        commit(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
                refreshListAdapter();/*w  w  w  .ja  v a2s. c om*/
            }
            break;
        case PgpHandler.REQUEST_CODE_ENCRYPT:
            //                    commit(this.getResources().getString(R.string.add_commit_text) + data.getExtras().getString("NAME") + this.getResources().getString(R.string.from_store));
            refreshListAdapter();
            break;
        case PgpHandler.REQUEST_CODE_EDIT:
            //                    commit(this.getResources().getString(R.string.edit_commit_text) + data.getExtras().getString("NAME"));
            refreshListAdapter();
            break;
        //                case GitActivity.REQUEST_INIT:
        //                    initializeRepositoryInfo();
        //                    break;
        //                case GitActivity.REQUEST_SYNC:
        //                case GitActivity.REQUEST_PULL:
        //                    updateListAdapter();
        //                    break;
        case HOME:
            checkLocalRepository();
            break;
        //                case NEW_REPO_BUTTON:
        //                    initializeRepositoryInfo();
        //                    break;
        //                case CLONE_REPO_BUTTON:
        //                    // duplicate code
        //                    if (settings.getBoolean("git_external", false) && settings.getString("git_external_repo", null) != null) {
        //                        String externalRepoPath = settings.getString("git_external_repo", null);
        //                        File dir = externalRepoPath != null ? new File(externalRepoPath) : null;
        //
        //                        if (dir != null &&
        //                                dir.exists() &&
        //                                dir.isDirectory() &&
        //                                !FileUtils.listFiles(dir, null, true).isEmpty() &&
        //                                !PasswordStorage.getPasswords(dir, PasswordStorage.getRepositoryDirectory(this)).isEmpty()) {
        //                            PasswordStorage.closeRepository();
        //                            checkLocalRepository();
        //                            return; // if not empty, just show me the passwords!
        //                        }
        //                    }
        //                    Intent intent = new Intent(activity, GitActivity.class);
        //                    intent.putExtra("Operation", GitActivity.REQUEST_CLONE);
        //                    startActivityForResult(intent, GitActivity.REQUEST_CLONE);
        //                    break;
        //                case PgpHandler.REQUEST_CODE_SELECT_FOLDER:
        //                    Log.d("Moving", "Moving passwords to " + data.getStringExtra("SELECTED_FOLDER_PATH"));
        //                    Log.d("Moving", TextUtils.join(", ", data.getStringArrayListExtra("Files")));
        //                    File target = new File(data.getStringExtra("SELECTED_FOLDER_PATH"));
        //                    if (!target.isDirectory()) {
        //                        Log.e("Moving", "Tried moving passwords to a non-existing folder.");
        //                        break;
        //                    }
        //
        //                    for (String string : data.getStringArrayListExtra("Files")) {
        //                        File source = new File(string);
        //                        if (!source.exists()) {
        //                            Log.e("Moving", "Tried moving something that appears non-existent.");
        //                            continue;
        //                        }
        //                        if (!source.renameTo(new File(target.getAbsolutePath() + "/" + source.getName()))) {
        //                            // TODO this should show a warning to the user
        //                            Log.e("Moving", "Something went wrong while moving.");
        //                        } else {
        //                            commit("[ANDROID PwdStore] Moved "
        //                                    + string.replace(PasswordStorage.getRepositoryDirectory(getApplicationContext()) + "/", "")
        //                                    + " to "
        //                                    + target.getAbsolutePath().replace(PasswordStorage.getRepositoryDirectory(getApplicationContext()) + "/", "")
        //                                    + target.getAbsolutePath() + "/" + source.getName() + ".");
        //                        }
        //                    }
        //                    updateListAdapter();
        //                    break;
        }
    }
}