Search in sources :

Example 1 with InjectionAppCompatActivity

use of io.freefair.android.injection.app.InjectionAppCompatActivity in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class MapFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch(item.getItemId()) {
        case R.id.map_preferences:
            Intent intent = new Intent(getActivity(), MapPrefActivity.class);
            startActivity(intent);
            return true;
        case R.id.get_opencellid:
            {
                if (mBound) {
                    GeoLocation lastKnown = mAimsicdService.lastKnownLocation();
                    if (lastKnown != null) {
                        Helpers.msgLong(getActivity(), getString(R.string.contacting_opencellid_for_data));
                        Cell cell;
                        cell = mAimsicdService.getCell();
                        cell.setLon(lastKnown.getLongitudeInDegrees());
                        cell.setLat(lastKnown.getLatitudeInDegrees());
                        setRefreshActionButtonState(true);
                        TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, false);
                        Helpers.getOpenCellData((InjectionAppCompatActivity) getActivity(), cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP, mAimsicdService);
                        return true;
                    }
                }
                if (mLatestCellLoc != null) {
                    Helpers.msgLong(getActivity(), getString(R.string.contacting_opencellid_for_data));
                    Cell cell = new Cell();
                    cell.setLat(mLatestCellLoc.getLatitude());
                    cell.setLon(mLatestCellLoc.getLongitude());
                    setRefreshActionButtonState(true);
                    TinyDB.getInstance().putBoolean(TinyDbKeys.FINISHED_LOAD_IN_MAP, false);
                    Helpers.getOpenCellData((InjectionAppCompatActivity) getActivity(), cell, RequestTask.DBE_DOWNLOAD_REQUEST_FROM_MAP, mAimsicdService);
                } else {
                    Helpers.msgLong(getActivity(), getString(R.string.unable_to_determine_last_location));
                }
                return true;
            }
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : Intent(android.content.Intent) InjectionAppCompatActivity(io.freefair.android.injection.app.InjectionAppCompatActivity) GeoLocation(com.secupwn.aimsicd.utils.GeoLocation) Cell(com.secupwn.aimsicd.utils.Cell)

Aggregations

Intent (android.content.Intent)1 Cell (com.secupwn.aimsicd.utils.Cell)1 GeoLocation (com.secupwn.aimsicd.utils.GeoLocation)1 InjectionAppCompatActivity (io.freefair.android.injection.app.InjectionAppCompatActivity)1