Merge pull request #111 from tonyyang924/code_tuning

replace hardcode to constant
master
Florent CHAMPIGNY 5 years ago committed by GitHub
commit 464a8f0cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivity.java
  2. 2
      app/src/main/java/com/github/florent37/camerafragment/sample/CameraFragmentMainActivityCustoms.java
  3. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/internal/ui/BaseAnncaFragment.java
  4. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSettingsView.java
  5. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/CameraSwitchView.java
  6. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/FlashSwitchView.java
  7. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/MediaActionSwitchView.java
  8. 2
      camerafragment/src/main/java/com/github/florent37/camerafragment/widgets/RecordButton.java

@ -123,7 +123,7 @@ public class CameraFragmentMainActivity extends AppCompatActivity {
@OnClick(R.id.addCameraButton) @OnClick(R.id.addCameraButton)
public void onAddCameraClicked() { public void onAddCameraClicked() {
if (Build.VERSION.SDK_INT > 15) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
final String[] permissions = { final String[] permissions = {
Manifest.permission.CAMERA, Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO, Manifest.permission.RECORD_AUDIO,

@ -214,7 +214,7 @@ public class CameraFragmentMainActivityCustoms extends AppCompatActivity {
@OnClick(R.id.addCameraButton) @OnClick(R.id.addCameraButton)
public void onAddCameraClicked(){ public void onAddCameraClicked(){
if (Build.VERSION.SDK_INT > 15) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
final String[] permissions = { final String[] permissions = {
Manifest.permission.CAMERA, Manifest.permission.CAMERA,
Manifest.permission.RECORD_AUDIO, Manifest.permission.RECORD_AUDIO,

@ -569,7 +569,7 @@ public abstract class BaseAnncaFragment<CameraId> extends Fragment implements Ca
} }
protected void rotateSettingsDialog(int degrees) { 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(); ViewGroup dialogView = (ViewGroup) settingsDialog.getWindow().getDecorView();
for (int i = 0; i < dialogView.getChildCount(); i++) { for (int i = 0; i < dialogView.getChildCount(); i++) {
dialogView.getChildAt(i).setRotation(degrees); dialogView.getChildAt(i).setRotation(degrees);

@ -35,7 +35,7 @@ public class CameraSettingsView extends android.support.v7.widget.AppCompatImage
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
super.setEnabled(enabled); super.setEnabled(enabled);
if (Build.VERSION.SDK_INT > 10) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
if (enabled) { if (enabled) {
setAlpha(1f); setAlpha(1f);
} else { } else {

@ -66,7 +66,7 @@ public class CameraSwitchView extends AppCompatImageButton {
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
super.setEnabled(enabled); super.setEnabled(enabled);
if (Build.VERSION.SDK_INT > 10) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
if (enabled) { if (enabled) {
setAlpha(1f); setAlpha(1f);
} else { } else {

@ -53,7 +53,7 @@ public class FlashSwitchView extends android.support.v7.widget.AppCompatImageBut
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
super.setEnabled(enabled); super.setEnabled(enabled);
if (Build.VERSION.SDK_INT > 10) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
if (enabled) { if (enabled) {
setAlpha(1f); setAlpha(1f);
} else { } else {

@ -86,7 +86,7 @@ public class MediaActionSwitchView extends android.support.v7.widget.AppCompatIm
@Override @Override
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
super.setEnabled(enabled); super.setEnabled(enabled);
if (Build.VERSION.SDK_INT > 10) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
if (enabled) { if (enabled) {
setAlpha(1f); setAlpha(1f);
} else { } else {

@ -45,7 +45,7 @@ public class RecordButton extends android.support.v7.widget.AppCompatImageButton
startRecordDrawable = ContextCompat.getDrawable(context, R.drawable.start_video_record_button); startRecordDrawable = ContextCompat.getDrawable(context, R.drawable.start_video_record_button);
stopRecordDrawable = ContextCompat.getDrawable(context, R.drawable.stop_button_background); 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)); setBackground(ContextCompat.getDrawable(context, R.drawable.circle_frame_background));
else else
setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.circle_frame_background)); setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.circle_frame_background));

Loading…
Cancel
Save