use constants for the mpx values

This commit is contained in:
tibbi 2016-11-06 12:53:31 +01:00
parent 945b845a44
commit f634df285b
3 changed files with 13 additions and 8 deletions

View File

@ -64,9 +64,9 @@ public class Config {
private int getOldDefaultResolution() {
final int index = getMaxResolution();
switch (index) {
case 1: return 9000000;
case 1: return Constants.EIGHT_MPX;
case 2: return 0;
default: return 6000000;
default: return Constants.FIVE_MPX;
}
}

View File

@ -7,6 +7,10 @@ public class Constants {
public static final String TREE_URI = "tree_uri";
public static final int TWO_MPX = 3000000;
public static final int FIVE_MPX = 6000000;
public static final int EIGHT_MPX = 9000000;
// shared preferences
public static final String PREFS_KEY = "Camera";
public static final String IS_FIRST_RUN = "is_first_run";

View File

@ -10,6 +10,7 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.AdapterView
import com.simplemobiletools.camera.Constants
import com.simplemobiletools.camera.R
import com.simplemobiletools.camera.dialogs.WritePermissionDialog
import com.simplemobiletools.camera.extensions.needsStupidWritePermissions
@ -141,18 +142,18 @@ class SettingsActivity : SimpleActivity() {
private fun getMaxPhotoSelection(): Int {
val maxRes = mConfig.maxPhotoResolution
return when (maxRes) {
3000000 -> 0
6000000 -> 1
9000000 -> 2
Constants.TWO_MPX -> 0
Constants.FIVE_MPX -> 1
Constants.EIGHT_MPX -> 2
else -> 3
}
}
private fun getMaxPhotoPx(index: Int): Int {
return when (index) {
0 -> 3000000
1 -> 6000000
2 -> 9000000
0 -> Constants.TWO_MPX
1 -> Constants.FIVE_MPX
2 -> Constants.EIGHT_MPX
else -> 0
}
}