zxing requires >= android-8, only gen QR Codes on >= android-8
The zxing library includes some Java 7 features, so it will only work on Android SDK 8 (2.1) or above. FDroid supports SDK 7 (2.0), so on 7, do not try to generate QR Codes.
This commit is contained in:
		
							parent
							
								
									47d4526f05
								
							
						
					
					
						commit
						3c005006ce
					
				| @ -16,6 +16,8 @@ import com.google.zxing.WriterException; | ||||
| import com.google.zxing.encode.Contents; | ||||
| import com.google.zxing.encode.QRCodeEncoder; | ||||
| 
 | ||||
| // zxing is android-8 and above | ||||
| @TargetApi(8) | ||||
| public class QrGenAsyncTask extends AsyncTask<String, Void, Void> { | ||||
|     private static final String TAG = "QrGenAsyncTask"; | ||||
| 
 | ||||
|  | ||||
| @ -188,7 +188,8 @@ public class LocalRepoActivity extends Activity { | ||||
|                 .replaceAll("ssid=[^?]*", "") | ||||
|                 .toUpperCase(Locale.ENGLISH); | ||||
|         Log.i("QRURI", qrUriString); | ||||
|         new QrGenAsyncTask(this, R.id.repoQrCode).execute(qrUriString); | ||||
|         if (Build.VERSION.SDK_INT >= 8) // zxing requires >= 8 | ||||
|             new QrGenAsyncTask(this, R.id.repoQrCode).execute(qrUriString); | ||||
| 
 | ||||
|         TextView wifiNetworkNameTextView = (TextView) findViewById(R.id.wifiNetworkName); | ||||
|         wifiNetworkNameTextView.setText(FDroidApp.ssid); | ||||
|  | ||||
| @ -2,11 +2,8 @@ | ||||
| package org.fdroid.fdroid.views; | ||||
| 
 | ||||
| import android.app.Activity; | ||||
| import android.content.BroadcastReceiver; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.content.IntentFilter; | ||||
| import android.content.SharedPreferences; | ||||
| import android.content.*; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.preference.PreferenceManager; | ||||
| import android.support.v4.content.LocalBroadcastManager; | ||||
| @ -73,7 +70,8 @@ public class QrWizardDownloadActivity extends Activity { | ||||
|         qrString += "://" + FDroidApp.ipAddressString; | ||||
|         qrString += ":" + FDroidApp.port; | ||||
| 
 | ||||
|         new QrGenAsyncTask(this, R.id.qrWizardImage).execute(qrString); | ||||
|         if (Build.VERSION.SDK_INT >= 8) // zxing requires >= 8 | ||||
|             new QrGenAsyncTask(this, R.id.qrWizardImage).execute(qrString); | ||||
|         Log.i(TAG, "qr: " + qrString); | ||||
| 
 | ||||
|         TextView wifiNetworkName = (TextView) findViewById(R.id.qrWifiNetworkName); | ||||
|  | ||||
| @ -2,12 +2,10 @@ | ||||
| package org.fdroid.fdroid.views; | ||||
| 
 | ||||
| import android.app.Activity; | ||||
| import android.content.BroadcastReceiver; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.content.IntentFilter; | ||||
| import android.content.*; | ||||
| import android.net.wifi.WifiInfo; | ||||
| import android.net.wifi.WifiManager; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.content.LocalBroadcastManager; | ||||
| import android.util.Log; | ||||
| @ -92,12 +90,11 @@ public class QrWizardWifiNetworkActivity extends Activity { | ||||
|             if (wifiInfo.getHiddenSSID()) | ||||
|                 qrString += ";H:true"; | ||||
|             qrString += ";;"; | ||||
|             new QrGenAsyncTask(this, R.id.qrWizardImage).execute(qrString); | ||||
|             Log.i(TAG, "qr: " + qrString); | ||||
|             if (Build.VERSION.SDK_INT >= 8) // zxing requires >= 8 | ||||
|                 new QrGenAsyncTask(this, R.id.qrWizardImage).execute(qrString); | ||||
| 
 | ||||
|             TextView wifiNetworkName = (TextView) findViewById(R.id.qrWifiNetworkName); | ||||
|             wifiNetworkName.setText(wifiInfo.getSSID()); | ||||
|             Log.i(TAG, "wifi network name: " + wifiInfo.getSSID()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner