Skip to content
This repository was archived by the owner on May 20, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea
.DS_Store
/build
/captures
/app/build
#/gradle
#gradlew.bat
#gradlew
*.iml
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void onResult(Barcode barcode) {
result.setText(barcode.rawValue);
}
})
.withFlashModeVisible(false)
.build();
materialBarcodeScanner.startScan();
}
Expand Down
2 changes: 1 addition & 1 deletion materialbarcodescanner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ dependencies {
testCompile 'junit:junit:4.12'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.android.gms:play-services-vision:8.4.0'
compile 'com.google.android.gms:play-services-vision:9.0.0'
compile 'com.android.support:design:23.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public void onClick(View v) {
if(mMaterialBarcodeScannerBuilder.isFlashEnabledByDefault()){
flashToggleIcon.setBackgroundResource(R.drawable.ic_flash_off_white_24dp);
}
if(!mMaterialBarcodeScannerBuilder.isFlashModeEnabled()){//for hiding flash
flashOnButton.setVisibility(View.GONE);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class MaterialBarcodeScannerBuilder {
protected int mTrackerResourceID = R.drawable.material_barcode_square_512;
protected int mTrackerDetectedResourceID = R.drawable.material_barcode_square_512_green;

private boolean mFlashModeEnabled = true;

/**
* Default constructor
*/
Expand Down Expand Up @@ -326,4 +328,20 @@ public int getScannerMode() {
public void clean() {
mActivity = null;
}

/**
* used for hiding or showing flash button on the camera
*/
public MaterialBarcodeScannerBuilder withFlashModeVisible(boolean enabled){
mFlashModeEnabled = enabled;
return this;
}

/**
* Get the flash enabled by default value associated with this builder
* @return
*/
public boolean isFlashModeEnabled() {
return mFlashModeEnabled;
}
}