diff options
188 files changed, 3008 insertions, 4070 deletions
diff --git a/art/md_switch_thumb_disable.svg b/art/md_switch_thumb_disable.svg deleted file mode 100644 index 6639218fa..000000000 --- a/art/md_switch_thumb_disable.svg +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" - xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="md_switch_thumb_disable_centered_square.svg" viewBox="0 0 120 120" - height="120" width="120" inkscape:version="0.91 r13725" version="1.1" id="svg2"> - <metadata id="metadata8"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs id="defs6"> - <linearGradient inkscape:collect="always" id="linearGradient4222"> - <stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop4224" /> - <stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop4226" /> - </linearGradient> - <linearGradient id="linearGradient4179" osb:paint="gradient"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop4181" /> - <stop style="stop-color:#ffffff;stop-opacity:0.25454545" offset="1" id="stop4183" /> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient4222" - id="linearGradient4228" x1="159.38722" y1="19.802504" x2="212.27522" y2="19.802504" - gradientUnits="userSpaceOnUse" gradientTransform="translate(-260.32215,163.27594)" /> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4230" - x="-0.012" width="1.024" y="-0.012" height="1.024"> - <feGaussianBlur inkscape:collect="always" stdDeviation="0.25916904" - id="feGaussianBlur4232" /> - </filter> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4371" - x="-0.23999999" width="1.48" y="-0.23999999" height="1.48"> - <feGaussianBlur inkscape:collect="always" stdDeviation="5.2888" - id="feGaussianBlur4373" /> - </filter> - </defs> - <sodipodi:namedview inkscape:current-layer="layer2" inkscape:window-maximized="1" - inkscape:window-y="0" inkscape:window-x="1400" inkscape:cy="61.379767" - inkscape:cx="10.572032" inkscape:zoom="3.8530612" showgrid="false" id="namedview4" - inkscape:window-height="1024" inkscape:window-width="1680" inkscape:pageshadow="2" - inkscape:pageopacity="0" guidetolerance="10" gridtolerance="10" objecttolerance="10" - borderopacity="1" bordercolor="#666666" pagecolor="#ffffff" /> - <g inkscape:groupmode="layer" id="layer1" inkscape:label="PNG" style="display:none" - sodipodi:insensitive="true" transform="translate(0,-2.5)" /> - <g inkscape:groupmode="layer" id="layer2" inkscape:label="SVG" style="display:inline" - transform="translate(0,-2.5)"> - <g id="g6404"> - <circle - style="opacity:1;fill:#000404;fill-opacity:0.45531915;stroke:none;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4371)" - id="circle4234" cx="59.999996" cy="66.499878" r="26.444" /> - <g transform="translate(3.3103058e-6,0.33229253)" id="g4148"> - <circle - style="opacity:1;fill:#bdbdbd;fill-opacity:1;stroke:#bdbdbd;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="path4218" cx="59.999996" cy="62.167587" r="25.916904" /> - <circle r="25.916904" cy="183.07845" cx="-74.490921" id="circle4220" - style="opacity:0.3;fill:none;fill-opacity:1;stroke:url(#linearGradient4228);stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4230)" - transform="matrix(0,-1,1,0,-123.07845,-12.323334)" /> - </g> - </g> - </g> -</svg> diff --git a/art/md_switch_thumb_off_normal.svg b/art/md_switch_thumb_off_normal.svg deleted file mode 100644 index 9c86e37d3..000000000 --- a/art/md_switch_thumb_off_normal.svg +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" - xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="md_switch_thumb_off_normal_centered.svg" viewBox="0 0 120 120" height="120" - width="120" inkscape:version="0.91 r13725" version="1.1" id="svg2"> - <metadata id="metadata8"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs id="defs6"> - <linearGradient inkscape:collect="always" id="linearGradient4222"> - <stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop4224" /> - <stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop4226" /> - </linearGradient> - <linearGradient id="linearGradient4179" osb:paint="gradient"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop4181" /> - <stop style="stop-color:#ffffff;stop-opacity:0.25454545" offset="1" id="stop4183" /> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient4222" - id="linearGradient4228" x1="159.38722" y1="19.802504" x2="212.27522" y2="19.802504" - gradientUnits="userSpaceOnUse" gradientTransform="translate(-260.32215,163.27594)" /> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4230" - x="-0.012" width="1.024" y="-0.012" height="1.024"> - <feGaussianBlur inkscape:collect="always" stdDeviation="0.25916904" - id="feGaussianBlur4232" /> - </filter> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4371" - x="-0.23999999" width="1.48" y="-0.23999999" height="1.48"> - <feGaussianBlur inkscape:collect="always" stdDeviation="5.2888" - id="feGaussianBlur4373" /> - </filter> - </defs> - <sodipodi:namedview inkscape:current-layer="layer2" inkscape:window-maximized="1" - inkscape:window-y="0" inkscape:window-x="1400" inkscape:cy="61.379767" - inkscape:cx="10.052965" inkscape:zoom="3.8530612" showgrid="false" id="namedview4" - inkscape:window-height="1024" inkscape:window-width="1680" inkscape:pageshadow="2" - inkscape:pageopacity="0" guidetolerance="10" gridtolerance="10" objecttolerance="10" - borderopacity="1" bordercolor="#666666" pagecolor="#ffffff" /> - <g inkscape:groupmode="layer" id="layer1" inkscape:label="PNG" style="display:none" - sodipodi:insensitive="true" transform="translate(0,-2.5)" /> - <g inkscape:groupmode="layer" id="layer2" inkscape:label="SVG" style="display:inline" - transform="translate(0,-2.5)"> - <circle r="26.444" cy="66.5" cx="59.999996" id="circle4234" - style="opacity:1;fill:#000404;fill-opacity:0.45531915;stroke:none;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4371)" /> - <g id="g6390" transform="translate(3.3103058e-6,-0.91758577)"> - <circle r="25.916904" cy="63.417587" cx="59.999996" id="path4218" - style="opacity:1;fill:#fafafa;fill-opacity:1;stroke:#fafafa;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <circle transform="matrix(0,-1,1,0,-123.07845,-11.073334)" - style="opacity:0.3;fill:none;fill-opacity:1;stroke:url(#linearGradient4228);stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4230)" - id="circle4220" cx="-74.490921" cy="183.07845" r="25.916904" /> - </g> - </g> -</svg> diff --git a/art/md_switch_thumb_off_pressed.svg b/art/md_switch_thumb_off_pressed.svg deleted file mode 100644 index fecb6bc2d..000000000 --- a/art/md_switch_thumb_off_pressed.svg +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" - xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="md_switch_thumb_off_pressed_centered.svg" viewBox="0 0 120 120" height="120" - width="120" inkscape:version="0.91 r13725" version="1.1" id="svg2"> - <metadata id="metadata8"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs id="defs6"> - <linearGradient inkscape:collect="always" id="linearGradient4222"> - <stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop4224" /> - <stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop4226" /> - </linearGradient> - <linearGradient id="linearGradient4179" osb:paint="gradient"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop4181" /> - <stop style="stop-color:#ffffff;stop-opacity:0.25454545" offset="1" id="stop4183" /> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient4222" - id="linearGradient4228" x1="159.38722" y1="19.802504" x2="212.27522" y2="19.802504" - gradientUnits="userSpaceOnUse" gradientTransform="translate(-260.32215,163.27594)" /> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4230" - x="-0.012" width="1.024" y="-0.012" height="1.024"> - <feGaussianBlur inkscape:collect="always" stdDeviation="0.25916904" - id="feGaussianBlur4232" /> - </filter> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4371" - x="-0.23999999" width="1.48" y="-0.23999999" height="1.48"> - <feGaussianBlur inkscape:collect="always" stdDeviation="5.2888" - id="feGaussianBlur4373" /> - </filter> - </defs> - <sodipodi:namedview inkscape:current-layer="layer2" inkscape:window-maximized="1" - inkscape:window-y="0" inkscape:window-x="1400" inkscape:cy="61.379767" - inkscape:cx="10.572032" inkscape:zoom="3.8530612" showgrid="false" id="namedview4" - inkscape:window-height="1024" inkscape:window-width="1680" inkscape:pageshadow="2" - inkscape:pageopacity="0" guidetolerance="10" gridtolerance="10" objecttolerance="10" - borderopacity="1" bordercolor="#666666" pagecolor="#ffffff" /> - <g inkscape:groupmode="layer" id="layer1" inkscape:label="PNG" style="display:none" - sodipodi:insensitive="true" transform="translate(0,-2.5)" /> - <g inkscape:groupmode="layer" id="layer2" inkscape:label="SVG" style="display:inline" - transform="translate(0,-2.5)"> - <circle - style="opacity:1;fill:#313131;fill-opacity:0.10196078;fill-rule:nonzero;stroke:none;stroke-width:1.00100005;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.10196078" - id="path4819" cx="60" cy="62.5" r="60" /> - <circle r="26.444" cy="66.5" cx="59.999996" id="circle4234" - style="opacity:1;fill:#000404;fill-opacity:0.45531915;stroke:none;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4371)" /> - <g id="g6417" transform="translate(3.3103058e-6,-0.91758577)"> - <circle r="25.916904" cy="63.417587" cx="59.999996" id="path4218" - style="opacity:1;fill:#fafafa;fill-opacity:1;stroke:#fafafa;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <circle transform="matrix(0,-1,1,0,-123.07845,-11.073334)" - style="opacity:0.3;fill:none;fill-opacity:1;stroke:url(#linearGradient4228);stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4230)" - id="circle4220" cx="-74.490921" cy="183.07845" r="25.916904" /> - </g> - </g> -</svg> diff --git a/art/md_switch_thumb_on_normal.svg b/art/md_switch_thumb_on_normal.svg deleted file mode 100644 index 8b66115e2..000000000 --- a/art/md_switch_thumb_on_normal.svg +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" - xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="md_switch_thumb_on_normal_centered_square.svg" viewBox="0 0 120 120" - height="120" width="120" inkscape:version="0.91 r13725" version="1.1" id="svg2"> - <metadata id="metadata8"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs id="defs6"> - <linearGradient inkscape:collect="always" id="linearGradient4222"> - <stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop4224" /> - <stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop4226" /> - </linearGradient> - <linearGradient id="linearGradient4179" osb:paint="gradient"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop4181" /> - <stop style="stop-color:#ffffff;stop-opacity:0.25454545" offset="1" id="stop4183" /> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient4222" - id="linearGradient4228" x1="159.38722" y1="19.802504" x2="212.27522" y2="19.802504" - gradientUnits="userSpaceOnUse" gradientTransform="translate(-260.32215,163.27594)" /> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4230" - x="-0.012" width="1.024" y="-0.012" height="1.024"> - <feGaussianBlur inkscape:collect="always" stdDeviation="0.25916904" - id="feGaussianBlur4232" /> - </filter> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4371" - x="-0.23999999" width="1.48" y="-0.23999999" height="1.48"> - <feGaussianBlur inkscape:collect="always" stdDeviation="5.2888" - id="feGaussianBlur4373" /> - </filter> - </defs> - <sodipodi:namedview inkscape:current-layer="layer2" inkscape:window-maximized="1" - inkscape:window-y="0" inkscape:window-x="1400" inkscape:cy="61.379767" - inkscape:cx="-14.397519" inkscape:zoom="3.8530612" showgrid="false" id="namedview4" - inkscape:window-height="1024" inkscape:window-width="1680" inkscape:pageshadow="2" - inkscape:pageopacity="0" guidetolerance="10" gridtolerance="10" objecttolerance="10" - borderopacity="1" bordercolor="#666666" pagecolor="#ffffff" /> - <g inkscape:groupmode="layer" id="layer2" inkscape:label="SVG" style="display:inline" - transform="translate(0,-2.5)"> - <circle r="26.444" cy="66.499878" cx="59.999996" id="circle4234" - style="opacity:1;fill:#000404;fill-opacity:0.45531915;stroke:none;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4371)" /> - <g id="g6440" transform="translate(3.3103058e-6,0.33241423)"> - <circle r="25.916904" cy="62.167587" cx="59.999996" id="path4218" - style="opacity:1;fill:#0091ea;fill-opacity:1;stroke:#0091ea;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - <circle transform="matrix(0,-1,1,0,-123.07845,-12.323334)" - style="opacity:0.3;fill:none;fill-opacity:1;stroke:url(#linearGradient4228);stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4230)" - id="circle4220" cx="-74.490921" cy="183.07845" r="25.916904" /> - </g> - </g> -</svg> diff --git a/art/md_switch_thumb_on_pressed.svg b/art/md_switch_thumb_on_pressed.svg deleted file mode 100644 index 90d14cbe4..000000000 --- a/art/md_switch_thumb_on_pressed.svg +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg xmlns:osb="http://www.openswatchbook.org/uri/2009/osb" - xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="md_switch_thumb_on_pressed_centered_square.svg" viewBox="0 0 120 120" - height="120" width="120" inkscape:version="0.91 r13725" version="1.1" id="svg2"> - <metadata id="metadata8"> - <rdf:RDF> - <cc:Work rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> - </cc:Work> - </rdf:RDF> - </metadata> - <defs id="defs6"> - <linearGradient inkscape:collect="always" id="linearGradient4222"> - <stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop4224" /> - <stop style="stop-color:#ffffff;stop-opacity:1" offset="1" id="stop4226" /> - </linearGradient> - <linearGradient id="linearGradient4179" osb:paint="gradient"> - <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop4181" /> - <stop style="stop-color:#ffffff;stop-opacity:0.25454545" offset="1" id="stop4183" /> - </linearGradient> - <linearGradient inkscape:collect="always" xlink:href="#linearGradient4222" - id="linearGradient4228" x1="159.38722" y1="19.802504" x2="212.27522" y2="19.802504" - gradientUnits="userSpaceOnUse" gradientTransform="translate(-260.32215,163.27594)" /> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4230" - x="-0.012" width="1.024" y="-0.012" height="1.024"> - <feGaussianBlur inkscape:collect="always" stdDeviation="0.25916904" - id="feGaussianBlur4232" /> - </filter> - <filter inkscape:collect="always" style="color-interpolation-filters:sRGB" id="filter4371" - x="-0.23999999" width="1.48" y="-0.23999999" height="1.48"> - <feGaussianBlur inkscape:collect="always" stdDeviation="5.2888" - id="feGaussianBlur4373" /> - </filter> - </defs> - <sodipodi:namedview inkscape:current-layer="layer2" inkscape:window-maximized="1" - inkscape:window-y="0" inkscape:window-x="1400" inkscape:cy="61.379767" - inkscape:cx="-46.31369" inkscape:zoom="3.8530612" showgrid="false" id="namedview4" - inkscape:window-height="1024" inkscape:window-width="1680" inkscape:pageshadow="2" - inkscape:pageopacity="0" guidetolerance="10" gridtolerance="10" objecttolerance="10" - borderopacity="1" bordercolor="#666666" pagecolor="#ffffff" /> - <g inkscape:groupmode="layer" id="layer1" inkscape:label="PNG" style="display:none" - sodipodi:insensitive="true" transform="translate(0,-2.5)" /> - <g inkscape:groupmode="layer" id="layer2" inkscape:label="SVG" style="display:inline" - transform="translate(0,-2.5)"> - <circle - style="opacity:1;fill:#0093e8;fill-opacity:0.10196078;fill-rule:nonzero;stroke:none;stroke-width:1.00100005;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.10196078" - id="path4819" cx="60" cy="62.5" r="60" /> - <g id="g4156"> - <circle - style="opacity:1;fill:#000404;fill-opacity:0.45531915;stroke:none;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4371)" - id="circle4234" cx="59.999996" cy="66.5" r="26.444" /> - <g transform="translate(3.3103058e-6,0.33241423)" id="g4149"> - <circle - style="opacity:1;fill:#0091ea;fill-opacity:1;stroke:#0091ea;stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" - id="path4218" cx="59.999996" cy="62.167587" r="25.916904" /> - <circle r="25.916904" cy="183.07845" cx="-74.490921" id="circle4220" - style="opacity:0.3;fill:none;fill-opacity:1;stroke:url(#linearGradient4228);stroke-width:1.05419147;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter4230)" - transform="matrix(0,-1,1,0,-123.07845,-12.323334)" /> - </g> - </g> - </g> -</svg> diff --git a/art/render.rb b/art/render.rb index 260c7dc24..6b075b1ec 100755 --- a/art/render.rb +++ b/art/render.rb @@ -43,11 +43,6 @@ images = { 'ic_send_picture_away.svg' => ['ic_send_picture_away', 36], 'ic_send_picture_dnd.svg' => ['ic_send_picture_dnd', 36], 'ic_verified_fingerprint.svg' => ['ic_verified_fingerprint', 36], - 'md_switch_thumb_disable.svg' => ['switch_thumb_disable', 48], - 'md_switch_thumb_off_normal.svg' => ['switch_thumb_off_normal', 48], - 'md_switch_thumb_off_pressed.svg' => ['switch_thumb_off_pressed', 48], - 'md_switch_thumb_on_normal.svg' => ['switch_thumb_on_normal', 48], - 'md_switch_thumb_on_pressed.svg' => ['switch_thumb_on_pressed', 48], 'message_bubble_received.svg' => ['message_bubble_received.9', 0], 'message_bubble_received_warning.svg' => ['message_bubble_received_warning.9', 0], 'message_bubble_received_white.svg' => ['message_bubble_received_white.9', 0], diff --git a/build.gradle b/build.gradle index 14e0b9704..7b5f18abe 100644 --- a/build.gradle +++ b/build.gradle @@ -30,42 +30,45 @@ allprojects { } configurations { - standardPushCompile + standardPushimplementation } ext { - supportLibVersion = '27.0.2' + supportLibVersion = '27.1.0' } dependencies { - compile project(':libs:MemorizingTrustManager') - compile project(':libs:android-transcoder') - standardPushCompile 'com.google.android.gms:play-services-gcm:11.8.0' - compile 'org.sufficientlysecure:openpgp-api:10.0' - compile 'com.soundcloud.android:android-crop:1.0.1@aar' - compile 'org.bouncycastle:bcmail-jdk15on:1.58' - compile 'org.jitsi:org.otr4j:0.22' - compile 'org.gnu.inet:libidn:1.15' - compile 'com.google.zxing:core:3.3.0' - compile 'de.measite.minidns:minidns-hla:0.2.4' - compile 'me.leolin:ShortcutBadger:1.1.21@aar' - compile 'com.kyleduo.switchbutton:library:1.2.8' - compile 'org.whispersystems:signal-protocol-java:2.6.2' - compile 'com.makeramen:roundedimageview:2.3.0' - compile 'jetty:javax.servlet:5.1.12' - compile 'com.google.code.gson:gson:2.8.0' - compile 'com.android.support:multidex:1.0.2' - compile "com.android.support:support-v13:$supportLibVersion" - compile "com.android.support:appcompat-v7:$supportLibVersion" - compile "com.android.support:support-v4:$supportLibVersion" - compile "com.android.support:support-emoji:$supportLibVersion" - compile "com.android.support:support-emoji-bundled:$supportLibVersion" - compile 'com.github.bumptech.glide:glide:3.8.0' - compile 'com.github.chrisbanes:PhotoView:2.0.0' - compile 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.3' - compile 'pub.devrel:easypermissions:1.1.3' - compile 'com.wefika:flowlayout:0.4.1' - compile 'com.googlecode.ez-vcard:ez-vcard:0.10.3' + implementation project(':libs:android-transcoder') + standardPushimplementation 'com.google.android.gms:play-services-gcm:11.8.0' + implementation 'org.sufficientlysecure:openpgp-api:10.0' + implementation 'com.soundcloud.android:android-crop:1.0.1@aar' + implementation 'org.bouncycastle:bcmail-jdk15on:1.58' + implementation 'org.jitsi:org.otr4j:0.22' + implementation 'org.gnu.inet:libidn:1.15' + implementation 'com.google.zxing:core:3.3.0' + implementation 'de.measite.minidns:minidns-hla:0.2.4' + implementation 'me.leolin:ShortcutBadger:1.1.21@aar' + implementation 'com.kyleduo.switchbutton:library:1.2.8' + implementation 'org.whispersystems:signal-protocol-java:2.6.2' + implementation 'com.makeramen:roundedimageview:2.3.0' + implementation 'jetty:javax.servlet:5.1.12' + implementation 'com.google.code.gson:gson:2.8.0' + implementation 'com.android.support:multidex:1.0.3' + implementation "com.android.support:support-v13:$supportLibVersion" + implementation "com.android.support:appcompat-v7:$supportLibVersion" + implementation "com.android.support:support-v4:$supportLibVersion" + implementation "com.android.support:support-emoji:$supportLibVersion" + implementation "com.android.support:support-emoji-bundled:$supportLibVersion" + implementation "com.android.support:support-emoji-appcompat:$supportLibVersion" + implementation "com.android.support:exifinterface:$supportLibVersion" + implementation "com.android.support:design:$supportLibVersion" + implementation "com.android.support:cardview-v7:$supportLibVersion" + implementation 'com.github.bumptech.glide:glide:3.8.0' + implementation 'com.github.chrisbanes:PhotoView:2.0.0' + implementation 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.3' + implementation 'pub.devrel:easypermissions:1.1.3' + implementation 'com.wefika:flowlayout:0.4.1' + implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.3' } ext { @@ -82,8 +85,8 @@ android { minSdkVersion 16 targetSdkVersion 25 - versionCode 218 - versionName "1.21.3" + versionCode 219 + versionName "2.0.0" archivesBaseName += "-$versionName" applicationId "de.pixart.messenger" @@ -93,6 +96,10 @@ android { dimension "distribution" } + dataBinding { + enabled true + } + dexOptions { // Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false. preDexLibraries = preDexEnabled && !travisBuild diff --git a/libs/MemorizingTrustManager/.gitignore b/libs/MemorizingTrustManager/.gitignore deleted file mode 100644 index c642de10f..000000000 --- a/libs/MemorizingTrustManager/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -bin -build -gen -local.properties -example/bin -example/gen -tags -.project -.classpath -.gradle -.*.swp diff --git a/libs/MemorizingTrustManager/AndroidManifest.xml b/libs/MemorizingTrustManager/AndroidManifest.xml deleted file mode 100644 index 4d3a2b41c..000000000 --- a/libs/MemorizingTrustManager/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="de.duenndns.ssl" - android:versionCode="1" - android:versionName="1.0"> - - <application android:label="MemorizingTrustManager"> - <activity - android:name="de.duenndns.ssl.MemorizingActivity" - android:theme="@android:style/Theme.Translucent.NoTitleBar" /> - </application> -</manifest> diff --git a/libs/MemorizingTrustManager/LICENSE.txt b/libs/MemorizingTrustManager/LICENSE.txt deleted file mode 100644 index 25012507a..000000000 --- a/libs/MemorizingTrustManager/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT license. - -Copyright (c) 2010 Georg Lukas <georg@op-co.de> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/libs/MemorizingTrustManager/README.mdwn b/libs/MemorizingTrustManager/README.mdwn deleted file mode 100644 index c48f38de3..000000000 --- a/libs/MemorizingTrustManager/README.mdwn +++ /dev/null @@ -1,125 +0,0 @@ -# MemorizingTrustManager - Private Cloud Support for Your App - -MemorizingTrustManager (MTM) is a project to enable smarter and more secure use -of SSL on Android. If it encounters an unknown SSL certificate, it asks the -user whether to accept the certificate once, permanently or to abort the -connection. This is a step in preventing man-in-the-middle attacks by blindly -accepting any invalid, self-signed and/or expired certificates. - -MTM is aimed at providing seamless integration into your Android application, -and the source code is available under the MIT license. - -## Screenshots - -![MemorizingTrustManager dialog](mtm-screenshot.png) -![MemorizingTrustManager notification](mtm-notification.png) -![MemorizingTrustManager server name dialog](mtm-servername.png) - -## Status - -MemorizingTrustManager is in production use in the -[yaxim XMPP client](https://yaxim.org/). It is usable and easy to integrate, -though it does not yet support hostname validation (the Java API makes it -**hard** to integrate). - -## Integration - -MTM is easy to integrate into your own application. Follow these steps or have -a look into the demo application in the `example` directory. - -### 1. Add MTM to your project - -Download the MTM source from GitHub, or add it as a -[git submodule](http://git-scm.com/docs/git-submodule): - - # plain download: - git clone https://github.com/ge0rg/MemorizingTrustManager - # submodule: - git submodule add https://github.com/ge0rg/MemorizingTrustManager - -Then add a library project dependency to `default.properties`: - - android.library.reference.1=MemorizingTrustManager - -### 2. Add the MTM (popup) Activity to your manifest - -Edit your `AndroidManifest.xml` and add the MTM activity element right before the -end of your closing `</application>` tag. - - ... - <activity android:name="de.duenndns.ssl.MemorizingActivity" - android:theme="@android:style/Theme.Translucent.NoTitleBar" - /> - </application> - </manifest> - -### 3. Hook MTM as the default TrustManager for your connection type - -Hooking MemorizingTrustmanager in HTTPS connections: - - // register MemorizingTrustManager for HTTPS - SSLContext sc = SSLContext.getInstance("TLS"); - MemorizingTrustManager mtm = new MemorizingTrustManager(this); - sc.init(null, new X509TrustManager[] { mtm }, new java.security.SecureRandom()); - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); - HttpsURLConnection.setDefaultHostnameVerifier( - mtm.wrapHostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier())); - - -Or, for aSmack you can use `setCustomSSLContext()`: - - org.jivesoftware.smack.ConnectionConfiguration connectionConfiguration = … - SSLContext sc = SSLContext.getInstance("TLS"); - MemorizingTrustManager mtm = new MemorizingTrustManager(this); - sc.init(null, new X509TrustManager[] { mtm }, new java.security.SecureRandom()); - connectionConfiguration.setCustomSSLContext(sc); - connectionConfiguration.setHostnameVerifier( - mtm.wrapHostnameVerifier(new org.apache.http.conn.ssl.StrictHostnameVerifier())); - -By default, MTM falls back to the system `TrustManager` before asking the user. -If you do not trust the establishment, you can enforce a dialog on *every new -connection* by supplying a `defaultTrustManager = null` parameter to the -constructor: - - MemorizingTrustManager mtm = new MemorizingTrustManager(this, null); - -If you want to use a different underlying `TrustManager`, like -[AndroidPinning](https://github.com/moxie0/AndroidPinning), just supply that to -MTM's constructor: - - X509TrustManager pinning = new PinningTrustManager(SystemKeyStore.getInstance(), - new String[] {"f30012bbc18c231ac1a44b788e410ce754182513"}, 0); - MemorizingTrustManager mtm = new MemorizingTrustManager(this, pinning); - -### 4. Profit! - -### Logging - -MTM uses java.util.logging (JUL) for logging purposes. If you have not -configured a Handler for JUL, then Android will by default log all -messages of Level.INFO or higher. In order to get also the debug log -messages (those with Level.FINE or lower) you need to configure a -Handler accordingly. The MTM example project contains -de.duenndns.mtmexample.JULHandler, which allows to enable and disable -debug logging at runtime. - -## Alternatives - -MemorizingTrustManager is not the only one out there. - -[**NetCipher**](https://guardianproject.info/code/netcipher/) is an Android -library made by the [Guardian Project](https://guardianproject.info/) to -improve network security for mobile apps. It comes with a StrongTrustManager -to do more thorough certificate checks, an independent Root CA store, and code -to easily route your traffic through -[the Tor network](https://www.torproject.org/) using [Orbot](https://guardianproject.info/apps/orbot/). - -[**AndroidPinning**](https://github.com/moxie0/AndroidPinning) is another Android -library, written by [Moxie Marlinspike](http://www.thoughtcrime.org/) to allow -pinning of server certificates, improving security against government-scale -MitM attacks. Use this if your app is made to communicate with a specific -server! - -## Contribute - -Please [help translating MTM into more languages](https://translations.launchpad.net/yaxim/master/+pots/mtm/)! diff --git a/libs/MemorizingTrustManager/ant.properties b/libs/MemorizingTrustManager/ant.properties deleted file mode 100644 index 21ef4e321..000000000 --- a/libs/MemorizingTrustManager/ant.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is used to override default values used by the Ant build system. -# -# This file must be checked in Version Control Systems, as it is -# integral to the build system of your project. -# This file is only used by the Ant script. -# You can use this to override default values such as -# 'source.dir' for the location of your java source folder and -# 'out.dir' for the location of your output folder. -# You can also use it define how the release builds are signed by declaring -# the following properties: -# 'key.store' for the location of your keystore and -# 'key.alias' for the name of the key to use. -# The password will be asked during the build when you use the 'release' target. - diff --git a/libs/MemorizingTrustManager/build.gradle b/libs/MemorizingTrustManager/build.gradle deleted file mode 100644 index c45f09435..000000000 --- a/libs/MemorizingTrustManager/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -buildscript { - repositories { - mavenCentral() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' - } -} - -apply plugin: 'com.android.library' - -android { - compileSdkVersion 27 - buildToolsVersion "27.0.3" - defaultConfig { - minSdkVersion 14 - targetSdkVersion 26 - } - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } - } - -} diff --git a/libs/MemorizingTrustManager/build.xml b/libs/MemorizingTrustManager/build.xml deleted file mode 100644 index 15b0b0104..000000000 --- a/libs/MemorizingTrustManager/build.xml +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="MemorizingTrustManager" default="help"> - - <!-- The local.properties file is created and updated by the 'android' tool. - It contains the path to the SDK. It should *NOT* be checked into - Version Control Systems. --> - <property file="local.properties" /> - - <!-- The ant.properties file can be created by you. It is only edited by the - 'android' tool to add properties to it. - This is the place to change some Ant specific build properties. - Here are some properties you may want to change/update: - - source.dir - The name of the source directory. Default is 'src'. - out.dir - The name of the output directory. Default is 'bin'. - - For other overridable properties, look at the beginning of the rules - files in the SDK, at tools/ant/build.xml - - Properties related to the SDK location or the project target should - be updated using the 'android' tool with the 'update' action. - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. - - --> - <property file="ant.properties" /> - - <!-- if sdk.dir was not set from one of the property file, then - get it from the ANDROID_HOME env var. - This must be done before we load project.properties since - the proguard config can use sdk.dir --> - <property environment="env" /> - <condition property="sdk.dir" value="${env.ANDROID_HOME}"> - <isset property="env.ANDROID_HOME" /> - </condition> - - <!-- The project.properties file is created and updated by the 'android' - tool, as well as ADT. - - This contains project specific properties such as project target, and library - dependencies. Lower level build properties are stored in ant.properties - (or in .classpath for Eclipse projects). - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. --> - <loadproperties srcFile="project.properties" /> - - <!-- quick check on sdk.dir --> - <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable." - unless="sdk.dir" /> - - <!-- - Import per project custom build rules if present at the root of the project. - This is the place to put custom intermediary targets such as: - -pre-build - -pre-compile - -post-compile (This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir}) - -post-package - -post-build - -pre-clean - --> - <import file="custom_rules.xml" optional="true" /> - - <!-- Import the actual build file. - - To customize existing targets, there are two options: - - Customize only one target: - - copy/paste the target into this file, *before* the - <import> task. - - customize it to your needs. - - Customize the whole content of build.xml - - copy/paste the content of the rules files (minus the top node) - into this file, replacing the <import> task. - - customize to your needs. - - *********************** - ****** IMPORTANT ****** - *********************** - In all cases you must update the value of version-tag below to read 'custom' instead of an integer, - in order to avoid having your file be overridden by tools such as "android update project" - --> - <!-- version-tag: 1 --> - <import file="${sdk.dir}/tools/ant/build.xml" /> - -</project> diff --git a/libs/MemorizingTrustManager/libs/.android_sucks b/libs/MemorizingTrustManager/libs/.android_sucks deleted file mode 100644 index e69de29bb..000000000 --- a/libs/MemorizingTrustManager/libs/.android_sucks +++ /dev/null diff --git a/libs/MemorizingTrustManager/mtm-notification.png b/libs/MemorizingTrustManager/mtm-notification.png Binary files differdeleted file mode 100644 index 20ff61488..000000000 --- a/libs/MemorizingTrustManager/mtm-notification.png +++ /dev/null diff --git a/libs/MemorizingTrustManager/mtm-screenshot.png b/libs/MemorizingTrustManager/mtm-screenshot.png Binary files differdeleted file mode 100644 index 96db9e4ee..000000000 --- a/libs/MemorizingTrustManager/mtm-screenshot.png +++ /dev/null diff --git a/libs/MemorizingTrustManager/mtm-servername.png b/libs/MemorizingTrustManager/mtm-servername.png Binary files differdeleted file mode 100644 index 2d76c4e4e..000000000 --- a/libs/MemorizingTrustManager/mtm-servername.png +++ /dev/null diff --git a/libs/MemorizingTrustManager/proguard-project.txt b/libs/MemorizingTrustManager/proguard-project.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/libs/MemorizingTrustManager/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/libs/MemorizingTrustManager/project.properties b/libs/MemorizingTrustManager/project.properties deleted file mode 100644 index 7c444cd57..000000000 --- a/libs/MemorizingTrustManager/project.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. -android.library=true -# Project target. -target=android-19 diff --git a/libs/MemorizingTrustManager/res/values-de/strings.xml b/libs/MemorizingTrustManager/res/values-de/strings.xml deleted file mode 100644 index 17682209f..000000000 --- a/libs/MemorizingTrustManager/res/values-de/strings.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Unbekanntes Zertifikat akzeptieren?</string> - <string name="mtm_trust_anchor">Das Serverzertifikat stammt nicht von einer bekannten Ausstellungsstelle (CA).</string> - <string name="mtm_cert_expired">The server certificate is expired.</string> - <string name="mtm_accept_servername">Abweichenden Servernamen akzeptieren?</string> - <string name="mtm_hostname_mismatch">Der Server konnte sich nicht als \"%s\" ausweisen. Das Zertifikat gilt nur für:</string> - - <string name="mtm_connect_anyway">Verbindung trotzdem aufbauen?</string> - <string name="mtm_cert_details">Zertifikat-Details:</string> - - <string name="mtm_decision_always">Immer</string> - <string name="mtm_decision_once">Einmal</string> - <string name="mtm_decision_abort">Abbrechen</string> - - <string name="mtm_notification">Zertifikatsprüfung</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-es/strings.xml b/libs/MemorizingTrustManager/res/values-es/strings.xml deleted file mode 100644 index c989db3c4..000000000 --- a/libs/MemorizingTrustManager/res/values-es/strings.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">¿Aceptar certicado desconocido?</string> - <string name="mtm_trust_anchor">El certificado del servidor no está firmado por una Autoridad Conocida (CA).</string> - <string name="mtm_cert_expired">The server certificate is expired.</string> - <string name="mtm_accept_servername">¿Aceptar discordancia en nombre del servidor?</string> - <string name="mtm_hostname_mismatch">El servidor no ha podido autenticarte como \"%s\". El certificado es solo válido para:</string> - - <string name="mtm_connect_anyway">¿Quieres conectar de todas formas?</string> - <string name="mtm_cert_details">Detalle del certificado:</string> - - <string name="mtm_decision_always">Siempre</string> - <string name="mtm_decision_once">Una vez</string> - <string name="mtm_decision_abort">Abortar</string> - - <string name="mtm_notification">Verificación de Certificado</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-eu/strings.xml b/libs/MemorizingTrustManager/res/values-eu/strings.xml deleted file mode 100644 index 97e7c32af..000000000 --- a/libs/MemorizingTrustManager/res/values-eu/strings.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Ziurtagiri ezezaguna onartu?</string> - <string name="mtm_trust_anchor">Zerbitzariaren ziurtagiria ez dago Ziurtagiri-emaile Autoritate ezagun batez sinatuta.</string> - <string name="mtm_cert_expired">Zerbitzariaren ziurtagiria iraungi da.</string> - <string name="mtm_accept_servername">Zerbitzariaren izeneko desadostasuna onartu?</string> - <string name="mtm_hostname_mismatch">Zerbitzaria ezin izan da \"%s\" bezala autentifikatu. Ziurtagiria soilik honetarako baliagarria da:</string> - - <string name="mtm_connect_anyway">Konektatu hala ere?</string> - <string name="mtm_cert_details">Ziurtagiriaren xehetasunak:</string> - - <string name="mtm_decision_always">Beti</string> - <string name="mtm_decision_once">Behin</string> - <string name="mtm_decision_abort">Utzi</string> - - <string name="mtm_notification">Ziurtagiriaren egiaztapena</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-fi/strings.xml b/libs/MemorizingTrustManager/res/values-fi/strings.xml deleted file mode 100644 index 2dfe31ac9..000000000 --- a/libs/MemorizingTrustManager/res/values-fi/strings.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Hyväksytäänkö palvelimen antama tuntematon varmenne?</string> - <string name="mtm_trust_anchor">Palvelimen varmenne ei ole tunnetun varmentajan (CA) allekirjoittama.</string> - <string name="mtm_accept_servername">Sallitaanko palvelimen nimi, joka ei vastaa varmeenteessa olevaa nimeä?</string> - <string name="mtm_hostname_mismatch">Palvelimella ei ole varmennetta nimelle \"%s\". Varmenteen sisältämät nimet:</string> - - <string name="mtm_connect_anyway">Haluatko jatkaa yhteyden muodostamista?</string> - <string name="mtm_cert_details">Sertifikaatin tiedot:</string> - - <string name="mtm_decision_always">Aina</string> - <string name="mtm_decision_once">Kerran</string> - <string name="mtm_decision_abort">Keskeytä</string> - - <string name="mtm_notification">Varmenteen tarkistus</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-fr/strings.xml b/libs/MemorizingTrustManager/res/values-fr/strings.xml deleted file mode 100644 index db27c9afe..000000000 --- a/libs/MemorizingTrustManager/res/values-fr/strings.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Accept Unknown Certificate?</string> - <string name="mtm_trust_anchor">Le certificat du serveur n’est pas signé par une Autorité de Certification reconnue.</string> - <string name="mtm_accept_servername">Accept Mismatching Server Name?</string> - <string name="mtm_hostname_mismatch">Server could not authenticate as \"%s\". The certificate is only valid for:</string> - - <string name="mtm_connect_anyway">Do you want to connect anyway?</string> - <string name="mtm_cert_details">Détails du certificat :</string> - - <string name="mtm_decision_always">Toujours</string> - <string name="mtm_decision_once">Une seule fois</string> - <string name="mtm_decision_abort">Annuler</string> - - <string name="mtm_notification">Certificate Verification</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-no/strings.xml b/libs/MemorizingTrustManager/res/values-no/strings.xml deleted file mode 100644 index 8cf9614b6..000000000 --- a/libs/MemorizingTrustManager/res/values-no/strings.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Godta ukjent sertifikat?</string> - <string name="mtm_trust_anchor">Sertifikatet er ikke utstilt av en kjent utstiller (CA).</string> - <string name="mtm_accept_servername">Godta feil servernavn?</string> - <string name="mtm_hostname_mismatch">Serveren heter ikke \"%s\". Sertifikatet gjelder bare for: </string> - - <string name="mtm_connect_anyway">Vil du bruke serveren likevel?</string> - <string name="mtm_cert_details">Sertifikatdetaljer:</string> - - <string name="mtm_decision_always">Alltid</string> - <string name="mtm_decision_once">En gang</string> - <string name="mtm_decision_abort">Avbryt</string> - - <string name="mtm_notification">Sertifikat-sjekk</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values-v21/themes.xml b/libs/MemorizingTrustManager/res/values-v21/themes.xml deleted file mode 100644 index c2bd573f0..000000000 --- a/libs/MemorizingTrustManager/res/values-v21/themes.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <style name="ConversationsTheme" parent="@android:style/Theme.Material.Light.DarkActionBar" /> - <style name="ConversationsTheme.Dark" parent="android:Theme.Material" /> - -</resources>
\ No newline at end of file diff --git a/libs/MemorizingTrustManager/res/values/defaults.xml b/libs/MemorizingTrustManager/res/values/defaults.xml deleted file mode 100644 index 6fea62719..000000000 --- a/libs/MemorizingTrustManager/res/values/defaults.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="theme">light</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values/strings.xml b/libs/MemorizingTrustManager/res/values/strings.xml deleted file mode 100644 index c38628895..000000000 --- a/libs/MemorizingTrustManager/res/values/strings.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="mtm_accept_cert">Accept Unknown Certificate?</string> - <string name="mtm_trust_anchor">The server certificate is not signed by a known Certificate Authority.</string> - <string name="mtm_cert_expired">The server certificate is expired.</string> - <string name="mtm_accept_servername">Accept Mismatching Server Name?</string> - <string name="mtm_hostname_mismatch">Server could not authenticate as \"%s\". The certificate is only valid for:</string> - - <string name="mtm_connect_anyway">Do you want to connect anyway?</string> - <string name="mtm_cert_details">Certificate details:</string> - - <string name="mtm_decision_always">Always</string> - <string name="mtm_decision_once">Once</string> - <string name="mtm_decision_abort">Abort</string> - - <string name="mtm_notification">Certificate Verification</string> -</resources> diff --git a/libs/MemorizingTrustManager/res/values/themes.xml b/libs/MemorizingTrustManager/res/values/themes.xml deleted file mode 100644 index 2b0643154..000000000 --- a/libs/MemorizingTrustManager/res/values/themes.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <style name="ConversationsTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar" /> - <style name="ConversationsTheme.Dark" parent="@android:style/Theme.Holo" /> - -</resources>
\ No newline at end of file diff --git a/libs/MemorizingTrustManager/settings.gradle b/libs/MemorizingTrustManager/settings.gradle deleted file mode 100644 index ff1d046b1..000000000 --- a/libs/MemorizingTrustManager/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':example' diff --git a/settings.gradle b/settings.gradle index f58a52264..661e8c501 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,2 @@ -include ':libs:MemorizingTrustManager' include ':libs:android-transcoder' rootProject.name = 'Pix-Art Messenger' diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index b05b31976..961c4df2a 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -230,7 +230,7 @@ </activity> <activity android:name=".ui.ShowFullscreenMessageActivity" - android:theme="@android:style/Theme.NoTitleBar.Fullscreen" + android:theme="@style/ConversationsTheme.NoActionBar.FullScreen" android:configChanges="orientation|screenSize"> </activity> <activity @@ -238,16 +238,16 @@ android:label="@string/trust_omemo_fingerprints" android:windowSoftInputMode="stateAlwaysHidden" /> <activity - android:name="de.duenndns.ssl.MemorizingActivity" - android:theme="@style/ConversationsTheme" - tools:replace="android:theme" /> - <activity android:name=".ui.AboutActivity" android:label="@string/title_activity_about" android:parentActivityName=".ui.SettingsActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".ui.SettingsActivity" /> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.PREFERENCE" /> + </intent-filter> </activity> <activity android:name=".ui.UpdaterActivity" @@ -256,11 +256,8 @@ android:launchMode="singleTask" android:theme="@style/ConversationsTheme"> </activity> - <activity - android:name="com.soundcloud.android.crop.CropImageActivity"> - </activity> - - <service android:name=".services.UpdateService" /> + <activity android:name="com.soundcloud.android.crop.CropImageActivity" /> + <activity android:name=".ui.MemorizingActivity" /> <service android:name=".services.ExportLogsService" /> <service android:name=".services.ContactChooserTargetService" diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 8783e1c64..60f2410aa 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -114,6 +114,8 @@ public final class Config { public static final boolean X509_VERIFICATION = false; //use x509 certificates to verify OMEMO keys + public static final boolean ONLY_INTERNAL_STORAGE = false; //use internal storage instead of sdcard to save attachments + public static final boolean IGNORE_ID_REWRITE_IN_MUC = true; public static final long MAM_MAX_CATCHUP = MILLISECONDS_IN_DAY * 5; diff --git a/libs/MemorizingTrustManager/src/de/duenndns/ssl/DomainHostnameVerifier.java b/src/main/java/de/pixart/messenger/crypto/DomainHostnameVerifier.java index 62b625ab9..0ceb650f3 100644 --- a/libs/MemorizingTrustManager/src/de/duenndns/ssl/DomainHostnameVerifier.java +++ b/src/main/java/de/pixart/messenger/crypto/DomainHostnameVerifier.java @@ -1,4 +1,4 @@ -package de.duenndns.ssl; +package de.pixart.messenger.crypto; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; @@ -7,4 +7,4 @@ public interface DomainHostnameVerifier extends HostnameVerifier { boolean verify(String domain, String hostname, SSLSession sslSession); -} +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java b/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java index e811a0f39..3f3c358a7 100644 --- a/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java +++ b/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java @@ -25,8 +25,6 @@ import java.util.List; import javax.net.ssl.SSLSession; -import de.duenndns.ssl.DomainHostnameVerifier; - public class XmppDomainVerifier implements DomainHostnameVerifier { private static final String LOGTAG = "XmppDomainVerifier"; diff --git a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MTMDecision.java b/src/main/java/de/pixart/messenger/entities/MTMDecision.java index 2b84c3ee5..38cc4b578 100644 --- a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MTMDecision.java +++ b/src/main/java/de/pixart/messenger/entities/MTMDecision.java @@ -21,13 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package de.duenndns.ssl; +package de.pixart.messenger.entities; -class MTMDecision { - public final static int DECISION_INVALID = 0; - public final static int DECISION_ABORT = 1; - public final static int DECISION_ONCE = 2; - public final static int DECISION_ALWAYS = 3; +public class MTMDecision { + public final static int DECISION_INVALID = 0; + public final static int DECISION_ABORT = 1; + public final static int DECISION_ONCE = 2; + public final static int DECISION_ALWAYS = 3; - int state = DECISION_INVALID; -} + public int state = DECISION_INVALID; +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java index a6e46cb76..9bbf2191d 100644 --- a/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java +++ b/src/main/java/de/pixart/messenger/generator/PresenceGenerator.java @@ -57,7 +57,7 @@ public class PresenceGenerator extends AbstractGenerator { Element cap = packet.addChild("c", "http://jabber.org/protocol/caps"); cap.setAttribute("hash", "sha-1"); - cap.setAttribute("node", "http://conversations.im"); + cap.setAttribute("node", "http://jabber.pix-art.de"); cap.setAttribute("ver", capHash); } return packet; diff --git a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MemorizingTrustManager.java b/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java index a3aa561ef..d98e97a58 100644 --- a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MemorizingTrustManager.java +++ b/src/main/java/de/pixart/messenger/services/MemorizingTrustManager.java @@ -24,9 +24,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package de.duenndns.ssl; +package de.pixart.messenger.services; -import android.app.Activity; import android.app.Application; import android.app.NotificationManager; import android.app.Service; @@ -35,6 +34,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.preference.PreferenceManager; +import android.support.v7.app.AppCompatActivity; import android.util.Base64; import android.util.Log; import android.util.SparseArray; @@ -79,6 +79,11 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; +import de.pixart.messenger.R; +import de.pixart.messenger.crypto.DomainHostnameVerifier; +import de.pixart.messenger.entities.MTMDecision; +import de.pixart.messenger.ui.MemorizingActivity; + /** * A X509 trust manager implementation which asks the user about invalid * certificates and memorizes their decision. @@ -99,12 +104,12 @@ public class MemorizingTrustManager { private static final Pattern PATTERN_IPV6 = Pattern.compile("\\A(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\\z"); final static String DECISION_INTENT = "de.duenndns.ssl.DECISION"; - final static String DECISION_INTENT_ID = DECISION_INTENT + ".decisionId"; - final static String DECISION_INTENT_CERT = DECISION_INTENT + ".cert"; + public final static String DECISION_INTENT_ID = DECISION_INTENT + ".decisionId"; + public final static String DECISION_INTENT_CERT = DECISION_INTENT + ".cert"; final static String DECISION_INTENT_CHOICE = DECISION_INTENT + ".decisionChoice"; private final static Logger LOGGER = Logger.getLogger(MemorizingTrustManager.class.getName()); - final static String DECISION_TITLE_ID = DECISION_INTENT + ".titleId"; + public final static String DECISION_TITLE_ID = DECISION_INTENT + ".titleId"; private final static int NOTIFICATION_ID = 100509; final static String NO_TRUST_ANCHOR = "Trust anchor for certification path not found."; @@ -113,7 +118,7 @@ public class MemorizingTrustManager { static String KEYSTORE_FILE = "KeyStore.bks"; Context master; - Activity foregroundAct; + AppCompatActivity foregroundAct; NotificationManager notificationManager; private static int decisionId = 0; private static SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>(); @@ -125,18 +130,17 @@ public class MemorizingTrustManager { private X509TrustManager appTrustManager; private String poshCacheDir; - /** - * Creates an instance of the MemorizingTrustManager class that falls back to a custom TrustManager. - * <p> + /** Creates an instance of the MemorizingTrustManager class that falls back to a custom TrustManager. + * * You need to supply the application context. This has to be one of: - * - Application - * - Activity - * - Service - * <p> + * - Application + * - Activity + * - Service + * * The context is used for file management, to display the dialog / * notification and for obtaining translated strings. * - * @param m Context for the application. + * @param m Context for the application. * @param defaultTrustManager Delegate trust management to this TM. If null, the user must accept every certificate. */ public MemorizingTrustManager(Context m, X509TrustManager defaultTrustManager) { @@ -145,14 +149,13 @@ public class MemorizingTrustManager { this.defaultTrustManager = defaultTrustManager; } - /** - * Creates an instance of the MemorizingTrustManager class using the system X509TrustManager. - * <p> + /** Creates an instance of the MemorizingTrustManager class using the system X509TrustManager. + * * You need to supply the application context. This has to be one of: - * - Application - * - Activity - * - Service - * <p> + * - Application + * - Activity + * - Service + * * The context is used for file management, to display the dialog / * notification and for obtaining translated strings. * @@ -167,22 +170,21 @@ public class MemorizingTrustManager { void init(Context m) { master = m; masterHandler = new Handler(m.getMainLooper()); - notificationManager = (NotificationManager) master.getSystemService(Context.NOTIFICATION_SERVICE); + notificationManager = (NotificationManager)master.getSystemService(Context.NOTIFICATION_SERVICE); Application app; if (m instanceof Application) { - app = (Application) m; + app = (Application)m; } else if (m instanceof Service) { - app = ((Service) m).getApplication(); - } else if (m instanceof Activity) { - app = ((Activity) m).getApplication(); - } else - throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!"); + app = ((Service)m).getApplication(); + } else if (m instanceof AppCompatActivity) { + app = ((AppCompatActivity)m).getApplication(); + } else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!"); File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE); keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE); - poshCacheDir = app.getFilesDir().getAbsolutePath() + "/posh_cache/"; + poshCacheDir = app.getFilesDir().getAbsolutePath()+"/posh_cache/"; appKeyStore = loadAppKeyStore(); } @@ -190,29 +192,29 @@ public class MemorizingTrustManager { /** * Binds an Activity to the MTM for displaying the query dialog. - * <p> + * * This is useful if your connection is run from a service that is * triggered by user interaction -- in such cases the activity is * visible and the user tends to ignore the service notification. - * <p> + * * You should never have a hidden activity bound to MTM! Use this * function in onResume() and @see unbindDisplayActivity in onPause(). * * @param act Activity to be bound */ - public void bindDisplayActivity(Activity act) { + public void bindDisplayActivity(AppCompatActivity act) { foregroundAct = act; } /** * Removes an Activity from the MTM display stack. - * <p> + * * Always call this function when the Activity added with - * {@link #bindDisplayActivity(Activity)} is hidden. + * {@link #bindDisplayActivity(AppCompatActivity)} is hidden. * * @param act Activity to be unbound */ - public void unbindDisplayActivity(Activity act) { + public void unbindDisplayActivity(AppCompatActivity act) { // do not remove if it was overridden by a different activity if (foregroundAct == act) foregroundAct = null; @@ -220,11 +222,11 @@ public class MemorizingTrustManager { /** * Changes the path for the KeyStore file. - * <p> + * * The actual filename relative to the app's directory will be * <code>app_<i>dirname</i>/<i>filename</i></code>. * - * @param dirname directory to store the KeyStore. + * @param dirname directory to store the KeyStore. * @param filename file name for the KeyStore. */ public static void setKeyStoreFile(String dirname, String filename) { @@ -250,6 +252,7 @@ public class MemorizingTrustManager { * Get a certificate for a given alias. * * @param alias the certificate's alias as returned by {@link #getCertificates()}. + * * @return the certificate associated with the alias or <tt>null</tt> if none found. */ public Certificate getCertificate(String alias) { @@ -263,15 +266,15 @@ public class MemorizingTrustManager { /** * Removes the given certificate from MTMs key store. - * <p> + * * <p> * <b>WARNING</b>: this does not immediately invalidate the certificate. It is * well possible that (a) data is transmitted over still existing connections or * (b) new connections are created using TLS renegotiation, without a new cert * check. * </p> - * * @param alias the certificate's alias as returned by {@link #getCertificates()}. + * * @throws KeyStoreException if the certificate could not be deleted. */ public void deleteCertificate(String alias) throws KeyStoreException { @@ -281,27 +284,28 @@ public class MemorizingTrustManager { /** * Creates a new hostname verifier supporting user interaction. - * <p> + * * <p>This method creates a new {@link HostnameVerifier} that is bound to * the given instance of {@link MemorizingTrustManager}, and leverages an * existing {@link HostnameVerifier}. The returned verifier performs the * following steps, returning as soon as one of them succeeds: - * </p> - * <ol> - * <li>Success, if the wrapped defaultVerifier accepts the certificate.</li> - * <li>Success, if the server certificate is stored in the keystore under the given hostname.</li> - * <li>Ask the user and return accordingly.</li> - * <li>Failure on exception.</li> - * </ol> + * </p> + * <ol> + * <li>Success, if the wrapped defaultVerifier accepts the certificate.</li> + * <li>Success, if the server certificate is stored in the keystore under the given hostname.</li> + * <li>Ask the user and return accordingly.</li> + * <li>Failure on exception.</li> + * </ol> * * @param defaultVerifier the {@link HostnameVerifier} that should perform the actual check * @return a new hostname verifier using the MTM's key store + * * @throws IllegalArgumentException if the defaultVerifier parameter is null */ public DomainHostnameVerifier wrapHostnameVerifier(final HostnameVerifier defaultVerifier, final boolean interactive) { - if (defaultVerifier == null) { + if (defaultVerifier == null) throw new IllegalArgumentException("The default verifier may not be null"); - } + return new MemorizingHostnameVerifier(defaultVerifier, interactive); } @@ -311,7 +315,7 @@ public class MemorizingTrustManager { tmf.init(ks); for (TrustManager t : tmf.getTrustManagers()) { if (t instanceof X509TrustManager) { - return (X509TrustManager) t; + return (X509TrustManager)t; } } } catch (Exception e) { @@ -397,7 +401,8 @@ public class MemorizingTrustManager { } public void checkCertTrusted(X509Certificate[] chain, String authType, String domain, boolean isServer, boolean interactive) - throws CertificateException { + throws CertificateException + { LOGGER.log(Level.FINE, "checkCertTrusted(" + chain + ", " + authType + ", " + isServer + ")"); try { LOGGER.log(Level.FINE, "checkCertTrusted: trying appTrustManager"); @@ -427,10 +432,10 @@ public class MemorizingTrustManager { } catch (CertificateException e) { boolean trustSystemCAs = !PreferenceManager.getDefaultSharedPreferences(master).getBoolean("dont_trust_system_cas", false); if (domain != null && isServer && trustSystemCAs && !isIp(domain)) { - String hash = getBase64Hash(chain[0], "SHA-256"); + String hash = getBase64Hash(chain[0],"SHA-256"); List<String> fingerprints = getPoshFingerprints(domain); if (hash != null && fingerprints.contains(hash)) { - Log.d("mtm", "trusted cert fingerprint of " + domain + " via posh"); + Log.d("mtm","trusted cert fingerprint of "+domain+" via posh"); return; } } @@ -454,11 +459,11 @@ public class MemorizingTrustManager { } private List<String> getPoshFingerprintsFromServer(String domain) { - return getPoshFingerprintsFromServer(domain, "https://" + domain + "/.well-known/posh/xmpp-client.json", -1, true); + return getPoshFingerprintsFromServer(domain, "https://"+domain+"/.well-known/posh/xmpp-client.json",-1,true); } private List<String> getPoshFingerprintsFromServer(String domain, String url, int maxTtl, boolean followUrl) { - Log.d("mtm", "downloading json for " + domain + " from " + url); + Log.d("mtm","downloading json for "+domain+" from "+url); try { List<String> results = new ArrayList<>(); HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection(); @@ -477,7 +482,7 @@ public class MemorizingTrustManager { return new ArrayList<>(); } if (maxTtl >= 0) { - expires = Math.min(maxTtl, expires); + expires = Math.min(maxTtl,expires); } String redirect; try { @@ -489,23 +494,23 @@ public class MemorizingTrustManager { return getPoshFingerprintsFromServer(domain, redirect, expires, false); } JSONArray fingerprints = jsonObject.getJSONArray("fingerprints"); - for (int i = 0; i < fingerprints.length(); i++) { + for(int i = 0; i < fingerprints.length(); i++) { JSONObject fingerprint = fingerprints.getJSONObject(i); String sha256 = fingerprint.getString("sha-256"); if (sha256 != null) { results.add(sha256); } } - writeFingerprintsToCache(domain, results, 1000L * expires + System.currentTimeMillis()); + writeFingerprintsToCache(domain, results,1000L * expires+System.currentTimeMillis()); return results; } catch (Exception e) { - Log.d("mtm", "error fetching posh " + e.getMessage()); + Log.d("mtm","error fetching posh "+e.getMessage()); return new ArrayList<>(); } } private File getPoshCacheFile(String domain) { - return new File(poshCacheDir + domain + ".json"); + return new File(poshCacheDir+domain+".json"); } private void writeFingerprintsToCache(String domain, List<String> results, long expires) { @@ -514,8 +519,8 @@ public class MemorizingTrustManager { try { file.createNewFile(); JSONObject jsonObject = new JSONObject(); - jsonObject.put("expires", expires); - jsonObject.put("fingerprints", new JSONArray(results)); + jsonObject.put("expires",expires); + jsonObject.put("fingerprints",new JSONArray(results)); FileOutputStream outputStream = new FileOutputStream(file); outputStream.write(jsonObject.toString().getBytes()); outputStream.flush(); @@ -534,7 +539,7 @@ public class MemorizingTrustManager { String line = buf.readLine(); StringBuilder sb = new StringBuilder(); - while (line != null) { + while(line != null){ sb.append(line).append("\n"); line = buf.readLine(); } @@ -546,11 +551,11 @@ public class MemorizingTrustManager { file.delete(); return null; } else { - Log.d("mtm", "posh fingerprints expire in " + (expiresIn / 1000) + "s"); + Log.d("mtm","posh fingerprints expire in "+(expiresIn/1000)+"s"); } List<String> result = new ArrayList<>(); JSONArray jsonArray = jsonObject.getJSONArray("fingerprints"); - for (int i = 0; i < jsonArray.length(); ++i) { + for(int i = 0; i < jsonArray.length(); ++i) { result.add(jsonArray.getString(i)); } return result; @@ -581,7 +586,7 @@ public class MemorizingTrustManager { return null; } md.update(certificate.getEncoded()); - return Base64.encodeToString(md.digest(), Base64.NO_WRAP); + return Base64.encodeToString(md.digest(),Base64.NO_WRAP); } private X509Certificate[] getAcceptedIssuers() { @@ -591,7 +596,7 @@ public class MemorizingTrustManager { private int createDecisionId(MTMDecision d) { int myId; - synchronized (openDecisions) { + synchronized(openDecisions) { myId = decisionId; openDecisions.put(myId, d); decisionId += 1; @@ -676,7 +681,7 @@ public class MemorizingTrustManager { Object name = altName.get(1); if (name instanceof String) { si.append("["); - si.append((Integer) altName.get(0)); + si.append((Integer)altName.get(0)); si.append("] "); si.append(name); si.append("\n"); @@ -695,7 +700,6 @@ public class MemorizingTrustManager { certDetails(si, cert); return si.toString(); } - /** * Returns the top-most entry of the activity stack. * @@ -706,7 +710,7 @@ public class MemorizingTrustManager { } int interact(final String message, final int titleId) { - /* prepare the MTMDecision blocker object */ + /* prepare the MTMDecision blocker object */ MTMDecision choice = new MTMDecision(); final int myId = createDecisionId(choice); @@ -731,9 +735,7 @@ public class MemorizingTrustManager { LOGGER.log(Level.FINE, "openDecisions: " + openDecisions + ", waiting on " + myId); try { - synchronized (choice) { - choice.wait(); - } + synchronized(choice) { choice.wait(); } } catch (InterruptedException e) { LOGGER.log(Level.FINER, "InterruptedException", e); } @@ -742,7 +744,8 @@ public class MemorizingTrustManager { } void interactCert(final X509Certificate[] chain, String authType, CertificateException cause) - throws CertificateException { + throws CertificateException + { switch (interact(certChainMessage(chain, cause), R.string.mtm_accept_cert)) { case MTMDecision.DECISION_ALWAYS: storeCert(chain[0]); // only store the server cert, not the whole chain @@ -753,7 +756,8 @@ public class MemorizingTrustManager { } } - boolean interactHostname(X509Certificate cert, String hostname) { + boolean interactHostname(X509Certificate cert, String hostname) + { switch (interact(hostNameMessage(cert, hostname), R.string.mtm_accept_servername)) { case MTMDecision.DECISION_ALWAYS: storeCert(hostname, cert); @@ -764,9 +768,9 @@ public class MemorizingTrustManager { } } - protected static void interactResult(int decisionId, int choice) { + public static void interactResult(int decisionId, int choice) { MTMDecision d; - synchronized (openDecisions) { + synchronized(openDecisions) { d = openDecisions.get(decisionId); openDecisions.remove(decisionId); } @@ -774,7 +778,7 @@ public class MemorizingTrustManager { LOGGER.log(Level.SEVERE, "interactResult: aborting due to stale decision reference!"); return; } - synchronized (d) { + synchronized(d) { d.state = choice; d.notify(); } @@ -794,7 +798,7 @@ public class MemorizingTrustManager { LOGGER.log(Level.FINE, "hostname verifier for " + domain + ", trying default verifier first"); // if the default verifier accepts the hostname, we are done if (defaultVerifier instanceof DomainHostnameVerifier) { - if (((DomainHostnameVerifier) defaultVerifier).verify(domain, hostname, session)) { + if (((DomainHostnameVerifier) defaultVerifier).verify(domain,hostname, session)) { return true; } } else { @@ -803,9 +807,10 @@ public class MemorizingTrustManager { } } + // otherwise, we check if the hostname is an alias for this cert in our keystore try { - X509Certificate cert = (X509Certificate) session.getPeerCertificates()[0]; + X509Certificate cert = (X509Certificate)session.getPeerCertificates()[0]; //Log.d(TAG, "cert: " + cert); if (cert.equals(appKeyStore.getCertificate(domain.toLowerCase(Locale.US)))) { LOGGER.log(Level.FINE, "certificate for " + domain + " is in our keystore. accepting."); @@ -826,10 +831,11 @@ public class MemorizingTrustManager { @Override public boolean verify(String domain, SSLSession sslSession) { - return verify(domain, null, sslSession); + return verify(domain,null,sslSession); } } + public X509TrustManager getNonInteractive(String domain) { return new NonInteractiveMemorizingTrustManager(domain); } @@ -895,4 +901,4 @@ public class MemorizingTrustManager { return MemorizingTrustManager.this.getAcceptedIssuers(); } } -} +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index d26114b47..2c2f0b2d4 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -70,7 +70,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import de.duenndns.ssl.MemorizingTrustManager; import de.pixart.messenger.BuildConfig; import de.pixart.messenger.Config; import de.pixart.messenger.R; diff --git a/src/main/java/de/pixart/messenger/ui/AboutActivity.java b/src/main/java/de/pixart/messenger/ui/AboutActivity.java index b3b296c42..e00707d96 100644 --- a/src/main/java/de/pixart/messenger/ui/AboutActivity.java +++ b/src/main/java/de/pixart/messenger/ui/AboutActivity.java @@ -1,11 +1,11 @@ package de.pixart.messenger.ui; -import android.app.Activity; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; import de.pixart.messenger.R; -public class AboutActivity extends Activity { +public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java b/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java index 4852c5961..a3536a368 100644 --- a/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java +++ b/src/main/java/de/pixart/messenger/ui/AbstractSearchableListItemActivity.java @@ -104,8 +104,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity { getMenuInflater().inflate(R.menu.choose_contact, menu); final MenuItem menuSearchView = menu.findItem(R.id.action_search); final View mSearchView = menuSearchView.getActionView(); - mSearchEditText = mSearchView - .findViewById(R.id.search_field); + mSearchEditText = mSearchView.findViewById(R.id.search_field); mSearchEditText.addTextChangedListener(mSearchTextWatcher); menuSearchView.setOnActionExpandListener(mOnActionExpandListener); return true; diff --git a/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java b/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java index 5a911298f..0775d2cf7 100644 --- a/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java +++ b/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java @@ -1,6 +1,6 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.text.SpannableString; diff --git a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java index 49a826f29..f6bec9838 100644 --- a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java @@ -2,15 +2,16 @@ package de.pixart.messenger.ui; import android.content.Intent; import android.os.Bundle; +import android.support.design.widget.TextInputLayout; import android.view.View; import android.widget.Button; import android.widget.EditText; -import android.widget.TextView; import android.widget.Toast; import de.pixart.messenger.R; import de.pixart.messenger.entities.Account; import de.pixart.messenger.services.XmppConnectionService; +import de.pixart.messenger.ui.widget.DisabledActionModeCallback; public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged { @@ -21,20 +22,17 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti if (mAccount != null) { final String currentPassword = mCurrentPassword.getText().toString(); final String newPassword = mNewPassword.getText().toString(); - final String newPasswordConfirm = mNewPasswordConfirm.getText().toString(); if (!mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) && !currentPassword.equals(mAccount.getPassword())) { mCurrentPassword.requestFocus(); - mCurrentPassword.setError(getString(R.string.account_status_unauthorized)); - } else if (!newPassword.equals(newPasswordConfirm)) { - mNewPasswordConfirm.requestFocus(); - mNewPasswordConfirm.setError(getString(R.string.passwords_do_not_match)); + mCurrentPasswordLayout.setError(getString(R.string.account_status_unauthorized)); + removeErrorsOnAllBut(mCurrentPasswordLayout); } else if (newPassword.trim().isEmpty()) { mNewPassword.requestFocus(); - mNewPassword.setError(getString(R.string.password_should_not_be_empty)); + mNewPasswordLayout.setError(getString(R.string.password_should_not_be_empty)); + removeErrorsOnAllBut(mNewPasswordLayout); } else { - mCurrentPassword.setError(null); - mNewPassword.setError(null); - mNewPasswordConfirm.setError(null); + mCurrentPasswordLayout.setError(null); + mNewPasswordLayout.setError(null); xmppConnectionService.updateAccountPasswordOnServer(mAccount, newPassword, ChangePasswordActivity.this); mChangePasswordButton.setEnabled(false); mChangePasswordButton.setTextColor(getSecondaryTextColor()); @@ -43,20 +41,18 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti } } }; - private TextView mCurrentPasswordLabel; private EditText mCurrentPassword; private EditText mNewPassword; - private EditText mNewPasswordConfirm; private Account mAccount; + private TextInputLayout mNewPasswordLayout; + private TextInputLayout mCurrentPasswordLayout; @Override void onBackendConnected() { this.mAccount = extractAccount(getIntent()); if (this.mAccount != null && this.mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) { - this.mCurrentPasswordLabel.setVisibility(View.GONE); this.mCurrentPassword.setVisibility(View.GONE); } else { - this.mCurrentPasswordLabel.setVisibility(View.VISIBLE); this.mCurrentPassword.setVisibility(View.VISIBLE); } } @@ -74,10 +70,10 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti }); this.mChangePasswordButton = findViewById(R.id.right_button); this.mChangePasswordButton.setOnClickListener(this.mOnChangePasswordButtonClicked); - this.mCurrentPasswordLabel = findViewById(R.id.current_password_label); this.mCurrentPassword = findViewById(R.id.current_password); + this.mCurrentPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback()); this.mNewPassword = findViewById(R.id.new_password); - this.mNewPasswordConfirm = findViewById(R.id.new_password_confirm); + this.mNewPassword.setCustomSelectionActionModeCallback(new DisabledActionModeCallback()); } @Override @@ -104,18 +100,27 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti @Override public void onPasswordChangeFailed() { - runOnUiThread(new Runnable() { - @Override - public void run() { - mNewPassword.setError(getString(R.string.could_not_change_password)); - mChangePasswordButton.setEnabled(true); - mChangePasswordButton.setTextColor(getPrimaryTextColor()); - mChangePasswordButton.setText(R.string.change_password); - } + runOnUiThread(() -> { + mNewPasswordLayout.setError(getString(R.string.could_not_change_password)); + mChangePasswordButton.setEnabled(true); + mChangePasswordButton.setTextColor(getPrimaryTextColor()); + mChangePasswordButton.setText(R.string.change_password); }); } + private void removeErrorsOnAllBut(TextInputLayout exception) { + if (this.mCurrentPasswordLayout != exception) { + this.mCurrentPasswordLayout.setErrorEnabled(false); + this.mCurrentPasswordLayout.setError(null); + } + if (this.mNewPasswordLayout != exception) { + this.mNewPasswordLayout.setErrorEnabled(false); + this.mNewPasswordLayout.setError(null); + } + + } + public void refreshUiReal() { } diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java index 9d51a1c1d..011c8b051 100644 --- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java @@ -1,10 +1,10 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.StringRes; +import android.support.v7.app.ActionBar; import android.view.ActionMode; import android.view.Menu; import android.view.MenuInflater; @@ -140,7 +140,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity { Intent intent = getIntent(); @StringRes int res = intent != null ? intent.getIntExtra(EXTRA_TITLE_RES_ID, R.string.title_activity_choose_contact) : R.string.title_activity_choose_contact; - ActionBar bar = getActionBar(); + ActionBar bar = getSupportActionBar(); if (bar != null) { try { bar.setTitle(res); diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index 21442bcd1..fa77b9423 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -1,14 +1,21 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; -import android.app.AlertDialog; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender.SendIntentException; +import android.content.res.Resources; +import android.databinding.DataBindingUtil; +import android.graphics.Bitmap; import android.graphics.PorterDuff; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.AsyncTask; import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; +import android.support.v7.widget.CardView; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; @@ -26,13 +33,16 @@ import android.widget.Toast; import org.openintents.openpgp.util.OpenPgpUtils; +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; +import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicInteger; import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.PgpEngine; +import de.pixart.messenger.databinding.ContactBinding; import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Bookmark; import de.pixart.messenger.entities.Contact; @@ -42,6 +52,7 @@ import de.pixart.messenger.entities.MucOptions.User; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.services.XmppConnectionService.OnConversationUpdate; import de.pixart.messenger.services.XmppConnectionService.OnMucRosterUpdate; +import de.pixart.messenger.utils.UIHelper; import de.pixart.messenger.xmpp.jid.Jid; public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnRoleChanged, XmppConnectionService.OnConfigurationPushed { @@ -83,10 +94,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private TextView mFullJid; private TextView mAccountJid; private LinearLayout membersView; - private LinearLayout mMoreDetails; + private CardView mMoreDetails; private RelativeLayout mMucSettings; private TextView mConferenceType; - private LinearLayout mConferenceInfoTable; + private CardView mConferenceInfoTable; private TextView mConferenceInfoMam; private TextView mNotifyStatusText; private ImageButton mChangeConferenceSettingsButton; @@ -294,29 +305,19 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mDestroyButton.setOnClickListener(destroyListener); mDestroyButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY); mConferenceType = findViewById(R.id.muc_conference_type); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); - } - mEditNickButton.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - quickEdit(mConversation.getMucOptions().getActualNick(), - 0, - new OnValueEdited() { - - @Override - public String onValueEdited(String value) { - if (xmppConnectionService.renameInMuc(mConversation, value, renameCallback)) { - return null; - } else { - return getString(R.string.invalid_username); - } - } - }); - } - }); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + mEditNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(), + 0, + value -> { + if (xmppConnectionService.renameInMuc(mConversation, value, renameCallback)) { + return null; + } else { + return getString(R.string.invalid_username); + } + })); this.mAdvancedMode = getPreferences().getBoolean("advanced_muc_mode", false); this.mConferenceInfoTable = findViewById(R.id.muc_info_more); this.mConferenceInfoTable.setVisibility(this.mAdvancedMode ? View.VISIBLE : View.GONE); @@ -600,17 +601,19 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } else { account = mConversation.getAccount().getJid().toBareJid().toString(); } - if (getActionBar() != null) { - final ActionBar ab = getActionBar(); - ab.setCustomView(R.layout.ab_title); - ab.setDisplayShowCustomEnabled(true); - TextView abtitle = findViewById(android.R.id.text1); - TextView absubtitle = findViewById(android.R.id.text2); - abtitle.setText(mConversation.getName()); - abtitle.setSelected(true); - abtitle.setClickable(false); - absubtitle.setVisibility(View.GONE); - absubtitle.setClickable(false); + if (getSupportActionBar() != null) { + final ActionBar ab = getSupportActionBar(); + if (ab != null) { + ab.setCustomView(R.layout.ab_title); + ab.setDisplayShowCustomEnabled(true); + TextView abtitle = findViewById(android.R.id.text1); + TextView absubtitle = findViewById(android.R.id.text2); + abtitle.setText(mConversation.getName()); + abtitle.setSelected(true); + abtitle.setClickable(false); + absubtitle.setVisibility(View.GONE); + absubtitle.setClickable(false); + } } ConferenceName.setText(mConversation.getName()); mAccountJid.setText(getString(R.string.using_account, account)); @@ -668,56 +671,44 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers mNotifyStatusText.setText(R.string.notify_only_when_highlighted); } - LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); membersView.removeAllViews(); + if (inflater == null) { + return; + } final ArrayList<User> users = mucOptions.getUsers(); Collections.sort(users); for (final User user : users) { + ContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.contact, membersView, false); final Contact contact = user.getContact(); - View view = inflater.inflate(R.layout.contact, membersView, false); - this.setListItemBackgroundOnView(view); + final String name = user.getName(); + this.setListItemBackgroundOnView(binding.getRoot()); if (contact != null && contact.showInRoster()) { - view.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - switchToContactDetails(contact); - } - }); + binding.getRoot().setOnClickListener((OnClickListener) view -> switchToContactDetails(contact)); } - registerForContextMenu(view); - view.setTag(user); - TextView tvDisplayName = view.findViewById(R.id.contact_display_name); - TextView tvKey = view.findViewById(R.id.key); - TextView tvStatus = view.findViewById(R.id.contact_jid); + registerForContextMenu(binding.getRoot()); + binding.getRoot().setTag(user); if (mAdvancedMode && user.getPgpKeyId() != 0) { - tvKey.setVisibility(View.VISIBLE); - tvKey.setOnClickListener(new OnClickListener() { - - @Override - public void onClick(View v) { - viewPgpKey(user); - } - }); - tvKey.setText(OpenPgpUtils.convertKeyIdToHex(user.getPgpKeyId())); + binding.key.setVisibility(View.VISIBLE); + binding.key.setOnClickListener(v -> viewPgpKey(user)); + binding.key.setText(OpenPgpUtils.convertKeyIdToHex(user.getPgpKeyId())); } - String name = user.getName(); if (contact != null) { - tvDisplayName.setText(contact.getDisplayName()); - tvStatus.setText((name != null ? name + " \u2022 " : "") + getStatus(user)); + binding.contactDisplayName.setText(contact.getDisplayName()); + binding.contactJid.setText((name != null ? name + " \u2022 " : "") + getStatus(user)); } else { - tvDisplayName.setText(name == null ? "" : name); - tvStatus.setText(getStatus(user)); + binding.contactDisplayName.setText(name == null ? "" : name); + binding.contactJid.setText(getStatus(user)); } - ImageView iv = view.findViewById(R.id.contact_photo); - iv.setImageBitmap(avatarService().get(user, getPixel(48), false)); + loadAvatar(user, binding.contactPhoto); if (user.getRole() == MucOptions.Role.NONE) { - tvDisplayName.setAlpha(INACTIVE_ALPHA); - tvKey.setAlpha(INACTIVE_ALPHA); - tvStatus.setAlpha(INACTIVE_ALPHA); - iv.setAlpha(INACTIVE_ALPHA); + binding.contactDisplayName.setAlpha(INACTIVE_ALPHA); + binding.key.setAlpha(INACTIVE_ALPHA); + binding.contactJid.setAlpha(INACTIVE_ALPHA); + binding.contactPhoto.setAlpha(INACTIVE_ALPHA); } - membersView.addView(view); + membersView.addView(binding.getRoot()); if (mConversation.getMucOptions().canInvite()) { mInviteButton.setVisibility(View.VISIBLE); } else { @@ -780,11 +771,95 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } private void displayToast(final String msg) { - runOnUiThread(new Runnable() { - @Override - public void run() { - Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show(); + runOnUiThread(() -> Toast.makeText(ConferenceDetailsActivity.this, msg, Toast.LENGTH_SHORT).show()); + } + + public static boolean cancelPotentialWork(User user, ImageView imageView) { + final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); + + if (bitmapWorkerTask != null) { + final User old = bitmapWorkerTask.o; + if (old == null || user != old) { + bitmapWorkerTask.cancel(true); + } else { + return false; + } + } + return true; + } + + private static BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) { + if (imageView != null) { + final Drawable drawable = imageView.getDrawable(); + if (drawable instanceof AsyncDrawable) { + final AsyncDrawable asyncDrawable = (AsyncDrawable) drawable; + return asyncDrawable.getBitmapWorkerTask(); } - }); + } + return null; + } + + public void loadAvatar(User user, ImageView imageView) { + if (cancelPotentialWork(user, imageView)) { + final Bitmap bm = avatarService().get(user, getPixel(48), true); + if (bm != null) { + cancelPotentialWork(user, imageView); + imageView.setImageBitmap(bm); + imageView.setBackgroundColor(0x00000000); + } else { + String seed = user.getRealJid() != null ? user.getRealJid().toBareJid().toString() : null; + imageView.setBackgroundColor(UIHelper.getColorForName(seed == null ? user.getName() : seed)); + imageView.setImageDrawable(null); + final BitmapWorkerTask task = new BitmapWorkerTask(imageView); + final AsyncDrawable asyncDrawable = new AsyncDrawable(getResources(), null, task); + imageView.setImageDrawable(asyncDrawable); + try { + task.execute(user); + } catch (final RejectedExecutionException ignored) { + } + } + } + } + + static class AsyncDrawable extends BitmapDrawable { + private final WeakReference<BitmapWorkerTask> bitmapWorkerTaskReference; + + public AsyncDrawable(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) { + super(res, bitmap); + bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask); + } + + public BitmapWorkerTask getBitmapWorkerTask() { + return bitmapWorkerTaskReference.get(); + } + } + + class BitmapWorkerTask extends AsyncTask<User, Void, Bitmap> { + private final WeakReference<ImageView> imageViewReference; + private User o = null; + + private BitmapWorkerTask(ImageView imageView) { + imageViewReference = new WeakReference<>(imageView); + } + + @Override + protected Bitmap doInBackground(User... params) { + this.o = params[0]; + if (imageViewReference.get() == null) { + return null; + } + return avatarService().get(this.o, getPixel(48), isCancelled()); + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + if (bitmap != null && !isCancelled()) { + final ImageView imageView = imageViewReference.get(); + if (imageView != null) { + imageView.setImageBitmap(bitmap); + imageView.setBackgroundColor(0x00000000); + } + } + } } } diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index ca435d6a5..824546266 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -1,11 +1,10 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; -import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.databinding.DataBindingUtil; import android.graphics.PorterDuff; import android.net.Uri; import android.os.Bundle; @@ -14,23 +13,19 @@ import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Button; -import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageButton; -import android.widget.LinearLayout; -import android.widget.QuickContactBadge; import android.widget.TextView; import android.widget.Toast; -import com.wefika.flowlayout.FlowLayout; - import org.openintents.openpgp.util.OpenPgpUtils; import java.util.List; @@ -51,6 +46,7 @@ import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.Namespace; import de.pixart.messenger.utils.UIHelper; import de.pixart.messenger.utils.XmppUri; +import de.pixart.messenger.databinding.ActivityContactDetailsBinding; import de.pixart.messenger.xmpp.OnKeyStatusUpdated; import de.pixart.messenger.xmpp.OnUpdateBlocklist; import de.pixart.messenger.xmpp.XmppConnection; @@ -109,22 +105,11 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } } }; + + ActivityContactDetailsBinding binding; + private Jid accountJid; - private TextView lastseen; private Jid contactJid; - private TextView contactDisplayName; - private TextView contactJidTv; - private TextView accountJidTv; - private TextView statusMessage; - private TextView resource; - private CheckBox send; - private CheckBox receive; - private Button addContactButton; - private Button mShowInactiveDevicesButton; - private QuickContactBadge badge; - private LinearLayout keys; - private LinearLayout keysWrapper; - private FlowLayout tags; private boolean showDynamicTags = false; private boolean showLastSeen = false; private boolean showInactiveOmemo = false; @@ -272,32 +257,15 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } } this.messageFingerprint = getIntent().getStringExtra("fingerprint"); - setContentView(R.layout.activity_contact_details); - - contactDisplayName = findViewById(R.id.contact_display_name); - contactJidTv = findViewById(R.id.details_contactjid); - accountJidTv = findViewById(R.id.details_account); - lastseen = findViewById(R.id.details_lastseen); - statusMessage = findViewById(R.id.status_message); - resource = findViewById(R.id.resource); - send = findViewById(R.id.details_send_presence); - receive = findViewById(R.id.details_receive_presence); - badge = findViewById(R.id.details_contact_badge); - addContactButton = findViewById(R.id.add_contact_button); - keys = findViewById(R.id.details_contact_keys); - keysWrapper = findViewById(R.id.keys_wrapper); - tags = findViewById(R.id.tags); - mShowInactiveDevicesButton = findViewById(R.id.show_inactive_devices); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + + this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } - mShowInactiveDevicesButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - showInactiveOmemo = !showInactiveOmemo; - populateView(); - } + binding.showInactiveDevices.setOnClickListener(v -> { + showInactiveOmemo = !showInactiveOmemo; + populateView(); }); this.mNotifyStatusButton = findViewById(R.id.notification_status_button); this.mNotifyStatusButton.setOnClickListener(this.mNotifyStatusClickListener); @@ -409,34 +377,39 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp mNotifyStatusButton.setImageResource(R.drawable.ic_notifications_grey600_24dp); mNotifyStatusText.setText(R.string.notify_on_all_messages); } - if (getActionBar() != null) { - final ActionBar ab = getActionBar(); - ab.setCustomView(R.layout.ab_title); - ab.setDisplayShowCustomEnabled(true); - TextView abtitle = findViewById(android.R.id.text1); - TextView absubtitle = findViewById(android.R.id.text2); - abtitle.setText(contact.getDisplayName()); - abtitle.setSelected(true); - abtitle.setClickable(false); - absubtitle.setVisibility(View.GONE); - absubtitle.setClickable(false); + if (getSupportActionBar() != null) { + final ActionBar ab = getSupportActionBar(); + if (ab != null) { + ab.setCustomView(R.layout.ab_title); + ab.setDisplayShowCustomEnabled(true); + TextView abtitle = findViewById(android.R.id.text1); + TextView absubtitle = findViewById(android.R.id.text2); + abtitle.setText(contact.getDisplayName()); + abtitle.setSelected(true); + abtitle.setClickable(false); + absubtitle.setVisibility(View.GONE); + absubtitle.setClickable(false); + } } invalidateOptionsMenu(); setTitle(contact.getDisplayName()); if (contact.getServer().toString().toLowerCase().equals(accountJid.getDomainpart().toLowerCase())) { - contactDisplayName.setText(contact.getDisplayName()); + binding.contactDisplayName.setText(contact.getDisplayName()); } else { - contactDisplayName.setText(contact.getDisplayJid()); + binding.contactDisplayName.setText(contact.getDisplayJid()); } if (contact.showInRoster()) { - send.setVisibility(View.VISIBLE); - receive.setVisibility(View.VISIBLE); - addContactButton.setVisibility(View.VISIBLE); - addContactButton.setText(getString(R.string.action_delete_contact)); - addContactButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY); + binding.detailsSendPresence.setVisibility(View.VISIBLE); + binding.detailsReceivePresence.setVisibility(View.VISIBLE); + binding.addContactButton.setVisibility(View.VISIBLE); + binding.addContactButton.setText(getString(R.string.action_delete_contact)); + binding.addContactButton.getBackground().setColorFilter(getWarningButtonColor(), PorterDuff.Mode.MULTIPLY); + binding.detailsSendPresence.setOnCheckedChangeListener(null); + binding.detailsReceivePresence.setOnCheckedChangeListener(null); + final AlertDialog.Builder deleteFromRosterDialog = new AlertDialog.Builder(ContactDetailsActivity.this); - addContactButton.setOnClickListener(new OnClickListener() { + binding.addContactButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { deleteFromRosterDialog.setNegativeButton(getString(R.string.cancel), null); @@ -448,15 +421,15 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp removeFromRoster).create().show(); } }); - send.setOnCheckedChangeListener(null); - receive.setOnCheckedChangeListener(null); + binding.detailsSendPresence.setOnCheckedChangeListener(null); + binding.detailsReceivePresence.setOnCheckedChangeListener(null); List<String> statusMessages = contact.getPresences().getStatusMessages(); if (statusMessages.size() == 0) { - statusMessage.setVisibility(View.GONE); + binding.statusMessage.setVisibility(View.GONE); } else { StringBuilder builder = new StringBuilder(); - statusMessage.setVisibility(View.VISIBLE); + binding.statusMessage.setVisibility(View.VISIBLE); int s = statusMessages.size(); for (int i = 0; i < s; ++i) { if (s > 1) { @@ -467,85 +440,85 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp builder.append("\n"); } } - statusMessage.setText(builder); + binding.statusMessage.setText(builder); } String resources = contact.getPresences().getMostAvailableResource(); if (resources.length() == 0) { - resource.setVisibility(View.GONE); + binding.resource.setVisibility(View.GONE); } else { - resource.setVisibility(View.VISIBLE); - resource.setText(resources); + binding.resource.setVisibility(View.VISIBLE); + binding.resource.setText(resources); } if (contact.getOption(Contact.Options.FROM)) { - send.setText(R.string.send_presence_updates); - send.setChecked(true); + binding.detailsSendPresence.setText(R.string.send_presence_updates); + binding.detailsSendPresence.setChecked(true); } else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { - send.setChecked(false); - send.setText(R.string.send_presence_updates); + binding.detailsSendPresence.setChecked(false); + binding.detailsSendPresence.setText(R.string.send_presence_updates); } else { - send.setText(R.string.preemptively_grant); + binding.detailsSendPresence.setText(R.string.preemptively_grant); if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) { - send.setChecked(true); + binding.detailsSendPresence.setChecked(true); } else { - send.setChecked(false); + binding.detailsSendPresence.setChecked(false); } } if (contact.getOption(Contact.Options.TO)) { - receive.setText(R.string.receive_presence_updates); - receive.setChecked(true); + binding.detailsReceivePresence.setText(R.string.receive_presence_updates); + binding.detailsReceivePresence.setChecked(true); } else { - receive.setText(R.string.ask_for_presence_updates); + binding.detailsReceivePresence.setText(R.string.ask_for_presence_updates); if (contact.getOption(Contact.Options.ASKING)) { - receive.setChecked(true); + binding.detailsReceivePresence.setChecked(true); } else { - receive.setChecked(false); + binding.detailsReceivePresence.setChecked(false); } } if (contact.getAccount().isOnlineAndConnected()) { - receive.setEnabled(true); - send.setEnabled(true); + binding.detailsReceivePresence.setEnabled(true); + binding.detailsSendPresence.setEnabled(true); } else { - receive.setEnabled(false); - send.setEnabled(false); + binding.detailsReceivePresence.setEnabled(false); + binding.detailsSendPresence.setEnabled(false); } - send.setOnCheckedChangeListener(this.mOnSendCheckedChange); - receive.setOnCheckedChangeListener(this.mOnReceiveCheckedChange); + binding.detailsSendPresence.setOnCheckedChangeListener(this.mOnSendCheckedChange); + binding.detailsReceivePresence.setOnCheckedChangeListener(this.mOnReceiveCheckedChange); } else { - addContactButton.setVisibility(View.VISIBLE); - addContactButton.setText(getString(R.string.add_contact)); - addContactButton.getBackground().clearColorFilter(); - addContactButton.setOnClickListener(new OnClickListener() { + binding.addContactButton.setVisibility(View.VISIBLE); + binding.addContactButton.setText(getString(R.string.add_contact)); + binding.addContactButton.getBackground().clearColorFilter(); + binding.addContactButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { showAddToRosterDialog(contact); } }); - send.setVisibility(View.GONE); - receive.setVisibility(View.GONE); - statusMessage.setVisibility(View.GONE); + binding.detailsSendPresence.setVisibility(View.GONE); + binding.detailsReceivePresence.setVisibility(View.GONE); + binding.statusMessage.setVisibility(View.GONE); } if (contact.isBlocked() && !this.showDynamicTags) { - lastseen.setVisibility(View.VISIBLE); - lastseen.setText(R.string.contact_blocked); + binding.detailsLastseen.setVisibility(View.VISIBLE); + binding.detailsLastseen.setText(R.string.contact_blocked); } else { if (showLastSeen && contact.getLastseen() > 0 && contact.getPresences().allOrNonSupport(Namespace.IDLE)) { - lastseen.setVisibility(View.VISIBLE); - lastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen())); + binding.detailsLastseen.setVisibility(View.VISIBLE); + binding.detailsLastseen.setText(UIHelper.lastseen(getApplicationContext(), contact.isActive(), contact.getLastseen())); } else { - lastseen.setVisibility(View.GONE); + binding.detailsLastseen.setVisibility(View.GONE); } } if (contact.getPresences().size() > 1) { - contactJidTv.setText(contact.getDisplayJid() + " (" + binding.detailsContactjid.setText(contact.getDisplayJid() + " (" + contact.getPresences().size() + ")"); } else { - contactJidTv.setText(contact.getDisplayJid()); + binding.detailsContactjid.setText(contact.getDisplayJid()); } String account; if (Config.DOMAIN_LOCK != null) { @@ -553,17 +526,17 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } else { account = contact.getAccount().getJid().toBareJid().toString(); } - accountJidTv.setText(getString(R.string.using_account, account)); - badge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE))); - badge.setOnClickListener(this.onBadgeClick); + binding.detailsAccount.setText(getString(R.string.using_account, account)); + binding.detailsContactBadge.setImageBitmap(avatarService().get(contact, getPixel(Config.AVATAR_SIZE))); + binding.detailsContactBadge.setOnClickListener(this.onBadgeClick); - keys.removeAllViews(); + binding.detailsContactKeys.removeAllViews(); boolean hasKeys = false; LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (Config.supportOtr()) { for (final String otrFingerprint : contact.getOtrFingerprints()) { hasKeys = true; - View view = inflater.inflate(R.layout.contact_key, keys, false); + View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false); TextView key = view.findViewById(R.id.key); TextView keyType = view.findViewById(R.id.key_type); ImageButton removeButton = view @@ -576,7 +549,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } else { keyType.setText(R.string.otr_fingerprint); } - keys.addView(view); + binding.detailsContactKeys.addView(view); removeButton.setOnClickListener(new OnClickListener() { @Override @@ -603,21 +576,21 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } if (!trust.isCompromised()) { boolean highlight = session.getFingerprint().equals(messageFingerprint); - addFingerprintRow(keys, session, highlight); + addFingerprintRow(binding.detailsContactKeys, session, highlight); } } if (showsInactive || skippedInactive) { - mShowInactiveDevicesButton.setText(showsInactive ? R.string.hide_inactive_devices : R.string.show_inactive_devices); - mShowInactiveDevicesButton.setVisibility(View.VISIBLE); + binding.showInactiveDevices.setText(showsInactive ? R.string.hide_inactive_devices : R.string.show_inactive_devices); + binding.showInactiveDevices.setVisibility(View.VISIBLE); } else { - mShowInactiveDevicesButton.setVisibility(View.GONE); + binding.showInactiveDevices.setVisibility(View.GONE); } } else { - mShowInactiveDevicesButton.setVisibility(View.GONE); + binding.showInactiveDevices.setVisibility(View.GONE); } if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) { hasKeys = true; - View view = inflater.inflate(R.layout.contact_key, keys, false); + View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false); TextView key = view.findViewById(R.id.key); TextView keyType = view.findViewById(R.id.key_type); keyType.setText(R.string.openpgp_key_id); @@ -635,21 +608,21 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp view.setOnClickListener(openKey); key.setOnClickListener(openKey); keyType.setOnClickListener(openKey); - keys.addView(view); + binding.detailsContactKeys.addView(view); } - keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE); + binding.keysWrapper.setVisibility(hasKeys ? View.VISIBLE : View.GONE); List<ListItem.Tag> tagList = contact.getTags(this); if (tagList.size() == 0 || !this.showDynamicTags) { - tags.setVisibility(View.GONE); + binding.tags.setVisibility(View.GONE); } else { - tags.setVisibility(View.VISIBLE); - tags.removeAllViewsInLayout(); + binding.tags.setVisibility(View.VISIBLE); + binding.tags.removeAllViewsInLayout(); for (final ListItem.Tag tag : tagList) { - final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, tags, false); + final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false); tv.setText(tag.getName()); tv.setBackgroundColor(tag.getColor()); - tags.addView(tv); + binding.tags.addView(tv); } } } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 192979083..dbfc61a0c 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1,8 +1,6 @@ package de.pixart.messenger.ui; import android.annotation.SuppressLint; -import android.app.ActionBar; -import android.app.AlertDialog; import android.app.FragmentTransaction; import android.app.PendingIntent; import android.content.ActivityNotFoundException; @@ -18,16 +16,17 @@ import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Typeface; -import android.media.ExifInterface; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Handler; import android.preference.PreferenceManager; import android.provider.MediaStore; import android.provider.Settings; +import android.support.media.ExifInterface; import android.support.v4.widget.SlidingPaneLayout; import android.support.v4.widget.SlidingPaneLayout.PanelSlideListener; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.util.Pair; import android.view.Gravity; @@ -250,7 +249,7 @@ public class ConversationActivity extends XmppActivity this.listAdapter = new ConversationAdapter(this, conversationList); listView.setAdapter(this.listAdapter); - final ActionBar actionBar = getActionBar(); + final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); } @@ -350,12 +349,9 @@ public class ConversationActivity extends XmppActivity @Override public void switchToConversation(Conversation conversation) { setSelectedConversation(conversation); - runOnUiThread(new Runnable() { - @Override - public void run() { - ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation()); - openConversation(); - } + runOnUiThread(() -> { + ConversationActivity.this.mConversationFragment.reInit(getSelectedConversation()); + openConversation(); }); } @@ -364,7 +360,7 @@ public class ConversationActivity extends XmppActivity } private void updateActionBarTitle(boolean titleShouldBeName) { - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); final Conversation conversation = getSelectedConversation(); if (ab != null) { if (titleShouldBeName && conversation != null) { @@ -481,6 +477,8 @@ public class ConversationActivity extends XmppActivity final MenuItem menuClearHistory = menu.findItem(R.id.action_clear_history); final MenuItem menuAdd = menu.findItem(R.id.action_add); final MenuItem menuInviteContact = menu.findItem(R.id.action_invite); + final MenuItem menuAttachSoundRecorder = menu.findItem(R.id.attach_record_voice); + final MenuItem menuAttachLocation = menu.findItem(R.id.attach_location); final MenuItem menuUpdater = menu.findItem(R.id.action_check_updates); final MenuItem menuInviteUser = menu.findItem(R.id.action_invite_user); final MenuItem menuSearchHistory = menu.findItem(R.id.action_search_history); @@ -498,6 +496,8 @@ public class ConversationActivity extends XmppActivity menuSecure.setVisible(false); menuInviteContact.setVisible(false); menuAttach.setVisible(false); + menuAttachLocation.setVisible(false); + menuAttachSoundRecorder.setVisible(false); menuClearHistory.setVisible(false); menuSearchHistory.setVisible(false); if (xmppConnectionService.installedFromFDroid()) { @@ -518,11 +518,7 @@ public class ConversationActivity extends XmppActivity menuArchiveChat.setVisible(false); } if (this.getSelectedConversation().getNextEncryption() != Message.ENCRYPTION_NONE) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - menuSecure.setIcon(R.drawable.ic_lock_white_24dp); - } else { - menuSecure.setIcon(R.drawable.ic_action_secure); - } + menuSecure.setIcon(R.drawable.ic_lock_white_24dp); } if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) { menuAttach.setVisible(getSelectedConversation().getAccount().httpUploadAvailable() && getSelectedConversation().getMucOptions().participating()); @@ -532,133 +528,119 @@ public class ConversationActivity extends XmppActivity menuSecure.setVisible(Config.multipleEncryptionChoices()); menuInviteContact.setVisible(xmppConnectionService != null && xmppConnectionService.findConferenceServer(getSelectedConversation().getAccount()) != null); } + menuAttachLocation.setVisible(true); + menuAttachSoundRecorder.setVisible(true); + configureEncryptionMenu(getSelectedConversation(), menu); } } - if (Config.supportOmemo()) { - new Handler().post(addOmemoDebuggerRunnable); - } return super.onCreateOptionsMenu(menu); } - private Runnable addOmemoDebuggerRunnable = new Runnable() { - @Override - public void run() { - View view = findViewById(R.id.action_security); - if (view != null) { - view.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View v) { - return v.getId() == R.id.action_security && quickOmemoDebugger(getSelectedConversation()); - } - }); - } - } - }; - - private boolean quickOmemoDebugger(Conversation c) { - if (c != null) { - boolean single = c.getMode() == Conversation.MODE_SINGLE; - AxolotlService axolotlService = c.getAccount().getAxolotlService(); - Pair<AxolotlService.AxolotlCapability, Jid> capabilityJidPair = axolotlService.isConversationAxolotlCapableDetailed(c); - switch (capabilityJidPair.first) { - case MISSING_PRESENCE: - Toast.makeText(ConversationActivity.this, single ? getString(R.string.missing_presence_subscription) : getString(R.string.missing_presence_subscription_with_x, capabilityJidPair.second.toBareJid().toString()), Toast.LENGTH_SHORT).show(); - return true; - case MISSING_KEYS: - Toast.makeText(ConversationActivity.this, single ? getString(R.string.missing_omemo_keys) : getString(R.string.missing_keys_from_x, capabilityJidPair.second.toBareJid().toString()), Toast.LENGTH_SHORT).show(); - return true; - case WRONG_CONFIGURATION: - Toast.makeText(ConversationActivity.this, R.string.wrong_conference_configuration, Toast.LENGTH_SHORT).show(); - return true; - case NO_MEMBERS: - Toast.makeText(ConversationActivity.this, R.string.this_conference_has_no_members, Toast.LENGTH_SHORT).show(); - return true; - } + private static void configureEncryptionMenu(Conversation conversation, Menu menu) { + MenuItem otr = menu.findItem(R.id.encryption_choice_otr); + MenuItem none = menu.findItem(R.id.encryption_choice_none); + MenuItem pgp = menu.findItem(R.id.encryption_choice_pgp); + MenuItem axolotl = menu.findItem(R.id.encryption_choice_axolotl); + pgp.setVisible(Config.supportOpenPgp()); + none.setVisible(Config.supportUnencrypted() || conversation.getMode() == Conversation.MODE_MULTI); + otr.setVisible(Config.supportOtr()); + axolotl.setVisible(Config.supportOmemo()); + if (conversation.getMode() == Conversation.MODE_MULTI) { + otr.setVisible(false); + } + if (!conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) { + axolotl.setEnabled(false); + } + switch (conversation.getNextEncryption()) { + case Message.ENCRYPTION_NONE: + none.setChecked(true); + break; + case Message.ENCRYPTION_OTR: + otr.setChecked(true); + break; + case Message.ENCRYPTION_PGP: + pgp.setChecked(true); + break; + case Message.ENCRYPTION_AXOLOTL: + axolotl.setChecked(true); + break; + default: + none.setChecked(true); + break; } - return false; } protected void selectPresenceToAttachFile(final int attachmentChoice, final int encryption) { final Conversation conversation = getSelectedConversation(); final Account account = conversation.getAccount(); - final OnPresenceSelected callback = new OnPresenceSelected() { - - @Override - public void onPresenceSelected() { - final Intent intent = new Intent(); - boolean chooser = false; - String fallbackPackageId = null; - switch (attachmentChoice) { - case ATTACHMENT_CHOICE_CHOOSE_IMAGE: - intent.setAction(Intent.ACTION_GET_CONTENT); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); - } - intent.setType("image/*"); - chooser = true; - break; - case ATTACHMENT_CHOICE_CHOOSE_VIDEO: - chooser = true; - intent.setType("video/*"); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setAction(Intent.ACTION_GET_CONTENT); - break; - case ATTACHMENT_CHOICE_TAKE_FROM_CAMERA: - AlertDialog.Builder builder = new AlertDialog.Builder(ConversationActivity.this); - builder.setTitle(getString(R.string.attach_take_from_camera)); - builder.setNegativeButton(getString(R.string.action_take_photo), - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Uri uri = xmppConnectionService.getFileBackend().getTakePhotoUri(); - intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); - intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); - intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); - mPendingPhotoUris.clear(); - mPendingPhotoUris.add(uri); - startActivityForResult(intent, attachmentChoice); - } - }); - builder.setPositiveButton(getString(R.string.action_take_video), - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Uri uri = xmppConnectionService.getFileBackend().getTakeVideoUri(); - intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE); - mPendingFileUris.clear(); - mPendingFileUris.add(uri); - startActivityForResult(intent, attachmentChoice); - } - }); - builder.create().show(); - break; - case ATTACHMENT_CHOICE_CHOOSE_FILE: - chooser = true; - intent.setType("*/*"); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setAction(Intent.ACTION_GET_CONTENT); - break; - case ATTACHMENT_CHOICE_RECORD_VOICE: - startActivityForResult(new Intent(getApplicationContext(), RecordingActivity.class), attachmentChoice); - break; - case ATTACHMENT_CHOICE_LOCATION: - startActivityForResult(new Intent(getApplicationContext(), ShareLocationActivity.class), attachmentChoice); - break; - } - if (intent.resolveActivity(getPackageManager()) != null) { - Log.d(Config.LOGTAG, "Attachment: " + attachmentChoice); - if (chooser) { - startActivityForResult( - Intent.createChooser(intent, getString(R.string.perform_action_with)), - attachmentChoice); - } else { - startActivityForResult(intent, attachmentChoice); + final OnPresenceSelected callback = () -> { + final Intent intent = new Intent(); + boolean chooser = false; + String fallbackPackageId = null; + switch (attachmentChoice) { + case ATTACHMENT_CHOICE_CHOOSE_IMAGE: + intent.setAction(Intent.ACTION_GET_CONTENT); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); } - } else if (fallbackPackageId != null) { - startActivity(getInstallApkIntent(fallbackPackageId)); + intent.setType("image/*"); + chooser = true; + break; + case ATTACHMENT_CHOICE_CHOOSE_VIDEO: + chooser = true; + intent.setType("video/*"); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setAction(Intent.ACTION_GET_CONTENT); + break; + case ATTACHMENT_CHOICE_TAKE_FROM_CAMERA: + AlertDialog.Builder builder = new AlertDialog.Builder(ConversationActivity.this); + builder.setTitle(getString(R.string.attach_take_from_camera)); + builder.setNegativeButton(getString(R.string.action_take_photo), + (dialog, which) -> { + Uri uri = xmppConnectionService.getFileBackend().getTakePhotoUri(); + intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); + mPendingPhotoUris.clear(); + mPendingPhotoUris.add(uri); + startActivityForResult(intent, attachmentChoice); + }); + builder.setPositiveButton(getString(R.string.action_take_video), + (dialog, which) -> { + Uri uri = xmppConnectionService.getFileBackend().getTakeVideoUri(); + intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE); + mPendingFileUris.clear(); + mPendingFileUris.add(uri); + startActivityForResult(intent, attachmentChoice); + }); + builder.create().show(); + break; + case ATTACHMENT_CHOICE_CHOOSE_FILE: + chooser = true; + intent.setType("*/*"); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setAction(Intent.ACTION_GET_CONTENT); + break; + case ATTACHMENT_CHOICE_RECORD_VOICE: + startActivityForResult(new Intent(getApplicationContext(), RecordingActivity.class), attachmentChoice); + break; + case ATTACHMENT_CHOICE_LOCATION: + startActivityForResult(new Intent(getApplicationContext(), ShareLocationActivity.class), attachmentChoice); + break; + } + if (intent.resolveActivity(getPackageManager()) != null) { + Log.d(Config.LOGTAG, "Attachment: " + attachmentChoice); + if (chooser) { + startActivityForResult( + Intent.createChooser(intent, getString(R.string.perform_action_with)), + attachmentChoice); + } else { + startActivityForResult(intent, attachmentChoice); } + } else if (fallbackPackageId != null) { + startActivity(getInstallApkIntent(fallbackPackageId)); } }; if ((account.httpUploadAvailable() || attachmentChoice == ATTACHMENT_CHOICE_LOCATION) && encryption != Message.ENCRYPTION_OTR) { @@ -817,8 +799,26 @@ public class ConversationActivity extends XmppActivity return true; } else if (getSelectedConversation() != null) { switch (item.getItemId()) { - case R.id.action_attach_file: - attachFileDialog(); + case R.id.encryption_choice_axolotl: + case R.id.encryption_choice_otr: + case R.id.encryption_choice_pgp: + case R.id.encryption_choice_none: + handleEncryptionSelection(item); + break; + case R.id.attach_choose_picture: + attachFile(ATTACHMENT_CHOICE_CHOOSE_IMAGE); + break; + case R.id.attach_take_picture: + attachFile(ATTACHMENT_CHOICE_TAKE_FROM_CAMERA); + break; + case R.id.attach_choose_file: + attachFile(ATTACHMENT_CHOICE_CHOOSE_FILE); + break; + case R.id.attach_record_voice: + attachFile(ATTACHMENT_CHOICE_RECORD_VOICE); + break; + case R.id.attach_location: + attachFile(ATTACHMENT_CHOICE_LOCATION); break; case R.id.action_archive_chat: this.endConversation(getSelectedConversation()); @@ -840,9 +840,6 @@ public class ConversationActivity extends XmppActivity case R.id.action_invite: inviteToConversation(getSelectedConversation()); break; - case R.id.action_security: - selectEncryptionDialog(getSelectedConversation()); - break; case R.id.action_clear_history: clearHistoryDialog(getSelectedConversation()); break; @@ -893,10 +890,8 @@ public class ConversationActivity extends XmppActivity protected void clearHistoryDialog(final Conversation conversation) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.clear_conversation_history)); - View dialogView = getLayoutInflater().inflate( - R.layout.dialog_clear_history, null); - final CheckBox endConversationCheckBox = dialogView - .findViewById(R.id.end_conversation_checkbox); + final View dialogView = getLayoutInflater().inflate(R.layout.dialog_clear_history, null); + final CheckBox endConversationCheckBox = dialogView.findViewById(R.id.end_conversation_checkbox); if (conversation.getMode() == Conversation.MODE_SINGLE) { endConversationCheckBox.setVisibility(View.VISIBLE); endConversationCheckBox.setChecked(true); @@ -904,65 +899,23 @@ public class ConversationActivity extends XmppActivity builder.setView(dialogView); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.delete_messages), - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation); - if (conversation.getMode() == Conversation.MODE_SINGLE) { - if (endConversationCheckBox.isChecked()) { - endConversation(conversation); - } else { - updateConversationList(); - ConversationActivity.this.mConversationFragment.updateMessages(); - } + (dialog, which) -> { + ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation); + if (conversation.getMode() == Conversation.MODE_SINGLE) { + if (endConversationCheckBox.isChecked()) { + endConversation(conversation); } else { updateConversationList(); ConversationActivity.this.mConversationFragment.updateMessages(); } + } else { + updateConversationList(); + ConversationActivity.this.mConversationFragment.updateMessages(); } }); builder.create().show(); } - protected void attachFileDialog() { - View menuAttachFile = findViewById(R.id.action_attach_file); - if (menuAttachFile == null) { - return; - } - PopupMenu attachFilePopup = new PopupMenu(this, menuAttachFile); - attachFilePopup.inflate(R.menu.attachment_choices); - attachFilePopup.setOnMenuItemClickListener(new OnMenuItemClickListener() { - - @Override - public boolean onMenuItemClick(MenuItem item) { - switch (item.getItemId()) { - case R.id.attach_choose_picture: - attachFile(ATTACHMENT_CHOICE_CHOOSE_IMAGE); - break; - case R.id.attach_take_picture: - attachFile(ATTACHMENT_CHOICE_TAKE_FROM_CAMERA); - break; - case R.id.attach_choose_video: - attachFile(ATTACHMENT_CHOICE_CHOOSE_VIDEO); - break; - case R.id.attach_choose_file: - attachFile(ATTACHMENT_CHOICE_CHOOSE_FILE); - break; - case R.id.attach_record_voice: - attachFile(ATTACHMENT_CHOICE_RECORD_VOICE); - break; - case R.id.attach_location: - attachFile(ATTACHMENT_CHOICE_LOCATION); - break; - } - return false; - } - }); - UIHelper.showIconsInPopup(attachFilePopup); - attachFilePopup.show(); - } - public void verifyOtrSessionDialog(final Conversation conversation, View view) { if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) { Toast.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show(); @@ -998,91 +951,47 @@ public class ConversationActivity extends XmppActivity popup.show(); } - protected void selectEncryptionDialog(final Conversation conversation) { - View menuItemView = findViewById(R.id.action_security); - if (menuItemView == null) { + private void handleEncryptionSelection(MenuItem item) { + Conversation conversation = getSelectedConversation(); + if (conversation == null) { return; } - PopupMenu popup = new PopupMenu(this, menuItemView); - final ConversationFragment fragment = (ConversationFragment) getFragmentManager() - .findFragmentByTag("conversation"); - if (fragment != null) { - popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { - - @Override - public boolean onMenuItemClick(MenuItem item) { - switch (item.getItemId()) { - case R.id.encryption_choice_none: - conversation.setNextEncryption(Message.ENCRYPTION_NONE); - item.setChecked(true); - break; - case R.id.encryption_choice_otr: - conversation.setNextEncryption(Message.ENCRYPTION_OTR); - item.setChecked(true); - break; - case R.id.encryption_choice_pgp: - if (hasPgp()) { - if (conversation.getAccount().getPgpSignature() != null) { - conversation.setNextEncryption(Message.ENCRYPTION_PGP); - item.setChecked(true); - } else { - announcePgp(conversation.getAccount(), conversation, null, onOpenPGPKeyPublished); - } - } else { - showInstallPgpDialog(); - } - break; - case R.id.encryption_choice_axolotl: - Log.d(Config.LOGTAG, AxolotlService.getLogprefix(conversation.getAccount()) - + "Enabled axolotl for Contact " + conversation.getContact().getJid()); - conversation.setNextEncryption(Message.ENCRYPTION_AXOLOTL); - item.setChecked(true); - break; - default: - conversation.setNextEncryption(Message.ENCRYPTION_NONE); - break; + final ConversationFragment fragment = (ConversationFragment) getFragmentManager().findFragmentByTag("conversation"); + switch (item.getItemId()) { + case R.id.encryption_choice_none: + conversation.setNextEncryption(Message.ENCRYPTION_NONE); + item.setChecked(true); + break; + case R.id.encryption_choice_otr: + conversation.setNextEncryption(Message.ENCRYPTION_OTR); + item.setChecked(true); + break; + case R.id.encryption_choice_pgp: + if (hasPgp()) { + if (conversation.getAccount().getPgpSignature() != null) { + conversation.setNextEncryption(Message.ENCRYPTION_PGP); + item.setChecked(true); + } else { + announcePgp(conversation.getAccount(), conversation, null, onOpenPGPKeyPublished); } - xmppConnectionService.updateConversation(conversation); - fragment.updateChatMsgHint(); - invalidateOptionsMenu(); - refreshUi(); - return true; + } else { + showInstallPgpDialog(); } - }); - popup.inflate(R.menu.encryption_choices); - MenuItem otr = popup.getMenu().findItem(R.id.encryption_choice_otr); - MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none); - MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp); - MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl); - pgp.setVisible(Config.supportOpenPgp()); - none.setVisible(Config.supportUnencrypted() || conversation.getMode() == Conversation.MODE_MULTI); - otr.setVisible(Config.supportOtr()); - axolotl.setVisible(Config.supportOmemo()); - if (conversation.getMode() == Conversation.MODE_MULTI) { - otr.setVisible(false); - } - if (!conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) { - axolotl.setEnabled(false); - } - switch (conversation.getNextEncryption()) { - case Message.ENCRYPTION_NONE: - none.setChecked(true); - break; - case Message.ENCRYPTION_OTR: - otr.setChecked(true); - break; - case Message.ENCRYPTION_PGP: - pgp.setChecked(true); - break; - case Message.ENCRYPTION_AXOLOTL: - axolotl.setChecked(true); - break; - default: - none.setChecked(true); - break; - } - popup.show(); + break; + case R.id.encryption_choice_axolotl: + Log.d(Config.LOGTAG, AxolotlService.getLogprefix(conversation.getAccount()) + + "Enabled axolotl for Contact " + conversation.getContact().getJid()); + conversation.setNextEncryption(Message.ENCRYPTION_AXOLOTL); + item.setChecked(true); + break; + default: + conversation.setNextEncryption(Message.ENCRYPTION_NONE); + break; } + xmppConnectionService.updateConversation(conversation); + fragment.updateChatMsgHint(); + invalidateOptionsMenu(); + refreshUi(); } @Override @@ -1260,7 +1169,6 @@ public class ConversationActivity extends XmppActivity recreate(); } this.mActivityPaused = false; - if (!isConversationsOverviewVisable() || !isConversationsOverviewHideable()) { sendReadMarkerIfNecessary(getSelectedConversation()); } @@ -1699,26 +1607,18 @@ public class ConversationActivity extends XmppActivity AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.battery_optimizations_enabled); builder.setMessage(R.string.battery_optimizations_enabled_dialog); - builder.setPositiveButton(R.string.next, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - Uri uri = Uri.parse("package:" + getPackageName()); - intent.setData(uri); - try { - startActivityForResult(intent, REQUEST_BATTERY_OP); - } catch (ActivityNotFoundException e) { - Toast.makeText(ConversationActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); - } + builder.setPositiveButton(R.string.next, (dialog, which) -> { + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + Uri uri = Uri.parse("package:" + getPackageName()); + intent.setData(uri); + try { + startActivityForResult(intent, REQUEST_BATTERY_OP); + } catch (ActivityNotFoundException e) { + Toast.makeText(ConversationActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - builder.setOnDismissListener(new DialogInterface.OnDismissListener() { - @Override - public void onDismiss(DialogInterface dialog) { - setNeverAskForBatteryOptimizationsAgain(); - } - }); + builder.setOnDismissListener(dialog -> setNeverAskForBatteryOptimizationsAgain()); } builder.create().show(); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index e73f30211..e4c648e25 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1,7 +1,7 @@ package de.pixart.messenger.ui; import android.app.Activity; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.Fragment; import android.app.PendingIntent; import android.content.ActivityNotFoundException; diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index c94ceb44b..d26c2123c 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -1,27 +1,28 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; -import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.PendingIntent; import android.content.ActivityNotFoundException; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; +import android.os.Handler; import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainAliasCallback; +import android.support.design.widget.TextInputLayout; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; @@ -48,6 +49,7 @@ import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.axolotl.AxolotlService; import de.pixart.messenger.crypto.axolotl.XmppAxolotlSession; +import de.pixart.messenger.databinding.ActivityEditAccountBinding; import de.pixart.messenger.entities.Account; import de.pixart.messenger.services.BarcodeProvider; import de.pixart.messenger.services.XmppConnectionService; @@ -66,24 +68,20 @@ import de.pixart.messenger.xmpp.forms.Data; import de.pixart.messenger.xmpp.jid.InvalidJidException; import de.pixart.messenger.xmpp.jid.Jid; import de.pixart.messenger.xmpp.pep.Avatar; - public class EditAccountActivity extends OmemoActivity implements OnAccountUpdate, OnUpdateBlocklist, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { private static final int REQUEST_DATA_SAVER = 0x37af244; - private AutoCompleteTextView mAccountJid; + private TextInputLayout mAccountJidLayout; private EditText mPassword; - private EditText mPasswordConfirm; + private TextInputLayout mPasswordLayout; private CheckBox mRegisterNew; private Button mCancelButton; private Button mSaveButton; private Button mDisableOsOptimizationsButton; - private TextView mDisableOsOptimizationsHeadline; private TextView getmDisableOsOptimizationsBody; private TableLayout mMoreTable; - private LinearLayout mStats; - private RelativeLayout mOsOptimizations; private TextView mServerInfoSm; private TextView mServerInfoRosterVersion; private TextView mServerInfoCarbons; @@ -100,7 +98,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private TextView mOwnFingerprintDesc; private TextView mOtrFingerprintDesc; private TextView getmPgpFingerprintDesc; - private TextView mAccountJidLabel; private ImageView mAvatar; private RelativeLayout mOtrFingerprintBox; private RelativeLayout mAxolotlFingerprintBox; @@ -109,10 +106,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private ImageButton mAxolotlFingerprintToClipboardButton; private ImageButton mPgpDeleteFingerprintButton; private LinearLayout keys; - private LinearLayout keysCard; private LinearLayout mNamePort; private EditText mHostname; + private TextInputLayout mHostnameLayout; private EditText mPort; + private TextInputLayout mPortLayout; private AlertDialog mCaptchaDialog = null; private Jid jidToEdit; @@ -129,7 +127,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat @Override public void onClick(final View v) { final String password = mPassword.getText().toString(); - final String passwordConfirm = mPasswordConfirm.getText().toString(); final boolean wasDisabled = mAccount != null && mAccount.getStatus() == Account.State.DISABLED; if (!mInitMode && passwordChangedInMagicCreateMode()) { @@ -147,9 +144,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat return; } final boolean registerNewAccount = mRegisterNew.isChecked() && !Config.DISALLOW_REGISTRATION_IN_UI; - if (mUsernameMode && mAccountJid.getText().toString().contains("@")) { - mAccountJid.setError(getString(R.string.invalid_username)); - mAccountJid.requestFocus(); + if (mUsernameMode && binding.accountJid.getText().toString().contains("@")) { + mAccountJidLayout.setError(getString(R.string.invalid_username)); + removeErrorsOnAllBut(mAccountJidLayout); + binding.accountJid.requestFocus(); return; } @@ -171,17 +169,18 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat final Jid jid; try { if (mUsernameMode) { - jid = Jid.fromParts(mAccountJid.getText().toString(), getUserModeDomain(), null); + jid = Jid.fromParts(binding.accountJid.getText().toString(), getUserModeDomain(), null); } else { - jid = Jid.fromString(mAccountJid.getText().toString()); + jid = Jid.fromString(binding.accountJid.getText().toString()); } } catch (final InvalidJidException e) { if (mUsernameMode) { - mAccountJid.setError(getString(R.string.invalid_username)); + mAccountJidLayout.setError(getString(R.string.invalid_username)); } else { - mAccountJid.setError(getString(R.string.invalid_jid)); + mAccountJidLayout.setError(getString(R.string.invalid_jid)); } - mAccountJid.requestFocus(); + binding.accountJid.requestFocus(); + removeErrorsOnAllBut(mAccountJidLayout); return; } String hostname = null; @@ -190,20 +189,23 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat hostname = mHostname.getText().toString().replaceAll("\\s", ""); final String port = mPort.getText().toString().replaceAll("\\s", ""); if (hostname.contains(" ")) { - mHostname.setError(getString(R.string.not_valid_hostname)); + mHostnameLayout.setError(getString(R.string.not_valid_hostname)); mHostname.requestFocus(); + removeErrorsOnAllBut(mHostnameLayout); return; } try { numericPort = Integer.parseInt(port); if (numericPort < 0 || numericPort > 65535) { - mPort.setError(getString(R.string.not_a_valid_port)); + mPortLayout.setError(getString(R.string.not_a_valid_port)); + removeErrorsOnAllBut(mPortLayout); mPort.requestFocus(); return; } } catch (NumberFormatException e) { - mPort.setError(getString(R.string.not_a_valid_port)); + mPortLayout.setError(getString(R.string.not_a_valid_port)); + removeErrorsOnAllBut(mPortLayout); mPort.requestFocus(); return; } @@ -211,22 +213,18 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (jid.isDomainJid()) { if (mUsernameMode) { - mAccountJid.setError(getString(R.string.invalid_username)); + mAccountJidLayout.setError(getString(R.string.invalid_username)); } else { - mAccountJid.setError(getString(R.string.invalid_jid)); + mAccountJidLayout.setError(getString(R.string.invalid_jid)); } - mAccountJid.requestFocus(); + removeErrorsOnAllBut(mAccountJidLayout); + binding.accountJid.requestFocus(); return; } if (registerNewAccount) { if (XmppConnection.errorMessage != null) { Toast.makeText(EditAccountActivity.this, XmppConnection.errorMessage, Toast.LENGTH_LONG).show(); } - if (!password.equals(passwordConfirm)) { - mPasswordConfirm.setError(getString(R.string.passwords_do_not_match)); - mPasswordConfirm.requestFocus(); - return; - } } if (mAccount != null) { if (mInitMode && mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE)) { @@ -236,11 +234,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat mAccount.setPort(numericPort); mAccount.setHostname(hostname); if (XmppConnection.errorMessage != null) { - mAccountJid.setError(XmppConnection.errorMessage); + mAccountJidLayout.setError(XmppConnection.errorMessage); } else { - mAccountJid.setError(null); + mAccountJidLayout.setError(null); } - mPasswordConfirm.setError(null); mAccount.setPassword(password); mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount); if (!xmppConnectionService.updateAccount(mAccount)) { @@ -249,8 +246,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } else { if (xmppConnectionService.findAccountByJid(jid) != null) { - mAccountJid.setError(getString(R.string.account_already_exists)); - mAccountJid.requestFocus(); + mAccountJidLayout.setError(getString(R.string.account_already_exists)); + removeErrorsOnAllBut(mAccountJidLayout); + binding.accountJid.requestFocus(); return; } mAccount = new Account(jid.toBareJid(), password); @@ -261,8 +259,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount); xmppConnectionService.createAccount(mAccount); } - mHostname.setError(null); - mPort.setError(null); + mHostnameLayout.setError(null); + mPortLayout.setError(null); if (mAccount.isEnabled() && !registerNewAccount && !mInitMode) { @@ -288,6 +286,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private boolean mSavedInstanceInit = false; private Button mClearDevicesButton; private XmppUri pendingUri = null; + private boolean mUseTor; + private ActivityEditAccountBinding binding; public void refreshUiReal() { invalidateOptionsMenu(); @@ -371,6 +371,24 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } }; + private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View view, boolean b) { + EditText et = (EditText) view; + if (b) { + int resId = mUsernameMode ? R.string.username : R.string.account_settings_example_jabber_id; + if (view.getId() == R.id.hostname) { + resId = mUseTor ? R.string.hostname_or_onion : R.string.hostname_example; + } + final int res = resId; + new Handler().postDelayed(() -> et.setHint(res), 500); + } else { + et.setHint(null); + } + } + }; + + private final OnClickListener mAvatarClickListener = new OnClickListener() { @Override public void onClick(final View view) { @@ -499,7 +517,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } else { unmodified = this.mAccount.getJid().toBareJid().toString(); } - return !unmodified.equals(this.mAccountJid.getText().toString()); + return !unmodified.equals(this.binding.accountJid.getText().toString()); } protected boolean passwordChangedInMagicCreateMode() { @@ -526,20 +544,17 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mSavedInstanceAccount = savedInstanceState.getString("account"); this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false); } - setContentView(R.layout.activity_edit_account); - this.mAccountJid = findViewById(R.id.account_jid); - this.mAccountJid.addTextChangedListener(this.mTextWatcher); - this.mAccountJidLabel = findViewById(R.id.account_jid_label); + this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account); + this.binding.accountJid.addTextChangedListener(this.mTextWatcher); + this.binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener); + this.mAccountJidLayout = (TextInputLayout) findViewById(R.id.account_jid_layout); this.mPassword = findViewById(R.id.account_password); this.mPassword.addTextChangedListener(this.mTextWatcher); - this.mPasswordConfirm = findViewById(R.id.account_password_confirm); + this.mPasswordLayout = (TextInputLayout) findViewById(R.id.account_password_layout); this.mAvatar = findViewById(R.id.avater); this.mAvatar.setOnClickListener(this.mAvatarClickListener); this.mRegisterNew = findViewById(R.id.account_register_new); - this.mStats = findViewById(R.id.stats); - this.mOsOptimizations = findViewById(R.id.os_optimization); this.mDisableOsOptimizationsButton = findViewById(R.id.os_optimization_disable); - this.mDisableOsOptimizationsHeadline = findViewById(R.id.os_optimization_headline); this.getmDisableOsOptimizationsBody = findViewById(R.id.os_optimization_body); this.mSessionEst = findViewById(R.id.session_est); this.mServerInfoRosterVersion = findViewById(R.id.server_info_roster_version); @@ -564,11 +579,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mAxolotlFingerprintBox = findViewById(R.id.axolotl_fingerprint_box); this.mAxolotlFingerprintToClipboardButton = findViewById(R.id.action_copy_axolotl_to_clipboard); this.mOwnFingerprintDesc = findViewById(R.id.own_fingerprint_desc); - this.keysCard = findViewById(R.id.other_device_keys_card); this.keys = findViewById(R.id.other_device_keys); this.mNamePort = findViewById(R.id.name_port); this.mHostname = findViewById(R.id.hostname); this.mHostname.addTextChangedListener(mTextWatcher); + this.mHostname.setOnFocusChangeListener(mEditTextFocusListener); + this.mHostnameLayout = (TextInputLayout)findViewById(R.id.hostname_layout); this.mClearDevicesButton = findViewById(R.id.clear_devices); this.mClearDevicesButton.setOnClickListener(new OnClickListener() { @Override @@ -579,6 +595,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mPort = findViewById(R.id.port); this.mPort.setText("5222"); this.mPort.addTextChangedListener(mTextWatcher); + this.mPortLayout = (TextInputLayout)findViewById(R.id.port_layout); this.mSaveButton = findViewById(R.id.save_button); this.mCancelButton = findViewById(R.id.cancel_button); this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener); @@ -589,13 +606,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() { @Override - public void onCheckedChanged(final CompoundButton buttonView, - final boolean isChecked) { - if (isChecked) { - mPasswordConfirm.setVisibility(View.VISIBLE); - } else { - mPasswordConfirm.setVisibility(View.GONE); - } + public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { updateSaveButton(); } }; @@ -688,12 +699,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.messageFingerprint = getIntent().getStringExtra("fingerprint"); if (!mInitMode) { this.mRegisterNew.setVisibility(View.GONE); - if (getActionBar() != null) { - getActionBar().setTitle(getString(R.string.account_details)); + if (getSupportActionBar() != null) { + getSupportActionBar().setTitle(getString(R.string.account_details)); } } else { this.mAvatar.setVisibility(View.GONE); - ActionBar ab = getActionBar(); + ActionBar ab = getSupportActionBar(); if (ab != null) { if (init && Config.MAGIC_CREATE_DOMAIN == null) { ab.setDisplayShowHomeEnabled(false); @@ -704,9 +715,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } SharedPreferences preferences = getPreferences(); - boolean useTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false); - this.mShowOptions = useTor || preferences.getBoolean("show_connection_options", false); - mHostname.setHint(useTor ? R.string.hostname_or_onion : R.string.hostname_example); + mUseTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false); + this.mShowOptions = mUseTor || preferences.getBoolean("show_connection_options", false); this.mNamePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); } @@ -769,13 +779,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mCancelButton.setTextColor(getSecondaryTextColor()); } if (mUsernameMode) { - this.mAccountJidLabel.setText(R.string.username); - this.mAccountJid.setHint(R.string.username_hint); + this.binding.accountJid.setHint(R.string.username_hint); } else { final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this, R.layout.simple_list_item, xmppConnectionService.getKnownHosts()); - this.mAccountJid.setAdapter(mKnownHostsAdapter); + this.binding.accountJid.setAdapter(mKnownHostsAdapter); } if (pendingUri != null) { processFingerprintVerification(pendingUri, false); @@ -890,11 +899,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private void updateAccountInformation(boolean init) { if (init) { - this.mAccountJid.getEditableText().clear(); + this.binding.accountJid.getEditableText().clear(); if (mUsernameMode) { - this.mAccountJid.getEditableText().append(this.mAccount.getJid().getLocalpart()); + this.binding.accountJid.getEditableText().append(this.mAccount.getJid().getLocalpart()); } else { - this.mAccountJid.getEditableText().append(this.mAccount.getJid().toBareJid().toString()); + this.binding.accountJid.getEditableText().append(this.mAccount.getJid().toBareJid().toString()); } this.mPassword.getEditableText().clear(); this.mPassword.getEditableText().append(this.mAccount.getPassword()); @@ -908,28 +917,28 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } final boolean editable = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY); - this.mAccountJid.setEnabled(editable); - this.mAccountJid.setFocusable(editable); - this.mAccountJid.setFocusableInTouchMode(editable); + this.binding.accountJid.setEnabled(editable); + this.binding.accountJid.setFocusable(editable); + this.binding.accountJid.setFocusableInTouchMode(editable); + this.mPasswordLayout.setPasswordVisibilityToggleEnabled(editable); if (!mInitMode) { this.mAvatar.setVisibility(View.VISIBLE); this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(Config.AVATAR_SIZE))); - this.mAccountJid.setEnabled(false); + this.binding.accountJid.setEnabled(false); } else { this.mAvatar.setVisibility(View.GONE); } if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) { this.mRegisterNew.setVisibility(View.VISIBLE); this.mRegisterNew.setChecked(true); - this.mPasswordConfirm.setText(this.mAccount.getPassword()); } else { this.mRegisterNew.setVisibility(View.GONE); this.mRegisterNew.setChecked(false); } if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) { Features features = this.mAccount.getXmppConnection().getFeatures(); - this.mStats.setVisibility(View.VISIBLE); + this.binding.stats.setVisibility(View.VISIBLE); boolean showBatteryWarning = !xmppConnectionService.getPushManagementService().available(mAccount) && isOptimizingBattery(); boolean showDataSaverWarning = isAffectedByDataSaver(); showOsOptimizationWarning(showBatteryWarning, showDataSaverWarning); @@ -993,18 +1002,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } final long pgpKeyId = this.mAccount.getPgpId(); if (pgpKeyId != 0 && Config.supportOpenPgp()) { - OnClickListener openPgp = new OnClickListener() { - @Override - public void onClick(View view) { - launchOpenKeyChain(pgpKeyId); - } - }; - OnClickListener delete = new OnClickListener() { - @Override - public void onClick(View view) { - showDeletePgpDialog(); - } - }; + OnClickListener openPgp = view -> launchOpenKeyChain(pgpKeyId); + OnClickListener delete = view -> showDeletePgpDialog(); this.mPgpFingerprintBox.setVisibility(View.VISIBLE); this.mPgpFingerprint.setText(OpenPgpUtils.convertKeyIdToHex(pgpKeyId)); this.mPgpFingerprint.setOnClickListener(openPgp); @@ -1023,20 +1022,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } this.mOtrFingerprintBox.setVisibility(View.VISIBLE); this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); - this.mOtrFingerprintToClipboardButton - .setVisibility(View.VISIBLE); - this.mOtrFingerprintToClipboardButton - .setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(final View v) { - - if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) { - Toast.makeText( - EditAccountActivity.this, - R.string.toast_message_otr_fingerprint, - Toast.LENGTH_SHORT).show(); - } + this.mOtrFingerprintToClipboardButton.setVisibility(View.VISIBLE); + this.mOtrFingerprintToClipboardButton.setOnClickListener(v -> { + if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) { + Toast.makeText( + EditAccountActivity.this, + R.string.toast_message_otr_fingerprint, + Toast.LENGTH_SHORT).show(); } }); } else { @@ -1053,16 +1045,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mOwnFingerprintDesc.setText(R.string.omemo_fingerprint); } this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2))); - this.mAxolotlFingerprintToClipboardButton - .setVisibility(View.VISIBLE); - this.mAxolotlFingerprintToClipboardButton - .setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(final View v) { - copyOmemoFingerprint(ownAxolotlFingerprint); - } - }); + this.mAxolotlFingerprintToClipboardButton.setVisibility(View.VISIBLE); + this.mAxolotlFingerprintToClipboardButton.setOnClickListener(v -> copyOmemoFingerprint(ownAxolotlFingerprint)); } else { this.mAxolotlFingerprintBox.setVisibility(View.GONE); } @@ -1076,7 +1060,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } if (hasKeys && Config.supportOmemo()) { - keysCard.setVisibility(View.VISIBLE); + this.binding.otherDeviceKeysCard.setVisibility(View.VISIBLE); Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds(); if (otherDevices == null || otherDevices.isEmpty()) { mClearDevicesButton.setVisibility(View.GONE); @@ -1084,30 +1068,49 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat mClearDevicesButton.setVisibility(View.VISIBLE); } } else { - keysCard.setVisibility(View.GONE); + this.binding.otherDeviceKeysCard.setVisibility(View.GONE); } } else { + final TextInputLayout errorLayout; if (this.mAccount.errorStatus()) { - final EditText errorTextField; if (this.mAccount.getStatus() == Account.State.UNAUTHORIZED) { - errorTextField = this.mPassword; + errorLayout = this.mPasswordLayout; } else if (mShowOptions && this.mAccount.getStatus() == Account.State.SERVER_NOT_FOUND && this.mHostname.getText().length() > 0) { - errorTextField = this.mHostname; + errorLayout = this.mHostnameLayout; } else { - errorTextField = this.mAccountJid; + errorLayout = this.mAccountJidLayout; } - errorTextField.setError(getString(this.mAccount.getStatus().getReadableId())); + errorLayout.setError(getString(this.mAccount.getStatus().getReadableId())); if (init || !accountInfoEdited()) { - errorTextField.requestFocus(); + errorLayout.requestFocus(); } } else { - this.mAccountJid.setError(null); - this.mPassword.setError(null); - this.mHostname.setError(null); + errorLayout = null; } - this.mStats.setVisibility(View.GONE); + removeErrorsOnAllBut(errorLayout); + this.binding.stats.setVisibility(View.GONE); + this.binding.otherDeviceKeysCard.setVisibility(View.GONE); + } + } + + private void removeErrorsOnAllBut(TextInputLayout exception) { + if (this.mAccountJidLayout != exception) { + this.mAccountJidLayout.setErrorEnabled(false); + this.mAccountJidLayout.setError(null); + } + if (this.mPasswordLayout != exception) { + this.mPasswordLayout.setErrorEnabled(false); + this.mPasswordLayout.setError(null); + } + if (this.mHostnameLayout != exception) { + this.mHostnameLayout.setErrorEnabled(false); + this.mHostnameLayout.setError(null); + } + if (this.mPortLayout != exception) { + this.mPortLayout.setErrorEnabled(false); + this.mPortLayout.setError(null); } } @@ -1116,53 +1119,44 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat builder.setTitle(R.string.unpublish_pgp); builder.setMessage(R.string.unpublish_pgp_message); builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialogInterface, int i) { - mAccount.setPgpSignId(0); - mAccount.unsetPgpSignature(); - xmppConnectionService.databaseBackend.updateAccount(mAccount); - xmppConnectionService.sendPresence(mAccount); - refreshUiReal(); - } + builder.setPositiveButton(R.string.confirm, (dialogInterface, i) -> { + mAccount.setPgpSignId(0); + mAccount.unsetPgpSignature(); + xmppConnectionService.databaseBackend.updateAccount(mAccount); + xmppConnectionService.sendPresence(mAccount); + refreshUiReal(); }); builder.create().show(); } private void showOsOptimizationWarning(boolean showBatteryWarning, boolean showDataSaverWarning) { - this.mOsOptimizations.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE); + this.binding.osOptimization.setVisibility(showBatteryWarning || showDataSaverWarning ? View.VISIBLE : View.GONE); if (showDataSaverWarning) { - this.mDisableOsOptimizationsHeadline.setText(R.string.data_saver_enabled); + this.binding.osOptimizationHeadline.setText(R.string.data_saver_enabled); this.getmDisableOsOptimizationsBody.setText(R.string.data_saver_enabled_explained); this.mDisableOsOptimizationsButton.setText(R.string.allow); - this.mDisableOsOptimizationsButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS); - Uri uri = Uri.parse("package:" + getPackageName()); - intent.setData(uri); - try { - startActivityForResult(intent, REQUEST_DATA_SAVER); - } catch (ActivityNotFoundException e) { - Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show(); - } + this.mDisableOsOptimizationsButton.setOnClickListener(v -> { + Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS); + Uri uri = Uri.parse("package:" + getPackageName()); + intent.setData(uri); + try { + startActivityForResult(intent, REQUEST_DATA_SAVER); + } catch (ActivityNotFoundException e) { + Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show(); } }); } else if (showBatteryWarning) { this.mDisableOsOptimizationsButton.setText(R.string.disable); - this.mDisableOsOptimizationsHeadline.setText(R.string.battery_optimizations_enabled); + this.binding.osOptimizationHeadline.setText(R.string.battery_optimizations_enabled); this.getmDisableOsOptimizationsBody.setText(R.string.battery_optimizations_enabled_explained); - this.mDisableOsOptimizationsButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - Uri uri = Uri.parse("package:" + getPackageName()); - intent.setData(uri); - try { - startActivityForResult(intent, REQUEST_BATTERY_OP); - } catch (ActivityNotFoundException e) { - Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); - } + this.mDisableOsOptimizationsButton.setOnClickListener(v -> { + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + Uri uri = Uri.parse("package:" + getPackageName()); + intent.setData(uri); + try { + startActivityForResult(intent, REQUEST_BATTERY_OP); + } catch (ActivityNotFoundException e) { + Toast.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); } }); } @@ -1175,12 +1169,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat builder.setMessage(getString(R.string.clear_other_devices_desc)); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.accept), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - mAccount.getAxolotlService().wipeOtherPepDevices(); - } - }); + (dialog, which) -> mAccount.getAxolotlService().wipeOtherPepDevices()); builder.create().show(); } @@ -1208,58 +1197,46 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat @Override public void onCaptchaRequested(final Account account, final String id, final Data data, final Bitmap captcha) { - runOnUiThread(new Runnable() { - @Override - public void run() { - if ((mCaptchaDialog != null) && mCaptchaDialog.isShowing()) { - mCaptchaDialog.dismiss(); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(EditAccountActivity.this); - final View view = getLayoutInflater().inflate(R.layout.captcha, null); - final ImageView imageView = view.findViewById(R.id.captcha); - final EditText input = view.findViewById(R.id.input); - imageView.setImageBitmap(captcha); - - builder.setTitle(getString(R.string.captcha_required)); - builder.setView(view); - - builder.setPositiveButton(getString(R.string.ok), - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - String rc = input.getText().toString(); - data.put("username", account.getUsername()); - data.put("password", account.getPassword()); - data.put("ocr", rc); - data.submit(); - - if (xmppConnectionServiceBound) { - xmppConnectionService.sendCreateAccountWithCaptchaPacket( - account, id, data); - } - } - }); - builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (xmppConnectionService != null) { - xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null); + runOnUiThread(() -> { + if ((mCaptchaDialog != null) && mCaptchaDialog.isShowing()) { + mCaptchaDialog.dismiss(); + } + final AlertDialog.Builder builder = new AlertDialog.Builder(EditAccountActivity.this); + final View view = getLayoutInflater().inflate(R.layout.captcha, null); + final ImageView imageView = view.findViewById(R.id.captcha); + final EditText input = view.findViewById(R.id.input); + imageView.setImageBitmap(captcha); + + builder.setTitle(getString(R.string.captcha_required)); + builder.setView(view); + + builder.setPositiveButton(getString(R.string.ok), + (dialog, which) -> { + String rc = input.getText().toString(); + data.put("username", account.getUsername()); + data.put("password", account.getPassword()); + data.put("ocr", rc); + data.submit(); + + if (xmppConnectionServiceBound) { + xmppConnectionService.sendCreateAccountWithCaptchaPacket( + account, id, data); } - } - }); + }); + builder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> { + if (xmppConnectionService != null) { + xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null); + } + }); - builder.setOnCancelListener(new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - if (xmppConnectionService != null) { - xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null); - } - } - }); - mCaptchaDialog = builder.create(); - mCaptchaDialog.show(); - input.requestFocus(); - } + builder.setOnCancelListener(dialog -> { + if (xmppConnectionService != null) { + xmppConnectionService.sendCreateAccountWithCaptchaPacket(account, null, null); + } + }); + mCaptchaDialog = builder.create(); + mCaptchaDialog.show(); + input.requestFocus(); }); } @@ -1274,46 +1251,32 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat @Override public void onPreferencesFetched(final Element prefs) { - runOnUiThread(new Runnable() { - @Override - public void run() { - if (mFetchingMamPrefsToast != null) { - mFetchingMamPrefsToast.cancel(); - } - AlertDialog.Builder builder = new Builder(EditAccountActivity.this); - builder.setTitle(R.string.server_side_mam_prefs); - String defaultAttr = prefs.getAttribute("default"); - final List<String> defaults = Arrays.asList("never", "roster", "always"); - final AtomicInteger choice = new AtomicInteger(Math.max(0, defaults.indexOf(defaultAttr))); - builder.setSingleChoiceItems(R.array.mam_prefs, choice.get(), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - choice.set(which); - } - }); - builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - prefs.setAttribute("default", defaults.get(choice.get())); - xmppConnectionService.pushMamPreferences(mAccount, prefs); - } - }); - builder.create().show(); + runOnUiThread(() -> { + if (mFetchingMamPrefsToast != null) { + mFetchingMamPrefsToast.cancel(); } + Builder builder = new Builder(EditAccountActivity.this); + builder.setTitle(R.string.server_side_mam_prefs); + String defaultAttr = prefs.getAttribute("default"); + final List<String> defaults = Arrays.asList("never", "roster", "always"); + final AtomicInteger choice = new AtomicInteger(Math.max(0, defaults.indexOf(defaultAttr))); + builder.setSingleChoiceItems(R.array.mam_prefs, choice.get(), (dialog, which) -> choice.set(which)); + builder.setNegativeButton(R.string.cancel, null); + builder.setPositiveButton(R.string.ok, (dialog, which) -> { + prefs.setAttribute("default", defaults.get(choice.get())); + xmppConnectionService.pushMamPreferences(mAccount, prefs); + }); + builder.create().show(); }); } @Override public void onPreferencesFetchFailed() { - runOnUiThread(new Runnable() { - @Override - public void run() { - if (mFetchingMamPrefsToast != null) { - mFetchingMamPrefsToast.cancel(); - } - Toast.makeText(EditAccountActivity.this, R.string.unable_to_fetch_mam_prefs, Toast.LENGTH_LONG).show(); + runOnUiThread(() -> { + if (mFetchingMamPrefsToast != null) { + mFetchingMamPrefsToast.cancel(); } + Toast.makeText(EditAccountActivity.this, R.string.unable_to_fetch_mam_prefs, Toast.LENGTH_LONG).show(); }); } diff --git a/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java b/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java index 4fabd3e89..d43c34ee4 100644 --- a/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java +++ b/src/main/java/de/pixart/messenger/ui/EnterJidDialog.java @@ -1,6 +1,6 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.view.LayoutInflater; diff --git a/src/main/java/de/pixart/messenger/ui/LocationActivity.java b/src/main/java/de/pixart/messenger/ui/LocationActivity.java index 6389fa7d4..04bd03584 100644 --- a/src/main/java/de/pixart/messenger/ui/LocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/LocationActivity.java @@ -6,10 +6,11 @@ import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; import de.pixart.messenger.Config; -public abstract class LocationActivity extends Activity implements LocationListener { +public abstract class LocationActivity extends AppCompatActivity implements LocationListener { private LocationManager locationManager; @Override diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java index 2d0d98ce7..b98efde3b 100644 --- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java @@ -1,12 +1,12 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Intent; import android.os.Bundle; import android.security.KeyChain; import android.security.KeyChainAliasCallback; +import android.support.v7.app.ActionBar; import android.util.Pair; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -60,7 +60,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda accountList.clear(); accountList.addAll(xmppConnectionService.getAccounts()); } - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(this.accountList.size() > 0); actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0); diff --git a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MemorizingActivity.java b/src/main/java/de/pixart/messenger/ui/MemorizingActivity.java index dd1649c94..8172e6f9c 100644 --- a/libs/MemorizingTrustManager/src/de/duenndns/ssl/MemorizingActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MemorizingActivity.java @@ -21,11 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package de.duenndns.ssl; +package de.pixart.messenger.ui; - -import android.app.Activity; -import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; @@ -33,15 +30,20 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatActivity; import java.util.logging.Level; import java.util.logging.Logger; -public class MemorizingActivity extends Activity - implements OnClickListener, OnCancelListener { +import de.pixart.messenger.R; +import de.pixart.messenger.entities.MTMDecision; +import de.pixart.messenger.services.MemorizingTrustManager; + +public class MemorizingActivity extends AppCompatActivity implements OnClickListener,OnCancelListener { - public static final String THEME = "theme"; private final static Logger LOGGER = Logger.getLogger(MemorizingActivity.class.getName()); + int decisionId; AlertDialog dialog; @@ -49,7 +51,7 @@ public class MemorizingActivity extends Activity @Override public void onCreate(Bundle savedInstanceState) { LOGGER.log(Level.FINE, "onCreate"); - setTheme(findTheme()); + //setTheme(findTheme()); super.onCreate(savedInstanceState); } @@ -63,9 +65,9 @@ public class MemorizingActivity extends Activity LOGGER.log(Level.FINE, "onResume with " + i.getExtras() + " decId=" + decisionId + " data: " + i.getData()); dialog = new AlertDialog.Builder(this).setTitle(titleId) .setMessage(cert) - .setPositiveButton(R.string.mtm_decision_always, this) - .setNeutralButton(R.string.mtm_decision_once, this) - .setNegativeButton(R.string.mtm_decision_abort, this) + .setPositiveButton(R.string.always, this) + .setNeutralButton(R.string.once, this) + .setNegativeButton(R.string.cancel, this) .setOnCancelListener(this) .create(); dialog.show(); @@ -85,11 +87,13 @@ public class MemorizingActivity extends Activity } protected int findTheme() { - return getPreferences().getString(THEME, getResources().getString(R.string.theme)).equals("dark") ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme; + return 0; + //return getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark") ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme; } protected SharedPreferences getPreferences() { - return PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); + return PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); } // react on AlertDialog button press @@ -112,4 +116,4 @@ public class MemorizingActivity extends Activity public void onCancel(DialogInterface dialog) { sendDecision(MTMDecision.DECISION_ABORT); } -} +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java index f45134e34..a549c76e3 100644 --- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java +++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java @@ -1,16 +1,15 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; -import android.content.DialogInterface; import android.content.Intent; +import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v4.content.ContextCompat; +import android.support.v7.app.AlertDialog; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -22,8 +21,8 @@ import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.axolotl.FingerprintStatus; import de.pixart.messenger.crypto.axolotl.XmppAxolotlSession; +import de.pixart.messenger.databinding.ContactKeyBinding; import de.pixart.messenger.entities.Account; -import de.pixart.messenger.ui.widget.Switch; import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.XmppUri; import de.pixart.messenger.utils.zxing.IntentIntegrator; @@ -116,12 +115,7 @@ public abstract class OmemoActivity extends XmppActivity { session.getTrust(), true, true, - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - account.getAxolotlService().setFingerprintTrust(fingerprint, FingerprintStatus.createActive(isChecked)); - } - }); + (buttonView, isChecked) -> account.getAxolotlService().setFingerprintTrust(fingerprint, FingerprintStatus.createActive(isChecked))); } protected void addFingerprintRowWithListeners(LinearLayout keys, final Account account, @@ -133,110 +127,81 @@ public abstract class OmemoActivity extends XmppActivity { CompoundButton.OnCheckedChangeListener onCheckedChangeListener) { - View view = getLayoutInflater().inflate(R.layout.contact_key, keys, false); - TextView key = view.findViewById(R.id.key); - TextView keyType = view.findViewById(R.id.key_type); + ContactKeyBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.contact_key, keys, true); if (Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509) { - View.OnClickListener listener = new View.OnClickListener() { - @Override - public void onClick(View v) { - showX509Certificate(account, fingerprint); - } - }; - key.setOnClickListener(listener); - keyType.setOnClickListener(listener); + binding.key.setOnClickListener(v -> showX509Certificate(account, fingerprint)); + binding.keyType.setOnClickListener(v -> showX509Certificate(account, fingerprint)); } - Switch trustToggle = view.findViewById(R.id.tgl_trust); - ImageView verifiedFingerprintSymbol = view.findViewById(R.id.verified_fingerprint); - trustToggle.setVisibility(View.VISIBLE); - registerForContextMenu(view); - view.setTag(R.id.TAG_ACCOUNT, account); - view.setTag(R.id.TAG_FINGERPRINT, fingerprint); - view.setTag(R.id.TAG_FINGERPRINT_STATUS, status); + binding.tglTrust.setVisibility(View.VISIBLE); + registerForContextMenu(binding.getRoot()); + binding.getRoot().setTag(R.id.TAG_ACCOUNT, account); + binding.getRoot().setTag(R.id.TAG_FINGERPRINT, fingerprint); + binding.getRoot().setTag(R.id.TAG_FINGERPRINT_STATUS, status); boolean x509 = Config.X509_VERIFICATION && status.getTrust() == FingerprintStatus.Trust.VERIFIED_X509; final View.OnClickListener toast; - trustToggle.setChecked(status.isTrusted(), false); + binding.tglTrust.setChecked(status.isTrusted()); if (status.isActive()) { - key.setTextColor(getPrimaryTextColor()); - keyType.setTextColor(getSecondaryTextColor()); + binding.key.setTextColor(getPrimaryTextColor()); + binding.keyType.setTextColor(getSecondaryTextColor()); if (status.isVerified()) { - verifiedFingerprintSymbol.setVisibility(View.VISIBLE); - verifiedFingerprintSymbol.setAlpha(1.0f); - trustToggle.setVisibility(View.GONE); - verifiedFingerprintSymbol.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - replaceToast(getString(R.string.this_device_has_been_verified), false); - } - }); + binding.verifiedFingerprint.setVisibility(View.VISIBLE); + binding.verifiedFingerprint.setAlpha(1.0f); + binding.tglTrust.setVisibility(View.GONE); + binding.verifiedFingerprint.setOnClickListener(v -> replaceToast(getString(R.string.this_device_has_been_verified), false)); toast = null; } else { - verifiedFingerprintSymbol.setVisibility(View.GONE); - trustToggle.setVisibility(View.VISIBLE); - trustToggle.setOnCheckedChangeListener(onCheckedChangeListener); + binding.verifiedFingerprint.setVisibility(View.GONE); + binding.tglTrust.setVisibility(View.VISIBLE); + binding.tglTrust.setOnCheckedChangeListener(onCheckedChangeListener); if (status.getTrust() == FingerprintStatus.Trust.UNDECIDED && undecidedNeedEnablement) { - trustToggle.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - account.getAxolotlService().setFingerprintTrust(fingerprint, FingerprintStatus.createActive(false)); - v.setEnabled(true); - v.setOnClickListener(null); - } + binding.buttonEnableDevice.setVisibility(View.VISIBLE); + binding.buttonEnableDevice.setOnClickListener(v -> { + account.getAxolotlService().setFingerprintTrust(fingerprint, FingerprintStatus.createActive(false)); + binding.buttonEnableDevice.setVisibility(View.GONE); + binding.tglTrust.setVisibility(View.VISIBLE); }); - trustToggle.setEnabled(false); + binding.tglTrust.setVisibility(View.GONE); } else { - trustToggle.setOnClickListener(null); - trustToggle.setEnabled(true); + binding.tglTrust.setOnClickListener(null); + binding.tglTrust.setEnabled(true); } - toast = new View.OnClickListener() { - @Override - public void onClick(View v) { - hideToast(); - } - }; + toast = v -> hideToast(); } } else { - key.setTextColor(getTertiaryTextColor()); - keyType.setTextColor(getTertiaryTextColor()); - toast = new View.OnClickListener() { - @Override - public void onClick(View v) { - replaceToast(getString(R.string.this_device_is_no_longer_in_use), false); - } - }; + binding.key.setTextColor(getTertiaryTextColor()); + binding.keyType.setTextColor(getTertiaryTextColor()); + toast = v -> replaceToast(getString(R.string.this_device_is_no_longer_in_use), false); if (status.isVerified()) { - trustToggle.setVisibility(View.GONE); - verifiedFingerprintSymbol.setVisibility(View.VISIBLE); - verifiedFingerprintSymbol.setAlpha(0.4368f); - verifiedFingerprintSymbol.setOnClickListener(toast); + binding.tglTrust.setVisibility(View.GONE); + binding.verifiedFingerprint.setVisibility(View.VISIBLE); + binding.verifiedFingerprint.setAlpha(0.4368f); + binding.verifiedFingerprint.setOnClickListener(toast); } else { - trustToggle.setVisibility(View.VISIBLE); - verifiedFingerprintSymbol.setVisibility(View.GONE); - trustToggle.setOnClickListener(null); - trustToggle.setEnabled(false); - trustToggle.setOnClickListener(toast); + binding.tglTrust.setVisibility(View.VISIBLE); + binding.verifiedFingerprint.setVisibility(View.GONE); + binding.tglTrust.setOnClickListener(null); + binding.tglTrust.setEnabled(false); + binding.tglTrust.setOnClickListener(toast); } } - view.setOnClickListener(toast); - key.setOnClickListener(toast); - keyType.setOnClickListener(toast); + binding.getRoot().setOnClickListener(toast); + binding.key.setOnClickListener(toast); + binding.keyType.setOnClickListener(toast); if (showTag) { - keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); + binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); } else { - keyType.setVisibility(View.GONE); + binding.keyType.setVisibility(View.GONE); } if (highlight) { - keyType.setTextColor(ContextCompat.getColor(this, R.color.accent)); - keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message)); + binding.keyType.setTextColor(ContextCompat.getColor(this, R.color.accent)); + binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509_selected_message : R.string.omemo_fingerprint_selected_message)); } else { - keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); + binding.keyType.setText(getString(x509 ? R.string.omemo_fingerprint_x509 : R.string.omemo_fingerprint)); } - key.setText(CryptoHelper.prettifyFingerprint(fingerprint.substring(2))); - - keys.addView(view); + binding.key.setText(CryptoHelper.prettifyFingerprint(fingerprint.substring(2))); } public void showPurgeKeyDialog(final Account account, final String fingerprint) { @@ -245,12 +210,9 @@ public abstract class OmemoActivity extends XmppActivity { builder.setMessage(R.string.distrust_omemo_key_text); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(R.string.confirm, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - account.getAxolotlService().distrustFingerprint(fingerprint); - refreshUi(); - } + (dialog, which) -> { + account.getAxolotlService().distrustFingerprint(fingerprint); + refreshUi(); }); builder.create().show(); } diff --git a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java index cfa743c69..21462ebfa 100644 --- a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java +++ b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java @@ -8,6 +8,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; +import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.WindowManager; @@ -24,7 +25,7 @@ import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.persistance.FileBackend; -public class RecordingActivity extends Activity implements View.OnClickListener { +public class RecordingActivity extends AppCompatActivity implements View.OnClickListener { private TextView mTimerTextView; private Button mCancelButton; diff --git a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java index 18d28914e..d4bddb534 100644 --- a/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SetPresenceActivity.java @@ -1,6 +1,7 @@ package de.pixart.messenger.ui; import android.content.Intent; +import android.databinding.DataBindingUtil; import android.os.Bundle; import android.os.Handler; import android.util.Pair; @@ -9,18 +10,13 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.CheckBox; -import android.widget.EditText; import android.widget.ImageButton; -import android.widget.LinearLayout; -import android.widget.ScrollView; -import android.widget.Spinner; import android.widget.TextView; import java.util.List; import de.pixart.messenger.R; +import de.pixart.messenger.databinding.ActivitySetPresenceBinding; import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.ListItem; import de.pixart.messenger.entities.Presence; @@ -33,12 +29,8 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis protected Account mAccount; private List<PresenceTemplate> mTemplates; - //UI Elements - protected ScrollView mScrollView; - protected EditText mStatusMessage; - protected Spinner mShowSpinner; - protected CheckBox mAllAccounts; - protected LinearLayout mTemplatesView; + private ActivitySetPresenceBinding binding; + private Pair<Integer, Intent> mPostponedActivityResult; private Runnable onPresenceChanged = new Runnable() { @@ -50,24 +42,13 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_set_presence); - mScrollView = findViewById(R.id.scroll_view); - mShowSpinner = findViewById(R.id.presence_show); + this.binding = DataBindingUtil.setContentView(this, R.layout.activity_set_presence); ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.presence_show_options, R.layout.simple_list_item); - mShowSpinner.setAdapter(adapter); - mShowSpinner.setSelection(1); - mStatusMessage = findViewById(R.id.presence_status_message); - mAllAccounts = findViewById(R.id.all_accounts); - mTemplatesView = findViewById(R.id.templates); - final Button changePresence = findViewById(R.id.change_presence); - changePresence.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - executeChangePresence(); - } - }); + this.binding.presenceShow.setAdapter(adapter); + this.binding.presenceShow.setSelection(1); + this.binding.changePresence.setOnClickListener(v -> executeChangePresence()); } @Override @@ -105,8 +86,8 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis private void executeChangePresence() { Presence.Status status = getStatusFromSpinner(); - boolean allAccounts = mAllAccounts.isChecked(); - String statusMessage = mStatusMessage.getText().toString().trim(); + boolean allAccounts = this.binding.allAccounts.isChecked(); + String statusMessage = this.binding.presenceStatusMessage.getText().toString().trim(); if (allAccounts && noAccountUsesPgp()) { xmppConnectionService.changeStatus(status, statusMessage); finish(); @@ -122,7 +103,7 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis } private Presence.Status getStatusFromSpinner() { - switch (mShowSpinner.getSelectedItemPosition()) { + switch (this.binding.presenceShow.getSelectedItemPosition()) { case 0: return Presence.Status.CHAT; case 2: @@ -139,19 +120,19 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis private void setStatusInSpinner(Presence.Status status) { switch (status) { case AWAY: - mShowSpinner.setSelection(2); + this.binding.presenceShow.setSelection(2); break; case XA: - mShowSpinner.setSelection(3); + this.binding.presenceShow.setSelection(3); break; case CHAT: - mShowSpinner.setSelection(0); + this.binding.presenceShow.setSelection(0); break; case DND: - mShowSpinner.setSelection(4); + this.binding.presenceShow.setSelection(4); break; default: - mShowSpinner.setSelection(1); + this.binding.presenceShow.setSelection(1); break; } } @@ -167,29 +148,29 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis if (mAccount != null) { setStatusInSpinner(mAccount.getPresenceStatus()); String message = mAccount.getPresenceStatusMessage(); - if (mStatusMessage.getText().length() == 0 && message != null) { - mStatusMessage.append(message); + if (this.binding.presenceStatusMessage.getText().length() == 0 && message != null) { + this.binding.presenceStatusMessage.append(message); } mTemplates = xmppConnectionService.getPresenceTemplates(mAccount); if (this.mPostponedActivityResult != null) { this.onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second); } boolean e = noAccountUsesPgp(); - mAllAccounts.setEnabled(e); - mAllAccounts.setTextColor(e ? getPrimaryTextColor() : getSecondaryTextColor()); + this.binding.allAccounts.setEnabled(e); + this.binding.allAccounts.setTextColor(e ? getPrimaryTextColor() : getSecondaryTextColor()); } redrawTemplates(); } private void redrawTemplates() { if (mTemplates == null || mTemplates.size() == 0) { - mTemplatesView.setVisibility(View.GONE); + this.binding.templates.setVisibility(View.GONE); } else { - mTemplatesView.removeAllViews(); - mTemplatesView.setVisibility(View.VISIBLE); + this.binding.templates.removeAllViews(); + this.binding.templates.setVisibility(View.VISIBLE); LayoutInflater inflater = getLayoutInflater(); for (PresenceTemplate template : mTemplates) { - View templateLayout = inflater.inflate(R.layout.presence_template, mTemplatesView, false); + View templateLayout = inflater.inflate(R.layout.presence_template, this.binding.templates, false); templateLayout.setTag(template); setListItemBackgroundOnView(templateLayout); templateLayout.setOnClickListener(this); @@ -202,7 +183,7 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis status.setText(tag.getName()); status.setBackgroundColor(tag.getColor()); message.setText(template.getStatusMessage()); - mTemplatesView.addView(templateLayout); + this.binding.templates.addView(templateLayout); } } } @@ -215,14 +196,9 @@ public class SetPresenceActivity extends XmppActivity implements View.OnClickLis } if (v.getId() == R.id.presence_template) { setStatusInSpinner(template.getStatus()); - mStatusMessage.getEditableText().clear(); - mStatusMessage.getEditableText().append(template.getStatusMessage()); - new Handler().post(new Runnable() { - @Override - public void run() { - mScrollView.smoothScrollTo(0, 0); - } - }); + this.binding.presenceStatusMessage.getEditableText().clear(); + this.binding.presenceStatusMessage.getEditableText().append(template.getStatusMessage()); + new Handler().post(() -> this.binding.scrollView.smoothScrollTo(0,0)); } else if (v.getId() == R.id.delete_button) { xmppConnectionService.databaseBackend.deletePresenceTemplate(template); mTemplates.remove(template); diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index 988f4be1e..cf1ccd658 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; import android.app.FragmentManager; import android.content.Context; import android.content.DialogInterface; @@ -8,6 +7,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.pm.PackageManager; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.CheckBoxPreference; @@ -16,12 +16,14 @@ import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; +import android.support.v7.app.AlertDialog; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.Toast; +import java.io.File; import java.security.KeyStoreException; import java.util.ArrayList; import java.util.Arrays; @@ -29,11 +31,11 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import de.duenndns.ssl.MemorizingTrustManager; import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.entities.Account; import de.pixart.messenger.services.ExportLogsService; +import de.pixart.messenger.services.MemorizingTrustManager; import de.pixart.messenger.xmpp.XmppConnection; import de.pixart.messenger.xmpp.jid.InvalidJidException; import de.pixart.messenger.xmpp.jid.Jid; @@ -70,6 +72,10 @@ public class SettingsActivity extends XmppActivity implements mSettingsFragment = new SettingsFragment(); fm.beginTransaction().replace(android.R.id.content, mSettingsFragment).commit(); } + mSettingsFragment.setActivityIntent(getIntent()); + + this.mTheme = findTheme(); + setTheme(this.mTheme); } @Override @@ -83,7 +89,9 @@ public class SettingsActivity extends XmppActivity implements PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); multiAccountPreference = mSettingsFragment.findPreference("enable_multi_accounts"); - isMultiAccountChecked = ((CheckBoxPreference) multiAccountPreference).isChecked(); + if (multiAccountPreference != null) { + isMultiAccountChecked = ((CheckBoxPreference) multiAccountPreference).isChecked(); + } ListPreference resources = (ListPreference) mSettingsFragment.findPreference("resource"); if (resources != null) { @@ -121,9 +129,8 @@ public class SettingsActivity extends XmppActivity implements } final Preference removeCertsPreference = mSettingsFragment.findPreference("remove_trusted_certificates"); - removeCertsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { + if (removeCertsPreference != null) { + removeCertsPreference.setOnPreferenceClickListener(preference -> { final MemorizingTrustManager mtm = xmppConnectionService.getMemorizingTrustManager(); final ArrayList<String> aliases = Collections.list(mtm.getCertificates()); if (aliases.size() == 0) { @@ -134,44 +141,37 @@ public class SettingsActivity extends XmppActivity implements final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this); dialogBuilder.setTitle(getResources().getString(R.string.dialog_manage_certs_title)); dialogBuilder.setMultiChoiceItems(aliases.toArray(new CharSequence[aliases.size()]), null, - new DialogInterface.OnMultiChoiceClickListener() { - @Override - public void onClick(DialogInterface dialog, int indexSelected, - boolean isChecked) { - if (isChecked) { - selectedItems.add(indexSelected); - } else if (selectedItems.contains(indexSelected)) { - selectedItems.remove(Integer.valueOf(indexSelected)); - } - if (selectedItems.size() > 0) - ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); - else { - ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); - } + (dialog, indexSelected, isChecked) -> { + if (isChecked) { + selectedItems.add(indexSelected); + } else if (selectedItems.contains(indexSelected)) { + selectedItems.remove(Integer.valueOf(indexSelected)); + } + if (selectedItems.size() > 0) + ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); + else { + ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); } }); dialogBuilder.setPositiveButton( - getResources().getString(R.string.dialog_manage_certs_positivebutton), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - int count = selectedItems.size(); - if (count > 0) { - for (int i = 0; i < count; i++) { - try { - Integer item = Integer.valueOf(selectedItems.get(i).toString()); - String alias = aliases.get(item); - mtm.deleteCertificate(alias); - } catch (KeyStoreException e) { - e.printStackTrace(); - displayToast("Error: " + e.getLocalizedMessage()); - } - } - if (xmppConnectionServiceBound) { - reconnectAccounts(); + getResources().getString(R.string.dialog_manage_certs_positivebutton), (dialog, which) -> { + int count = selectedItems.size(); + if (count > 0) { + for (int i = 0; i < count; i++) { + try { + Integer item = Integer.valueOf(selectedItems.get(i).toString()); + String alias = aliases.get(item); + mtm.deleteCertificate(alias); + } catch (KeyStoreException e) { + e.printStackTrace(); + displayToast("Error: " + e.getLocalizedMessage()); } - displayToast(getResources().getQuantityString(R.plurals.toast_delete_certificates, count, count)); } + if (xmppConnectionServiceBound) { + reconnectAccounts(); + } + displayToast(getResources().getQuantityString(R.plurals.toast_delete_certificates, count, count)); } }); dialogBuilder.setNegativeButton(getResources().getString(R.string.dialog_manage_certs_negativebutton), null); @@ -179,33 +179,41 @@ public class SettingsActivity extends XmppActivity implements removeCertsDialog.show(); removeCertsDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); return true; - } - }); + }); + } final Preference exportLogsPreference = mSettingsFragment.findPreference("export_logs"); - exportLogsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { + if (exportLogsPreference != null) { + exportLogsPreference.setOnPreferenceClickListener(preference -> { if (hasStoragePermission(REQUEST_WRITE_LOGS)) { startExport(); } return true; + }); + } + + if (Config.ONLY_INTERNAL_STORAGE) { + final Preference cleanCachePreference = mSettingsFragment.findPreference("clean_cache"); + if (cleanCachePreference != null) { + cleanCachePreference.setOnPreferenceClickListener(preference -> cleanCache()); } - }); - final Preference deleteOmemoPreference = mSettingsFragment.findPreference("delete_omemo_identities"); - deleteOmemoPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - deleteOmemoIdentities(); - return true; + final Preference cleanPrivateStoragePreference = mSettingsFragment.findPreference("clean_private_storage"); + if (cleanPrivateStoragePreference != null) { + cleanPrivateStoragePreference.setOnPreferenceClickListener(preference -> cleanPrivateStorage()); } - }); + } + + final Preference deleteOmemoPreference = mSettingsFragment.findPreference("delete_omemo_identities"); + if (deleteOmemoPreference != null) { + deleteOmemoPreference.setOnPreferenceClickListener(preference -> deleteOmemoIdentities()); + } final Preference enableMultiAccountsPreference = mSettingsFragment.findPreference("enable_multi_accounts"); - Log.d(Config.LOGTAG, "Multi account checkbox checked: " + isMultiAccountChecked); - if (isMultiAccountChecked) { - enableMultiAccountsPreference.setEnabled(false); + if (enableMultiAccountsPreference != null) { + Log.d(Config.LOGTAG, "Multi account checkbox checked: " + isMultiAccountChecked); + if (isMultiAccountChecked) { + enableMultiAccountsPreference.setEnabled(false); /* if (xmppConnectionServiceBound) { // todo doesn't work --> it seems the service is never bound final List<Account> accounts = xmppConnectionService.getAccounts(); @@ -221,12 +229,13 @@ public class SettingsActivity extends XmppActivity implements enableMultiAccountsPreference.setEnabled(false); } */ - } else { - enableMultiAccountsPreference.setEnabled(true); - enableMultiAccountsPreference.setOnPreferenceClickListener(preference -> { - enableMultiAccounts(); - return true; - }); + } else { + enableMultiAccountsPreference.setEnabled(true); + enableMultiAccountsPreference.setOnPreferenceClickListener(preference -> { + enableMultiAccounts(); + return true; + }); + } } } @@ -234,7 +243,60 @@ public class SettingsActivity extends XmppActivity implements return i != null && getPackageManager().queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY).size() > 0; } - private void deleteOmemoIdentities() { + private boolean cleanCache() { + Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.setData(Uri.parse("package:" + getPackageName())); + startActivity(intent); + return true; + } + + private boolean cleanPrivateStorage() { + cleanPrivatePictures(); + cleanPrivateFiles(); + return true; + } + + private void cleanPrivatePictures() { + try { + File dir = new File(getFilesDir().getAbsolutePath(), "/Pictures/"); + File[] array = dir.listFiles(); + if (array != null) { + for (int b = 0; b < array.length; b++) { + String name = array[b].getName().toLowerCase(); + if (name.equals(".nomedia")) { + continue; + } + if (array[b].isFile()) { + array[b].delete(); + } + } + } + } catch (Throwable e) { + Log.e("CleanCache", e.toString()); + } + } + + private void cleanPrivateFiles() { + try { + File dir = new File(getFilesDir().getAbsolutePath(), "/Files/"); + File[] array = dir.listFiles(); + if (array != null) { + for (int b = 0; b < array.length; b++) { + String name = array[b].getName().toLowerCase(); + if (name.equals(".nomedia")) { + continue; + } + if (array[b].isFile()) { + array[b].delete(); + } + } + } + } catch (Throwable e) { + Log.e("CleanCache", e.toString()); + } + } + + private boolean deleteOmemoIdentities() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.pref_delete_omemo_identities); final List<CharSequence> accounts = new ArrayList<>(); @@ -281,6 +343,7 @@ public class SettingsActivity extends XmppActivity implements AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); + return true; } private void enableMultiAccounts() { diff --git a/src/main/java/de/pixart/messenger/ui/SettingsFragment.java b/src/main/java/de/pixart/messenger/ui/SettingsFragment.java index 8cea5eb61..939ef6145 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsFragment.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsFragment.java @@ -1,64 +1,58 @@ package de.pixart.messenger.ui; -import android.app.Dialog; +import android.content.Intent; import android.os.Bundle; import android.preference.Preference; +import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import android.preference.PreferenceScreen; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.widget.FrameLayout; -import android.widget.LinearLayout; +import android.text.TextUtils; +import de.pixart.messenger.Config; import de.pixart.messenger.R; public class SettingsFragment extends PreferenceFragment { - //http://stackoverflow.com/questions/16374820/action-bar-home-button-not-functional-with-nested-preferencescreen/16800527#16800527 - private void initializeActionBar(PreferenceScreen preferenceScreen) { - final Dialog dialog = preferenceScreen.getDialog(); + private String page = null; - if (dialog != null) { - View homeBtn = dialog.findViewById(android.R.id.home); + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preferences); - if (homeBtn != null) { - View.OnClickListener dismissDialogClickListener = new View.OnClickListener() { - @Override - public void onClick(View v) { - dialog.dismiss(); - } - }; + // Remove from standard preferences if the flag ONLY_INTERNAL_STORAGE is false + if (!Config.ONLY_INTERNAL_STORAGE) { + PreferenceCategory mCategory = (PreferenceCategory) findPreference("security_options"); + if (mCategory != null) { + Preference cleanCache = findPreference("clean_cache"); + Preference cleanPrivateStorage = findPreference("clean_private_storage"); + mCategory.removePreference(cleanCache); + mCategory.removePreference(cleanPrivateStorage); + } + } - ViewParent homeBtnContainer = homeBtn.getParent(); + if (!TextUtils.isEmpty(page)) { + openPreferenceScreen(page); + } + } - if (homeBtnContainer instanceof FrameLayout) { - ViewGroup containerParent = (ViewGroup) homeBtnContainer.getParent(); - if (containerParent instanceof LinearLayout) { - containerParent.setOnClickListener(dismissDialogClickListener); - } else { - ((FrameLayout) homeBtnContainer).setOnClickListener(dismissDialogClickListener); - } - } else { - homeBtn.setOnClickListener(dismissDialogClickListener); + public void setActivityIntent(final Intent intent) { + if (intent != null) { + if (Intent.ACTION_VIEW.equals(intent.getAction())) { + if (intent.getExtras() != null) { + this.page = intent.getExtras().getString("page"); } } } } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Load the preferences from an XML resource - addPreferencesFromResource(R.xml.preferences); - } - - @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - super.onPreferenceTreeClick(preferenceScreen, preference); - if (preference instanceof PreferenceScreen) { - initializeActionBar((PreferenceScreen) preference); + private void openPreferenceScreen(final String screenName) { + final Preference pref = findPreference(screenName); + if (pref instanceof PreferenceScreen) { + final PreferenceScreen preferenceScreen = (PreferenceScreen) pref; + getActivity().setTitle(preferenceScreen.getTitle()); + preferenceScreen.setDependency(""); + setPreferenceScreen((PreferenceScreen) pref); } - return false; } } diff --git a/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java index 5a1122c7a..510135c5a 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareLocationActivity.java @@ -41,9 +41,9 @@ public class ShareLocationActivity extends LocationActivity implements LocationL protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_share_locaction); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); diff --git a/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java index 41d22f2a5..e7ee427db 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareViaAccountActivity.java @@ -1,7 +1,7 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -31,7 +31,7 @@ public class ShareViaAccountActivity extends XmppActivity { accountList.clear(); accountList.addAll(xmppConnectionService.getAccounts()); } - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(this.accountList.size() > 0); actionBar.setDisplayHomeAsUpEnabled(this.accountList.size() > 0); diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java index 15e7b7267..64671c1f2 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java @@ -170,9 +170,9 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer super.onCreate(savedInstanceState); boolean useBundledEmoji = getPreferences().getBoolean(USE_BUNDLED_EMOJIS, getResources().getBoolean(R.bool.use_bundled_emoji)); new EmojiService(this).init(useBundledEmoji); - if (getActionBar() != null) { - getActionBar().setDisplayHomeAsUpEnabled(false); - getActionBar().setHomeButtonEnabled(false); + if (getSupportActionBar() != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(false); + getSupportActionBar().setHomeButtonEnabled(false); } setContentView(R.layout.share_with); diff --git a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java index 619ab2101..83928d0cd 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowFullscreenMessageActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.SharedPreferences; @@ -11,6 +10,7 @@ import android.media.MediaMetadataRetriever; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.view.WindowManager; @@ -39,7 +39,7 @@ import de.pixart.messenger.utils.ExifHelper; import static de.pixart.messenger.persistance.FileBackend.close; -public class ShowFullscreenMessageActivity extends Activity { +public class ShowFullscreenMessageActivity extends AppCompatActivity { Integer oldOrientation; PhotoView mImage; diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java index 2f844e107..2661589d8 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -12,6 +11,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v7.app.AppCompatActivity; import android.text.TextUtils; import android.view.Menu; import android.view.MenuInflater; @@ -30,7 +30,7 @@ import de.pixart.messenger.services.EmojiService; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; -public class ShowLocationActivity extends Activity { +public class ShowLocationActivity extends AppCompatActivity { private Location location; private String mLocationName; @@ -39,9 +39,9 @@ public class ShowLocationActivity extends Activity { super.onCreate(savedInstanceState); boolean useBundledEmoji = getPreferences().getBoolean(USE_BUNDLED_EMOJIS, getResources().getBoolean(R.bool.use_bundled_emoji)); new EmojiService(this).init(useBundledEmoji); - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_show_locaction); diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index c1cd8a015..dacc35a8d 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -2,15 +2,7 @@ package de.pixart.messenger.ui; import android.Manifest; import android.annotation.SuppressLint; -import android.app.ActionBar; -import android.app.ActionBar.Tab; -import android.app.ActionBar.TabListener; -import android.app.AlertDialog; import android.app.Dialog; -import android.app.Fragment; -import android.app.FragmentManager; -import android.app.FragmentTransaction; -import android.app.ListFragment; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Context; @@ -18,11 +10,21 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.pm.PackageManager; +import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.annotation.DrawableRes; +import android.support.annotation.NonNull; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentTransaction; +import android.support.v4.app.ListFragment; +import android.support.v4.view.MenuItemCompat; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.SpannableString; import android.text.Spanned; @@ -39,7 +41,6 @@ import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; -import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.CheckBox; @@ -58,6 +59,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import de.pixart.messenger.Config; import de.pixart.messenger.R; +import de.pixart.messenger.databinding.ActivityStartConversationBinding; import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Bookmark; import de.pixart.messenger.entities.Contact; @@ -78,13 +80,10 @@ import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; public class StartConversationActivity extends XmppActivity implements OnRosterUpdate, OnUpdateBlocklist { - private final int REQUEST_SYNC_CONTACTS = 0x3b28cf; - private final int REQUEST_CREATE_CONFERENCE = 0x3b39da; + private final int REQUEST_SYNC_CONTACTS = 0x28cf; + private final int REQUEST_CREATE_CONFERENCE = 0x39da; public int conference_context_id; public int contact_context_id; - private Tab mContactsTab; - private Tab mConferencesTab; - private ViewPager mViewPager; private ListPagerAdapter mListPagerAdapter; private List<ListItem> contacts = new ArrayList<>(); private ListItemAdapter mContactsAdapter; @@ -119,29 +118,30 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU return true; } }; - private TabListener mTabListener = new TabListener() { + private ActionBar.TabListener mTabListener = new ActionBar.TabListener() { @Override - public void onTabUnselected(Tab tab, FragmentTransaction ft) { + public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { return; } @Override - public void onTabSelected(Tab tab, FragmentTransaction ft) { - mViewPager.setCurrentItem(tab.getPosition()); + public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { + binding.startConversationViewPager.setCurrentItem(tab.getPosition()); onTabChanged(); } @Override - public void onTabReselected(Tab tab, FragmentTransaction ft) { + public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { return; } }; private ViewPager.SimpleOnPageChangeListener mOnPageChangeListener = new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { - if (getActionBar() != null) { - getActionBar().setSelectedNavigationItem(position); + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + actionBar.setSelectedNavigationItem(position); } onTabChanged(); } @@ -166,7 +166,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU private TextView.OnEditorActionListener mSearchDone = new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { - int pos = getActionBar().getSelectedNavigationIndex(); + int pos = getSupportActionBar().getSelectedNavigationIndex(); if (pos == 0) { if (contacts.size() == 1) { openConversationForContact((Contact) contacts.get(0)); @@ -198,6 +198,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU private String mInitialJid; private Pair<Integer, Intent> mPostponedActivityResult; private Toast mToast; + private ActivityStartConversationBinding binding; private UiCallback<Conversation> mAdhocConferenceCallback = new UiCallback<Conversation>() { @Override public void success(final Conversation conversation) { @@ -255,21 +256,25 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new EmojiService(this).init(useBundledEmoji()); - setContentView(R.layout.activity_start_conversation); - mViewPager = findViewById(R.id.start_conversation_view_pager); - ActionBar actionBar = getActionBar(); + this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation); + this.binding.fab.setOnClickListener((v) -> { + if (getSupportActionBar().getSelectedNavigationIndex() == 0) { + showCreateContactDialog(null, null); + } else { + showCreateConferenceDialog(); + } + }); + ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - mContactsTab = actionBar.newTab().setText(R.string.contacts) - .setTabListener(mTabListener); - mConferencesTab = actionBar.newTab().setText(R.string.conferences) - .setTabListener(mTabListener); + ActionBar.Tab mContactsTab = actionBar.newTab().setText(R.string.contacts).setTabListener(mTabListener); + ActionBar.Tab mConferencesTab = actionBar.newTab().setText(R.string.conferences).setTabListener(mTabListener); actionBar.addTab(mContactsTab); actionBar.addTab(mConferencesTab); - mViewPager.setOnPageChangeListener(mOnPageChangeListener); - mListPagerAdapter = new ListPagerAdapter(getFragmentManager()); - mViewPager.setAdapter(mListPagerAdapter); + binding.startConversationViewPager.setOnPageChangeListener(mOnPageChangeListener); + mListPagerAdapter = new ListPagerAdapter(getSupportFragmentManager()); + binding.startConversationViewPager.setAdapter(mListPagerAdapter); mConferenceAdapter = new ListItemAdapter(this, conferences); mContactsAdapter = new ListItemAdapter(this, contacts); @@ -595,8 +600,6 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.start_conversation, menu); - MenuItem menuCreateContact = menu.findItem(R.id.action_create_contact); - MenuItem menuCreateConference = menu.findItem(R.id.action_conference); MenuItem menuHideOffline = menu.findItem(R.id.action_hide_offline); final MenuItem menuActionAccounts = menu.findItem(R.id.action_accounts); if (xmppConnectionService.getAccounts().size() == 1 && !xmppConnectionService.multipleAccounts()) { @@ -608,17 +611,11 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU mMenuSearchView = menu.findItem(R.id.action_search); mMenuSearchView.setOnActionExpandListener(mOnActionExpandListener); View mSearchView = mMenuSearchView.getActionView(); - mSearchEditText = mSearchView - .findViewById(R.id.search_field); + mSearchEditText = mSearchView.findViewById(R.id.search_field); mSearchEditText.addTextChangedListener(mSearchTextWatcher); mSearchEditText.setOnEditorActionListener(mSearchDone); - if (getActionBar().getSelectedNavigationIndex() == 0) { - menuCreateConference.setVisible(false); - } else { - menuCreateContact.setVisible(false); - } if (mInitialJid != null) { - mMenuSearchView.expandActionView(); + MenuItemCompat.expandActionView(mMenuSearchView); mSearchEditText.append(mInitialJid); filter(mInitialJid); } @@ -628,15 +625,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.action_create_contact: - showCreateContactDialog(null, null); - return true; case R.id.action_join_conference: showJoinConferenceDialog(null); return true; - case R.id.action_create_conference: - showCreateConferenceDialog(); - return true; case R.id.action_scan_qr_code: Intent intent = new Intent(this, UriHandlerActivity.class); intent.setAction(UriHandlerActivity.ACTION_SCAN_QR_CODE); @@ -752,7 +743,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } @Override - public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { if (grantResults.length > 0) if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (requestCode == REQUEST_SYNC_CONTACTS && xmppConnectionServiceBound) { @@ -778,7 +769,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } } final Intent intent = getIntent(); - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); boolean init = intent != null && intent.getBooleanExtra("init", false); boolean noConversations = xmppConnectionService.getConversations().size() == 0; if ((init || noConversations) && ab != null) { @@ -945,6 +936,13 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } private void onTabChanged() { + @DrawableRes final int fabDrawable; + if (getSupportActionBar().getSelectedNavigationIndex() == 0) { + fabDrawable = R.drawable.ic_person_add_white_24dp; + } else { + fabDrawable = R.drawable.ic_group_add_white_24dp; + } + binding.fab.setImageResource(fabDrawable); invalidateOptionsMenu(); } @@ -980,10 +978,12 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } @Override - public void onViewCreated(final View view, final Bundle savedInstanceState) { + public void onViewCreated(@NonNull final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); registerForContextMenu(getListView()); getListView().setFastScrollEnabled(true); + getListView().setDivider(null); + getListView().setDividerHeight(0); } @Override @@ -991,6 +991,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU final ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); final StartConversationActivity activity = (StartConversationActivity) getActivity(); + if (activity == null) { + return; + } activity.getMenuInflater().inflate(mResContextMenu, menu); final AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo; if (mResContextMenu == R.menu.conference_context) { @@ -1019,6 +1022,9 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU @Override public boolean onContextItemSelected(final MenuItem item) { StartConversationActivity activity = (StartConversationActivity) getActivity(); + if (activity == null) { + return true; + } switch (item.getItemId()) { case R.id.context_start_conversation: activity.openConversationForContact(); @@ -1061,7 +1067,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } @Override - public void destroyItem(ViewGroup container, int position, Object object) { + public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { assert (0 <= position && position < fragments.length); FragmentTransaction trans = fragmentManager.beginTransaction(); trans.remove(fragments[position]); @@ -1070,7 +1076,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } @Override - public Fragment instantiateItem(ViewGroup container, int position) { + public Fragment instantiateItem(@NonNull ViewGroup container, int position) { Fragment fragment = getItem(position); FragmentTransaction trans = fragmentManager.beginTransaction(); trans.add(container.getId(), fragment, "fragment:" + position); @@ -1084,7 +1090,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU } @Override - public boolean isViewFromObject(View view, Object fragment) { + public boolean isViewFromObject(@NonNull View view, @NonNull Object fragment) { return ((Fragment) fragment).getView() == view; } @@ -1095,26 +1101,12 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU if (position == 1) { listFragment.setListAdapter(mConferenceAdapter); listFragment.setContextMenu(R.menu.conference_context); - listFragment.setOnListItemClickListener(new OnItemClickListener() { - - @Override - public void onItemClick(AdapterView<?> arg0, View arg1, - int position, long arg3) { - openConversationForBookmark(position); - } - }); + listFragment.setOnListItemClickListener((arg0, arg1, p, arg3) -> openConversationForBookmark(p)); } else { listFragment.setListAdapter(mContactsAdapter); listFragment.setContextMenu(R.menu.contact_context); - listFragment.setOnListItemClickListener(new OnItemClickListener() { - - @Override - public void onItemClick(AdapterView<?> arg0, View arg1, - int position, long arg3) { - openConversationForContact(position); - } - }); + listFragment.setOnListItemClickListener((arg0, arg1, p, arg3) -> openConversationForContact(p)); } fragments[position] = listFragment; } diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java index 853b1b2a4..c36f0fcbc 100644 --- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java +++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java @@ -1,18 +1,16 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; import android.content.Intent; +import android.databinding.DataBindingUtil; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.util.Log; import android.view.Gravity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Button; import android.widget.CompoundButton; -import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; import org.whispersystems.libsignal.IdentityKey; @@ -29,6 +27,8 @@ import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.axolotl.AxolotlService; import de.pixart.messenger.crypto.axolotl.FingerprintStatus; +import de.pixart.messenger.databinding.ActivityTrustKeysBinding; +import de.pixart.messenger.databinding.KeysCardBinding; import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.utils.CryptoHelper; @@ -43,21 +43,13 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat private Account mAccount; private Conversation mConversation; - private TextView keyErrorMessage; - private LinearLayout keyErrorMessageCard; - private TextView ownKeysTitle; - private LinearLayout ownKeys; - private LinearLayout ownKeysCard; - private LinearLayout foreignKeys; - private Button mSaveButton; - private Button mCancelButton; private AtomicBoolean mUseCameraHintShown = new AtomicBoolean(false); private AxolotlService.FetchStatus lastFetchReport = AxolotlService.FetchStatus.SUCCESS; private final Map<String, Boolean> ownKeysToTrust = new HashMap<>(); - private final Map<Jid, Map<String, Boolean>> foreignKeysToTrust = new HashMap<>(); + private final Map<Jid,Map<String, Boolean>> foreignKeysToTrust = new HashMap<>(); private final OnClickListener mSaveButtonListener = new OnClickListener() { @Override @@ -74,9 +66,8 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat finish(); } }; - - private XmppUri mPendingFingerprintVerificationUri = null; private Toast mUseCameraHintToast = null; + private ActivityTrustKeysBinding binding; @Override protected void refreshUiReal() { @@ -87,9 +78,9 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_trust_keys); + this.binding = DataBindingUtil.setContentView(this,R.layout.activity_trust_keys); this.contactJids = new ArrayList<>(); - for (String jid : getIntent().getStringArrayExtra("contacts")) { + for(String jid : getIntent().getStringArrayExtra("contacts")) { try { this.contactJids.add(Jid.fromString(jid)); } catch (InvalidJidException e) { @@ -97,25 +88,17 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } } - keyErrorMessageCard = findViewById(R.id.key_error_message_card); - keyErrorMessage = findViewById(R.id.key_error_message); - ownKeysTitle = findViewById(R.id.own_keys_title); - ownKeys = findViewById(R.id.own_keys_details); - ownKeysCard = findViewById(R.id.own_keys_card); - foreignKeys = findViewById(R.id.foreign_keys); - mCancelButton = findViewById(R.id.cancel_button); - mCancelButton.setOnClickListener(mCancelButtonListener); - mSaveButton = findViewById(R.id.save_button); - mSaveButton.setOnClickListener(mSaveButtonListener); - - - if (getActionBar() != null) { - getActionBar().setHomeButtonEnabled(true); - getActionBar().setDisplayHomeAsUpEnabled(true); + binding.cancelButton.setOnClickListener(mCancelButtonListener); + binding.saveButton.setOnClickListener(mSaveButtonListener); + + + if (getSupportActionBar() != null) { + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); } if (savedInstanceState != null) { - mUseCameraHintShown.set(savedInstanceState.getBoolean("camera_hint_shown", false)); + mUseCameraHintShown.set(savedInstanceState.getBoolean("camera_hint_shown",false)); } } @@ -135,7 +118,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat private void showCameraToast() { mUseCameraHintToast = Toast.makeText(this,R.string.use_camera_icon_to_scan_barcode,Toast.LENGTH_LONG); - ActionBar actionBar = getActionBar(); + ActionBar actionBar = getSupportActionBar(); mUseCameraHintToast.setGravity(Gravity.TOP | Gravity.END, 0 ,actionBar == null ? 0 : actionBar.getHeight()); mUseCameraHintToast.show(); } @@ -187,13 +170,13 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat private void populateView() { setTitle(getString(R.string.trust_omemo_fingerprints)); - ownKeys.removeAllViews(); - foreignKeys.removeAllViews(); + binding.ownKeysDetails.removeAllViews(); + binding.foreignKeys.removeAllViews(); boolean hasOwnKeys = false; boolean hasForeignKeys = false; - for (final String fingerprint : ownKeysToTrust.keySet()) { + for(final String fingerprint : ownKeysToTrust.keySet()) { hasOwnKeys = true; - addFingerprintRowWithListeners(ownKeys, mAccount, fingerprint, false, + addFingerprintRowWithListeners(binding.ownKeysDetails, mAccount, fingerprint, false, FingerprintStatus.createActive(ownKeysToTrust.get(fingerprint)), false, false, new CompoundButton.OnCheckedChangeListener() { @Override @@ -208,84 +191,74 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat synchronized (this.foreignKeysToTrust) { for (Map.Entry<Jid, Map<String, Boolean>> entry : foreignKeysToTrust.entrySet()) { hasForeignKeys = true; - final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.keys_card, foreignKeys, false); + KeysCardBinding keysCardBinding = DataBindingUtil.inflate(getLayoutInflater(),R.layout.keys_card, binding.foreignKeys,false); + //final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.keys_card, foreignKeys, false); final Jid jid = entry.getKey(); - final TextView header = layout.findViewById(R.id.foreign_keys_title); - final LinearLayout keysContainer = layout.findViewById(R.id.foreign_keys_details); - final TextView informNoKeys = layout.findViewById(R.id.no_keys_to_accept); - header.setText(jid.toString()); - header.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - switchToContactDetails(mAccount.getRoster().getContact(jid)); - } - }); + keysCardBinding.foreignKeysTitle.setText(jid.toString()); + keysCardBinding.foreignKeysTitle.setOnClickListener(v -> switchToContactDetails(mAccount.getRoster().getContact(jid))); final Map<String, Boolean> fingerprints = entry.getValue(); for (final String fingerprint : fingerprints.keySet()) { - addFingerprintRowWithListeners(keysContainer, mAccount, fingerprint, false, + addFingerprintRowWithListeners(keysCardBinding.foreignKeysDetails, mAccount, fingerprint, false, FingerprintStatus.createActive(fingerprints.get(fingerprint)), false, false, - new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - fingerprints.put(fingerprint, isChecked); - lockOrUnlockAsNeeded(); - } + (buttonView, isChecked) -> { + fingerprints.put(fingerprint, isChecked); + lockOrUnlockAsNeeded(); } ); } if (fingerprints.size() == 0) { - informNoKeys.setVisibility(View.VISIBLE); + keysCardBinding.noKeysToAccept.setVisibility(View.VISIBLE); if (hasNoOtherTrustedKeys(jid)) { if (!mAccount.getRoster().getContact(jid).mutualPresenceSubscription()) { - informNoKeys.setText(R.string.error_no_keys_to_trust_presence); + keysCardBinding.noKeysToAccept.setText(R.string.error_no_keys_to_trust_presence); } else { - informNoKeys.setText(R.string.error_no_keys_to_trust_server_error); + keysCardBinding.noKeysToAccept.setText(R.string.error_no_keys_to_trust_server_error); } } else { - informNoKeys.setText(getString(R.string.no_keys_just_confirm, mAccount.getRoster().getContact(jid).getDisplayName())); + keysCardBinding.noKeysToAccept.setText(getString(R.string.no_keys_just_confirm, mAccount.getRoster().getContact(jid).getDisplayName())); } } else { - informNoKeys.setVisibility(View.GONE); + keysCardBinding.noKeysToAccept.setVisibility(View.GONE); } - foreignKeys.addView(layout); + binding.foreignKeys.addView(keysCardBinding.foreignKeysCard); } } - if ((hasOwnKeys || foreignActuallyHasKeys()) && mUseCameraHintShown.compareAndSet(false, true)) { + if ((hasOwnKeys || foreignActuallyHasKeys()) && mUseCameraHintShown.compareAndSet(false,true)) { showCameraToast(); } - ownKeysTitle.setText(mAccount.getJid().toBareJid().toString()); - ownKeysCard.setVisibility(hasOwnKeys ? View.VISIBLE : View.GONE); - foreignKeys.setVisibility(hasForeignKeys ? View.VISIBLE : View.GONE); - if (hasPendingKeyFetches()) { + binding.ownKeysTitle.setText(mAccount.getJid().toBareJid().toString()); + binding.ownKeysCard.setVisibility(hasOwnKeys ? View.VISIBLE : View.GONE); + binding.foreignKeys.setVisibility(hasForeignKeys ? View.VISIBLE : View.GONE); + if(hasPendingKeyFetches()) { setFetching(); lock(); } else { if (!hasForeignKeys && hasNoOtherTrustedKeys()) { - keyErrorMessageCard.setVisibility(View.VISIBLE); + binding.keyErrorMessageCard.setVisibility(View.VISIBLE); if (lastFetchReport == AxolotlService.FetchStatus.ERROR || mAccount.getAxolotlService().fetchMapHasErrors(contactJids)) { if (anyWithoutMutualPresenceSubscription(contactJids)) { - keyErrorMessage.setText(R.string.error_no_keys_to_trust_presence); + binding.keyErrorMessage.setText(R.string.error_no_keys_to_trust_presence); } else { - keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error); + binding.keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error); } } else { - keyErrorMessage.setText(R.string.error_no_keys_to_trust); + binding.keyErrorMessage.setText(R.string.error_no_keys_to_trust); } - ownKeys.removeAllViews(); - ownKeysCard.setVisibility(View.GONE); - foreignKeys.removeAllViews(); - foreignKeys.setVisibility(View.GONE); + binding.ownKeysDetails.removeAllViews(); + binding.ownKeysCard.setVisibility(View.GONE); + binding.foreignKeys.removeAllViews(); + binding.foreignKeys.setVisibility(View.GONE); } lockOrUnlockAsNeeded(); setDone(); } } - private boolean anyWithoutMutualPresenceSubscription(List<Jid> contactJids) { - for (Jid jid : contactJids) { + private boolean anyWithoutMutualPresenceSubscription(List<Jid> contactJids){ + for(Jid jid : contactJids) { if (!mAccount.getRoster().getContact(jid).mutualPresenceSubscription()) { return true; } @@ -309,9 +282,9 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat ownKeysToTrust.clear(); AxolotlService service = this.mAccount.getAxolotlService(); Set<IdentityKey> ownKeysSet = service.getKeysWithTrust(FingerprintStatus.createActiveUndecided()); - for (final IdentityKey identityKey : ownKeysSet) { + for(final IdentityKey identityKey : ownKeysSet) { final String fingerprint = CryptoHelper.bytesToHex(identityKey.getPublicKey().serialize()); - if (!ownKeysToTrust.containsKey(fingerprint)) { + if(!ownKeysToTrust.containsKey(fingerprint)) { ownKeysToTrust.put(fingerprint, false); } } @@ -380,7 +353,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } switch (report) { case ERROR: - Toast.makeText(TrustKeysActivity.this, R.string.error_fetching_omemo_key, Toast.LENGTH_SHORT).show(); + Toast.makeText(TrustKeysActivity.this,R.string.error_fetching_omemo_key,Toast.LENGTH_SHORT).show(); break; case SUCCESS_TRUSTED: Toast.makeText(TrustKeysActivity.this,R.string.blindly_trusted_omemo_keys,Toast.LENGTH_LONG).show(); @@ -416,7 +389,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } private void commitTrusts() { - for (final String fingerprint : ownKeysToTrust.keySet()) { + for(final String fingerprint :ownKeysToTrust.keySet()) { mAccount.getAxolotlService().setFingerprintTrust( fingerprint, FingerprintStatus.createActive(ownKeysToTrust.get(fingerprint))); @@ -443,13 +416,13 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } private void unlock() { - mSaveButton.setEnabled(true); - mSaveButton.setTextColor(getPrimaryTextColor()); + binding.saveButton.setEnabled(true); + binding.saveButton.setTextColor(getPrimaryTextColor()); } private void lock() { - mSaveButton.setEnabled(false); - mSaveButton.setTextColor(getSecondaryTextColor()); + binding.saveButton.setEnabled(false); + binding.saveButton.setTextColor(getSecondaryTextColor()); } private void lockOrUnlockAsNeeded() { @@ -467,10 +440,10 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } private void setDone() { - mSaveButton.setText(getString(R.string.done)); + binding.saveButton.setText(getString(R.string.done)); } private void setFetching() { - mSaveButton.setText(getString(R.string.fetching_keys)); + binding.saveButton.setText(getString(R.string.fetching_keys)); } -} +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java index 8a23741ef..f62454510 100644 --- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java @@ -1,7 +1,7 @@ package de.pixart.messenger.ui; import android.Manifest; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java index 262be5bb0..09d4d26ac 100644 --- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java @@ -1,8 +1,8 @@ package de.pixart.messenger.ui; -import android.app.Activity; import android.content.Intent; import android.net.Uri; +import android.support.v7.app.AppCompatActivity; import java.util.Arrays; import java.util.List; @@ -13,7 +13,7 @@ import de.pixart.messenger.utils.zxing.IntentIntegrator; import de.pixart.messenger.utils.zxing.IntentResult; import de.pixart.messenger.xmpp.jid.Jid; -public class UriHandlerActivity extends Activity { +public class UriHandlerActivity extends AppCompatActivity { public static final String ACTION_SCAN_QR_CODE = "scan_qr_code"; @Override diff --git a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java index a64f39a03..ea9bcc5a8 100644 --- a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java +++ b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java @@ -1,10 +1,10 @@ package de.pixart.messenger.ui; -import android.app.ActionBar; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; +import android.support.v7.app.ActionBar; import android.view.Menu; import android.view.View; import android.widget.Button; @@ -251,7 +251,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer protected void updateView() { if (this.mConversation != null && this.mConversation.hasValidOtrSession()) { - final ActionBar actionBar = getActionBar(); + final ActionBar actionBar = getSupportActionBar(); this.mVerificationExplain.setText(R.string.no_otr_session_found); invalidateOptionsMenu(); switch (this.mode) { diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java index 0e84d1d64..0c02183c6 100644 --- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java +++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java @@ -1,9 +1,7 @@ package de.pixart.messenger.ui; import android.Manifest; -import android.app.ActionBar; -import android.app.Activity; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; @@ -13,6 +11,8 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.os.Build; import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -79,7 +79,7 @@ public class WelcomeActivity extends XmppActivity { } super.onCreate(savedInstanceState); setContentView(R.layout.welcome); - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayShowHomeEnabled(false); ab.setDisplayHomeAsUpEnabled(false); @@ -336,7 +336,7 @@ public class WelcomeActivity extends XmppActivity { } } - public static void launch(Activity activity) { + public static void launch(AppCompatActivity activity) { Intent intent = new Intent(activity, WelcomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); activity.startActivity(intent); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 79f528f93..7e0df64ca 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -3,9 +3,7 @@ package de.pixart.messenger.ui; import android.Manifest; import android.annotation.SuppressLint; import android.annotation.TargetApi; -import android.app.ActionBar; -import android.app.Activity; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.PendingIntent; import android.content.ActivityNotFoundException; @@ -39,6 +37,8 @@ import android.os.SystemClock; import android.preference.PreferenceManager; import android.provider.Settings; import android.support.v4.content.ContextCompat; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; import android.text.InputType; import android.util.DisplayMetrics; import android.util.Log; @@ -83,7 +83,7 @@ import de.pixart.messenger.xmpp.OnUpdateBlocklist; import de.pixart.messenger.xmpp.jid.InvalidJidException; import de.pixart.messenger.xmpp.jid.Jid; -public abstract class XmppActivity extends Activity { +public abstract class XmppActivity extends AppCompatActivity { protected static final int REQUEST_ANNOUNCE_PGP = 0x0101; protected static final int REQUEST_INVITE_TO_CONVERSATION = 0x0102; @@ -276,7 +276,7 @@ public abstract class XmppActivity extends Activity { } public void showInstallPgpDialog() { - Builder builder = new AlertDialog.Builder(this); + AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.openkeychain_required)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getText(R.string.openkeychain_required_long)); @@ -437,7 +437,7 @@ public abstract class XmppActivity extends Activity { setTheme(this.mTheme); this.mUsingEnterKey = usingEnterKey(); mUseSubject = getPreferences().getBoolean("use_subject", getResources().getBoolean(R.bool.use_subject)); - final ActionBar ab = getActionBar(); + final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); } @@ -565,8 +565,7 @@ public abstract class XmppActivity extends Activity { } protected void inviteToConversation(Conversation conversation) { - Intent intent = new Intent(getApplicationContext(), - ChooseContactActivity.class); + Intent intent = new Intent(this, ChooseContactActivity.class); List<String> contacts = new ArrayList<>(); if (conversation.getMode() == Conversation.MODE_MULTI) { for (MucOptions.User user : conversation.getMucOptions().getUsers(false)) { diff --git a/src/main/java/de/pixart/messenger/ui/adapter/AccountAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/AccountAdapter.java index 451e326e6..792d365ef 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/AccountAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/AccountAdapter.java @@ -134,7 +134,8 @@ public class AccountAdapter extends ArrayAdapter<Account> { @Override protected Bitmap doInBackground(Account... params) { - return activity.avatarService().get(params[0], activity.getPixel(56), isCancelled()); + this.account = params[0]; + return activity.avatarService().get(this.account, activity.getPixel(56), isCancelled()); } @Override diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java index 162455732..3c2de008e 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java @@ -357,7 +357,8 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> { @Override protected Bitmap doInBackground(Conversation... params) { - return activity.avatarService().get(params[0], activity.getPixel(56)); + this.conversation = params[0]; + return activity.avatarService().get(this.conversation, activity.getPixel(56), isCancelled()); } @Override diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java index 8b4af00d8..2df1e5b0f 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java @@ -1,8 +1,8 @@ package de.pixart.messenger.ui.adapter; -import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; +import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; @@ -23,6 +23,7 @@ import java.util.List; import java.util.concurrent.RejectedExecutionException; import de.pixart.messenger.R; +import de.pixart.messenger.databinding.ContactBinding; import de.pixart.messenger.entities.ListItem; import de.pixart.messenger.ui.SettingsActivity; import de.pixart.messenger.ui.XmppActivity; @@ -60,15 +61,17 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { @Override public View getView(int position, View view, ViewGroup parent) { - LayoutInflater inflater = (LayoutInflater) getContext() - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + LayoutInflater inflater = activity.getLayoutInflater(); ListItem item = getItem(position); + ViewHolder viewHolder; if (view == null) { - view = inflater.inflate(R.layout.contact, parent, false); + ContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.contact, parent, false); + viewHolder = ViewHolder.get(binding); + view = binding.getRoot(); + } else { + viewHolder = (ViewHolder) view.getTag(); } - ViewHolder viewHolder = ViewHolder.get(view); - List<ListItem.Tag> tags = item.getTags(activity); if (tags.size() == 0 || !this.showDynamicTags) { @@ -137,7 +140,8 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { @Override protected Bitmap doInBackground(ListItem... params) { - return activity.avatarService().get(params[0], activity.getPixel(48), isCancelled()); + this.item = params[0]; + return activity.avatarService().get(this.item, activity.getPixel(56), isCancelled()); } @Override @@ -221,17 +225,13 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> { private ViewHolder() { } - public static ViewHolder get(View layout) { - ViewHolder viewHolder = (ViewHolder) layout.getTag(); - if (viewHolder == null) { - viewHolder = new ViewHolder(); - - viewHolder.name = layout.findViewById(R.id.contact_display_name); - viewHolder.jid = layout.findViewById(R.id.contact_jid); - viewHolder.avatar = layout.findViewById(R.id.contact_photo); - viewHolder.tags = layout.findViewById(R.id.tags); - layout.setTag(viewHolder); - } + public static ViewHolder get(ContactBinding binding) { + ViewHolder viewHolder = new ViewHolder(); + viewHolder.name = binding.contactDisplayName; + viewHolder.jid = binding.contactJid; + viewHolder.avatar = binding.contactPhoto; + viewHolder.tags = binding.tags; + binding.getRoot().setTag(viewHolder); return viewHolder; } } diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index ca6b02284..181bce607 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -1223,7 +1223,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie @Override protected Bitmap doInBackground(Message... params) { - return activity.avatarService().get(params[0], size, isCancelled()); + this.message = params[0]; + return activity.avatarService().get(this.message, size, isCancelled()); } @Override diff --git a/src/main/java/de/pixart/messenger/ui/widget/DisabledActionModeCallback.java b/src/main/java/de/pixart/messenger/ui/widget/DisabledActionModeCallback.java new file mode 100644 index 000000000..5acf3a666 --- /dev/null +++ b/src/main/java/de/pixart/messenger/ui/widget/DisabledActionModeCallback.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2018, Daniel Gultsch All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package de.pixart.messenger.ui.widget; + +import android.view.ActionMode; +import android.view.Menu; +import android.view.MenuItem; + +public class DisabledActionModeCallback implements ActionMode.Callback { + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + return false; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + + } +}
\ No newline at end of file diff --git a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java index 3b9b50f1c..bb1f0536c 100644 --- a/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java +++ b/src/main/java/de/pixart/messenger/ui/widget/EditMessage.java @@ -5,7 +5,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.Nullable; -import android.support.text.emoji.widget.EmojiEditText; +import android.support.text.emoji.widget.EmojiAppCompatEditText; import android.support.v13.view.inputmethod.EditorInfoCompat; import android.support.v13.view.inputmethod.InputConnectionCompat; import android.support.v13.view.inputmethod.InputContentInfoCompat; @@ -19,15 +19,9 @@ import android.view.inputmethod.InputConnection; import de.pixart.messenger.Config; -public class EditMessage extends EmojiEditText { +public class EditMessage extends EmojiAppCompatEditText { - private static final InputFilter SPAN_FILTER = new InputFilter() { - - @Override - public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { - return source instanceof Spanned ? source.toString() : source; - } - }; + private static final InputFilter SPAN_FILTER = (source, start, end, dest, dstart, dend) -> source instanceof Spanned ? source.toString() : source; protected Handler mTypingHandler = new Handler(); protected KeyboardListener keyboardListener; diff --git a/src/main/java/de/pixart/messenger/ui/widget/Switch.java b/src/main/java/de/pixart/messenger/ui/widget/Switch.java deleted file mode 100644 index 40d8f4c99..000000000 --- a/src/main/java/de/pixart/messenger/ui/widget/Switch.java +++ /dev/null @@ -1,68 +0,0 @@ -package de.pixart.messenger.ui.widget; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.MotionEvent; -import android.view.ViewConfiguration; - -import com.kyleduo.switchbutton.SwitchButton; - -public class Switch extends SwitchButton { - - private int mTouchSlop; - private int mClickTimeout; - private float mStartX; - private float mStartY; - private OnClickListener mOnClickListener; - - public Switch(Context context) { - super(context); - mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); - mClickTimeout = ViewConfiguration.getPressedStateDuration() + ViewConfiguration.getTapTimeout(); - } - - public Switch(Context context, AttributeSet attrs) { - super(context, attrs); - mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); - mClickTimeout = ViewConfiguration.getPressedStateDuration() + ViewConfiguration.getTapTimeout(); - } - - public Switch(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); - mClickTimeout = ViewConfiguration.getPressedStateDuration() + ViewConfiguration.getTapTimeout(); - } - - @Override - public void setOnClickListener(OnClickListener onClickListener) { - this.mOnClickListener = onClickListener; - } - - @Override - public boolean onTouchEvent(MotionEvent event) { - if (!isEnabled()) { - float deltaX = event.getX() - mStartX; - float deltaY = event.getY() - mStartY; - int action = event.getAction(); - switch (action) { - case MotionEvent.ACTION_DOWN: - mStartX = event.getX(); - mStartY = event.getY(); - break; - case MotionEvent.ACTION_CANCEL: - case MotionEvent.ACTION_UP: - float time = event.getEventTime() - event.getDownTime(); - if (deltaX < mTouchSlop && deltaY < mTouchSlop && time < mClickTimeout) { - if (mOnClickListener != null) { - this.mOnClickListener.onClick(this); - } - } - break; - default: - break; - } - return true; - } - return super.onTouchEvent(event); - } -} diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java index efec5098b..9aacef24f 100644 --- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java @@ -1,6 +1,6 @@ package de.pixart.messenger.utils; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java index 451ec3aec..08e1d7dad 100644 --- a/src/main/java/de/pixart/messenger/utils/UIHelper.java +++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java @@ -557,19 +557,4 @@ public class UIHelper { return type; } } - - public static boolean showIconsInPopup(PopupMenu attachFilePopup) { - try { - Field field = attachFilePopup.getClass().getDeclaredField("mPopup"); - field.setAccessible(true); - Object menuPopupHelper = field.get(attachFilePopup); - Class<?> cls = Class.forName("com.android.internal.view.menu.MenuPopupHelper"); - Method method = cls.getDeclaredMethod("setForceShowIcon", new Class[]{boolean.class}); - method.setAccessible(true); - method.invoke(menuPopupHelper, new Object[]{true}); - return true; - } catch (Exception e) { - return false; - } - } } diff --git a/src/main/java/de/pixart/messenger/utils/zxing/IntentIntegrator.java b/src/main/java/de/pixart/messenger/utils/zxing/IntentIntegrator.java index dc5ba8ace..ebb92ae4c 100644 --- a/src/main/java/de/pixart/messenger/utils/zxing/IntentIntegrator.java +++ b/src/main/java/de/pixart/messenger/utils/zxing/IntentIntegrator.java @@ -17,7 +17,7 @@ package de.pixart.messenger.utils.zxing; import android.app.Activity; -import android.app.AlertDialog; +import android.support.v7.app.AlertDialog; import android.app.Fragment; import android.content.ActivityNotFoundException; import android.content.DialogInterface; diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 6bd4904bf..1025c5f1d 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -50,8 +50,8 @@ import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; -import de.duenndns.ssl.DomainHostnameVerifier; -import de.duenndns.ssl.MemorizingTrustManager; +import de.pixart.messenger.crypto.DomainHostnameVerifier; +import de.pixart.messenger.services.MemorizingTrustManager; import de.pixart.messenger.Config; import de.pixart.messenger.crypto.XmppDomainVerifier; import de.pixart.messenger.crypto.axolotl.AxolotlService; diff --git a/src/main/res/drawable-hdpi/ic_action_download.png b/src/main/res/drawable-hdpi/ic_action_download.png Binary files differdeleted file mode 100644 index 596fd582c..000000000 --- a/src/main/res/drawable-hdpi/ic_action_download.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/ic_action_secure.png b/src/main/res/drawable-hdpi/ic_action_secure.png Binary files differdeleted file mode 100644 index e066ba4dc..000000000 --- a/src/main/res/drawable-hdpi/ic_action_secure.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/switch_thumb_disable.png b/src/main/res/drawable-hdpi/switch_thumb_disable.png Binary files differdeleted file mode 100644 index edf2a0cb6..000000000 --- a/src/main/res/drawable-hdpi/switch_thumb_disable.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/switch_thumb_off_normal.png b/src/main/res/drawable-hdpi/switch_thumb_off_normal.png Binary files differdeleted file mode 100644 index e68516df5..000000000 --- a/src/main/res/drawable-hdpi/switch_thumb_off_normal.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/switch_thumb_off_pressed.png b/src/main/res/drawable-hdpi/switch_thumb_off_pressed.png Binary files differdeleted file mode 100644 index 66a71eed8..000000000 --- a/src/main/res/drawable-hdpi/switch_thumb_off_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/switch_thumb_on_normal.png b/src/main/res/drawable-hdpi/switch_thumb_on_normal.png Binary files differdeleted file mode 100644 index 07b504b8a..000000000 --- a/src/main/res/drawable-hdpi/switch_thumb_on_normal.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/switch_thumb_on_pressed.png b/src/main/res/drawable-hdpi/switch_thumb_on_pressed.png Binary files differdeleted file mode 100644 index 2afb5d515..000000000 --- a/src/main/res/drawable-hdpi/switch_thumb_on_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/tab_selected_conversations.9.png b/src/main/res/drawable-hdpi/tab_selected_conversations.9.png Binary files differdeleted file mode 100644 index 68b1dd750..000000000 --- a/src/main/res/drawable-hdpi/tab_selected_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/tab_selected_focused_conversations.9.png b/src/main/res/drawable-hdpi/tab_selected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 557452d31..000000000 --- a/src/main/res/drawable-hdpi/tab_selected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/tab_selected_pressed_conversations.9.png b/src/main/res/drawable-hdpi/tab_selected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index e91a93fa1..000000000 --- a/src/main/res/drawable-hdpi/tab_selected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/tab_unselected_focused_conversations.9.png b/src/main/res/drawable-hdpi/tab_unselected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 3dbdb6156..000000000 --- a/src/main/res/drawable-hdpi/tab_unselected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-hdpi/tab_unselected_pressed_conversations.9.png b/src/main/res/drawable-hdpi/tab_unselected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index c4a248118..000000000 --- a/src/main/res/drawable-hdpi/tab_unselected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/ic_action_download.png b/src/main/res/drawable-mdpi/ic_action_download.png Binary files differdeleted file mode 100644 index e2a58608f..000000000 --- a/src/main/res/drawable-mdpi/ic_action_download.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/ic_action_secure.png b/src/main/res/drawable-mdpi/ic_action_secure.png Binary files differdeleted file mode 100644 index fcb585f6f..000000000 --- a/src/main/res/drawable-mdpi/ic_action_secure.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/switch_thumb_disable.png b/src/main/res/drawable-mdpi/switch_thumb_disable.png Binary files differdeleted file mode 100644 index 5aca01b01..000000000 --- a/src/main/res/drawable-mdpi/switch_thumb_disable.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/switch_thumb_off_normal.png b/src/main/res/drawable-mdpi/switch_thumb_off_normal.png Binary files differdeleted file mode 100644 index b077942d0..000000000 --- a/src/main/res/drawable-mdpi/switch_thumb_off_normal.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/switch_thumb_off_pressed.png b/src/main/res/drawable-mdpi/switch_thumb_off_pressed.png Binary files differdeleted file mode 100644 index 31a66b563..000000000 --- a/src/main/res/drawable-mdpi/switch_thumb_off_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/switch_thumb_on_normal.png b/src/main/res/drawable-mdpi/switch_thumb_on_normal.png Binary files differdeleted file mode 100644 index a20e6c03c..000000000 --- a/src/main/res/drawable-mdpi/switch_thumb_on_normal.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/switch_thumb_on_pressed.png b/src/main/res/drawable-mdpi/switch_thumb_on_pressed.png Binary files differdeleted file mode 100644 index f8ee1b838..000000000 --- a/src/main/res/drawable-mdpi/switch_thumb_on_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/tab_selected_conversations.9.png b/src/main/res/drawable-mdpi/tab_selected_conversations.9.png Binary files differdeleted file mode 100644 index e18c2e9c6..000000000 --- a/src/main/res/drawable-mdpi/tab_selected_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/tab_selected_focused_conversations.9.png b/src/main/res/drawable-mdpi/tab_selected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 5ce9469df..000000000 --- a/src/main/res/drawable-mdpi/tab_selected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/tab_selected_pressed_conversations.9.png b/src/main/res/drawable-mdpi/tab_selected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index 4bb9e6a64..000000000 --- a/src/main/res/drawable-mdpi/tab_selected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/tab_unselected_focused_conversations.9.png b/src/main/res/drawable-mdpi/tab_unselected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 255fb97f0..000000000 --- a/src/main/res/drawable-mdpi/tab_unselected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-mdpi/tab_unselected_pressed_conversations.9.png b/src/main/res/drawable-mdpi/tab_unselected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index 8803ec053..000000000 --- a/src/main/res/drawable-mdpi/tab_unselected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/ic_action_download.png b/src/main/res/drawable-xhdpi/ic_action_download.png Binary files differdeleted file mode 100644 index a43f70428..000000000 --- a/src/main/res/drawable-xhdpi/ic_action_download.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/ic_action_secure.png b/src/main/res/drawable-xhdpi/ic_action_secure.png Binary files differdeleted file mode 100644 index 05b6acc74..000000000 --- a/src/main/res/drawable-xhdpi/ic_action_secure.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/switch_thumb_disable.png b/src/main/res/drawable-xhdpi/switch_thumb_disable.png Binary files differdeleted file mode 100644 index e416b4feb..000000000 --- a/src/main/res/drawable-xhdpi/switch_thumb_disable.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/switch_thumb_off_normal.png b/src/main/res/drawable-xhdpi/switch_thumb_off_normal.png Binary files differdeleted file mode 100644 index 230a84bc0..000000000 --- a/src/main/res/drawable-xhdpi/switch_thumb_off_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/switch_thumb_off_pressed.png b/src/main/res/drawable-xhdpi/switch_thumb_off_pressed.png Binary files differdeleted file mode 100644 index e80086d99..000000000 --- a/src/main/res/drawable-xhdpi/switch_thumb_off_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/switch_thumb_on_normal.png b/src/main/res/drawable-xhdpi/switch_thumb_on_normal.png Binary files differdeleted file mode 100644 index a771329d7..000000000 --- a/src/main/res/drawable-xhdpi/switch_thumb_on_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/switch_thumb_on_pressed.png b/src/main/res/drawable-xhdpi/switch_thumb_on_pressed.png Binary files differdeleted file mode 100644 index cd88d6586..000000000 --- a/src/main/res/drawable-xhdpi/switch_thumb_on_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/tab_selected_conversations.9.png b/src/main/res/drawable-xhdpi/tab_selected_conversations.9.png Binary files differdeleted file mode 100644 index 7de791d70..000000000 --- a/src/main/res/drawable-xhdpi/tab_selected_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/tab_selected_focused_conversations.9.png b/src/main/res/drawable-xhdpi/tab_selected_focused_conversations.9.png Binary files differdeleted file mode 100644 index b9ab85694..000000000 --- a/src/main/res/drawable-xhdpi/tab_selected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/tab_selected_pressed_conversations.9.png b/src/main/res/drawable-xhdpi/tab_selected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index 2fe1ffada..000000000 --- a/src/main/res/drawable-xhdpi/tab_selected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/tab_unselected_focused_conversations.9.png b/src/main/res/drawable-xhdpi/tab_unselected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 3d59b0d0d..000000000 --- a/src/main/res/drawable-xhdpi/tab_unselected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xhdpi/tab_unselected_pressed_conversations.9.png b/src/main/res/drawable-xhdpi/tab_unselected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index 2da35fe80..000000000 --- a/src/main/res/drawable-xhdpi/tab_unselected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/ic_action_download.png b/src/main/res/drawable-xxhdpi/ic_action_download.png Binary files differdeleted file mode 100644 index d01732ee9..000000000 --- a/src/main/res/drawable-xxhdpi/ic_action_download.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/ic_action_secure.png b/src/main/res/drawable-xxhdpi/ic_action_secure.png Binary files differdeleted file mode 100644 index 76e1190d6..000000000 --- a/src/main/res/drawable-xxhdpi/ic_action_secure.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/switch_thumb_disable.png b/src/main/res/drawable-xxhdpi/switch_thumb_disable.png Binary files differdeleted file mode 100644 index 3ff8a48dd..000000000 --- a/src/main/res/drawable-xxhdpi/switch_thumb_disable.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/switch_thumb_off_normal.png b/src/main/res/drawable-xxhdpi/switch_thumb_off_normal.png Binary files differdeleted file mode 100644 index de02d19e5..000000000 --- a/src/main/res/drawable-xxhdpi/switch_thumb_off_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/switch_thumb_off_pressed.png b/src/main/res/drawable-xxhdpi/switch_thumb_off_pressed.png Binary files differdeleted file mode 100644 index 7dee139ef..000000000 --- a/src/main/res/drawable-xxhdpi/switch_thumb_off_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/switch_thumb_on_normal.png b/src/main/res/drawable-xxhdpi/switch_thumb_on_normal.png Binary files differdeleted file mode 100644 index de13a5993..000000000 --- a/src/main/res/drawable-xxhdpi/switch_thumb_on_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/switch_thumb_on_pressed.png b/src/main/res/drawable-xxhdpi/switch_thumb_on_pressed.png Binary files differdeleted file mode 100644 index 6c260776e..000000000 --- a/src/main/res/drawable-xxhdpi/switch_thumb_on_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/tab_selected_conversations.9.png b/src/main/res/drawable-xxhdpi/tab_selected_conversations.9.png Binary files differdeleted file mode 100644 index 9f13a9c20..000000000 --- a/src/main/res/drawable-xxhdpi/tab_selected_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/tab_selected_focused_conversations.9.png b/src/main/res/drawable-xxhdpi/tab_selected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 0b20a8af2..000000000 --- a/src/main/res/drawable-xxhdpi/tab_selected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/tab_selected_pressed_conversations.9.png b/src/main/res/drawable-xxhdpi/tab_selected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index f6dab1b05..000000000 --- a/src/main/res/drawable-xxhdpi/tab_selected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/tab_unselected_focused_conversations.9.png b/src/main/res/drawable-xxhdpi/tab_unselected_focused_conversations.9.png Binary files differdeleted file mode 100644 index 31f944a83..000000000 --- a/src/main/res/drawable-xxhdpi/tab_unselected_focused_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxhdpi/tab_unselected_pressed_conversations.9.png b/src/main/res/drawable-xxhdpi/tab_unselected_pressed_conversations.9.png Binary files differdeleted file mode 100644 index a54ea8506..000000000 --- a/src/main/res/drawable-xxhdpi/tab_unselected_pressed_conversations.9.png +++ /dev/null diff --git a/src/main/res/drawable-xxxhdpi/switch_thumb_disable.png b/src/main/res/drawable-xxxhdpi/switch_thumb_disable.png Binary files differdeleted file mode 100644 index 865f11dbe..000000000 --- a/src/main/res/drawable-xxxhdpi/switch_thumb_disable.png +++ /dev/null diff --git a/src/main/res/drawable-xxxhdpi/switch_thumb_off_normal.png b/src/main/res/drawable-xxxhdpi/switch_thumb_off_normal.png Binary files differdeleted file mode 100644 index 268a63435..000000000 --- a/src/main/res/drawable-xxxhdpi/switch_thumb_off_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xxxhdpi/switch_thumb_off_pressed.png b/src/main/res/drawable-xxxhdpi/switch_thumb_off_pressed.png Binary files differdeleted file mode 100644 index dc15d1838..000000000 --- a/src/main/res/drawable-xxxhdpi/switch_thumb_off_pressed.png +++ /dev/null diff --git a/src/main/res/drawable-xxxhdpi/switch_thumb_on_normal.png b/src/main/res/drawable-xxxhdpi/switch_thumb_on_normal.png Binary files differdeleted file mode 100644 index e66b72411..000000000 --- a/src/main/res/drawable-xxxhdpi/switch_thumb_on_normal.png +++ /dev/null diff --git a/src/main/res/drawable-xxxhdpi/switch_thumb_on_pressed.png b/src/main/res/drawable-xxxhdpi/switch_thumb_on_pressed.png Binary files differdeleted file mode 100644 index eddb55bb8..000000000 --- a/src/main/res/drawable-xxxhdpi/switch_thumb_on_pressed.png +++ /dev/null diff --git a/src/main/res/drawable/actionbar_tab_indicator.xml b/src/main/res/drawable/actionbar_tab_indicator.xml deleted file mode 100644 index ffd36f6fe..000000000 --- a/src/main/res/drawable/actionbar_tab_indicator.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - - <!-- Non focused states --> - <item android:drawable="@android:color/transparent" android:state_focused="false" android:state_pressed="false" android:state_selected="false" /> - <item android:drawable="@drawable/tab_selected_conversations" android:state_focused="false" android:state_pressed="false" android:state_selected="true" /> - - <!-- Focused states --> - <item android:drawable="@drawable/tab_unselected_focused_conversations" android:state_focused="true" android:state_pressed="false" android:state_selected="false" /> - <item android:drawable="@drawable/tab_selected_focused_conversations" android:state_focused="true" android:state_pressed="false" android:state_selected="true" /> - - <!-- Pressed --> - <!-- Non focused states --> - <item android:drawable="@drawable/tab_unselected_pressed_conversations" android:state_focused="false" android:state_pressed="true" android:state_selected="false" /> - <item android:drawable="@drawable/tab_selected_pressed_conversations" android:state_focused="false" android:state_pressed="true" android:state_selected="true" /> - - <!-- Focused states --> - <item android:drawable="@drawable/tab_unselected_pressed_conversations" android:state_focused="true" android:state_pressed="true" android:state_selected="false" /> - <item android:drawable="@drawable/tab_selected_pressed_conversations" android:state_focused="true" android:state_pressed="true" android:state_selected="true" /> - -</selector>
\ No newline at end of file diff --git a/src/main/res/drawable/ic_visibility.xml b/src/main/res/drawable/ic_visibility.xml new file mode 100644 index 000000000..57ba4f002 --- /dev/null +++ b/src/main/res/drawable/ic_visibility.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/> +</vector>
\ No newline at end of file diff --git a/src/main/res/drawable/ic_visibility_off.xml b/src/main/res/drawable/ic_visibility_off.xml new file mode 100644 index 000000000..fd954d349 --- /dev/null +++ b/src/main/res/drawable/ic_visibility_off.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M12,7c2.76,0 5,2.24 5,5 0,0.65 -0.13,1.26 -0.36,1.83l2.92,2.92c1.51,-1.26 2.7,-2.89 3.43,-4.75 -1.73,-4.39 -6,-7.5 -11,-7.5 -1.4,0 -2.74,0.25 -3.98,0.7l2.16,2.16C10.74,7.13 11.35,7 12,7zM2,4.27l2.28,2.28 0.46,0.46C3.08,8.3 1.78,10.02 1,12c1.73,4.39 6,7.5 11,7.5 1.55,0 3.03,-0.3 4.38,-0.84l0.42,0.42L19.73,22 21,20.73 3.27,3 2,4.27zM7.53,9.8l1.55,1.55c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.66 1.34,3 3,3 0.22,0 0.44,-0.03 0.65,-0.08l1.55,1.55c-0.67,0.33 -1.41,0.53 -2.2,0.53 -2.76,0 -5,-2.24 -5,-5 0,-0.79 0.2,-1.53 0.53,-2.2zM11.84,9.02l3.15,3.15 0.02,-0.16c0,-1.66 -1.34,-3 -3,-3l-0.17,0.01z"/> +</vector>
\ No newline at end of file diff --git a/src/main/res/drawable/switch_back_off.xml b/src/main/res/drawable/switch_back_off.xml deleted file mode 100644 index 9082347b2..000000000 --- a/src/main/res/drawable/switch_back_off.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - - <item android:state_enabled="false"> - <shape android:shape="rectangle"> - <solid android:color="#D5D5D5" /> - - <corners android:radius="99dp" /> - </shape> - </item> - <item android:state_enabled="true"> - <shape android:shape="rectangle"> - <solid android:color="#939393" /> - - <corners android:radius="99dp" /> - </shape> - </item> - -</selector>
\ No newline at end of file diff --git a/src/main/res/drawable/switch_back_on.xml b/src/main/res/drawable/switch_back_on.xml deleted file mode 100644 index ae78edecc..000000000 --- a/src/main/res/drawable/switch_back_on.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="false"> - <shape android:shape="rectangle"> - <solid android:color="#D5D5D5" /> - <corners android:radius="99dp" /> - </shape> - </item> - <item android:state_enabled="true"> - <shape android:shape="rectangle"> - <!-- 30% accent on white --> - <solid android:color="#b3ddf7" /> - <corners android:radius="99dp" /> - </shape> - </item> -</selector>
\ No newline at end of file diff --git a/src/main/res/drawable/switch_thumb.xml b/src/main/res/drawable/switch_thumb.xml deleted file mode 100644 index da33e46c3..000000000 --- a/src/main/res/drawable/switch_thumb.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - - <item android:drawable="@drawable/switch_thumb_disable" android:state_enabled="false" /> - <item android:drawable="@drawable/switch_thumb_on_pressed" android:state_checked="true" android:state_pressed="true" /> - <item android:drawable="@drawable/switch_thumb_on_pressed" android:state_checked="true" android:state_focused="true" /> - <item android:drawable="@drawable/switch_thumb_on_normal" android:state_checked="true" /> - <item android:drawable="@drawable/switch_thumb_off_pressed" android:state_checked="false" android:state_pressed="true" /> - <item android:drawable="@drawable/switch_thumb_off_pressed" android:state_checked="false" android:state_focused="true" /> - <item android:drawable="@drawable/switch_thumb_off_normal" android:state_checked="false" /> - -</selector>
\ No newline at end of file diff --git a/src/main/res/drawable/visibility_toggle_drawable.xml b/src/main/res/drawable/visibility_toggle_drawable.xml new file mode 100644 index 000000000..9c887e7e9 --- /dev/null +++ b/src/main/res/drawable/visibility_toggle_drawable.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/ic_visibility" android:state_checked="true" /> + <item android:drawable="@drawable/ic_visibility_off" android:state_checked="false" /> +</selector>
\ No newline at end of file diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index d36eecccb..c50485f56 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -13,7 +13,6 @@ android:layout_width="48dp" android:layout_height="48dp" android:layout_alignParentLeft="true" - android:src="@drawable/ic_profile" android:contentDescription="@string/account_image_description" android:background="@drawable/message_border" android:padding="1dp" diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml index 8808227e3..1dfdc8309 100644 --- a/src/main/res/layout/activity_change_password.xml +++ b/src/main/res/layout/activity_change_password.xml @@ -1,79 +1,71 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/grey200"> + android:background="?attr/color_background_secondary"> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/button_bar"> - <LinearLayout + <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding" - android:orientation="vertical"> - - <TextView - android:id="@+id/current_password_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/current_password" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:layout_marginTop="@dimen/activity_vertical_margin"> - <EditText - android:id="@+id/current_password" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:hint="@string/password" - android:inputType="textPassword" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/new_password" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - <EditText - android:id="@+id/new_password" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:hint="@string/password" - android:inputType="textPassword" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + <android.support.design.widget.TextInputLayout + android:id="@+id/current_password_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" + app:passwordToggleEnabled="true" + app:passwordToggleTint="?attr/color_text_secondary"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/account_settings_confirm_password" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <android.support.design.widget.TextInputEditText + android:id="@+id/current_password" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:hint="@string/current_password" + android:inputType="textPassword" + android:textColor="?attr/color_text_primary" + android:textColorHint="?attr/color_text_secondary" + android:textSize="?attr/TextSizeBody" /> + </android.support.design.widget.TextInputLayout> - <EditText - android:id="@+id/new_password_confirm" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/password" - android:inputType="textPassword" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> - </LinearLayout> + <android.support.design.widget.TextInputLayout + android:id="@+id/new_password_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" + app:passwordToggleEnabled="true" + app:passwordToggleTint="?attr/color_text_secondary"> + + <android.support.design.widget.TextInputEditText + android:id="@+id/new_password" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:hint="@string/new_password" + android:inputType="textPassword" + android:textColor="?attr/color_text_primary" + android:textColorHint="?attr/color_text_secondary" + android:textSize="?attr/TextSizeBody" /> + </android.support.design.widget.TextInputLayout> + </LinearLayout> + </android.support.v7.widget.CardView> </ScrollView> <LinearLayout @@ -97,7 +89,7 @@ android:layout_height="fill_parent" android:layout_marginBottom="7dp" android:layout_marginTop="7dp" - android:background="@color/black12" /> + android:background="?attr/divider" /> <Button android:id="@+id/right_button" diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml index 031110bea..75ef17978 100644 --- a/src/main/res/layout/activity_contact_details.xml +++ b/src/main/res/layout/activity_contact_details.xml @@ -1,250 +1,246 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@color/grey200"> +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> - <LinearLayout - android:id="@+id/details_main_layout" + <ScrollView android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_height="fill_parent" + android:background="@color/grey200"> - <RelativeLayout + <LinearLayout + android:id="@+id/details_main_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding"> - - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/contact_display_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:text="@string/contact" - android:textColor="@color/black87" - android:textIsSelectable="false" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:paddingBottom="5dp" - android:textAlignment="center" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" /> - - <QuickContactBadge - android:id="@+id/details_contact_badge" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:adjustViewBounds="true" - android:background="@drawable/message_border" - android:maxHeight="384dp" - android:maxWidth="384dp" - android:padding="1dp" - android:layout_below="@+id/contact_display_name" - android:layout_centerHorizontal="true" /> - - <LinearLayout - android:id="@+id/details_jidbox" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentLeft="true" - android:layout_alignParentRight="true" - android:layout_alignParentStart="true" - android:layout_below="@+id/details_contact_badge" - android:layout_marginTop="16dp" - android:orientation="vertical"> - - <TextView - android:id="@+id/details_contactjid" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:text="@string/account_settings_example_jabber_id" - android:textColor="@color/black87" - android:textIsSelectable="true" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:visibility="gone" /> - - <com.wefika.flowlayout.FlowLayout - android:id="@+id/tags" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="4dp" - android:layout_marginLeft="-2dp" - android:layout_marginTop="4dp" - android:orientation="horizontal"> - </com.wefika.flowlayout.FlowLayout> - - <TextView - android:id="@+id/details_lastseen" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeBody" - android:layout_marginBottom="4dp" - android:layout_marginTop="4dp" /> - - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/status_message" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="4dp" - android:gravity="center_horizontal" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeBody" - android:textStyle="italic" - android:layout_marginBottom="4dp" /> - - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/resource" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="4dp" - android:gravity="center_horizontal" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeBody" - android:textStyle="italic" - android:layout_marginBottom="4dp" /> - - <Button - android:id="@+id/add_contact_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" - android:layout_gravity="center_horizontal" - android:text="@string/add_contact" - android:layout_marginBottom="4dp" - android:layout_marginTop="4dp" /> - - <CheckBox - android:id="@+id/details_send_presence" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_below="@+id/add_contact_button" - android:text="@string/send_presence_updates" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:layout_marginTop="4dp" /> - - <CheckBox - android:id="@+id/details_receive_presence" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_below="@+id/details_send_presence" - android:text="@string/receive_presence_updates" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:orientation="vertical"> - </LinearLayout> - - <TextView - android:id="@+id/details_account" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@+id/details_jidbox" - android:layout_marginTop="32dp" - android:text="@string/using_account" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" - android:visibility="gone" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding"> - - <RelativeLayout - android:layout_width="fill_parent" + <android.support.v7.widget.CardView + android:layout_width="match_parent" android:layout_height="wrap_content" - android:touchscreenBlocksFocus="true" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" > + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> - <TextView - android:id="@+id/notification_status_text" - android:layout_width="wrap_content" + <RelativeLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/notify_on_all_messages" - android:layout_centerVertical="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:layout_alignParentLeft="true" - android:layout_toLeftOf="@+id/notification_status_button" /> + android:padding="@dimen/card_padding_regular"> + + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/contact_display_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_gravity="center_horizontal" + android:paddingBottom="5dp" + android:text="@string/contact" + android:textAlignment="center" + android:textColor="@color/black87" + android:textIsSelectable="false" + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold" /> + + <QuickContactBadge + android:id="@+id/details_contact_badge" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/contact_display_name" + android:layout_centerHorizontal="true" + android:adjustViewBounds="true" + android:background="@drawable/message_border" + android:maxHeight="384dp" + android:maxWidth="384dp" + android:padding="1dp" + android:scaleType="centerCrop" /> + + <LinearLayout + android:id="@+id/details_jidbox" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:layout_alignParentLeft="true" + android:layout_alignParentRight="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/details_contact_badge" + android:layout_marginTop="16dp" + android:orientation="vertical"> + + <TextView + android:id="@+id/details_contactjid" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="@string/account_settings_example_jabber_id" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + android:textIsSelectable="true" + android:visibility="gone" /> + + <com.wefika.flowlayout.FlowLayout + android:id="@+id/tags" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginLeft="-2dp" + android:layout_marginTop="4dp" + android:orientation="horizontal"></com.wefika.flowlayout.FlowLayout> + + <TextView + android:id="@+id/details_lastseen" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" /> + + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/status_message" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:gravity="center_horizontal" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> + + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/resource" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:gravity="center_horizontal" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody" + android:textStyle="italic" /> + + <Button + android:id="@+id/add_contact_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="4dp" + android:layout_marginTop="4dp" + android:text="@string/add_contact" /> + + <CheckBox + android:id="@+id/details_send_presence" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/add_contact_button" + android:layout_marginTop="4dp" + android:text="@string/send_presence_updates" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> + + <CheckBox + android:id="@+id/details_receive_presence" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/details_send_presence" + android:text="@string/receive_presence_updates" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> + + </LinearLayout> + + <TextView + android:id="@+id/details_account" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_below="@+id/details_jidbox" + android:layout_marginTop="32dp" + android:text="@string/using_account" + android:textAppearance="@style/TextAppearance.AppCompat.Caption" + android:visibility="gone" /> + </RelativeLayout> + </android.support.v7.widget.CardView> + + <android.support.v7.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> - <ImageButton - android:id="@+id/notification_status_button" - style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" + <RelativeLayout + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="@drawable/ic_notifications_grey600_24dp" /> - </RelativeLayout> - - </RelativeLayout> - - <LinearLayout - android:id="@+id/keys_wrapper" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding"> - - <LinearLayout + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:padding="@dimen/card_padding_regular" + android:touchscreenBlocksFocus="true"> + + <TextView + android:id="@+id/notification_status_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/notification_status_button" + android:text="@string/notify_on_all_messages" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> + + <ImageButton + android:id="@+id/notification_status_button" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:layout_gravity="center_horizontal" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="@drawable/ic_notifications_grey600_24dp" /> + </RelativeLayout> + + </android.support.v7.widget.CardView> + + <android.support.v7.widget.CardView + android:id="@+id/keys_wrapper" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> <LinearLayout - android:id="@+id/details_contact_keys" - android:layout_width="fill_parent" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:divider="?android:dividerHorizontal" android:orientation="vertical" - android:showDividers="middle"> + android:padding="@dimen/card_padding_list"> + + <LinearLayout + android:id="@+id/details_contact_keys" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:divider="?android:dividerHorizontal" + android:orientation="vertical" + android:showDividers="middle"></LinearLayout> + + <Button + android:id="@+id/show_inactive_devices" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginTop="8dp" + android:text="@string/show_inactive_devices" + android:textColor="@color/accent" /> </LinearLayout> - - <Button - android:id="@+id/show_inactive_devices" - style="?android:attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="8dp" - android:text="@string/show_inactive_devices" - android:textColor="@color/accent" /> - </LinearLayout> + </android.support.v7.widget.CardView> </LinearLayout> - </LinearLayout> - -</ScrollView> + </ScrollView> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 7b60b7a64..b685e9cad 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -1,732 +1,732 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/grey200"> + xmlns:tools="http://schemas.android.com/tools"> - <ScrollView - android:layout_width="fill_parent" + <RelativeLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_above="@+id/button_bar" - android:layout_alignParentTop="true"> + android:background="?attr/color_background_secondary"> - <LinearLayout - android:id="@+id/account_main_layout" - android:layout_width="match_parent" + <ScrollView + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_above="@+id/button_bar" + android:layout_alignParentTop="true"> - <RelativeLayout - android:id="@+id/editor" - android:layout_width="fill_parent" + <LinearLayout + android:id="@+id/account_main_layout" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding"> - - <com.makeramen.roundedimageview.RoundedImageView - android:id="@+id/avater" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" - android:layout_marginBottom="16dp" - android:adjustViewBounds="true" - android:background="@drawable/message_border" - android:contentDescription="@string/account_image_description" - android:maxHeight="384dp" - android:maxWidth="384dp" - android:padding="1dp" - app:riv_corner_radius="5dp" /> + android:orientation="vertical"> - <LinearLayout + <RelativeLayout + android:id="@+id/editor" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_below="@+id/avater" - android:orientation="vertical"> - - <TextView - android:id="@+id/account_jid_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/account_settings_jabber_id" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - - <AutoCompleteTextView - android:id="@+id/account_jid" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/account_settings_example_jabber_id" - android:inputType="textEmailAddress" - android:imeOptions="actionNext" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:background="@drawable/infocard_border" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> - <TextView + <com.makeramen.roundedimageview.RoundedImageView + android:id="@+id/avater" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:text="@string/account_settings_password" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - - <EditText - android:id="@+id/account_password" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:hint="@string/password" - android:inputType="textPassword" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_marginBottom="16dp" + android:adjustViewBounds="true" + android:background="@drawable/message_border" + android:contentDescription="@string/account_image_description" + android:maxHeight="384dp" + android:maxWidth="384dp" + android:padding="1dp" + app:riv_corner_radius="5dp" /> <LinearLayout - android:id="@+id/name_port" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:orientation="horizontal" - android:weightSum="1"> + android:layout_below="@+id/avater" + android:orientation="vertical"> - <LinearLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="0.8" - android:orientation="vertical"> + <android.support.design.widget.TextInputLayout + android:id="@+id/account_jid_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/account_settings_jabber_id"> - <TextView - android:id="@+id/textView" - android:layout_width="wrap_content" + <AutoCompleteTextView + android:id="@+id/account_jid" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/account_settings_hostname" - android:textColor="@color/black87" + android:imeOptions="actionNext" + android:inputType="textEmailAddress" + android:textColor="?attr/color_text_primary" + android:textColorHint="?attr/color_text_secondary" android:textSize="?attr/TextSizeBody" /> + </android.support.design.widget.TextInputLayout> - <EditText - android:id="@+id/hostname" - android:layout_width="fill_parent" + <android.support.design.widget.TextInputLayout + android:id="@+id/account_password_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:passwordToggleDrawable="@drawable/visibility_toggle_drawable" + app:passwordToggleEnabled="true" + app:passwordToggleTint="?attr/color_text_secondary"> + + <android.support.design.widget.TextInputEditText + android:id="@+id/account_password" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:hint="@string/hostname_or_onion" - android:inputType="textNoSuggestions" + android:hint="@string/password" + android:inputType="textPassword" android:textColor="@color/black87" android:textColorHint="@color/black54" android:textSize="?attr/TextSizeBody" /> - </LinearLayout> + </android.support.design.widget.TextInputLayout> <LinearLayout - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="0.2" - android:orientation="vertical"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/account_settings_port" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:id="@+id/name_port" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:orientation="horizontal" + android:weightSum="1"> - <EditText - android:id="@+id/port" - android:layout_width="match_parent" + <LinearLayout + android:layout_width="0dp" android:layout_height="match_parent" - android:inputType="number" - android:maxLength="5" - android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" /> + android:layout_weight="0.8" + android:orientation="vertical"> + + <android.support.design.widget.TextInputLayout + android:id="@+id/hostname_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:hint="@string/account_settings_hostname"> + + <EditText + android:id="@+id/hostname" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:inputType="textNoSuggestions" + android:textColor="?attr/color_text_primary" + android:textColorHint="?attr/color_text_secondary" + android:textSize="?attr/TextSizeBody" /> + </android.support.design.widget.TextInputLayout> + </LinearLayout> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="0.2" + android:orientation="vertical"> + + <android.support.design.widget.TextInputLayout + android:id="@+id/port_layout" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:hint="@string/account_settings_port"> + + <EditText + android:id="@+id/port" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:inputType="number" + android:maxLength="5" + android:textColor="?attr/color_text_primary" + android:textColorHint="?attr/color_text_secondary" + android:textSize="?attr/TextSizeBody" /> + </android.support.design.widget.TextInputLayout> + </LinearLayout> </LinearLayout> + + <CheckBox + android:id="@+id/account_register_new" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="@string/register_account" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> + + <TextView + android:id="@+id/account_confirm_password_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/account_settings_confirm_password" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:visibility="gone" /> + + <EditText + android:id="@+id/account_password_confirm" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:hint="@string/confirm_password" + android:inputType="textPassword" + android:textColor="@color/black87" + android:textColorHint="@color/black54" + android:textSize="?attr/TextSizeBody" + android:visibility="gone" /> </LinearLayout> + </RelativeLayout> - <CheckBox - android:id="@+id/account_register_new" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:text="@string/register_account" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <RelativeLayout + android:id="@+id/os_optimization" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:background="@drawable/infocard_border" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular" + android:visibility="gone"> <TextView - android:id="@+id/account_confirm_password_desc" + android:id="@+id/os_optimization_headline" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/account_settings_confirm_password" + android:text="@string/battery_optimizations_enabled" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:visibility="gone" /> + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold" /> - <EditText - android:id="@+id/account_password_confirm" - android:layout_width="match_parent" + <TextView + android:id="@+id/os_optimization_body" + android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_below="@+id/os_optimization_headline" + android:layout_marginBottom="8dp" android:layout_marginTop="8dp" - android:hint="@string/confirm_password" - android:inputType="textPassword" + android:text="@string/battery_optimizations_enabled_explained" android:textColor="@color/black87" - android:textColorHint="@color/black54" - android:textSize="?attr/TextSizeBody" - android:visibility="gone" /> - </LinearLayout> - </RelativeLayout> + android:textSize="?attr/TextSizeBody" /> - <RelativeLayout - android:id="@+id/os_optimization" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:visibility="gone"> - - <TextView - android:id="@+id/os_optimization_headline" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/battery_optimizations_enabled" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" /> - - <TextView - android:id="@+id/os_optimization_body" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_below="@+id/os_optimization_headline" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:text="@string/battery_optimizations_enabled_explained" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - - <Button - android:id="@+id/os_optimization_disable" - style="?android:attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" - android:layout_below="@+id/os_optimization_body" - android:layout_marginRight="-8dp" - android:text="@string/disable" - android:textColor="@color/accent" /> - </RelativeLayout> + <Button + android:id="@+id/os_optimization_disable" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_below="@+id/os_optimization_body" + android:layout_marginRight="-8dp" + android:text="@string/disable" + android:textColor="@color/accent" /> + </RelativeLayout> - <LinearLayout - android:id="@+id/stats" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:visibility="gone"> - - <TableLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:shrinkColumns="0" - android:stretchColumns="1"> + <LinearLayout + android:id="@+id/stats" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:background="@drawable/infocard_border" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular" + android:visibility="gone"> - <TableRow - android:layout_width="fill_parent" + <TableLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - tools:ignore="UselessParent"> + android:shrinkColumns="0" + android:stretchColumns="1"> - <TextView - android:layout_width="wrap_content" + <TableRow + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_session_established" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + tools:ignore="UselessParent"> - <TextView - android:id="@+id/session_est" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_session_established" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - </TableLayout> + <TextView + android:id="@+id/session_est" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TableLayout - android:id="@+id/server_info_more" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:shrinkColumns="0" - android:stretchColumns="1" - android:visibility="gone"> + </TableLayout> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TableLayout + android:id="@+id/server_info_more" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:shrinkColumns="0" + android:stretchColumns="1" + android:visibility="gone"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_pep" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_pep" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_pep" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_pep" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_blocking" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_blocking" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_blocking" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_blocking" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_stream_management" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_sm" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_stream_management" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_sm" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_roster_version" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_roster_version" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_roster_version" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_roster_version" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_carbon_messages" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_carbons" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_carbon_messages" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_carbons" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_mam" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_mam" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_mam" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_mam" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_csi" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_csi" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - tools:ignore="RtlHardcoded" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_csi" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:id="@+id/push_row" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_csi" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + tools:ignore="RtlHardcoded" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_push" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:id="@+id/push_row" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_push" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_push" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <TableRow - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/server_info_push" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> + </TableRow> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true" - android:text="@string/server_info_http_upload" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/server_info_http_upload" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_http_upload" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - </TableRow> - </TableLayout> + <TextView + android:id="@+id/server_info_http_upload" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" /> - <RelativeLayout - android:id="@+id/pgp_fingerprint_box" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="32dp"> + </TableRow> + </TableLayout> - <LinearLayout + <RelativeLayout + android:id="@+id/pgp_fingerprint_box" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/action_delete_pgp" - android:orientation="vertical"> - - <TextView - android:id="@+id/pgp_fingerprint" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="monospace" - android:textColor="@color/primary" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" /> + android:layout_height="match_parent" + android:layout_marginTop="32dp"> - <TextView - android:id="@+id/pgp_fingerprint_desc" + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/openpgp_key_id" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" /> - </LinearLayout> - - <ImageButton - android:id="@+id/action_delete_pgp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:alpha="1.0" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_remove" - android:visibility="visible" /> - </RelativeLayout> - - <RelativeLayout - android:id="@+id/otr_fingerprint_box" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="24dp"> + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/action_delete_pgp" + android:orientation="vertical"> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/action_copy_to_clipboard" - android:orientation="vertical"> + <TextView + android:id="@+id/pgp_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="monospace" + android:textColor="@color/primary" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace" /> - <TextView - android:id="@+id/otr_fingerprint" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fontFamily="monospace" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" /> + <TextView + android:id="@+id/pgp_fingerprint_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/openpgp_key_id" + android:textColor="@color/black54" + android:textSize="?attr/TextSizeInfo" /> + </LinearLayout> - <TextView - android:id="@+id/otr_fingerprint_desc" + <ImageButton + android:id="@+id/action_delete_pgp" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/otr_fingerprint" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" /> - - </LinearLayout> + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:alpha="1.0" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_remove" + android:visibility="visible" /> + </RelativeLayout> - <ImageButton - android:id="@+id/action_copy_to_clipboard" + <RelativeLayout + android:id="@+id/otr_fingerprint_box" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:background="?android:selectableItemBackground" - android:contentDescription="@string/copy_otr_clipboard_description" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_copy" - android:visibility="visible" /> - </RelativeLayout> - - <RelativeLayout - android:id="@+id/axolotl_fingerprint_box" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="24dp"> + android:layout_height="match_parent" + android:layout_marginTop="24dp"> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/axolotl_actions" - android:orientation="vertical"> - - <TextView - android:id="@+id/axolotl_fingerprint" + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:fontFamily="monospace" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" /> + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/action_copy_to_clipboard" + android:orientation="vertical"> - <TextView - android:id="@+id/own_fingerprint_desc" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/omemo_fingerprint" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" /> - </LinearLayout> + <TextView + android:id="@+id/otr_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="monospace" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace" /> - <LinearLayout - android:id="@+id/axolotl_actions" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:orientation="vertical"> + <TextView + android:id="@+id/otr_fingerprint_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/otr_fingerprint" + android:textColor="@color/black54" + android:textSize="?attr/TextSizeInfo" /> + + </LinearLayout> <ImageButton - android:id="@+id/action_copy_axolotl_to_clipboard" + android:id="@+id/action_copy_to_clipboard" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" - android:contentDescription="@string/copy_omemo_clipboard_description" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_otr_clipboard_description" android:padding="@dimen/image_button_padding" android:src="?attr/icon_copy" android:visibility="visible" /> + </RelativeLayout> - <ImageButton - android:id="@+id/action_regenerate_omemo_key" + <RelativeLayout + android:id="@+id/axolotl_fingerprint_box" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginTop="24dp"> + + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" - android:contentDescription="@string/regenerate_omemo_key" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_refresh" - android:visibility="gone" /> - </LinearLayout> - </RelativeLayout> - </LinearLayout> + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/axolotl_actions" + android:orientation="vertical"> - <LinearLayout - android:id="@+id/other_device_keys_card" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:visibility="gone"> - - <TextView - android:id="@+id/other_device_keys_title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/other_devices" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" /> + <TextView + android:id="@+id/axolotl_fingerprint" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="monospace" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace" /> + + <TextView + android:id="@+id/own_fingerprint_desc" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/omemo_fingerprint" + android:textColor="@color/black54" + android:textSize="?attr/TextSizeInfo" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/axolotl_actions" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:orientation="vertical"> + + <ImageButton + android:id="@+id/action_copy_axolotl_to_clipboard" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/copy_omemo_clipboard_description" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_copy" + android:visibility="visible" /> + + <ImageButton + android:id="@+id/action_regenerate_omemo_key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/regenerate_omemo_key" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_refresh" + android:visibility="gone" /> + </LinearLayout> + </RelativeLayout> + </LinearLayout> <LinearLayout - android:id="@+id/other_device_keys" + android:id="@+id/other_device_keys_card" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:divider="?android:dividerHorizontal" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:background="@drawable/infocard_border" android:orientation="vertical" - android:showDividers="middle"></LinearLayout> + android:padding="@dimen/card_padding_regular" + android:visibility="gone"> - <Button - android:id="@+id/clear_devices" - style="?android:attr/borderlessButtonStyle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:text="@string/clear_other_devices" - android:textColor="@color/accent" /> + <TextView + android:id="@+id/other_device_keys_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/other_devices" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeHeadline" + android:layout_margin="@dimen/list_padding" + android:textStyle="bold" /> + + <LinearLayout + android:id="@+id/other_device_keys" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:divider="?android:dividerHorizontal" + android:orientation="vertical" + android:showDividers="middle"></LinearLayout> + + <Button + android:id="@+id/clear_devices" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:text="@string/clear_other_devices" + android:textColor="@color/accent" /> + </LinearLayout> </LinearLayout> - </LinearLayout> - </ScrollView> + </ScrollView> - <LinearLayout - android:id="@+id/button_bar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" - android:layout_alignParentLeft="true" - android:layout_alignParentRight="true" - android:layout_alignParentStart="true"> - - <Button - android:id="@+id/cancel_button" - style="?android:attr/borderlessButtonStyle" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/cancel" - android:textColor="@color/black87" /> - - <View - android:layout_width="1dp" - android:layout_height="fill_parent" - android:layout_marginBottom="7dp" - android:layout_marginTop="7dp" - android:background="@color/black12" /> - - <Button - android:id="@+id/save_button" - style="?android:attr/borderlessButtonStyle" - android:layout_width="0dp" + <LinearLayout + android:id="@+id/button_bar" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="1" - android:enabled="false" - android:text="@string/save" - android:textColor="@color/black54" /> - </LinearLayout> + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + android:layout_alignParentLeft="true" + android:layout_alignParentRight="true" + android:layout_alignParentStart="true"> + + <Button + android:id="@+id/cancel_button" + style="?android:attr/borderlessButtonStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/cancel" + android:textColor="@color/black87" /> -</RelativeLayout>
\ No newline at end of file + <View + android:layout_width="1dp" + android:layout_height="fill_parent" + android:layout_marginBottom="7dp" + android:layout_marginTop="7dp" + android:background="@color/black12" /> + + <Button + android:id="@+id/save_button" + style="?android:attr/borderlessButtonStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:enabled="false" + android:text="@string/save" + android:textColor="@color/black54" /> + </LinearLayout> + </RelativeLayout> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/activity_fullscreen_message.xml b/src/main/res/layout/activity_fullscreen_message.xml index b97117c8b..bc6eeb850 100644 --- a/src/main/res/layout/activity_fullscreen_message.xml +++ b/src/main/res/layout/activity_fullscreen_message.xml @@ -5,11 +5,6 @@ android:orientation="vertical" android:background="@android:color/black"> - <include - android:id="@+id/toolbar" - layout="@layout/tool_bar"> - </include> - <com.github.chrisbanes.photoview.PhotoView android:id="@id/message_image_view" android:layout_width="match_parent" diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index ac49a28c3..35a779cf4 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -11,114 +11,104 @@ android:layout_height="wrap_content" android:orientation="vertical"> - <LinearLayout - android:layout_width="fill_parent" + <android.support.v7.widget.CardView + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding"> - - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/conference_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:text="@string/conference_subject" - android:textColor="@color/black87" - android:textIsSelectable="false" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:paddingBottom="5dp" - android:textAlignment="center" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" /> + android:orientation="vertical"> - <RelativeLayout - android:layout_width="fill_parent" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:id="@+id/muc_settings"> + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> - <TextView - android:id="@+id/muc_conference_type" + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/conference_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentLeft="true" - android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/change_conference_button" - android:text="@string/private_conference" + android:layout_alignParentTop="true" + android:layout_centerHorizontal="true" + android:layout_gravity="center_horizontal" + android:paddingBottom="5dp" + android:text="@string/conference_subject" + android:textAlignment="center" android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:textIsSelectable="false" + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold" /> - <ImageButton - android:id="@+id/change_conference_button" - style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:layout_gravity="center_horizontal" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_settings" /> - </RelativeLayout> + <RelativeLayout + android:id="@+id/muc_settings" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <RelativeLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + <TextView + android:id="@+id/muc_conference_type" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/change_conference_button" + android:text="@string/private_conference" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> - <TextView - android:id="@+id/notification_status_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/notify_on_all_messages" - android:layout_centerVertical="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:layout_alignParentLeft="true" - android:layout_toLeftOf="@+id/notification_status_button" /> + <ImageButton + android:id="@+id/change_conference_button" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:layout_gravity="center_horizontal" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_settings" /> + </RelativeLayout> - <ImageButton - android:id="@+id/notification_status_button" - style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="@drawable/ic_notifications_grey600_24dp" /> - </RelativeLayout> + <RelativeLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content"> - <TextView - android:id="@+id/details_account" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:layout_marginTop="32dp" - android:text="@string/using_account" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" - android:visibility="gone" /> + <TextView + android:id="@+id/notification_status_text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_centerVertical="true" + android:layout_toLeftOf="@+id/notification_status_button" + android:text="@string/notify_on_all_messages" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> - <TextView - android:id="@+id/muc_jabberid" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:text="@string/account_settings_example_jabber_id" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:textIsSelectable="true" - android:visibility="gone" /> - </LinearLayout> + <ImageButton + android:id="@+id/notification_status_button" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:layout_gravity="center_horizontal" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="@drawable/ic_notifications_grey600_24dp" /> + </RelativeLayout> - <LinearLayout + <TextView + android:id="@+id/muc_jabberid" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:text="@string/account_settings_example_jabber_id" + android:textIsSelectable="true" + android:visibility="gone" + android:textAppearance="@style/TextAppearance.AppCompat.Title" /> + </LinearLayout> + </android.support.v7.widget.CardView> + + <android.support.v7.widget.CardView android:id="@+id/muc_more_details" android:layout_width="fill_parent" android:layout_height="wrap_content" @@ -126,141 +116,149 @@ android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding"> - + android:orientation="vertical"> - <RelativeLayout - android:layout_width="fill_parent" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="32dp"> - - <com.makeramen.roundedimageview.RoundedImageView - android:id="@+id/your_photo" - android:layout_width="72dp" - android:layout_height="72dp" - android:layout_alignParentEnd="false" - android:layout_alignParentLeft="true" - android:padding="1dp" - android:src="@drawable/ic_profile" - app:riv_corner_radius="36dp" - app:riv_border_width="1dp" - app:riv_border_color="@color/grey500" - android:layout_alignParentRight="false" /> + android:orientation="vertical" + android:padding="@dimen/card_padding_list"> - <LinearLayout + <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_centerVertical="true" - android:layout_toRightOf="@+id/your_photo" - android:orientation="vertical" - android:paddingLeft="8dp"> + android:layout_marginBottom="32dp"> - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/muc_your_nick" - android:layout_width="wrap_content" + <com.makeramen.roundedimageview.RoundedImageView + android:id="@+id/your_photo" + android:layout_width="72dp" + android:layout_height="72dp" + android:layout_alignParentEnd="false" + android:layout_alignParentLeft="true" + android:layout_alignParentRight="false" + android:padding="1dp" + app:riv_border_color="@color/grey500" + app:riv_border_width="1dp" + app:riv_corner_radius="36dp" /> + + <LinearLayout + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" /> + android:layout_centerVertical="true" + android:layout_toRightOf="@+id/your_photo" + android:orientation="vertical" + android:paddingLeft="@dimen/avatar_item_distance"> - <TextView - android:id="@+id/muc_role" + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/muc_your_nick" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" /> + + <TextView + android:id="@+id/muc_role" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary" /> + </LinearLayout> + + <ImageButton + android:id="@+id/edit_nick_button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - </LinearLayout> + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_edit_dark" /> + </RelativeLayout> + + <LinearLayout + android:id="@+id/muc_members" + android:layout_width="fill_parent" + android:layout_height="0dp" + android:layout_weight="1" + android:divider="?android:dividerHorizontal" + android:orientation="vertical" + android:showDividers="middle"></LinearLayout> - <ImageButton - android:id="@+id/edit_nick_button" + <Button + android:id="@+id/invite" + style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - android:background="?android:selectableItemBackground" - android:padding="@dimen/image_button_padding" - android:src="?attr/icon_edit_dark" /> - </RelativeLayout> + android:layout_gravity="center_horizontal" + android:layout_marginTop="24dp" + android:text="@string/invite_contact" /> - <LinearLayout - android:id="@+id/muc_members" - android:layout_width="fill_parent" - android:layout_height="0dp" - android:layout_weight="1" - android:divider="?android:dividerHorizontal" - android:orientation="vertical" - android:showDividers="middle"> + <Button + android:id="@+id/destroy" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginTop="24dp" + android:text="@string/destroy_muc" /> </LinearLayout> + </android.support.v7.widget.CardView> - <Button - android:id="@+id/invite" - style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="24dp" - android:text="@string/invite_contact" /> - - <Button - android:id="@+id/destroy" - style="?android:attr/buttonStyleSmall" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="24dp" - android:text="@string/destroy_muc" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="fill_parent" + <android.support.v7.widget.CardView + android:id="@+id/muc_info_more" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:id="@+id/muc_info_more" - android:shrinkColumns="0" - android:stretchColumns="1" android:visibility="gone"> - <TableLayout + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:stretchColumns="1"> + android:orientation="vertical" + android:padding="@dimen/card_padding_list"> - <TableRow - android:layout_width="fill_parent" - android:layout_height="match_parent"> + <TableLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:stretchColumns="1"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/server_info_mam" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:singleLine="true" - android:ellipsize="end" /> + <TableRow + android:layout_width="fill_parent" + android:layout_height="match_parent"> - <TextView - android:id="@+id/muc_info_mam" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="right" - android:paddingLeft="4dp" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> - </TableRow> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:singleLine="true" + android:text="@string/server_info_mam" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> - </TableLayout> - </LinearLayout> + <TextView + android:id="@+id/muc_info_mam" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:paddingLeft="4dp" + android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> + </TableRow> + </TableLayout> + <TextView + android:id="@+id/details_account" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:layout_marginTop="32dp" + android:text="@string/using_account" + android:visibility="gone" + android:textAppearance="@style/TextAppearance.AppCompat.Caption" /> + </LinearLayout> + </android.support.v7.widget.CardView> </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/src/main/res/layout/activity_publish_profile_picture.xml b/src/main/res/layout/activity_publish_profile_picture.xml index 922d1f8f3..c6339604c 100644 --- a/src/main/res/layout/activity_publish_profile_picture.xml +++ b/src/main/res/layout/activity_publish_profile_picture.xml @@ -31,7 +31,7 @@ android:layout_marginTop="@dimen/activity_vertical_margin" android:layout_marginBottom="@dimen/activity_vertical_margin" android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding"> + android:padding="@dimen/card_padding_regular"> <LinearLayout android:id="@+id/account_image_wrapper" diff --git a/src/main/res/layout/activity_set_presence.xml b/src/main/res/layout/activity_set_presence.xml index 705bba333..1996e6fdf 100644 --- a/src/main/res/layout/activity_set_presence.xml +++ b/src/main/res/layout/activity_set_presence.xml @@ -1,76 +1,85 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@color/grey200" - android:id="@+id/scroll_view"> - - <LinearLayout +<layout xmlns:android="http://schemas.android.com/apk/res/android"> + <ScrollView + android:id="@+id/scroll_view" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_height="fill_parent" + android:background="?attr/color_background_secondary"> <LinearLayout - android:layout_width="match_parent" + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding" android:orientation="vertical"> - <android.support.text.emoji.widget.EmojiEditText + <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" - android:inputType="textMultiLine" - android:hint="@string/status_message" - android:id="@+id/presence_status_message" - android:textColor="@color/black87" - android:layout_marginBottom="8dp" - android:textSize="?attr/TextSizeBody" /> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> - <Spinner - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/presence_show" - android:layout_gravity="center_horizontal" /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> - <CheckBox - android:layout_marginTop="16dp" - android:layout_marginBottom="16dp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/all_accounts_on_this_device" - android:id="@+id/all_accounts" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:visibility="gone" /> + <android.support.text.emoji.widget.EmojiAppCompatEditText + android:id="@+id/presence_status_message" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:hint="@string/status_message" + android:inputType="textMultiLine" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody"/> + + <Spinner + android:id="@+id/presence_show" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal"/> + + <CheckBox + android:id="@+id/all_accounts" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:layout_marginTop="16dp" + android:text="@string/all_accounts_on_this_device" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody"/> - <Button - android:id="@+id/change_presence" - style="?android:attr/borderlessButtonStyle" - android:layout_width="wrap_content" + <Button + android:id="@+id/change_presence" + style="?android:attr/borderlessButtonStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right" + android:layout_marginBottom="-8dp" + android:layout_marginRight="-8dp" + android:text="@string/change_presence" + android:textColor="@color/accent"/> + </LinearLayout> + </android.support.v7.widget.CardView> + + <android.support.v7.widget.CardView + android:id="@+id/templates_card" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="right" - android:text="@string/change_presence" - android:textColor="@color/accent" /> - </LinearLayout> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> - <LinearLayout - android:id="@+id/templates" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:padding="@dimen/infocard_padding" - android:orientation="vertical" - android:divider="?android:dividerHorizontal" - android:showDividers="middle"> + <LinearLayout + android:id="@+id/templates" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"/> + </android.support.v7.widget.CardView> </LinearLayout> - </LinearLayout> -</ScrollView>
\ No newline at end of file + </ScrollView> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/activity_start_conversation.xml b/src/main/res/layout/activity_start_conversation.xml index 28e954b99..c95dc3678 100644 --- a/src/main/res/layout/activity_start_conversation.xml +++ b/src/main/res/layout/activity_start_conversation.xml @@ -1,8 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/start_conversation_view_pager" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/grey50"> - -</android.support.v4.view.ViewPager>
\ No newline at end of file +<layout xmlns:android="http://schemas.android.com/apk/res/android" > + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> + <android.support.v4.view.ViewPager + android:id="@+id/start_conversation_view_pager" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?attr/color_background_primary"/> + <android.support.design.widget.FloatingActionButton + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end|bottom" + android:src="?attr/icon_add_person" + android:layout_margin="16dp" /> + </FrameLayout> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/activity_trust_keys.xml b/src/main/res/layout/activity_trust_keys.xml index 2ebffb5be..4806f492e 100644 --- a/src/main/res/layout/activity_trust_keys.xml +++ b/src/main/res/layout/activity_trust_keys.xml @@ -1,129 +1,141 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/grey200"> +<layout xmlns:android="http://schemas.android.com/apk/res/android"> - <ScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_above="@+id/button_bar" - android:layout_alignParentTop="true"> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?attr/color_background_secondary"> - <LinearLayout - android:layout_width="match_parent" + <ScrollView + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:layout_above="@+id/button_bar" + android:layout_alignParentTop="true"> <LinearLayout - android:id="@+id/key_error_message_card" - android:layout_width="fill_parent" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:visibility="gone"> - - <TextView - android:id="@+id/key_error_message_title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" - android:text="@string/error_trustkeys_title" /> - - <TextView - android:id="@+id/key_error_message" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:padding="8dp" /> - - </LinearLayout> + android:orientation="vertical"> - <LinearLayout - android:id="@+id/own_keys_card" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding" - android:visibility="gone"> - - <TextView - android:id="@+id/own_keys_title" - android:layout_width="wrap_content" + <android.support.v7.widget.CardView + android:id="@+id/key_error_message_card" + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" /> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:visibility="gone"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> + + <TextView + android:id="@+id/key_error_message_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/error_trustkeys_title" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold"/> + + <TextView + android:id="@+id/key_error_message" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="8dp" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody"/> + </LinearLayout> + + </android.support.v7.widget.CardView> + + <android.support.v7.widget.CardView + android:id="@+id/own_keys_card" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin" + android:visibility="gone"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> + + <TextView + android:id="@+id/own_keys_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold"/> + + <LinearLayout + android:id="@+id/own_keys_details" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:divider="?android:dividerHorizontal" + android:orientation="vertical" + android:showDividers="middle"> + </LinearLayout> + </LinearLayout> + + </android.support.v7.widget.CardView> <LinearLayout - android:id="@+id/own_keys_details" + android:id="@+id/foreign_keys" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:divider="?android:dividerHorizontal" - android:showDividers="middle" - android:orientation="vertical"></LinearLayout> + android:orientation="vertical" + android:visibility="gone"> - </LinearLayout> - - <LinearLayout - android:id="@+id/foreign_keys" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:visibility="gone" - android:orientation="vertical"> + </LinearLayout> </LinearLayout> + </ScrollView> - </LinearLayout> - </ScrollView> - - <LinearLayout - android:id="@+id/button_bar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentStart="true" - android:layout_alignParentEnd="true" - android:layout_alignParentLeft="true" - android:layout_alignParentRight="true"> - - <Button - android:id="@+id/cancel_button" - style="?android:attr/borderlessButtonStyle" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/cancel" - android:textColor="@color/black87" /> - - <View - android:layout_width="1dp" - android:layout_height="fill_parent" - android:layout_marginBottom="7dp" - android:layout_marginTop="7dp" - android:background="@color/black12" /> - - <Button - android:id="@+id/save_button" - style="?android:attr/borderlessButtonStyle" - android:layout_width="0dp" + <LinearLayout + android:id="@+id/button_bar" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="1" - android:enabled="true" - android:textColor="@color/black54" - android:text="@string/done" /> - </LinearLayout> -</RelativeLayout> + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + android:layout_alignParentLeft="true" + android:layout_alignParentRight="true" + android:layout_alignParentStart="true"> + + <Button + android:id="@+id/cancel_button" + style="?android:attr/borderlessButtonStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/cancel" + android:textColor="?attr/color_text_primary"/> + + <View + android:layout_width="1dp" + android:layout_height="fill_parent" + android:layout_marginBottom="7dp" + android:layout_marginTop="7dp" + android:background="?attr/divider"/> + + <Button + android:id="@+id/save_button" + style="?android:attr/borderlessButtonStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:enabled="true" + android:text="@string/done" + android:textColor="?attr/color_text_secondary"/> + </LinearLayout> + </RelativeLayout> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/contact.xml b/src/main/res/layout/contact.xml index 2865f3edf..eea98181e 100644 --- a/src/main/res/layout/contact.xml +++ b/src/main/res/layout/contact.xml @@ -1,62 +1,61 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?android:attr/activatedBackgroundIndicator" - android:padding="8dp"> - - <com.makeramen.roundedimageview.RoundedImageView - android:id="@+id/contact_photo" - android:layout_width="56dp" - android:layout_height="56dp" - android:layout_alignParentLeft="true" - android:src="@drawable/ic_profile" - app:riv_border_width="1dp" - app:riv_border_color="@color/grey500" - app:riv_corner_radius="28dp" /> - - <LinearLayout - android:layout_width="wrap_content" +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <RelativeLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_centerVertical="true" - android:layout_toRightOf="@+id/contact_photo" - android:orientation="vertical" - android:paddingLeft="8dp"> + android:background="?android:attr/activatedBackgroundIndicator" + android:padding="@dimen/list_padding"> - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/contact_display_name" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" /> + <com.makeramen.roundedimageview.RoundedImageView + android:id="@+id/contact_photo" + android:layout_width="56dp" + android:layout_height="56dp" + android:layout_alignParentLeft="true" + app:riv_border_color="@color/grey500" + app:riv_border_width="1dp" + app:riv_corner_radius="28dp" /> - <TextView - android:id="@+id/contact_jid" + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:singleLine="true" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" /> + android:layout_centerVertical="true" + android:layout_toRightOf="@+id/contact_photo" + android:orientation="vertical" + android:paddingLeft="@dimen/avatar_item_distance"> - <com.wefika.flowlayout.FlowLayout - android:id="@+id/tags" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="-2dp" - android:orientation="horizontal"> - </com.wefika.flowlayout.FlowLayout> + <android.support.text.emoji.widget.EmojiTextView + android:id="@+id/contact_display_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" /> - <TextView - android:id="@+id/key" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" - android:fontFamily="monospace" - android:visibility="gone" /> - </LinearLayout> - -</RelativeLayout>
\ No newline at end of file + <TextView + android:id="@+id/contact_jid" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary" /> + + <com.wefika.flowlayout.FlowLayout + android:id="@+id/tags" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="-2dp" + android:orientation="horizontal"></com.wefika.flowlayout.FlowLayout> + + <TextView + android:id="@+id/key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="monospace" + android:textColor="@color/black87" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace" + android:visibility="gone" /> + </LinearLayout> + + </RelativeLayout> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/contact_key.xml b/src/main/res/layout/contact_key.xml index 0edd1aea3..0aa695ea8 100644 --- a/src/main/res/layout/contact_key.xml +++ b/src/main/res/layout/contact_key.xml @@ -1,91 +1,85 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:longClickable="true"> +<layout xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout - android:id="@+id/key_data" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" - android:paddingBottom="8dp" - android:paddingLeft="8dp" - android:paddingTop="8dp"> + android:padding="@dimen/list_padding"> - <TextView - android:id="@+id/key" + <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@color/black87" android:layout_alignParentLeft="true" + android:layout_centerVertical="true" android:layout_toLeftOf="@+id/action_container" - android:textSize="?attr/TextSizeBody" - android:typeface="monospace" - android:fontFamily="monospace" - android:longClickable="true" - android:clickable="true" /> + android:orientation="vertical"> - <TextView - android:id="@+id/key_type" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black54" - android:layout_alignParentLeft="true" - android:layout_below="@+id/key" - android:maxLines="1" - android:textSize="?attr/TextSizeInfo" - android:longClickable="true" - android:clickable="true" /> + <TextView + android:id="@+id/key" + android:layout_width="wrap_content" + android:layout_height="wrap_content" - <TextView - android:id="@+id/key_trust" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@+id/key" - android:visibility="gone" - android:textColor="@color/black54" - android:textSize="?attr/TextSizeInfo" - android:longClickable="true" /> + android:clickable="true" + android:fontFamily="monospace" + android:longClickable="true" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody" + android:typeface="monospace" /> + + <TextView + android:id="@+id/key_type" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:clickable="true" + android:longClickable="true" + android:maxLines="1" + android:textColor="?attr/color_text_secondary" + android:textSize="?attr/TextSizeInfo" /> + </LinearLayout> <LinearLayout android:id="@+id/action_container" - android:layout_width="96dp" - android:layout_marginRight="-32dp" - android:layout_height="wrap_content" - android:orientation="vertical" + android:layout_width="@dimen/key_action_width" + android:layout_height="48dp" android:layout_alignParentRight="true" - android:layout_centerVertical="true"> + android:layout_centerVertical="true" + android:gravity="center" + android:orientation="vertical"> <ImageButton - android:layout_gravity="center_horizontal" android:id="@+id/button_remove" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" + android:alpha="?attr/icon_alpha" + android:background="?attr/selectableItemBackgroundBorderless" android:padding="@dimen/image_button_padding" android:src="?attr/icon_remove" - android:layout_marginRight="16dp" + android:visibility="gone" /> + + <ImageButton + android:id="@+id/button_enable_device" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:alpha="?attr/icon_alpha" + android:background="?attr/selectableItemBackgroundBorderless" + android:padding="@dimen/image_button_padding" + android:src="?attr/icon_enable_undecided_device" android:visibility="gone" /> <ImageView - android:visibility="gone" android:id="@+id/verified_fingerprint" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginRight="16dp" - android:src="@drawable/ic_verified_fingerprint" /> + android:src="@drawable/ic_verified_fingerprint" + android:visibility="gone" /> - <de.pixart.messenger.ui.widget.Switch + <android.support.v7.widget.SwitchCompat android:id="@+id/tgl_trust" - android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - style="@style/MD" /> + android:visibility="gone" /> </LinearLayout> + </RelativeLayout> -</RelativeLayout>
\ No newline at end of file +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 74afeae16..fe5eec4a3 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -18,7 +18,7 @@ <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" - android:background="?android:selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:orientation="horizontal" android:padding="8dp"> diff --git a/src/main/res/layout/keys_card.xml b/src/main/res/layout/keys_card.xml index 89c47c904..70f2c12d9 100644 --- a/src/main/res/layout/keys_card.xml +++ b/src/main/res/layout/keys_card.xml @@ -1,38 +1,47 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout android:id="@+id/foreign_keys_card" - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/activity_vertical_margin" - android:layout_marginLeft="@dimen/activity_horizontal_margin" - android:layout_marginRight="@dimen/activity_horizontal_margin" - android:layout_marginTop="@dimen/activity_vertical_margin" - android:background="@drawable/infocard_border" - android:orientation="vertical" - android:padding="@dimen/infocard_padding"> +<layout xmlns:android="http://schemas.android.com/apk/res/android"> - <TextView - android:id="@+id/foreign_keys_title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" /> + <android.support.v7.widget.CardView + android:id="@+id/foreign_keys_card" - <LinearLayout - android:id="@+id/foreign_keys_details" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:divider="?android:dividerHorizontal" - android:orientation="vertical" - android:showDividers="middle"></LinearLayout> + android:layout_marginBottom="@dimen/activity_vertical_margin" + android:layout_marginLeft="@dimen/activity_horizontal_margin" + android:layout_marginRight="@dimen/activity_horizontal_margin" + android:layout_marginTop="@dimen/activity_vertical_margin"> - <TextView - android:layout_marginTop="8dp" - android:id="@+id/no_keys_to_accept" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@color/black87" - android:text="@string/no_keys_just_confirm" - android:textSize="?attr/TextSizeBody" /> -</LinearLayout>
\ No newline at end of file + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:padding="@dimen/card_padding_regular"> + + <TextView + android:id="@+id/foreign_keys_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeHeadline" + android:textStyle="bold"/> + + <LinearLayout + android:id="@+id/foreign_keys_details" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:divider="?android:dividerHorizontal" + android:orientation="vertical" + android:showDividers="middle"> + </LinearLayout> + + <TextView + android:id="@+id/no_keys_to_accept" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="@string/no_keys_just_confirm" + android:textColor="?attr/color_text_primary" + android:textSize="?attr/TextSizeBody"/> + </LinearLayout> + </android.support.v7.widget.CardView> +</layout>
\ No newline at end of file diff --git a/src/main/res/layout/message_content.xml b/src/main/res/layout/message_content.xml index 9bfa661e8..df6e8500d 100644 --- a/src/main/res/layout/message_content.xml +++ b/src/main/res/layout/message_content.xml @@ -48,7 +48,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> android:layout_height="wrap_content" android:layout_centerVertical="true" android:alpha="1.0" - android:background="?android:selectableItemBackground"/> + android:background="?attr/selectableItemBackgroundBorderless"/> <TextView android:id="@+id/runtime" diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml index 41be316a9..6c50f2bae 100644 --- a/src/main/res/layout/message_received.xml +++ b/src/main/res/layout/message_received.xml @@ -16,7 +16,6 @@ android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:scaleType="fitXY" - android:src="@drawable/ic_profile" app:riv_border_width="1dip" app:riv_border_color="@color/grey500" app:riv_corner_radius="24dp" /> diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml index 835830ea9..15a52a797 100644 --- a/src/main/res/layout/message_sent.xml +++ b/src/main/res/layout/message_sent.xml @@ -14,7 +14,6 @@ android:layout_width="48dp" android:layout_height="48dp" android:scaleType="fitXY" - android:src="@drawable/ic_profile" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" diff --git a/src/main/res/layout/message_status.xml b/src/main/res/layout/message_status.xml index afdf317d7..835e380a5 100644 --- a/src/main/res/layout/message_status.xml +++ b/src/main/res/layout/message_status.xml @@ -29,7 +29,6 @@ android:layout_marginRight="-1.5dp" android:padding="0dp" android:scaleType="fitXY" - android:src="@drawable/ic_profile" app:riv_border_width="1dp" app:riv_border_color="@color/grey500" app:riv_corner_radius="16dp"/> diff --git a/src/main/res/layout/presence_template.xml b/src/main/res/layout/presence_template.xml index 22ce44147..b305f18db 100644 --- a/src/main/res/layout/presence_template.xml +++ b/src/main/res/layout/presence_template.xml @@ -47,7 +47,7 @@ android:layout_centerVertical="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:background="?android:selectableItemBackground" + android:background="?attr/selectableItemBackgroundBorderless" android:padding="@dimen/image_button_padding" android:src="?attr/icon_remove" /> </RelativeLayout>
\ No newline at end of file diff --git a/src/main/res/layout/show_location_infowindow.xml b/src/main/res/layout/show_location_infowindow.xml deleted file mode 100644 index d7c208610..000000000 --- a/src/main/res/layout/show_location_infowindow.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <android.support.text.emoji.widget.EmojiTextView - android:id="@+id/title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="?attr/TextSizeBody" - android:textStyle="bold" /> - - <TextView - android:id="@+id/snippet" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="?attr/TextSizeInfo" /> - </LinearLayout> - -</LinearLayout>
\ No newline at end of file diff --git a/src/main/res/layout/tool_bar.xml b/src/main/res/layout/tool_bar.xml deleted file mode 100644 index 990a00e03..000000000 --- a/src/main/res/layout/tool_bar.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/primary" - android:elevation="2dp" - android:theme="@style/Base.ThemeOverlay.AppCompat.Dark" />
\ No newline at end of file diff --git a/src/main/res/menu/attachment_choices.xml b/src/main/res/menu/attachment_choices.xml deleted file mode 100644 index 1f5ef9c2c..000000000 --- a/src/main/res/menu/attachment_choices.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:id="@+id/attach_location" - android:title="@string/send_location" - android:icon="?attr/ic_attach_location"/> - - <item - android:id="@+id/attach_record_voice" - android:title="@string/attach_record_voice" - android:icon="?attr/ic_attach_record"/> - - <item - android:id="@+id/attach_take_picture" - android:title="@string/attach_take_from_camera" - android:icon="?attr/ic_attach_camera"/> - - <item - android:id="@+id/attach_choose_picture" - android:title="@string/attach_choose_picture" - android:icon="?attr/ic_attach_photo"/> - - <item - android:id="@+id/attach_choose_video" - android:title="@string/attach_choose_video" - android:icon="?attr/ic_attach_video"/> - - <item - android:id="@+id/attach_choose_file" - android:title="@string/choose_file" - android:icon="?attr/ic_attach_document"/> - -</menu>
\ No newline at end of file diff --git a/src/main/res/menu/change_presence.xml b/src/main/res/menu/change_presence.xml index 34af0a679..5417076b6 100644 --- a/src/main/res/menu/change_presence.xml +++ b/src/main/res/menu/change_presence.xml @@ -1,12 +1,13 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_account_details" android:title="@string/account_details" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_account_box_white_24dp" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_settings" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/choose_contact.xml b/src/main/res/menu/choose_contact.xml index 382e96017..b0f907ffd 100644 --- a/src/main/res/menu/choose_contact.xml +++ b/src/main/res/menu/choose_contact.xml @@ -1,24 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_search" - android:actionLayout="@layout/actionview_search" + app:actionLayout="@layout/actionview_search" android:icon="?attr/icon_search" - android:showAsAction="collapseActionView|always" + app:showAsAction="collapseActionView|always" android:title="@string/search" /> <item android:id="@+id/action_create_contact" android:icon="?attr/icon_add_person" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/create_contact" android:visible="false" /> <item android:id="@+id/action_block_jid" android:icon="?attr/icon_add_person" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/block_jabber_id" android:visible="false" /> </menu> diff --git a/src/main/res/menu/contact_details.xml b/src/main/res/menu/contact_details.xml index 29ef166e5..50243150b 100644 --- a/src/main/res/menu/contact_details.xml +++ b/src/main/res/menu/contact_details.xml @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_edit_contact" android:icon="?attr/icon_edit" android:orderInCategory="10" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/action_edit_contact" /> <item android:id="@+id/action_share" android:icon="?attr/icon_share" android:orderInCategory="15" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/share_uri_with"> <menu> <item @@ -30,14 +31,14 @@ <item android:id="@+id/action_block" android:orderInCategory="72" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_speaker_notes_off_white_24dp" android:title="@string/action_block_contact" /> <item android:id="@+id/action_unblock" android:orderInCategory="73" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_speaker_notes_white_24dp" android:title="@string/action_unblock_contact" /> diff --git a/src/main/res/menu/conversations.xml b/src/main/res/menu/conversations.xml index 992371fc7..9687e45ff 100644 --- a/src/main/res/menu/conversations.xml +++ b/src/main/res/menu/conversations.xml @@ -1,71 +1,116 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_add" android:icon="?attr/icon_new" android:orderInCategory="10" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/action_add" /> <item android:id="@+id/action_security" android:icon="?attr/icon_not_secure" android:orderInCategory="20" - android:showAsAction="always" - android:title="@string/action_secure" /> + app:showAsAction="always" + android:title="@string/action_secure" > + <menu> + <group android:checkableBehavior="single"> + <item + android:id="@+id/encryption_choice_none" + android:title="@string/encryption_choice_unencrypted" /> + <item + android:id="@+id/encryption_choice_axolotl" + android:title="@string/encryption_choice_omemo" /> + <item + android:id="@+id/encryption_choice_otr" + android:title="@string/encryption_choice_otr" /> + <item + android:id="@+id/encryption_choice_pgp" + android:title="@string/encryption_choice_pgp" /> + </group> + </menu> + </item> <item android:id="@+id/action_attach_file" android:icon="?attr/icon_new_attachment" android:orderInCategory="30" - android:showAsAction="always" - android:title="@string/attach_file" /> + app:showAsAction="always" + android:title="@string/attach_file" > + <menu> + + <item + android:id="@+id/attach_choose_file" + android:icon="?attr/ic_attach_document" + android:title="@string/choose_file" /> + + <item + android:id="@+id/attach_choose_picture" + android:icon="?attr/ic_attach_photo" + android:title="@string/attach_choose_picture" /> + + <item + android:id="@+id/attach_take_picture" + android:icon="?attr/ic_attach_camera" + android:title="@string/attach_take_from_camera" /> + <item + android:id="@+id/attach_record_voice" + android:icon="?attr/ic_attach_record" + android:title="@string/attach_record_voice" /> + + <item + android:id="@+id/attach_location" + android:icon="?attr/ic_attach_location" + android:title="@string/send_location" /> + </menu> + </item> <item android:id="@+id/action_invite" android:orderInCategory="45" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/invite_contact" /> <item android:id="@+id/action_clear_history" android:orderInCategory="50" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_clear_history" /> <item android:id="@+id/action_archive_chat" android:orderInCategory="60" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_end_conversation" /> <item android:id="@+id/action_archive_muc" android:orderInCategory="60" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_end_conversation_muc" /> <item android:id="@+id/action_accounts" android:orderInCategory="90" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/mgmt_account_edit" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_settings" /> <item android:id="@+id/action_invite_user" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/invite_user" /> <item android:id="@+id/action_create_issue" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/create_issue" /> <item android:id="@+id/action_check_updates" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_check_update" /> <item android:id="@+id/action_search_history" android:icon="?attr/icon_search" - android:showAsAction="ifRoom" + app:showAsAction="ifRoom" android:title="@string/search" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/editaccount.xml b/src/main/res/menu/editaccount.xml index 698c648ee..13e8db4a6 100644 --- a/src/main/res/menu/editaccount.xml +++ b/src/main/res/menu/editaccount.xml @@ -1,9 +1,10 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_share" android:title="@string/share_uri_with" android:icon="?attr/icon_share" - android:showAsAction="always"> + app:showAsAction="always"> <menu> <item android:id="@+id/action_share_uri" @@ -22,19 +23,19 @@ <item android:id="@+id/action_change_presence" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/change_presence" android:icon="@drawable/ic_new_releases_white_24dp" /> <item android:id="@+id/action_show_block_list" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_speaker_notes_off_white_24dp" android:title="@string/show_block_list" /> <item android:id="@+id/action_renew_certificate" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_renew_certificate" android:visible="false" /> @@ -42,28 +43,28 @@ android:id="@+id/action_server_info_show_more" android:checkable="true" android:checked="false" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/server_info_show_more" /> <item android:id="@+id/action_mam_prefs" android:icon="@drawable/ic_cloud_white_24dp" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/mam_prefs" /> <item android:id="@+id/action_show_password" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/show_password" /> <item android:id="@+id/action_change_password_on_server" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_vpn_key_white_24dp" android:title="@string/change_password" /> <item android:id="@+id/mgmt_account_reconnect" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/mgmt_account_reconnect" /> <item android:id="@+id/mgmt_account_announce_pgp" @@ -71,6 +72,6 @@ <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_settings" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/encryption_choices.xml b/src/main/res/menu/encryption_choices.xml deleted file mode 100644 index 89b6761ce..000000000 --- a/src/main/res/menu/encryption_choices.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - - <group android:checkableBehavior="single"> - <item - android:id="@+id/encryption_choice_none" - android:title="@string/encryption_choice_unencrypted" /> - <item - android:id="@+id/encryption_choice_axolotl" - android:title="@string/encryption_choice_omemo" /> - <item - android:id="@+id/encryption_choice_otr" - android:title="@string/encryption_choice_otr" /> - <item - android:id="@+id/encryption_choice_pgp" - android:title="@string/encryption_choice_pgp" /> - </group> - -</menu>
\ No newline at end of file diff --git a/src/main/res/menu/manageaccounts.xml b/src/main/res/menu/manageaccounts.xml index 38b82010b..044c715c5 100644 --- a/src/main/res/menu/manageaccounts.xml +++ b/src/main/res/menu/manageaccounts.xml @@ -1,21 +1,22 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_add_account" android:icon="?attr/icon_add_person" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/action_add_account" /> <item android:id="@+id/action_add_account_with_cert" - android:showAsAction="never" + app:showAsAction="never" android:icon="?attr/icon_add_person" android:title="@string/action_add_account_with_certificate" android:visible="true" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_settings" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/manageaccounts_context.xml b/src/main/res/menu/manageaccounts_context.xml index beca7b8ec..a49b770df 100644 --- a/src/main/res/menu/manageaccounts_context.xml +++ b/src/main/res/menu/manageaccounts_context.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/mgmt_account_change_presence" @@ -12,7 +13,7 @@ android:title="@string/mgmt_account_publish_pgp" /> <item android:id="@+id/mgmt_account_reconnect" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/mgmt_account_reconnect" /> <item android:id="@+id/mgmt_account_delete" diff --git a/src/main/res/menu/muc_details.xml b/src/main/res/menu/muc_details.xml index 585bd1def..910c986ec 100644 --- a/src/main/res/menu/muc_details.xml +++ b/src/main/res/menu/muc_details.xml @@ -1,16 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_edit_subject" android:icon="?attr/icon_edit" android:orderInCategory="10" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/action_edit_subject" /> <item android:id="@+id/action_share" android:icon="?attr/icon_share" - android:showAsAction="always" + app:showAsAction="always" android:orderInCategory="15" android:title="@string/share_uri_with" > <menu> @@ -29,19 +30,19 @@ <item android:id="@+id/action_save_as_bookmark" android:orderInCategory="80" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/save_as_bookmark" /> <item android:id="@+id/action_delete_bookmark" android:orderInCategory="80" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/delete_bookmark" /> <item android:id="@+id/action_advanced_mode" android:checkable="true" android:checked="false" android:orderInCategory="85" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/advanced_mode" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/publish_avatar.xml b/src/main/res/menu/publish_avatar.xml index 39478c0a4..72ceb2d17 100644 --- a/src/main/res/menu/publish_avatar.xml +++ b/src/main/res/menu/publish_avatar.xml @@ -1,8 +1,9 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_crop_image" - android:showAsAction="always" + app:showAsAction="always" android:icon="@drawable/ic_crop_white_24dp" android:title="@string/select_image_and_crop" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/select_multiple.xml b/src/main/res/menu/select_multiple.xml index efd6e4d0a..51f05e21a 100644 --- a/src/main/res/menu/select_multiple.xml +++ b/src/main/res/menu/select_multiple.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/selection_submit" android:title="@string/invite_contact" - android:showAsAction="always" /> + app:showAsAction="always" /> </menu> diff --git a/src/main/res/menu/share_with.xml b/src/main/res/menu/share_with.xml index ff87edc1a..5c57eedd8 100644 --- a/src/main/res/menu/share_with.xml +++ b/src/main/res/menu/share_with.xml @@ -1,11 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_add" android:icon="?attr/icon_new" android:orderInCategory="10" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/action_add" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/showlocation.xml b/src/main/res/menu/showlocation.xml index 3eb0647c9..c7049a5b0 100644 --- a/src/main/res/menu/showlocation.xml +++ b/src/main/res/menu/showlocation.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_navigate" - android:showAsAction="always" + app:showAsAction="always" android:title="@string/navigate" android:icon="@drawable/ic_navigation_white_24dp" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/start_conversation.xml b/src/main/res/menu/start_conversation.xml index ea7572b41..12cb941bb 100644 --- a/src/main/res/menu/start_conversation.xml +++ b/src/main/res/menu/start_conversation.xml @@ -1,53 +1,38 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_search" - android:actionLayout="@layout/actionview_search" android:icon="?attr/icon_search" - android:showAsAction="collapseActionView|always" - android:title="@string/search" /> + android:title="@string/search" + app:actionLayout="@layout/actionview_search" + app:showAsAction="collapseActionView|always" /> <item - android:id="@+id/action_create_contact" - android:icon="?attr/icon_add_person" - android:showAsAction="always" - android:title="@string/create_contact" /> - <item - android:id="@+id/action_conference" - android:icon="?attr/icon_add_group" - android:showAsAction="always" - android:title="@string/join_or_create_conference"> - <menu> - <item - android:id="@+id/action_join_conference" - android:title="@string/join_conference" /> - <item - android:id="@+id/action_create_conference" - android:title="@string/create_conference" /> - - </menu> - </item> + android:id="@+id/action_join_conference" + android:title="@string/join_conference" + app:showAsAction="never" /> <item android:id="@+id/action_scan_qr_code" - android:showAsAction="never" - android:title="@string/scan_qr_code" /> + android:title="@string/scan_qr_code" + app:showAsAction="never" /> <item android:id="@+id/action_hide_offline" android:checkable="true" android:checked="false" android:orderInCategory="85" - android:showAsAction="never" - android:title="@string/hide_offline" /> + android:title="@string/hide_offline" + app:showAsAction="never" /> <item android:id="@+id/action_accounts" android:orderInCategory="90" - android:showAsAction="never" - android:title="@string/mgmt_account_edit" /> + android:title="@string/mgmt_account_edit" + app:showAsAction="never" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" - android:title="@string/action_settings" /> + android:title="@string/action_settings" + app:showAsAction="never" /> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/trust_keys.xml b/src/main/res/menu/trust_keys.xml index 7c63bd7fe..e40295eea 100644 --- a/src/main/res/menu/trust_keys.xml +++ b/src/main/res/menu/trust_keys.xml @@ -1,9 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_scan_qr_code" android:title="@string/scan_qr_code" - android:showAsAction="always" + app:showAsAction="always" android:icon="?attr/icon_scan_qr_code"/> </menu>
\ No newline at end of file diff --git a/src/main/res/menu/verify_otr.xml b/src/main/res/menu/verify_otr.xml index 7dadffce8..b6dd79610 100644 --- a/src/main/res/menu/verify_otr.xml +++ b/src/main/res/menu/verify_otr.xml @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_show_qr_code" android:title="@string/show_qr_code" - android:showAsAction="never" /> + app:showAsAction="never" /> <item android:id="@+id/action_settings" android:orderInCategory="100" - android:showAsAction="never" + app:showAsAction="never" android:title="@string/action_settings" /> </menu>
\ No newline at end of file diff --git a/src/main/res/values-v21/dimens.xml b/src/main/res/values-v21/dimens.xml index 4a3d93d1b..a82d69bef 100644 --- a/src/main/res/values-v21/dimens.xml +++ b/src/main/res/values-v21/dimens.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <dimen name="elv_undo_bottom_offset">63dp</dimen> <!-- 48dp + 15dp --> - <dimen name="image_button_padding">12dp</dimen> + <!-- 48dp + 15dp --> </resources>
\ No newline at end of file diff --git a/src/main/res/values-v21/themes.xml b/src/main/res/values-v21/themes.xml deleted file mode 100644 index 0c0b3cefb..000000000 --- a/src/main/res/values-v21/themes.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <style name="ConversationsTheme" parent="@android:style/Theme.Material.Light.DarkActionBar"> - <item name="android:colorPrimary">@color/primary</item> - <item name="android:colorPrimaryDark">@color/primary_dark</item> - <item name="android:colorAccent">@color/accent</item> - <item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item> - - <item name="android:windowActionModeOverlay">true</item> - <item name="android:actionModeBackground">@color/accent</item> - - <item name="TextSizeInfo">12sp</item> - <item name="TextSizeBody">14sp</item> - <item name="IconSize">16sp</item> - <item name="TextSizeHeadline">18sp</item> - <item name="TextSeparation">5sp</item> - - <item name="color_text_primary">@color/black87</item> - <item name="color_text_secondary">@color/black54</item> - - <item name="dialog_horizontal_padding">24dp</item> - <item name="dialog_vertical_padding">16dp</item> - - <item name="icon_add_group">@drawable/ic_group_add_white_24dp</item> - <item name="icon_add_person">@drawable/ic_person_add_white_24dp</item> - <item name="icon_cancel">@drawable/ic_cancel_white_24dp</item> - <item name="icon_copy">@drawable/ic_content_copy_grey600_24dp</item> - <item name="icon_discard">@drawable/ic_delete_white_24dp</item> - <item name="icon_download">@drawable/ic_file_download_white_24dp</item> - <item name="icon_edit">@drawable/ic_edit_white_24dp</item> - <item name="icon_edit_dark">@drawable/ic_edit_grey600_24dp</item> - <item name="icon_done">@drawable/ic_done_black_24dp</item> - <item name="icon_quote">@drawable/ic_reply_white_24dp</item> - <item name="icon_group">@drawable/ic_group_white_24dp</item> - <item name="icon_new">@drawable/ic_contacts_white_24dp</item> - <item name="icon_refresh">@drawable/ic_refresh_grey600_24dp</item> - <item name="icon_new_attachment">@drawable/ic_attach_file_white_24dp</item> - <item name="icon_not_secure">@drawable/ic_lock_open_white_24dp</item> - <item name="icon_remove">@drawable/ic_delete_grey600_24dp</item> - <item name="icon_search">@drawable/ic_search_white_24dp</item> - <item name="icon_secure">@drawable/ic_lock_open_white_24dp</item> - <item name="icon_settings">@drawable/ic_settings_grey600_24dp</item> - <item name="icon_import_export">@drawable/ic_import_export_white_24dp</item> - <item name="icon_share">@drawable/ic_share_white_24dp</item> - <item name="icon_scan_qr_code">@drawable/ic_barcode_scan_white_24dp</item> - - <item name="ic_attach_camera">@drawable/ic_attach_camera</item> - <item name="ic_attach_document">@drawable/ic_attach_document</item> - <item name="ic_attach_location">@drawable/ic_attach_location</item> - <item name="ic_attach_photo">@drawable/ic_attach_photo</item> - <item name="ic_attach_video">@drawable/ic_attach_video</item> - <item name="ic_attach_record">@drawable/ic_attach_record</item> - - </style> - -</resources>
\ No newline at end of file diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 83598c041..f9bdae03a 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -7,6 +7,10 @@ <attr name="TextSeparation" format="dimension"/> <attr name="IconSize" format="dimension" /> + <attr name="color_background_secondary" format="reference|color" /> + <attr name="color_background_primary" format="reference|color" /> + <attr name="color_warning" format="reference|color"/> + <attr name="color_text_primary" format="reference|color" /> <attr name="color_text_secondary" format="reference|color" /> @@ -33,6 +37,7 @@ <attr name="icon_share" format="reference" /> <attr name="icon_import_export" format="reference" /> <attr name="icon_scan_qr_code" format="reference" /> + <attr name="icon_enable_undecided_device" format="reference" /> <attr name="icon_notifications" format="reference" /> <attr name="icon_notifications_off" format="reference" /> @@ -54,4 +59,6 @@ <attr name="ic_file_vcard" format="reference" /> <attr name="ic_file_calendar" format="reference" /> + <attr name="icon_alpha" format="float"/> + </resources>
\ No newline at end of file diff --git a/src/main/res/values/dimens.xml b/src/main/res/values/dimens.xml index cb103131a..933c7daea 100644 --- a/src/main/res/values/dimens.xml +++ b/src/main/res/values/dimens.xml @@ -2,8 +2,12 @@ <!-- Default screen margins, per the Android Design guidelines. --> <dimen name="activity_horizontal_margin">8dp</dimen> <dimen name="activity_vertical_margin">8dp</dimen> - <dimen name="infocard_padding">16dp</dimen> - <dimen name="image_button_padding">8dp</dimen> - <dimen name="elv_touch_slop">64dp</dimen> + <dimen name="card_padding_regular">16dp</dimen> + <dimen name="card_padding_list">8dp</dimen> <!-- card_padding_regular minus list_padding --> + <dimen name="list_padding">8dp</dimen> + <dimen name="image_button_padding">12dp</dimen> + <dimen name="key_action_width">48dp</dimen> <!-- icon width (24dp) + 2 * image button padding --> + <dimen name="fineprint_size">11sp</dimen> <dimen name="audio_player_width">224dp</dimen> + <dimen name="avatar_item_distance">16dp</dimen> </resources> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 16fe709ee..2d5d6fa20 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -428,8 +428,6 @@ <string name="no_application_found_to_display_location">No application found to display location</string> <string name="location">Location</string> <string name="received_location">Received location</string> - <string name="title_undo_swipe_out_conversation">Conversation closed</string> - <string name="title_undo_swipe_out_muc">Left group chat</string> <string name="pref_dont_trust_system_cas_title">Don’t trust system CAs</string> <string name="pref_dont_trust_system_cas_summary">All certificates must be manually approved</string> <string name="pref_remove_trusted_certificates_title">Remove certificates</string> @@ -460,7 +458,6 @@ <string name="download_failed_server_not_found">Download failed: Server not found</string> <string name="download_failed_file_not_found">Download failed: File not found</string> <string name="download_failed_could_not_connect">Download failed: Could not connect to host</string> - <string name="elv_undo">undo</string> <string name="download_failed_could_not_write_file">Download failed: Could not write file</string> <string name="pref_use_white_background">Use white background</string> <string name="pref_use_white_background_summary">Show sent messages as black text on a white background</string> @@ -763,4 +760,14 @@ <string name="huawei_protected_apps_summary">To keep receiving notifications, even when the screen is turned off, you need to add Pix-Art Messenger to the list of protected apps.</string> <string name="pref_enable_multi_accounts_title">Enable multiple accounts</string> <string name="pref_enable_multi_accounts_summary">You want to use multiple accounts, so you have to set a password for daily backups.</string> + <string name="mtm_accept_cert">Accept Unknown Certificate?</string> + <string name="mtm_trust_anchor">The server certificate is not signed by a known Certificate Authority.</string> + <string name="mtm_cert_expired">The server certificate is expired.</string> + <string name="mtm_accept_servername">Accept Mismatching Server Name?</string> + <string name="mtm_hostname_mismatch">Server could not authenticate as \"%s\". The certificate is only valid for:</string> + <string name="mtm_connect_anyway">Do you want to connect anyway?</string> + <string name="mtm_cert_details">Certificate details:</string> + <string name="mtm_notification">Certificate Verification</string> + <string name="once">Once</string> + <string name="theme">Theme</string> </resources> diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 5c0808d04..1b3798eca 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -1,17 +1,6 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="MD"> - <item name="animationVelocity">6</item> - <item name="insetBottom">16dp</item> - <item name="insetTop">16dp</item> - <item name="insetLeft">16dp</item> - <item name="insetRight">16dp</item> - <item name="measureFactor">1.4</item> - <item name="offDrawable">@drawable/switch_back_off</item> - <item name="onDrawable">@drawable/switch_back_on</item> - <item name="thumbDrawable">@drawable/switch_thumb</item> - <item name="thumb_margin">-17dp</item> - <item name="android:padding">16dp</item> + <style name="TextAppearance.Conversations.Body1.Secondary" parent="TextAppearance.AppCompat.Body1"> + <item name="android:textColor">?android:textColorSecondary</item> </style> - </resources>
\ No newline at end of file diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index a20b5c6c6..b70fe0bd7 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -1,19 +1,30 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <style name="ConversationsTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> - <item name="android:actionBarStyle">@style/ConversationsActionBar</item> - <item name="android:actionBarWidgetTheme">@style/ConversationsActionBarWidget</item> - <item name="android:actionBarTabStyle">@style/ConversationsActionBarTabs</item> + <style name="ConversationsTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primary_dark</item> + <item name="colorAccent">@color/accent</item> + + <item name="color_text_primary">@color/black87</item> + <item name="color_text_secondary">@color/black54</item> + + <item name="color_background_primary">@color/grey50</item> + <item name="color_background_secondary">@color/grey200</item> + + <item name="android:windowActionModeOverlay">true</item> + <item name="android:actionModeBackground">@color/accent</item> + <item name="android:homeAsUpIndicator">@drawable/ic_arrow_back_white_24dp</item> + <item name="TextSizeInfo">12sp</item> <item name="TextSizeBody">14sp</item> + <item name="TextSeparation">5sp</item> <item name="IconSize">16sp</item> <item name="TextSizeHeadline">18sp</item> - <item name="TextSeparation">5sp</item> - <item name="color_text_primary">@color/black87</item> - <item name="color_text_secondary">@color/black54</item> + <!--<item type="reference" name="infocard_border">@drawable/infocard_border</item>--> + <item name="divider">@color/black12</item> <item name="icon_add_group">@drawable/ic_group_add_white_24dp</item> <item name="icon_add_person">@drawable/ic_person_add_white_24dp</item> @@ -38,8 +49,10 @@ <item name="icon_import_export">@drawable/ic_import_export_white_24dp</item> <item name="icon_share">@drawable/ic_share_white_24dp</item> <item name="icon_scan_qr_code">@drawable/ic_barcode_scan_white_24dp</item> + <item type="reference" name="icon_enable_undecided_device">@drawable/ic_new_releases_black_24dp</item> <item name="dialog_horizontal_padding">16dp</item> <item name="dialog_vertical_padding">16dp</item> + <item type="float" name="icon_alpha">0.54</item> <item name="ic_attach_camera">@drawable/ic_attach_camera</item> <item name="ic_attach_document">@drawable/ic_attach_document</item> @@ -61,29 +74,15 @@ <item name="TextSizeHeadline">20sp</item> </style> - <style name="ConversationsActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse"> - <item name="android:background">@color/primary</item> - <item name="android:backgroundStacked">@color/primary_dark</item> - <item name="android:displayOptions">showHome|homeAsUp|showTitle</item> - <item name="android:icon">@android:color/transparent</item> - </style> - - <style name="ConversationsActionBarWidget" parent="android:Theme.Holo.Light"> - <item name="android:popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item> - <item name="android:dropDownListViewStyle"> - @android:style/Widget.Holo.Light.ListView.DropDown - </item> - </style> - - <style name="ConversationsActionBarTabs" parent="@android:style/Widget.Holo.ActionBar.TabView"> - <item name="android:background">@drawable/actionbar_tab_indicator</item> - </style> - - <style name="ConversationsDialog" parent="@android:style/Theme.Holo.Light.Dialog"> + <style name="ConversationsDialog" parent="Theme.AppCompat.Light.Dialog"> <item name="android:windowNoTitle">true</item> <item name="TextSizeInfo">12sp</item> <item name="TextSizeBody">14sp</item> <item name="TextSizeHeadline">18sp</item> </style> + <style name="ConversationsTheme.NoActionBar.FullScreen" parent="Theme.AppCompat.Light.NoActionBar"> + <item name="android:windowFullscreen">true</item> + </style> + </resources>
\ No newline at end of file diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 0343d1171..bfcffe012 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -65,6 +65,14 @@ android:key="quiet_hours" android:summary="@string/pref_quiet_hours_summary" android:title="@string/title_pref_quiet_hours"> + <intent + android:action="android.intent.action.VIEW" + android:targetClass="de.pixart.messenger.ui.SettingsActivity" + android:targetPackage="de.pixart.messenger"> + <extra + android:name="page" + android:value="quiet_hours" /> + </intent> <CheckBoxPreference android:defaultValue="@bool/enable_quiet_hours" android:key="enable_quiet_hours" @@ -247,6 +255,14 @@ android:icon="@drawable/ic_settings_black_24dp" android:key="expert" android:title="@string/pref_expert_options"> + <intent + android:action="android.intent.action.VIEW" + android:targetClass="de.pixart.messenger.ui.SettingsActivity" + android:targetPackage="de.pixart.messenger"> + <extra + android:name="page" + android:value="expert" /> + </intent> <PreferenceCategory android:title="@string/pref_general" android:key="general"> <ListPreference |