nicer dialog screen if openkeychain is not installed
This commit is contained in:
		
							parent
							
								
									37c8e157d0
								
							
						
					
					
						commit
						82bccedf70
					
				|  | @ -79,4 +79,8 @@ | ||||||
|     <string name="contact_offline_file">Sending files to an offline contact is unfortunately not supported.</string> |     <string name="contact_offline_file">Sending files to an offline contact is unfortunately not supported.</string> | ||||||
|     <string name="send_unencrypted">Send unencrypted</string> |     <string name="send_unencrypted">Send unencrypted</string> | ||||||
|     <string name="decryption_failed">Decrpytion failed. Maybe you don’t have the proper private key.</string> |     <string name="decryption_failed">Decrpytion failed. Maybe you don’t have the proper private key.</string> | ||||||
|  |     <string name="openkeychain_required">OpenKeychain</string> | ||||||
|  |     <string name="openkeychain_required_long">Conversations utilizes a third party called <b>OpenKeychain</b> to encrypt and decrypt messages and to mange your public keys.\n\nOpenKeychain is licensed under GPLv3 and available on F-Droid and Google Play.\n\nTo use openPGP please install the app and then restart Conversations.</string> | ||||||
|  |     <string name="restart">Restart</string> | ||||||
|  |     <string name="install">Install</string> | ||||||
| </resources> | </resources> | ||||||
|  |  | ||||||
|  | @ -271,7 +271,7 @@ public class ConversationFragment extends Fragment { | ||||||
| 				 | 				 | ||||||
| 				if (item.getType() == Message.TYPE_IMAGE) { | 				if (item.getType() == Message.TYPE_IMAGE) { | ||||||
| 					String[] fileParams = item.getBody().split(","); | 					String[] fileParams = item.getBody().split(","); | ||||||
| 					if (fileParams.length>=1) { | 					if ((fileParams.length>=1)&&(item.getStatus() != Message.STATUS_PREPARING)) { | ||||||
| 						long size = Long.parseLong(fileParams[0]); | 						long size = Long.parseLong(fileParams[0]); | ||||||
| 						filesize = size/1024+" KB \u00B7 "; | 						filesize = size/1024+" KB \u00B7 "; | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
|  | @ -10,8 +10,11 @@ import android.app.AlertDialog; | ||||||
| import android.app.AlertDialog.Builder; | import android.app.AlertDialog.Builder; | ||||||
| import android.content.ComponentName; | import android.content.ComponentName; | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
|  | import android.content.DialogInterface; | ||||||
|  | import android.content.DialogInterface.OnClickListener; | ||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
| import android.content.ServiceConnection; | import android.content.ServiceConnection; | ||||||
|  | import android.net.Uri; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
| import android.os.IBinder; | import android.os.IBinder; | ||||||
| import android.view.MenuItem; | import android.view.MenuItem; | ||||||
|  | @ -84,9 +87,27 @@ public abstract class XmppActivity extends Activity { | ||||||
| 			return true; | 			return true; | ||||||
| 		} else { | 		} else { | ||||||
| 			Builder builder = new AlertDialog.Builder(this); | 			Builder builder = new AlertDialog.Builder(this); | ||||||
| 			builder.setTitle("OpenKeychain not found"); | 			builder.setTitle(getString(R.string.openkeychain_required)); | ||||||
| 			builder.setIconAttribute(android.R.attr.alertDialogIcon); | 			builder.setIconAttribute(android.R.attr.alertDialogIcon); | ||||||
| 			builder.setMessage("Please make sure you have installed OpenKeychain"); | 			builder.setMessage(getText(R.string.openkeychain_required_long)); | ||||||
|  | 			builder.setNegativeButton(getString(R.string.cancel), null); | ||||||
|  | 			builder.setNeutralButton(getString(R.string.restart), new OnClickListener() { | ||||||
|  | 				 | ||||||
|  | 				@Override | ||||||
|  | 				public void onClick(DialogInterface dialog, int which) { | ||||||
|  | 					// TODO Auto-generated method stub | ||||||
|  | 					 | ||||||
|  | 				} | ||||||
|  | 			}); | ||||||
|  | 			builder.setPositiveButton(getString(R.string.install), new OnClickListener() { | ||||||
|  | 				 | ||||||
|  | 				@Override | ||||||
|  | 				public void onClick(DialogInterface dialog, int which) { | ||||||
|  | 					Uri uri = Uri.parse("market://details?id=org.sufficientlysecure.keychain"); | ||||||
|  | 					Intent intent = new Intent(Intent.ACTION_VIEW, uri); | ||||||
|  | 					startActivity(intent); | ||||||
|  | 				} | ||||||
|  | 			}); | ||||||
| 			builder.create().show(); | 			builder.create().show(); | ||||||
| 			return false; | 			return false; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Daniel Gultsch
						Daniel Gultsch