Work on new pgp header
12
images/drawables-pgp/status_lock_closed.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>lock-closed</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="lock-closed" sketch:type="MSArtboardGroup" fill="#000000">
|
||||
<path d="M81.502,45.132 L79.577,45.132 L79.577,29.479 C79.479,10.285 66.387,-0.164 50.476,-0.164 C34.57,-0.164 20.304,10.782 20.801,29.479 L20.785,45.112 C20.785,45.112 21.025,45.133 19.825,45.133 C18.555,45.133 10.185,46.606 10.185,54.069 L10.185,89.893 C10.185,97.852 19.605,99.836 19.825,99.836 L81.027,99.836 C81.247,99.836 90.181,98.843 90.181,89.893 L90.181,54.564 C90.182,46.109 81.727,45.132 81.502,45.132 L81.502,45.132 Z M59.334,86.055 L41.061,86.055 L46.024,71.489 C43.904,70.077 42.496,67.623 42.496,64.824 C42.496,60.44 45.938,56.886 50.183,56.886 C54.428,56.886 57.87,60.443 57.87,64.824 C57.87,67.619 56.466,70.077 54.348,71.485 L59.334,86.055 L59.334,86.055 Z M34.261,45.132 L34.277,29.686 C34.277,19.737 40.348,11.783 50.183,11.783 C59.924,11.783 66.088,18.741 66.088,29.686 L66.098,45.132 L34.261,45.132 L34.261,45.132 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
12
images/drawables-pgp/status_lock_error.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>lock-error</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="lock-error" sketch:type="MSArtboardGroup" fill="#000000">
|
||||
<path d="M80.459,45.474 L78.533,45.474 L78.533,29.826 C78.435,10.633 65.344,0.183 49.433,0.183 C33.527,0.183 19.265,11.128 19.761,29.826 L19.745,45.454 C19.745,45.454 19.985,45.475 18.784,45.475 C17.514,45.475 9.145,46.946 9.145,54.407 L9.145,90.228 C9.145,98.187 18.565,100.171 18.784,100.171 L79.984,100.171 C80.203,100.171 89.138,99.178 89.138,90.228 L89.138,54.901 C89.139,46.452 80.684,45.474 80.459,45.474 L80.459,45.474 Z M33.234,30.033 C33.234,20.084 39.304,12.131 49.14,12.131 C58.881,12.131 65.045,19.088 65.045,30.033 L65.055,45.474 L33.218,45.474 L33.234,30.033 L33.234,30.033 Z M59.4033767,90.873 L48.4582822,79.9279055 L38.2296593,90.3644491 L31.6365,83.7568884 L42.5824946,72.8153942 L32.3439707,62.5939721 L38.7544118,56.1079235 L49.7013065,67.0503177 L60.1234487,56.7100837 L66.6365,63.2240351 L55.6896053,74.1673294 L66.0091373,84.4778605 L59.4033767,90.873 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
12
images/drawables-pgp/status_lock_open.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>lock-open</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="lock-open" sketch:type="MSArtboardGroup" fill="#000000">
|
||||
<path d="M79.577,26.479 C79.577,10.833 66.387,-0.164 50.476,-0.164 C34.57,-0.164 20.304,10.782 20.801,29.479 L20.785,45.112 C20.785,45.112 21.025,45.133 19.825,45.133 C18.555,45.133 10.185,46.606 10.185,54.069 L10.185,89.893 C10.185,97.852 19.605,99.836 19.825,99.836 L81.027,99.836 C81.247,99.836 90.181,98.843 90.181,89.893 L90.181,54.564 C90.181,46.107 81.726,45.13 81.5,45.13 L34.259,45.13 L34.275,29.684 C34.275,19.735 40.346,11.781 50.181,11.781 C59.922,11.781 66.664,18.164 66.664,29.164 L79.577,26.479 Z M59.334,86.055 L41.061,86.055 L46.024,71.49 C43.904,70.078 42.496,67.624 42.496,64.825 C42.496,60.44 45.938,56.887 50.183,56.887 C54.428,56.887 57.87,60.445 57.87,64.825 C57.87,67.62 56.466,70.078 54.348,71.485 L59.334,86.055 L59.334,86.055 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
12
images/drawables-pgp/status_signature_expired_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-expired-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-expired-cutout" sketch:type="MSArtboardGroup" transform="translate(0.110156, 0.000000)" fill="#000000">
|
||||
<path d="M5.21763502,25.9334098 C4.62201801,24.5421709 5.31408066,20.2649627 6.50270803,18.5737297 C7.69394204,16.8824967 14.8139764,11.1118682 18.0827017,9.51888655 C21.3514269,7.92852492 25.1232335,10.7136228 25.1232335,10.7136228 L31.1693326,18.5737297 C21.6564037,21.754453 12.2477403,33.889148 12.2477403,33.889148 C12.2477403,33.889148 5.81325202,27.3259588 5.21763502,25.9334098 Z M50.7969868,98.0040129 C30.5564763,98.0040129 14.1592664,81.3860653 14.1592664,60.910451 C14.1592664,41.4138456 29.0387981,25.4459175 47.9423376,23.9707712 L47.9423376,18.3341735 L41.6333009,18.3341735 L41.6333009,9.02828206 L59.2561767,9.02828206 L59.2561767,18.3341735 L53.6477076,18.3341735 L53.6477076,23.9707712 C72.5460092,25.4445909 87.4333977,41.412519 87.4333977,60.910451 C87.4333977,81.3847387 71.0296405,98.0040129 50.7969868,98.0040129 Z M51.541054,71.6933659 C57.6539179,71.6933659 62.6093732,66.7455263 62.6093732,60.6420567 C62.6093732,54.5385872 57.6539179,49.5907476 51.541054,49.5907476 C45.4281901,49.5907476 40.4727348,54.5385872 40.4727348,60.6420567 C40.4727348,66.7455263 45.4281901,71.6933659 51.541054,71.6933659 Z M96.3766201,25.9341425 C95.7811759,27.3252533 89.3433427,33.889148 89.3433427,33.889148 C89.3433427,33.889148 79.9321974,21.7542607 70.4233315,18.5751403 L76.4676764,10.7157573 C76.4676764,10.7157573 80.2396916,7.92829614 83.5087714,9.5185113 C86.7765483,11.1152759 93.8997286,16.884063 95.0880111,18.5751403 C96.2775965,20.2635977 96.9694584,24.540412 96.3766201,25.9341425 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
12
images/drawables-pgp/status_signature_invalid_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-invalid-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-invalid-cutout" sketch:type="MSArtboardGroup" transform="translate(0.110156, 0.000000)" fill="#000000">
|
||||
<path d="M77.3119658,92 L50,64.6787909 L22.6865385,92 L8.00299145,77.3054987 L35.3149573,49.9977557 L8,22.6870202 L22.6850427,8.00149623 L50,35.3137279 L77.3149573,8 L92,22.6825315 L64.6850427,49.9977557 L91.9970085,77.3054987 L77.3119658,92 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 995 B |
12
images/drawables-pgp/status_signature_revoked_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="101px" height="100px" viewBox="0 0 101 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-revoked-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-revoked-cutout" sketch:type="MSArtboardGroup" transform="translate(0.915625, 0.000000)" fill="#000000">
|
||||
<path d="M50.1457786,95.2902674 C25.2543974,95.2902674 5,75.0407401 5,50.1451337 C5,25.252107 25.2556872,5 50.1457786,5 C75.03587,5 95.2902674,25.252107 95.2902674,50.1451337 C95.2902674,75.0394503 75.0371599,95.2902674 50.1457786,95.2902674 Z M35.5297191,75.6701923 C39.8404345,78.1467253 44.8296167,79.569442 50.1464236,79.569442 C66.3793238,79.569442 79.5862102,66.3638454 79.5862102,50.1296554 C79.5862102,44.8115586 78.1622037,39.8223764 75.6843808,35.5116611 L35.5297191,75.6701923 Z M50.1464236,20.6911586 C33.9135233,20.6911586 20.7066369,33.8967551 20.7066369,50.1309452 C20.7066369,55.3523024 22.0803389,60.2563538 24.473031,64.512895 L64.5296632,24.4575526 C60.2718321,22.0635707 55.3690706,20.6911586 50.1464236,20.6911586 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
12
images/drawables-pgp/status_signature_unknown_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="101px" height="100px" viewBox="0 0 101 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-unknown-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-unknown-cutout" sketch:type="MSArtboardGroup" transform="translate(0.915625, 0.000000)" fill="#000000">
|
||||
<path d="M11.4743662,97.2253545 C1.98936285,97.2253571 -1.69987039,86.6466353 1.98936288,81.2764443 C2.36018089,80.2888073 37.5445854,9.4248374 37.6406733,9.21698534 C41.524789,0.483122973 56.8650161,0.0416071437 60.7924391,9.21698534 C60.7572519,9.19524917 98.2991929,81.8687547 97.9337883,81.2642177 C101.323931,86.2404407 96.9260512,97.2253571 88.8978453,97.2253545 C88.8978453,97.2253545 11.4756386,97.2879401 11.4743662,97.2253545 Z M50.5378687,73.3388569 C47.2443918,73.3388569 44.2703808,76.046195 44.2703808,79.5061732 C44.2703808,82.9729198 47.1388056,85.6802579 50.5378687,85.6802579 C53.9369317,85.6802579 56.8040029,82.9729198 56.8040029,79.5061732 C56.8053565,76.046195 53.8313455,73.3388569 50.5378687,73.3388569 Z M50.3063913,28.5 C46.5729719,28.5 42.719076,30.2990258 43.0805057,32.9143334 L45.8826007,65.934287 L54.7315355,65.934287 L57.5322768,32.9143334 C57.8937065,30.2990258 54.0398106,28.5 50.3063913,28.5 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
12
images/drawables-pgp/status_signature_unverified_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="101px" height="100px" viewBox="0 0 101 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-unverified-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-unverified-cutout" sketch:type="MSArtboardGroup" transform="translate(0.915625, 0.000000)" fill="#000000">
|
||||
<path d="M49.8900274,96.5521596 C75.8474106,96.5521596 96.8900274,75.5095428 96.8900274,49.5521596 C96.8900274,23.5947764 75.8474106,2.5521596 49.8900274,2.5521596 C23.9326441,2.5521596 2.89002736,23.5947764 2.89002736,49.5521596 C2.89002736,75.5095428 23.9326441,96.5521596 49.8900274,96.5521596 Z M42.9188472,79.4349375 L42.9188472,67.0146143 L55.3391704,67.0146143 L55.3391704,79.4349375 L42.9188472,79.4349375 Z M68.652586,41.8646591 C67.9712562,43.583078 67.1302842,45.0524085 66.1249189,46.2716815 C65.1167028,47.4919237 64.0039592,48.5318919 62.7800362,49.3906167 C61.5570634,50.25128 60.4006082,51.1080664 59.3135213,51.9677605 C58.2254842,52.829393 57.2609796,53.8121774 56.4181072,54.9209598 C55.5733342,56.0307115 55.0449948,57.4147511 54.8273874,59.0779247 L54.8273874,62.237567 L43.8168316,62.237567 L43.8168316,58.4954263 C43.9802747,56.114064 44.4278428,54.1165111 45.1623867,52.5095519 C45.89503,50.9025928 46.7531065,49.5292145 47.7309145,48.3923248 C48.7106231,47.2564044 49.7425954,46.2716815 50.8296823,45.4400947 C51.9177195,44.6104463 52.9230848,43.7769211 53.8476788,42.9463035 C54.7722728,42.1147166 55.5201202,41.2007465 56.0912209,40.2024546 C56.6623216,39.2041628 56.9188893,37.9577517 56.8647251,36.4612832 C56.8647251,33.9112774 56.2537138,32.0261534 55.030741,30.804942 C53.8058678,29.5876075 52.1058691,28.9760325 49.9326456,28.9760325 C48.4645081,28.9760325 47.2006746,29.2677664 46.1392445,29.8492956 C45.0797149,30.4317941 44.2092851,31.2071664 43.5298558,32.177351 C42.848526,33.1475357 42.3477439,34.2844253 42.0208576,35.5860816 C41.6939713,36.8906456 41.5305282,38.2901926 41.5305282,39.7866612 L29.5431146,39.7866612 C29.5953784,36.7917856 30.0999615,34.0479368 31.0521128,31.5541455 C32.0023636,29.0593851 33.3346152,26.8970655 35.0479174,25.0691252 C36.7612195,23.2382773 38.8270647,21.8115922 41.2464032,20.7832547 C43.6666919,19.7568556 46.3730062,19.2441406 49.3624951,19.2441406 C53.2224138,19.2441406 56.4447142,19.785932 59.0274958,20.8666072 C61.6093272,21.9482516 63.6894262,23.2935226 65.2668425,24.9024202 C66.8442588,26.5103485 67.9712562,28.2423365 68.6516357,30.0993532 C69.3310651,31.9573391 69.6703046,33.6883579 69.6703046,35.2962862 C69.6722051,37.9567825 69.3320153,40.1481786 68.652586,41.8646591 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
12
images/drawables-pgp/status_signature_verified_cutout.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="100px" height="100px" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.0.4 (8053) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>signature-verified-cutout</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="signature-verified-cutout" sketch:type="MSArtboardGroup" transform="translate(0.110156, 0.000000)" fill="#000000">
|
||||
<path d="M50,97 C75.9573832,97 97,75.9573832 97,50 C97,24.0426168 75.9573832,3 50,3 C24.0426168,3 3,24.0426168 3,50 C3,75.9573832 24.0426168,97 50,97 Z M46.2732912,77.5085 L20,57.830916 L27.9184401,47.6349702 L43.3096859,59.5152262 L70.31112,23 L80.867825,30.7782191 L46.2732912,77.5085 Z" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
19
images/update-drawables-pgp.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
APP_DIR=../k9mail/src/main
|
||||
MDPI_DIR=$APP_DIR/res/drawable-mdpi
|
||||
HDPI_DIR=$APP_DIR/res/drawable-hdpi
|
||||
XDPI_DIR=$APP_DIR/res/drawable-xhdpi
|
||||
XXDPI_DIR=$APP_DIR/res/drawable-xxhdpi
|
||||
XXXDPI_DIR=$APP_DIR/res/drawable-xxxhdpi
|
||||
SRC_DIR=./drawables-pgp/
|
||||
|
||||
|
||||
for NAME in "status_lock_closed" "status_lock_error" "status_lock_open" "status_signature_expired_cutout" "status_signature_invalid_cutout" "status_signature_revoked_cutout" "status_signature_unknown_cutout" "status_signature_unverified_cutout" "status_signature_verified_cutout"
|
||||
do
|
||||
echo $NAME
|
||||
inkscape -w 24 -h 24 -e "$MDPI_DIR/$NAME.png" "$SRC_DIR/$NAME.svg"
|
||||
inkscape -w 32 -h 32 -e "$HDPI_DIR/$NAME.png" "$SRC_DIR/$NAME.svg"
|
||||
inkscape -w 48 -h 48 -e "$XDPI_DIR/$NAME.png" "$SRC_DIR/$NAME.svg"
|
||||
inkscape -w 64 -h 64 -e "$XXDPI_DIR/$NAME.png" "$SRC_DIR/$NAME.svg"
|
||||
done
|
@ -51,7 +51,7 @@ import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.view.MessageHeader;
|
||||
import com.fsck.k9.ui.messageview.MessageOpenPgpView;
|
||||
import com.fsck.k9.ui.messageview.MessageOpenPgpViewOld;
|
||||
import com.fsck.k9.view.MessageTitleView;
|
||||
import com.fsck.k9.view.ViewSwitcher;
|
||||
import com.fsck.k9.view.ViewSwitcher.OnSwitchCompleteListener;
|
||||
@ -1564,7 +1564,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
|
||||
// handle OpenPGP results from PendingIntents in OpenPGP view
|
||||
// must be handled in this main activity, because startIntentSenderForResult() does not support Fragments
|
||||
MessageOpenPgpView openPgpView = (MessageOpenPgpView) findViewById(R.id.layout_decrypt_openpgp);
|
||||
MessageOpenPgpViewOld openPgpView = (MessageOpenPgpViewOld) findViewById(R.id.layout_decrypt_openpgp);
|
||||
if (openPgpView != null && openPgpView.handleOnActivityResult(requestCode, resultCode, data)) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,201 +1,143 @@
|
||||
|
||||
package com.fsck.k9.ui.messageview;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender.SendIntentException;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Identity;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.crypto.CryptoHelper;
|
||||
import com.fsck.k9.crypto.OpenPgpApiHelper;
|
||||
import com.fsck.k9.helper.IdentityHelper;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.Part;
|
||||
|
||||
import com.fsck.k9.mail.internet.MessageExtractor;
|
||||
import com.fsck.k9.mail.internet.MimeUtility;
|
||||
import org.openintents.openpgp.OpenPgpError;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
||||
|
||||
public class MessageOpenPgpView extends LinearLayout {
|
||||
|
||||
private Context mContext;
|
||||
private MessageViewFragment mFragment;
|
||||
private RelativeLayout mSignatureLayout = null;
|
||||
private ImageView mSignatureStatusImage = null;
|
||||
private TextView mSignatureUserId = null;
|
||||
private TextView mText = null;
|
||||
private ProgressBar mProgress;
|
||||
private Button mGetKeyButton;
|
||||
|
||||
private OpenPgpServiceConnection mOpenPgpServiceConnection;
|
||||
private OpenPgpApi mOpenPgpApi;
|
||||
private ImageView mResultEncryptionIcon;
|
||||
private TextView mResultEncryptionText;
|
||||
private ImageView mResultSignatureIcon;
|
||||
private TextView mResultSignatureText;
|
||||
private LinearLayout mResultSignatureLayout;
|
||||
private TextView mResultSignatureName;
|
||||
private TextView mResultSignatureEmail;
|
||||
|
||||
private String mOpenPgpProvider;
|
||||
private Message mMessage;
|
||||
|
||||
private PendingIntent mMissingKeyPI;
|
||||
// private PendingIntent mMissingKeyPI;
|
||||
|
||||
private static final int REQUEST_CODE_DECRYPT_VERIFY = 12;
|
||||
|
||||
String mData;
|
||||
Account mAccount;
|
||||
|
||||
public MessageOpenPgpView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void setupChildViews() {
|
||||
mSignatureLayout = (RelativeLayout) findViewById(R.id.openpgp_signature_layout);
|
||||
mSignatureStatusImage = (ImageView) findViewById(R.id.openpgp_signature_status);
|
||||
mSignatureUserId = (TextView) findViewById(R.id.openpgp_user_id);
|
||||
mText = (TextView) findViewById(R.id.openpgp_text);
|
||||
mProgress = (ProgressBar) findViewById(R.id.openpgp_progress);
|
||||
mGetKeyButton = (Button) findViewById(R.id.openpgp_get_key);
|
||||
mResultEncryptionIcon = (ImageView) findViewById(R.id.result_encryption_icon);
|
||||
mResultEncryptionText = (TextView) findViewById(R.id.result_encryption_text);
|
||||
mResultSignatureIcon = (ImageView) findViewById(R.id.result_signature_icon);
|
||||
mResultSignatureText = (TextView) findViewById(R.id.result_signature_text);
|
||||
mResultSignatureLayout = (LinearLayout) findViewById(R.id.result_signature_layout);
|
||||
mResultSignatureName = (TextView) findViewById(R.id.result_signature_name);
|
||||
mResultSignatureEmail = (TextView) findViewById(R.id.result_signature_email);
|
||||
|
||||
mGetKeyButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getMissingKey();
|
||||
}
|
||||
});
|
||||
// mGetKeyButton.setOnClickListener(new OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// getMissingKey();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void setFragment(Fragment fragment) {
|
||||
mFragment = (MessageViewFragment) fragment;
|
||||
}
|
||||
// public void setFragment(Fragment fragment) {
|
||||
// mFragment = (MessageViewFragment) fragment;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Fill the decrypt layout with signature data, if known, make controls
|
||||
* visible, if they should be visible.
|
||||
*/
|
||||
public void updateLayout(Account account, String decryptedData,
|
||||
final OpenPgpSignatureResult signatureResult,
|
||||
final Message message) {
|
||||
public void updateLayout(final OpenPgpSignatureResult signatureResult,
|
||||
boolean decryptedData,
|
||||
PendingIntent getMissingKeyIntent) {
|
||||
|
||||
// set class variables
|
||||
mAccount = account;
|
||||
mOpenPgpProvider = mAccount.getOpenPgpProvider();
|
||||
mMessage = message;
|
||||
|
||||
// only use this view if a OpenPGP Provider is set
|
||||
if (mOpenPgpProvider == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Activity activity = mFragment.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
// bind to service
|
||||
mOpenPgpServiceConnection = new OpenPgpServiceConnection(activity,
|
||||
mOpenPgpProvider);
|
||||
mOpenPgpServiceConnection.bindToService();
|
||||
|
||||
if ((message == null) && (decryptedData == null)) {
|
||||
this.setVisibility(View.GONE);
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
}
|
||||
if (decryptedData != null && signatureResult == null) {
|
||||
if (decryptedData) {
|
||||
// encrypted-only
|
||||
setStatusImage(mContext, mResultEncryptionIcon, mResultEncryptionText, STATE_ENCRYPTED);
|
||||
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_blue));
|
||||
mText.setText(R.string.openpgp_successful_decryption);
|
||||
// MessageOpenPgpView.this.setBackgroundColor(mContext.getResources().getColor(
|
||||
// R.color.openpgp_blue));
|
||||
// mText.setText(R.string.openpgp_successful_decryption);
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
} else if (decryptedData != null && signatureResult != null) {
|
||||
// signed-only and signed-and-encrypted
|
||||
}
|
||||
|
||||
if (signatureResult != null) {
|
||||
switch (signatureResult.getStatus()) {
|
||||
case OpenPgpSignatureResult.SIGNATURE_ERROR:
|
||||
// TODO: signature error but decryption works?
|
||||
mText.setText(R.string.openpgp_signature_invalid);
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_red));
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
mSignatureLayout.setVisibility(View.GONE);
|
||||
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_INVALID);
|
||||
// // TODO: signature error but decryption works?
|
||||
// mText.setText(R.string.openpgp_signature_invalid);
|
||||
// MessageOpenPgpView.this.setBackgroundColor(mContext.getResources().getColor(
|
||||
// R.color.openpgp_red));
|
||||
//
|
||||
// mGetKeyButton.setVisibility(View.GONE);
|
||||
// mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
// mSignatureLayout.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_valid_certified);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_valid_signature_certified);
|
||||
}
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_green));
|
||||
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_VERIFIED);
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureUserId.setText(signatureResult.getUserId());
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
// if (signatureResult.isSignatureOnly()) {
|
||||
// mText.setText(R.string.openpgp_signature_valid_certified);
|
||||
// } else {
|
||||
// mText.setText(R.string.openpgp_successful_decryption_valid_signature_certified);
|
||||
// }
|
||||
// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
// R.color.openpgp_green));
|
||||
//
|
||||
// mGetKeyButton.setVisibility(View.GONE);
|
||||
// mSignatureUserId.setText(signatureResult.getUserId());
|
||||
// mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
// mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_unknown_text);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_unknown_signature);
|
||||
}
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNKNOWN_KEY);
|
||||
|
||||
mGetKeyButton.setVisibility(View.VISIBLE);
|
||||
mSignatureUserId.setText(R.string.openpgp_signature_unknown);
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
// if (signatureResult.isSignatureOnly()) {
|
||||
// mText.setText(R.string.openpgp_signature_unknown_text);
|
||||
// } else {
|
||||
// mText.setText(R.string.openpgp_successful_decryption_unknown_signature);
|
||||
// }
|
||||
// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
// R.color.openpgp_orange));
|
||||
//
|
||||
// mGetKeyButton.setVisibility(View.VISIBLE);
|
||||
// mSignatureUserId.setText(R.string.openpgp_signature_unknown);
|
||||
// mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
// mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_valid_uncertified);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_valid_signature_uncertified);
|
||||
}
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
setStatusImage(mContext, mResultSignatureIcon, mResultSignatureText, STATE_UNVERIFIED);
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureUserId.setText(signatureResult.getUserId());
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
// if (signatureResult.isSignatureOnly()) {
|
||||
// mText.setText(R.string.openpgp_signature_valid_uncertified);
|
||||
// } else {
|
||||
// mText.setText(R.string.openpgp_successful_decryption_valid_signature_uncertified);
|
||||
// }
|
||||
// MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
// R.color.openpgp_orange));
|
||||
//
|
||||
// mGetKeyButton.setVisibility(View.GONE);
|
||||
// mSignatureUserId.setText(signatureResult.getUserId());
|
||||
// mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
// mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
@ -203,221 +145,149 @@ public class MessageOpenPgpView extends LinearLayout {
|
||||
break;
|
||||
}
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
}
|
||||
|
||||
// Start new decryption/verification
|
||||
CryptoHelper helper = new CryptoHelper();
|
||||
if (helper.isEncrypted(message) || helper.isSigned(message)) {
|
||||
// start automatic decrypt
|
||||
decryptAndVerify(message);
|
||||
} else {
|
||||
try {
|
||||
// check for PGP/MIME encryption
|
||||
Part pgp = MimeUtility.findFirstPartByMimeType(message, "application/pgp-encrypted");
|
||||
if (pgp != null) {
|
||||
Toast.makeText(mContext, R.string.pgp_mime_unsupported, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// nothing to do...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void decryptAndVerify(final Message message) {
|
||||
this.setVisibility(View.VISIBLE);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
mText.setText(R.string.openpgp_decrypting_verifying);
|
||||
|
||||
// waiting in a new thread
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// get data String
|
||||
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
if (part == null) {
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
|
||||
}
|
||||
if (part != null) {
|
||||
mData = MessageExtractor.getTextFromPart(part);
|
||||
}
|
||||
|
||||
// wait for service to be bound
|
||||
while (!mOpenPgpServiceConnection.isBound()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
mOpenPgpApi = new OpenPgpApi(getContext(),
|
||||
mOpenPgpServiceConnection.getService());
|
||||
public static final int STATE_REVOKED = 1;
|
||||
public static final int STATE_EXPIRED = 2;
|
||||
public static final int STATE_VERIFIED = 3;
|
||||
public static final int STATE_UNAVAILABLE = 4;
|
||||
public static final int STATE_ENCRYPTED = 5;
|
||||
public static final int STATE_NOT_ENCRYPTED = 6;
|
||||
public static final int STATE_UNVERIFIED = 7;
|
||||
public static final int STATE_UNKNOWN_KEY = 8;
|
||||
public static final int STATE_INVALID = 9;
|
||||
public static final int STATE_NOT_SIGNED = 10;
|
||||
|
||||
decryptVerify(new Intent());
|
||||
|
||||
} catch (MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Unable to decrypt email.", me);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
new Thread(r).start();
|
||||
}
|
||||
|
||||
private void decryptVerify(Intent intent) {
|
||||
intent.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
|
||||
intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
||||
|
||||
Identity identity = IdentityHelper.getRecipientIdentityFromMessage(mAccount, mMessage);
|
||||
String accName = OpenPgpApiHelper.buildAccountName(identity);
|
||||
intent.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, accName);
|
||||
|
||||
InputStream is = new ByteArrayInputStream(mData.getBytes(Charset.forName("UTF-8")));
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
|
||||
DecryptVerifyCallback callback = new DecryptVerifyCallback(os, REQUEST_CODE_DECRYPT_VERIFY);
|
||||
|
||||
mOpenPgpApi.executeApiAsync(intent, is, os, callback);
|
||||
}
|
||||
|
||||
private void getMissingKey() {
|
||||
try {
|
||||
mFragment.getActivity().startIntentSenderForResult(
|
||||
mMissingKeyPI.getIntentSender(),
|
||||
REQUEST_CODE_DECRYPT_VERIFY, null, 0, 0, 0);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
}
|
||||
public static void setStatusImage(Context context, ImageView statusIcon, int state) {
|
||||
setStatusImage(context, statusIcon, null, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on successful decrypt/verification
|
||||
* Sets status image based on constant
|
||||
*/
|
||||
private class DecryptVerifyCallback implements OpenPgpApi.IOpenPgpCallback {
|
||||
ByteArrayOutputStream os;
|
||||
int requestCode;
|
||||
|
||||
private DecryptVerifyCallback(ByteArrayOutputStream os, int requestCode) {
|
||||
this.os = os;
|
||||
this.requestCode = requestCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReturn(Intent result) {
|
||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
||||
try {
|
||||
final String output = os.toString("UTF-8");
|
||||
|
||||
OpenPgpSignatureResult sigResult = null;
|
||||
if (result.hasExtra(OpenPgpApi.RESULT_SIGNATURE)) {
|
||||
sigResult = result.getParcelableExtra(OpenPgpApi.RESULT_SIGNATURE);
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "result: " + os.toByteArray().length
|
||||
+ " str=" + output);
|
||||
|
||||
// missing key -> PendingIntent to get keys
|
||||
mMissingKeyPI = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||
|
||||
mProgress.setVisibility(View.GONE);
|
||||
mFragment.setMessageWithOpenPgp(output, sigResult);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException", e);
|
||||
public static void setStatusImage(Context context, ImageView statusIcon, TextView statusText,
|
||||
int state) {
|
||||
switch (state) {
|
||||
/** GREEN: everything is good **/
|
||||
case STATE_VERIFIED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_verified_cutout));
|
||||
int color = R.color.openpgp_green;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
|
||||
PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||
try {
|
||||
mFragment.getActivity().startIntentSenderForResult(
|
||||
pi.getIntentSender(),
|
||||
requestCode, null, 0, 0, 0);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
case STATE_ENCRYPTED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_lock_closed));
|
||||
int color = R.color.openpgp_green;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpenPgpApi.RESULT_CODE_ERROR: {
|
||||
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
|
||||
handleError(error);
|
||||
/** ORANGE: mostly bad... **/
|
||||
case STATE_UNVERIFIED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_unverified_cutout));
|
||||
int color = R.color.openpgp_orange;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STATE_UNKNOWN_KEY: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout));
|
||||
int color = R.color.openpgp_orange;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
/** RED: really bad... **/
|
||||
case STATE_REVOKED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
|
||||
int color = R.color.openpgp_red;
|
||||
// if (unobtrusive) {
|
||||
// color = R.color.bg_gray;
|
||||
// }
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STATE_EXPIRED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_expired_cutout));
|
||||
int color = R.color.openpgp_red;
|
||||
// if (unobtrusive) {
|
||||
// color = R.color.bg_gray;
|
||||
// }
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STATE_NOT_ENCRYPTED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_lock_open));
|
||||
int color = R.color.openpgp_red;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STATE_NOT_SIGNED: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_unknown_cutout));
|
||||
int color = R.color.openpgp_red;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case STATE_INVALID: {
|
||||
statusIcon.setImageDrawable(
|
||||
context.getResources().getDrawable(R.drawable.status_signature_invalid_cutout));
|
||||
int color = R.color.openpgp_red;
|
||||
statusIcon.setColorFilter(context.getResources().getColor(color),
|
||||
PorterDuff.Mode.SRC_IN);
|
||||
if (statusText != null) {
|
||||
statusText.setTextColor(context.getResources().getColor(color));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleOnActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "onActivityResult resultCode: " + resultCode);
|
||||
|
||||
// try again after user interaction
|
||||
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_DECRYPT_VERIFY) {
|
||||
/*
|
||||
* The data originally given to the decryptVerify() method, is again
|
||||
* returned here to be used when calling decryptVerify() after user
|
||||
* interaction. The Intent now also contains results from the user
|
||||
* interaction, for example selected key ids.
|
||||
*/
|
||||
decryptVerify(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void handleError(final OpenPgpError error) {
|
||||
Activity activity = mFragment.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
mProgress.setVisibility(View.GONE);
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "OpenPGP Error ID:" + error.getErrorId());
|
||||
Log.d(K9.LOG_TAG, "OpenPGP Error Message:" + error.getMessage());
|
||||
}
|
||||
|
||||
mText.setText(mFragment.getString(R.string.openpgp_error) + " "
|
||||
+ error.getMessage());
|
||||
MessageOpenPgpView.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_red));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
// bind to service if a OpenPGP Provider is available
|
||||
if (mOpenPgpProvider != null) {
|
||||
mOpenPgpServiceConnection = new OpenPgpServiceConnection(mFragment.getActivity(),
|
||||
mOpenPgpProvider);
|
||||
mOpenPgpServiceConnection.bindToService();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
if (mOpenPgpServiceConnection != null) {
|
||||
mOpenPgpServiceConnection.unbindFromService();
|
||||
}
|
||||
}
|
||||
// private void getMissingKey() {
|
||||
// try {
|
||||
// mFragment.getActivity().startIntentSenderForResult(
|
||||
// mMissingKeyPI.getIntentSender(),
|
||||
// REQUEST_CODE_DECRYPT_VERIFY, null, 0, 0, 0);
|
||||
// } catch (SendIntentException e) {
|
||||
// Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,423 @@
|
||||
|
||||
package com.fsck.k9.ui.messageview;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender.SendIntentException;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.Identity;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.crypto.CryptoHelper;
|
||||
import com.fsck.k9.crypto.OpenPgpApiHelper;
|
||||
import com.fsck.k9.helper.IdentityHelper;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.Part;
|
||||
|
||||
import com.fsck.k9.mail.internet.MessageExtractor;
|
||||
import com.fsck.k9.mail.internet.MimeUtility;
|
||||
import org.openintents.openpgp.OpenPgpError;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
||||
|
||||
public class MessageOpenPgpViewOld extends LinearLayout {
|
||||
|
||||
private Context mContext;
|
||||
private MessageViewFragment mFragment;
|
||||
private RelativeLayout mSignatureLayout = null;
|
||||
private ImageView mSignatureStatusImage = null;
|
||||
private TextView mSignatureUserId = null;
|
||||
private TextView mText = null;
|
||||
private ProgressBar mProgress;
|
||||
private Button mGetKeyButton;
|
||||
|
||||
private OpenPgpServiceConnection mOpenPgpServiceConnection;
|
||||
private OpenPgpApi mOpenPgpApi;
|
||||
|
||||
private String mOpenPgpProvider;
|
||||
private Message mMessage;
|
||||
|
||||
private PendingIntent mMissingKeyPI;
|
||||
|
||||
private static final int REQUEST_CODE_DECRYPT_VERIFY = 12;
|
||||
|
||||
String mData;
|
||||
Account mAccount;
|
||||
|
||||
public MessageOpenPgpViewOld(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public void setupChildViews() {
|
||||
mSignatureLayout = (RelativeLayout) findViewById(R.id.openpgp_signature_layout);
|
||||
mSignatureStatusImage = (ImageView) findViewById(R.id.openpgp_signature_status);
|
||||
mSignatureUserId = (TextView) findViewById(R.id.openpgp_user_id);
|
||||
mText = (TextView) findViewById(R.id.openpgp_text);
|
||||
mProgress = (ProgressBar) findViewById(R.id.openpgp_progress);
|
||||
mGetKeyButton = (Button) findViewById(R.id.openpgp_get_key);
|
||||
|
||||
mGetKeyButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getMissingKey();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setFragment(Fragment fragment) {
|
||||
mFragment = (MessageViewFragment) fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the decrypt layout with signature data, if known, make controls
|
||||
* visible, if they should be visible.
|
||||
*/
|
||||
public void updateLayout(Account account, String decryptedData,
|
||||
final OpenPgpSignatureResult signatureResult,
|
||||
final Message message) {
|
||||
|
||||
// set class variables
|
||||
mAccount = account;
|
||||
mOpenPgpProvider = mAccount.getOpenPgpProvider();
|
||||
mMessage = message;
|
||||
|
||||
// only use this view if a OpenPGP Provider is set
|
||||
if (mOpenPgpProvider == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Activity activity = mFragment.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
// bind to service
|
||||
mOpenPgpServiceConnection = new OpenPgpServiceConnection(activity,
|
||||
mOpenPgpProvider);
|
||||
mOpenPgpServiceConnection.bindToService();
|
||||
|
||||
if ((message == null) && (decryptedData == null)) {
|
||||
this.setVisibility(View.GONE);
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
}
|
||||
if (decryptedData != null && signatureResult == null) {
|
||||
// encrypted-only
|
||||
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_blue));
|
||||
mText.setText(R.string.openpgp_successful_decryption);
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
} else if (decryptedData != null && signatureResult != null) {
|
||||
// signed-only and signed-and-encrypted
|
||||
|
||||
switch (signatureResult.getStatus()) {
|
||||
case OpenPgpSignatureResult.SIGNATURE_ERROR:
|
||||
// TODO: signature error but decryption works?
|
||||
mText.setText(R.string.openpgp_signature_invalid);
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_red));
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
mSignatureLayout.setVisibility(View.GONE);
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_valid_certified);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_valid_signature_certified);
|
||||
}
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_green));
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureUserId.setText(signatureResult.getUserId());
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_unknown_text);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_unknown_signature);
|
||||
}
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
|
||||
mGetKeyButton.setVisibility(View.VISIBLE);
|
||||
mSignatureUserId.setText(R.string.openpgp_signature_unknown);
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED:
|
||||
if (signatureResult.isSignatureOnly()) {
|
||||
mText.setText(R.string.openpgp_signature_valid_uncertified);
|
||||
}
|
||||
else {
|
||||
mText.setText(R.string.openpgp_successful_decryption_valid_signature_uncertified);
|
||||
}
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
|
||||
mGetKeyButton.setVisibility(View.GONE);
|
||||
mSignatureUserId.setText(signatureResult.getUserId());
|
||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||
mSignatureLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// don't process further
|
||||
return;
|
||||
}
|
||||
|
||||
// Start new decryption/verification
|
||||
CryptoHelper helper = new CryptoHelper();
|
||||
if (helper.isEncrypted(message) || helper.isSigned(message)) {
|
||||
// start automatic decrypt
|
||||
decryptAndVerify(message);
|
||||
} else {
|
||||
try {
|
||||
// check for PGP/MIME encryption
|
||||
Part pgp = MimeUtility.findFirstPartByMimeType(message, "application/pgp-encrypted");
|
||||
if (pgp != null) {
|
||||
Toast.makeText(mContext, R.string.pgp_mime_unsupported, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// nothing to do...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void decryptAndVerify(final Message message) {
|
||||
this.setVisibility(View.VISIBLE);
|
||||
mProgress.setVisibility(View.VISIBLE);
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_orange));
|
||||
mText.setText(R.string.openpgp_decrypting_verifying);
|
||||
|
||||
// waiting in a new thread
|
||||
Runnable r = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// get data String
|
||||
Part part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
if (part == null) {
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
|
||||
}
|
||||
if (part != null) {
|
||||
mData = MessageExtractor.getTextFromPart(part);
|
||||
}
|
||||
|
||||
// wait for service to be bound
|
||||
while (!mOpenPgpServiceConnection.isBound()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
mOpenPgpApi = new OpenPgpApi(getContext(),
|
||||
mOpenPgpServiceConnection.getService());
|
||||
|
||||
decryptVerify(new Intent());
|
||||
|
||||
} catch (MessagingException me) {
|
||||
Log.e(K9.LOG_TAG, "Unable to decrypt email.", me);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
new Thread(r).start();
|
||||
}
|
||||
|
||||
private void decryptVerify(Intent intent) {
|
||||
intent.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
|
||||
intent.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
|
||||
|
||||
Identity identity = IdentityHelper.getRecipientIdentityFromMessage(mAccount, mMessage);
|
||||
String accName = OpenPgpApiHelper.buildAccountName(identity);
|
||||
intent.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, accName);
|
||||
|
||||
InputStream is = new ByteArrayInputStream(mData.getBytes(Charset.forName("UTF-8")));
|
||||
final ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
|
||||
DecryptVerifyCallback callback = new DecryptVerifyCallback(os, REQUEST_CODE_DECRYPT_VERIFY);
|
||||
|
||||
mOpenPgpApi.executeApiAsync(intent, is, os, callback);
|
||||
}
|
||||
|
||||
private void getMissingKey() {
|
||||
try {
|
||||
mFragment.getActivity().startIntentSenderForResult(
|
||||
mMissingKeyPI.getIntentSender(),
|
||||
REQUEST_CODE_DECRYPT_VERIFY, null, 0, 0, 0);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on successful decrypt/verification
|
||||
*/
|
||||
private class DecryptVerifyCallback implements OpenPgpApi.IOpenPgpCallback {
|
||||
ByteArrayOutputStream os;
|
||||
int requestCode;
|
||||
|
||||
private DecryptVerifyCallback(ByteArrayOutputStream os, int requestCode) {
|
||||
this.os = os;
|
||||
this.requestCode = requestCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReturn(Intent result) {
|
||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
||||
try {
|
||||
final String output = os.toString("UTF-8");
|
||||
|
||||
OpenPgpSignatureResult sigResult = null;
|
||||
if (result.hasExtra(OpenPgpApi.RESULT_SIGNATURE)) {
|
||||
sigResult = result.getParcelableExtra(OpenPgpApi.RESULT_SIGNATURE);
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "result: " + os.toByteArray().length
|
||||
+ " str=" + output);
|
||||
|
||||
// missing key -> PendingIntent to get keys
|
||||
mMissingKeyPI = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||
|
||||
mProgress.setVisibility(View.GONE);
|
||||
mFragment.setMessageWithOpenPgp(output, sigResult);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(K9.LOG_TAG, "UnsupportedEncodingException", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED: {
|
||||
PendingIntent pi = result.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
|
||||
try {
|
||||
mFragment.getActivity().startIntentSenderForResult(
|
||||
pi.getIntentSender(),
|
||||
requestCode, null, 0, 0, 0);
|
||||
} catch (SendIntentException e) {
|
||||
Log.e(K9.LOG_TAG, "SendIntentException", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OpenPgpApi.RESULT_CODE_ERROR: {
|
||||
OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR);
|
||||
handleError(error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean handleOnActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (K9.DEBUG)
|
||||
Log.d(K9.LOG_TAG, "onActivityResult resultCode: " + resultCode);
|
||||
|
||||
// try again after user interaction
|
||||
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_DECRYPT_VERIFY) {
|
||||
/*
|
||||
* The data originally given to the decryptVerify() method, is again
|
||||
* returned here to be used when calling decryptVerify() after user
|
||||
* interaction. The Intent now also contains results from the user
|
||||
* interaction, for example selected key ids.
|
||||
*/
|
||||
decryptVerify(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void handleError(final OpenPgpError error) {
|
||||
Activity activity = mFragment.getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
mProgress.setVisibility(View.GONE);
|
||||
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "OpenPGP Error ID:" + error.getErrorId());
|
||||
Log.d(K9.LOG_TAG, "OpenPGP Error Message:" + error.getMessage());
|
||||
}
|
||||
|
||||
mText.setText(mFragment.getString(R.string.openpgp_error) + " "
|
||||
+ error.getMessage());
|
||||
MessageOpenPgpViewOld.this.setBackgroundColor(mFragment.getResources().getColor(
|
||||
R.color.openpgp_red));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
// bind to service if a OpenPGP Provider is available
|
||||
if (mOpenPgpProvider != null) {
|
||||
mOpenPgpServiceConnection = new OpenPgpServiceConnection(mFragment.getActivity(),
|
||||
mOpenPgpProvider);
|
||||
mOpenPgpServiceConnection.bindToService();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
if (mOpenPgpServiceConnection != null) {
|
||||
mOpenPgpServiceConnection.unbindFromService();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -88,7 +88,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
private static final int DISPLAY_NAME_INDEX = 1;
|
||||
|
||||
|
||||
private MessageOpenPgpView mOpenPgpView;
|
||||
private MessageOpenPgpViewOld mOpenPgpView;
|
||||
private MessageWebView mMessageContentView;
|
||||
private MessageHeader mHeaderContainer;
|
||||
private LinearLayout mAttachments;
|
||||
@ -126,7 +126,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
mHiddenAttachments.setVisibility(View.GONE);
|
||||
mShowHiddenAttachments = (Button) findViewById(R.id.show_hidden_attachments);
|
||||
mShowHiddenAttachments.setVisibility(View.GONE);
|
||||
mOpenPgpView = (MessageOpenPgpView) findViewById(R.id.layout_decrypt_openpgp);
|
||||
mOpenPgpView = (MessageOpenPgpViewOld) findViewById(R.id.layout_decrypt_openpgp);
|
||||
mOpenPgpView.setFragment(fragment);
|
||||
mOpenPgpView.setupChildViews();
|
||||
mShowPicturesAction = findViewById(R.id.show_pictures);
|
||||
|
BIN
k9mail/src/main/res/drawable-hdpi/status_lock_closed.png
Normal file
After Width: | Height: | Size: 675 B |
BIN
k9mail/src/main/res/drawable-hdpi/status_lock_error.png
Normal file
After Width: | Height: | Size: 748 B |
BIN
k9mail/src/main/res/drawable-hdpi/status_lock_open.png
Normal file
After Width: | Height: | Size: 675 B |
After Width: | Height: | Size: 789 B |
After Width: | Height: | Size: 444 B |
After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 740 B |
After Width: | Height: | Size: 813 B |
After Width: | Height: | Size: 695 B |
BIN
k9mail/src/main/res/drawable-mdpi/status_lock_closed.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
k9mail/src/main/res/drawable-mdpi/status_lock_error.png
Normal file
After Width: | Height: | Size: 622 B |
BIN
k9mail/src/main/res/drawable-mdpi/status_lock_open.png
Normal file
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 643 B |
After Width: | Height: | Size: 410 B |
After Width: | Height: | Size: 685 B |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 667 B |
After Width: | Height: | Size: 557 B |
BIN
k9mail/src/main/res/drawable-xhdpi/status_lock_closed.png
Normal file
After Width: | Height: | Size: 911 B |
BIN
k9mail/src/main/res/drawable-xhdpi/status_lock_error.png
Normal file
After Width: | Height: | Size: 1008 B |
BIN
k9mail/src/main/res/drawable-xhdpi/status_lock_open.png
Normal file
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1017 B |
BIN
k9mail/src/main/res/drawable-xxhdpi/status_lock_closed.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
k9mail/src/main/res/drawable-xxhdpi/status_lock_error.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
k9mail/src/main/res/drawable-xxhdpi/status_lock_open.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 694 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
@ -250,6 +250,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/message_view_openpgp_layout"/>
|
||||
<include layout="@layout/message_view_openpgp_layout_old"/>
|
||||
|
||||
</com.fsck.k9.view.MessageHeader>
|
||||
|
@ -3,71 +3,195 @@
|
||||
android:id="@+id/layout_decrypt_openpgp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" >
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.00"
|
||||
android:orientation="vertical"
|
||||
android:padding="2dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openpgp_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimaryInverse"
|
||||
android:textIsSelectable="false" />
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/openpgp_signature_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp"
|
||||
android:visibility="gone" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/openpgp_signature_layout_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openpgp_signature"
|
||||
android:id="@+id/result_encryption_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/signed_large" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openpgp_signature_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/overlay_error" />
|
||||
</RelativeLayout>
|
||||
android:src="@drawable/status_lock_open"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openpgp_user_id"
|
||||
android:id="@+id/result_encryption_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/openpgp_signature_layout_image"
|
||||
android:ellipsize="end"
|
||||
android:paddingLeft="5dip"
|
||||
android:text="@string/openpgp_user_id"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimaryInverse" />
|
||||
</RelativeLayout>
|
||||
android:text="Not Encrypted (set in-code)"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/result_signature_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/status_signature_unverified_cutout"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_signature_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="Signed by (set in-code)"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/result_signature_divider1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/result_signature_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:clickable="true"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:paddingRight="4dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="4dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_signature_name"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Alice (set in-code)" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_signature_email"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="alice@example.com (set in-code)"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dip"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="right"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/result_signature_action"
|
||||
android:paddingLeft="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Show"
|
||||
android:drawablePadding="8dp"
|
||||
android:gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/result_signature_divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1"-->
|
||||
<!--android:orientation="vertical"-->
|
||||
<!--android:padding="2dp">-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/openpgp_text"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_gravity="center_vertical"-->
|
||||
<!--android:ellipsize="end"-->
|
||||
<!--android:gravity="center"-->
|
||||
<!--android:maxLines="1"-->
|
||||
<!--android:padding="2dp"-->
|
||||
<!--android:singleLine="true"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceSmall"-->
|
||||
<!--android:textColor="?android:textColorPrimaryInverse"-->
|
||||
<!--android:textIsSelectable="false" />-->
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:id="@+id/openpgp_signature_layout"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:gravity="center_vertical"-->
|
||||
<!--android:orientation="horizontal"-->
|
||||
<!--android:padding="2dp"-->
|
||||
<!--android:visibility="gone">-->
|
||||
|
||||
<!--<RelativeLayout-->
|
||||
<!--android:id="@+id/openpgp_signature_layout_image"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:id="@+id/openpgp_signature"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:src="@drawable/signed_large" />-->
|
||||
|
||||
<!--<ImageView-->
|
||||
<!--android:id="@+id/openpgp_signature_status"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:src="@drawable/overlay_error" />-->
|
||||
<!--</RelativeLayout>-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/openpgp_user_id"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_centerVertical="true"-->
|
||||
<!--android:layout_toRightOf="@+id/openpgp_signature_layout_image"-->
|
||||
<!--android:ellipsize="end"-->
|
||||
<!--android:paddingLeft="5dip"-->
|
||||
<!--android:text="@string/openpgp_user_id"-->
|
||||
<!--android:textAppearance="?android:attr/textAppearanceMedium"-->
|
||||
<!--android:textColor="?android:textColorPrimaryInverse" />-->
|
||||
<!--</RelativeLayout>-->
|
||||
<!--</LinearLayout>-->
|
||||
|
||||
<Button
|
||||
android:id="@+id/openpgp_get_key"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
@ -79,13 +203,4 @@
|
||||
android:text="@string/openpgp_get_key"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/openpgp_progress"
|
||||
style="?android:attr/progressBarStyleSmallInverse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.fsck.k9.ui.messageview.MessageOpenPgpView>
|
||||
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.fsck.k9.ui.messageview.MessageOpenPgpViewOld xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout_decrypt_openpgp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.00"
|
||||
android:orientation="vertical"
|
||||
android:padding="2dp" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openpgp_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="2dp"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:textColorPrimaryInverse"
|
||||
android:textIsSelectable="false" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/openpgp_signature_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp"
|
||||
android:visibility="gone" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/openpgp_signature_layout_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openpgp_signature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/signed_large" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openpgp_signature_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/overlay_error" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openpgp_user_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/openpgp_signature_layout_image"
|
||||
android:ellipsize="end"
|
||||
android:paddingLeft="5dip"
|
||||
android:text="@string/openpgp_user_id"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimaryInverse" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/openpgp_get_key"
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@+id/openpgp_signature_layout_image"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/openpgp_get_key"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/openpgp_progress"
|
||||
style="?android:attr/progressBarStyleSmallInverse"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</com.fsck.k9.ui.messageview.MessageOpenPgpViewOld>
|
@ -6,4 +6,5 @@
|
||||
<color name="openpgp_orange">#FF8800</color>
|
||||
<color name="openpgp_green">#669900</color>
|
||||
<color name="openpgp_blue">#336699</color>
|
||||
<color name="openpgp_blue">#336699</color>
|
||||
</resources>
|
||||
|