1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-10 20:15:54 +00:00

Fix app icon to open info drawer, code cleanup.

This commit is contained in:
Felix Ableitner 2014-06-08 03:20:06 +02:00
parent af397b0027
commit 8e8de14ef5
2 changed files with 6 additions and 6 deletions

View file

@ -214,7 +214,8 @@ public class MainActivity extends ActionBarActivity
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (mLocalNodeInfoFragment.onOptionsItemSelected(item)) { if (mLocalNodeInfoFragment.onOptionsItemSelected(item) ||
mDrawerToggle.onOptionsItemSelected(item)) {
return true; return true;
} }
@ -238,7 +239,6 @@ public class MainActivity extends ActionBarActivity
@Override @Override
protected void onPostCreate(Bundle savedInstanceState) { protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState); super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState(); mDrawerToggle.syncState();
} }

View file

@ -432,12 +432,12 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener {
* Converts a number of bytes to a human readable transfer rate in bits (eg 100 Kb/s). * Converts a number of bytes to a human readable transfer rate in bits (eg 100 Kb/s).
*/ */
public String readableTransferRate(long bytes) { public String readableTransferRate(long bytes) {
bytes *= 8; long bits = bytes * 8;
final String[] units = mContext.getResources().getStringArray(R.array.transfer_rate_units); final String[] units = mContext.getResources().getStringArray(R.array.transfer_rate_units);
if (bytes <= 0) return "0 " + units[0]; if (bits <= 0) return "0 " + units[0];
int digitGroups = (int) (Math.log10(bytes)/Math.log10(1024)); int digitGroups = (int) (Math.log10(bits)/Math.log10(1024));
return new DecimalFormat("#,##0.#") return new DecimalFormat("#,##0.#")
.format(bytes/Math.pow(1024, digitGroups)) + " " + units[digitGroups]; .format(bits/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
} }
/** /**