From 6062f3f2ece900c00972f39a42bf0f6603ffbd47 Mon Sep 17 00:00:00 2001 From: Tony Yang Date: Thu, 15 Nov 2018 16:24:22 +0800 Subject: [PATCH] replace hardcode to constant --- .../camerafragment/sample/CameraFragmentMainActivity.java | 2 +- .../sample/CameraFragmentMainActivityCustoms.java | 2 +- .../florent37/camerafragment/internal/ui/BaseAnncaFragment.java | 2 +- .../florent37/camerafragment/widgets/CameraSettingsView.java | 2 +- .../florent37/camerafragment/widgets/CameraSwitchView.java | 2 +- .../florent37/camerafragment/widgets/FlashSwitchView.java | 2 +- .../florent37/camerafragment/widgets/MediaActionSwitchView.java | 2 +- .../github/florent37/camerafragment/widgets/RecordButton.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivity.java b/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivity.java index 8367e32..2564198 100644 --- a/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivity.java +++ b/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivity.java @@ -123,7 +123,7 @@ public class CameraFragmentMainActivity extends AppCompatActivity { @OnClick(R.id.addCameraButton) public void onAddCameraClicked() { - if (Build.VERSION.SDK_INT > 15) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { final String[] permissions = { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, diff --git a/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivityCustoms.java b/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivityCustoms.java index 5207898..5c9af9f 100644 --- a/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivityCustoms.java +++ b/app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivityCustoms.java @@ -214,7 +214,7 @@ public class CameraFragmentMainActivityCustoms extends AppCompatActivity { @OnClick(R.id.addCameraButton) public void onAddCameraClicked(){ - if (Build.VERSION.SDK_INT > 15) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { final String[] permissions = { Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java index ea5a016..e7a45e5 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java @@ -569,7 +569,7 @@ public abstract class BaseAnncaFragment extends Fragment implements Ca } protected void rotateSettingsDialog(int degrees) { - if (settingsDialog != null && settingsDialog.isShowing() && Build.VERSION.SDK_INT > 10) { + if (settingsDialog != null && settingsDialog.isShowing() && Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { ViewGroup dialogView = (ViewGroup) settingsDialog.getWindow().getDecorView(); for (int i = 0; i < dialogView.getChildCount(); i++) { dialogView.getChildAt(i).setRotation(degrees); diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSettingsView.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSettingsView.java index ae88b7d..5ea2dfd 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSettingsView.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSettingsView.java @@ -35,7 +35,7 @@ public class CameraSettingsView extends android.support.v7.widget.AppCompatImage public void setEnabled(boolean enabled) { super.setEnabled(enabled); - if (Build.VERSION.SDK_INT > 10) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { if (enabled) { setAlpha(1f); } else { diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSwitchView.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSwitchView.java index c043823..8853d88 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSwitchView.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSwitchView.java @@ -66,7 +66,7 @@ public class CameraSwitchView extends AppCompatImageButton { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); - if (Build.VERSION.SDK_INT > 10) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { if (enabled) { setAlpha(1f); } else { diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/FlashSwitchView.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/FlashSwitchView.java index e270979..ce64ab3 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/FlashSwitchView.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/FlashSwitchView.java @@ -53,7 +53,7 @@ public class FlashSwitchView extends android.support.v7.widget.AppCompatImageBut @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); - if (Build.VERSION.SDK_INT > 10) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { if (enabled) { setAlpha(1f); } else { diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/MediaActionSwitchView.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/MediaActionSwitchView.java index 3258f73..7516d30 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/MediaActionSwitchView.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/MediaActionSwitchView.java @@ -86,7 +86,7 @@ public class MediaActionSwitchView extends android.support.v7.widget.AppCompatIm @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); - if (Build.VERSION.SDK_INT > 10) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { if (enabled) { setAlpha(1f); } else { diff --git a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/RecordButton.java b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/RecordButton.java index 90e2e35..703437c 100644 --- a/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/RecordButton.java +++ b/camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/RecordButton.java @@ -45,7 +45,7 @@ public class RecordButton extends android.support.v7.widget.AppCompatImageButton startRecordDrawable = ContextCompat.getDrawable(context, R.drawable.start_video_record_button); stopRecordDrawable = ContextCompat.getDrawable(context, R.drawable.stop_button_background); - if (Build.VERSION.SDK_INT > 15) + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) setBackground(ContextCompat.getDrawable(context, R.drawable.circle_frame_background)); else setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.circle_frame_background));