diff --git a/src/main/java/com/nutomic/syncthingandroid/gui/MainActivity.java b/src/main/java/com/nutomic/syncthingandroid/gui/MainActivity.java index 12683e0d..e90c5bd7 100644 --- a/src/main/java/com/nutomic/syncthingandroid/gui/MainActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/gui/MainActivity.java @@ -214,7 +214,8 @@ public class MainActivity extends ActionBarActivity @Override public boolean onOptionsItemSelected(MenuItem item) { - if (mLocalNodeInfoFragment.onOptionsItemSelected(item)) { + if (mLocalNodeInfoFragment.onOptionsItemSelected(item) || + mDrawerToggle.onOptionsItemSelected(item)) { return true; } @@ -238,7 +239,6 @@ public class MainActivity extends ActionBarActivity @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); - // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java index 655f2ff5..e1976d30 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/RestApi.java @@ -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). */ public String readableTransferRate(long bytes) { - bytes *= 8; + long bits = bytes * 8; final String[] units = mContext.getResources().getStringArray(R.array.transfer_rate_units); - if (bytes <= 0) return "0 " + units[0]; - int digitGroups = (int) (Math.log10(bytes)/Math.log10(1024)); + if (bits <= 0) return "0 " + units[0]; + int digitGroups = (int) (Math.log10(bits)/Math.log10(1024)); return new DecimalFormat("#,##0.#") - .format(bytes/Math.pow(1024, digitGroups)) + " " + units[digitGroups]; + .format(bits/Math.pow(1024, digitGroups)) + " " + units[digitGroups]; } /**