Call to the camera autofocus checker in the view

This commit is contained in:
jif 2018-03-01 18:40:30 +01:00
parent b419b78c94
commit 6d1fc68ff1
2 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.localrepo.SwapService; import org.fdroid.fdroid.localrepo.SwapService;
import org.fdroid.fdroid.net.WifiStateChangeService; import org.fdroid.fdroid.net.WifiStateChangeService;
import org.fdroid.fdroid.views.swap.device.camera.CameraCharacteristicsChecker;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
@ -63,6 +64,7 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
protected void onFinishInflate() { protected void onFinishInflate() {
super.onFinishInflate(); super.onFinishInflate();
setUIFromWifi(); setUIFromWifi();
setUpWarningMessageQrScan();
ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code); ImageView qrImage = (ImageView) findViewById(R.id.wifi_qr_code);
@ -81,6 +83,14 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner
onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST)); onWifiStateChanged, new IntentFilter(WifiStateChangeService.BROADCAST));
} }
private void setUpWarningMessageQrScan() {
final View qrWarnningMessage = findViewById(R.id.warning_qr_scanner);
final boolean hasAutofocus = CameraCharacteristicsChecker.getInstance(getContext()).hasAutofocus();
final int visiblity = hasAutofocus ? GONE : VISIBLE;
qrWarnningMessage.setVisibility(visiblity);
}
/** /**
* Remove relevant listeners/receivers/etc so that they do not receive and process events * Remove relevant listeners/receivers/etc so that they do not receive and process events
* when this view is not in use. * when this view is not in use.

View File

@ -44,6 +44,14 @@
android:layout_gravity="center" android:layout_gravity="center"
android:id="@+id/btn_qr_scanner"/> android:id="@+id/btn_qr_scanner"/>
<TextView
android:id="@+id/warning_qr_scanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/warning_scaning_qr_code"
android:visibility="gone"
style="@style/SwapTheme.Wizard.QRScanWarningText"/>
</LinearLayout> </LinearLayout>
</org.fdroid.fdroid.views.swap.WifiQrView> </org.fdroid.fdroid.views.swap.WifiQrView>