Skip to content

Commit

Permalink
Reduce Toast Length
Browse files Browse the repository at this point in the history
Changed the toast to the msgShort method which uses a shorter timer for the toast
events, meaning toasts displayed by the application will be visible for a shorter
period.
  • Loading branch information
xLaMbChOpSx committed Jun 28, 2014
1 parent 4049b1b commit a0135bd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/SecUpwN/AIMSICD/AIMSICD.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.update_opencelldata:
Location loc = mAimsicdService.lastKnownLocation();
if (loc != null && loc.hasAccuracy()) {
Helpers.sendMsg(mContext, "Contacting OpenCellID.org for data...");
Helpers.msgShort(mContext, "Contacting OpenCellID.org for data...");
Helpers.getOpenCellData(mContext, loc.getLatitude(), loc.getLongitude(),
RequestTask.OPEN_CELL_ID_REQUEST);
} else {
Helpers.sendMsg(mContext,
Helpers.msgShort(mContext,
"Unable to determine your last location. \nEnable Location Services and try again.");
}
return true;
Expand Down
13 changes: 6 additions & 7 deletions app/src/main/java/com/SecUpwN/AIMSICD/activities/MapViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public View getInfoContents(Marker arg0) {
}
});
} else {
Helpers.sendMsg(this, "Unable to create map!");
Helpers.msgShort(this, "Unable to create map!");
}
}
}
Expand Down Expand Up @@ -288,15 +288,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.get_opencellid: {
Location lastKnown = mAimsicdService.mDevice.getLastLocation();
if (lastKnown != null) {
Helpers.sendMsg(this, "Contacting OpenCellID.org for data...");
Helpers.msgShort(this, "Contacting OpenCellID.org for data...");
Helpers.getOpenCellData(mContext, lastKnown.getLatitude(),
lastKnown.getLongitude(), RequestTask.OPEN_CELL_ID_REQUEST_FROM_MAP);
} else if (loc != null) {
Helpers.sendMsg(this, "Contacting OpenCellID.org for data...");
Helpers.msgShort(this, "Contacting OpenCellID.org for data...");
Helpers.getOpenCellData(mContext, loc.latitude, loc.longitude,
RequestTask.OPEN_CELL_ID_REQUEST_FROM_MAP);
} else {
Helpers.sendMsg(mContext,
Helpers.msgShort(mContext,
"Unable to determine your last location. \nEnable Location Services and try again.");
}
return true;
Expand Down Expand Up @@ -406,9 +406,8 @@ private void loadEntries() {
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(POSITION));
} else {
// Try and find last known location and zoom there
Location lastLoc = mAimsicdService.mDevice.getLastLocation();
if (lastLoc != null && (lastLoc.getLatitude() != 0.0
&& lastLoc.getLongitude() != 0.0)) {
Location lastLoc = mAimsicdService.lastKnownLocation();
if (lastLoc != null && lastLoc.hasAccuracy()) {
loc = new LatLng(lastLoc.getLatitude(), lastLoc.getLongitude());
CameraPosition POSITION =
new CameraPosition.Builder().target(loc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void onResume() {
//Refresh display if preference is not set to manual
if (AimsicdService.REFRESH_RATE != 0) {
timerHandler.postDelayed(timerRunnable, 0);
Helpers.sendMsg(mContext, "Refreshing every "
Helpers.msgShort(mContext, "Refreshing every "
+ TimeUnit.MILLISECONDS.toSeconds(AimsicdService.REFRESH_RATE) + " seconds");
}
}
Expand Down Expand Up @@ -150,7 +150,7 @@ private class btnClick implements View.OnClickListener {

@Override
public void onClick(View v) {
Helpers.sendMsg(mContext, "Refreshing now...");
Helpers.msgShort(mContext, "Refreshing now...");
updateUI();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void BuildTable(Cursor tableData) {
lv.setVisibility(View.VISIBLE);
} else {
lv.setVisibility(View.GONE);
Helpers.sendMsg(mContext, "Table contains no data to display");
Helpers.msgShort(mContext, "Table contains no data to display");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ public void startTrackingFemto() {

/* Check if it is a CDMA phone */
if (mDevice.getPhoneID() != TelephonyManager.PHONE_TYPE_CDMA) {
Helpers.sendMsg(this, "AIMSICD can only detect Femtocell connections on CDMA devices.");
Helpers.msgShort(this, "AIMSICD can only detect Femtocell connections on CDMA devices.");
return;
}

Expand Down Expand Up @@ -1053,7 +1053,7 @@ public void stopTrackingFemto() {
private void getServiceStateInfo(ServiceState s) {
if (s != null) {
if (IsConnectedToCdmaFemto(s)) {
Helpers.sendMsg(this, "ALERT!! Femtocell Connection Detected!!");
Helpers.msgShort(this, "ALERT!! Femtocell Connection Detected!!");
mFemtoDetected = true;
setNotification();
//toggleRadio();
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/com/SecUpwN/AIMSICD/utils/RequestTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ protected void onPostExecute(String result) {
if (result != null && result.equals("Successful")) {
mDbAdapter.open();
if (mDbAdapter.updateOpenCellID()) {
Helpers.sendMsg(mContext, "OpenCellID data successfully received");
Helpers.msgShort(mContext, "OpenCellID data successfully received");
}
mDbAdapter.close();
} else {
Helpers.sendMsg(mContext, "Error retrieving OpenCellID data");
Helpers.msgShort(mContext, "Error retrieving OpenCellID data");
}
break;
case OPEN_CELL_ID_REQUEST_FROM_MAP:
Expand All @@ -146,19 +146,19 @@ protected void onPostExecute(String result) {
if (mDbAdapter.updateOpenCellID()) {
Intent intent = new Intent(MapViewer.updateOpenCellIDMarkers);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
Helpers.sendMsg(mContext, "OpenCellID data successfully received and "
Helpers.msgShort(mContext, "OpenCellID data successfully received and "
+ "Map Markers updated");
mDbAdapter.close();
}
} else {
Helpers.sendMsg(mContext, "Error retrieving OpenCellID data");
Helpers.msgShort(mContext, "Error retrieving OpenCellID data");
}
break;
case RESTORE_DATABASE:
if (result != null && result.equals("Successful")) {
Helpers.sendMsg(mContext, "Restore database completed successfully");
Helpers.msgShort(mContext, "Restore database completed successfully");
} else {
Helpers.sendMsg(mContext, "Error restoring database");
Helpers.msgShort(mContext, "Error restoring database");
}
break;
case BACKUP_DATABASE:
Expand All @@ -169,7 +169,7 @@ protected void onPostExecute(String result) {
+ AIMSICDDbAdapter.FOLDER);
builder.create().show();
} else {
Helpers.sendMsg(mContext, "Error backing up database");
Helpers.msgShort(mContext, "Error backing up database");
}
}
}
Expand Down

0 comments on commit a0135bd

Please sign in to comment.