diff options
author | cyberta <cyberta@riseup.net> | 2022-11-30 15:45:54 +0000 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2022-11-30 15:45:54 +0000 |
commit | c0d1a28e5d737fbf24e13ade9fd6988a07ee2719 (patch) | |
tree | 14a07baeb8abfdb9f46a54559bd0e4730c3b4989 /app | |
parent | fe27b89218ac9bbbfaab302b5c9747c12af47afd (diff) | |
parent | da824fa125a5583d07e8ac2f6585459956d87ac1 (diff) |
Merge branch 'main_ui' into 'master'
Update UI for Bitmask
See merge request leap/bitmask_android!218
Diffstat (limited to 'app')
80 files changed, 2246 insertions, 150 deletions
diff --git a/app/build.gradle b/app/build.gradle index 1e17f01d..630aefc0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ android { //allow manual gateway selection buildConfigField 'boolean', 'allow_manual_gateway_selection', 'true' // grey out background in EipFragment (main screen) if VPN is not running - buildConfigField 'boolean', 'use_color_filter', 'true' + buildConfigField 'boolean', 'use_color_filter', 'false' // decide if we use obfsvpn or shapeshifter as obfs4 lib buildConfigField 'boolean', 'use_obfsvpn', 'true' // obfsvpn Debugging config fields to pin and configure a particular proxy diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/custom/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index a95a14ef..2588f436 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/custom/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -84,6 +84,8 @@ import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.FragmentManagerEnhanced; import se.leap.bitmaskclient.base.MainActivity; +import se.leap.bitmaskclient.base.fragments.DonationReminderDialog; +import se.leap.bitmaskclient.base.fragments.GatewaySelectionFragment; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.base.utils.PreferenceHelper; diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java b/app/src/custom/java/se/leap/bitmaskclient/base/views/MainButton.java index c5ac4544..c5ac4544 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/MainButton.java +++ b/app/src/custom/java/se/leap/bitmaskclient/base/views/MainButton.java diff --git a/app/src/custom/res/drawable/crow.xml b/app/src/custom/res/drawable/crow.xml new file mode 100644 index 00000000..3d3660b8 --- /dev/null +++ b/app/src/custom/res/drawable/crow.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:viewportWidth="137" + android:viewportHeight="192" + android:width="137dp" + android:height="192dp"> + <path + android:pathData="M69.8243 44.3636C69.8243 44.3636 66.935 38.7879 66.6942 38.0606C66.4534 37.3333 65.0088 29.3333 65.0088 29.3333L66.935 25.9394L71.2689 19.6364L77.2882 14.7879L78.7328 14.303L93.42 8.72727L94.8647 7.27273L93.42 4.84849L91.2531 3.63636L87.4007 2.66666L77.7698 1.69697H70.3058L65.2496 2.90909L60.6749 1.21212L54.8963 0.484846L46.4692 0.242421L42.1353 0L35.1529 2.66666L24.3181 15.2727L22.8735 20.1212L22.1511 24.4848L18.5395 32.4848L16.1318 40L14.9279 48V49.697L9.39016 58.1818L6.26011 64.4848V73.4545L7.2232 92.1212L8.90861 98.9091L12.2794 105.212L16.6134 109.333L18.5395 117.333L25.7627 133.576L34.4306 144L34.9121 144.485L38.0422 160.242L27.4482 179.636L24.0773 182.303L21.6696 184.242H17.3357L14.9279 185.455L12.0387 185.697L10.3533 187.394L6.74165 186.909L3.13006 186.667L0.481548 188.606L0 192L1.92619 189.818L5.05624 188.848L5.29701 192L10.3533 190.303L13.2425 190.061L18.2988 190.788C18.2988 190.788 22.6327 190.545 23.355 190.303C24.0773 190.303 28.8928 190.788 28.8928 190.788L32.2636 190.303L34.1898 191.03L36.5975 190.303L39.246 191.515L43.0984 191.03L43.58 188.364L43.3392 186.909L45.9877 187.879L48.1547 189.576L49.5993 191.515V189.091L47.9139 186.182C47.9139 186.182 46.71 184.485 45.9877 184.727C45.2654 184.727 42.3761 184.242 42.3761 184.242L40.4499 184.97L38.283 184L36.116 185.212L34.1898 184.485L33.2267 182.545L31.7821 182.061L33.2267 178.182L36.5975 173.333L41.1722 165.576L45.2654 160.727L46.71 158.788C46.71 158.788 48.6362 155.879 48.6362 155.152C48.6362 154.424 49.1178 146.182 49.1178 146.182L46.71 140.848L45.5061 136.485L67.6573 141.818H68.8612L87.8823 155.636L90.5308 159.03L91.4938 172.848L91.0123 176L89.5677 178.424L88.6046 179.879L87.8823 182.061L87.4007 183.515L83.7891 184.727L80.1775 184L78.0106 183.758L73.9174 184.242L72.232 185.939L71.5097 188.121L71.9912 190.303L72.7135 188.121L73.9174 186.667L75.1213 186.424V188.364L76.5659 189.333L79.696 187.879L81.1406 187.636L81.6221 189.818H86.1968L89.3269 188.848L91.9754 189.333L95.8278 189.818L97.0316 189.333L97.9947 188.364L99.6801 191.758V187.879L97.9947 183.515L95.587 182.061L96.0686 180.848L94.3831 177.455L94.6239 164.849L104.255 176.242L117.016 186.182C117.016 186.182 125.684 189.333 126.406 189.333C127.128 189.333 133.148 188.606 133.148 188.606L137 182.303L134.111 173.576L135.315 170.667L129.295 162.667L116.293 149.333L113.163 138.909L113.404 131.879L110.515 124.364L107.385 118.788L109.311 112.727L107.866 104L101.366 89.2121L103.773 88.7273L99.4394 81.9394L102.088 81.2121L97.5132 73.697L99.4394 72.7273L96.0686 66.9091L97.2724 66.1818L92.9385 62.5455L94.3831 61.8182L83.5483 54.0606L69.8243 44.3636Z" + android:fillColor="#000000" /> +</vector>
\ No newline at end of file diff --git a/app/src/custom/res/drawable/ravens1.xml b/app/src/custom/res/drawable/ravens1.xml new file mode 100644 index 00000000..d38b0c19 --- /dev/null +++ b/app/src/custom/res/drawable/ravens1.xml @@ -0,0 +1,16 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:viewportWidth="342" + android:viewportHeight="206" + android:width="342dp" + android:height="206dp"> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-224.2934" + android:translateY="11.72371"> + <path + android:pathData="M385.13834 197.43106c-0.72897 -1.36208 -0.61597 -2.15071 0.51401 -3.58724l1.0109 -1.28515 -2.7045 -3.53096c-1.67306 -2.18432 -3.16903 -3.64755 -3.92253 -3.83667 -0.78962 -0.19818 -1.46242 -0.8906 -1.91284 -1.96862 -0.78944 -1.88939 -0.68998 -1.87306 -7.21616 -1.18532 -3.17774 0.33487 -5.21281 0.85767 -7.44 1.9113 -3.28857 1.55574 -5.44061 1.80404 -6.78577 0.78292 -1.02537 -0.77836 -1.06491 -1.42761 -0.13401 -2.20019 0.38829 -0.32225 0.65829 -1.03611 0.6 -1.58634 -0.0805 -0.75951 0.24078 -1.07485 1.33401 -1.3095 0.792 -0.17 1.87322 -0.54195 2.40272 -0.82656 0.66764 -0.35886 1.7028 -0.37114 3.37723 -0.0401 3.1702 0.62683 7.16506 -0.46946 9.11061 -2.50018 0.98579 -1.02893 1.81957 -1.42897 2.97837 -1.42897 0.88512 0 2.4561 -0.432 3.49107 -0.96 1.03497 -0.528 2.21436 -0.96 2.62088 -0.96 0.40651 0 0.73912 -0.30839 0.73912 -0.68532 0 -0.54071 -0.53763 -0.62982 -2.54805 -0.42233 -3.2514 0.33557 -4.17195 -0.44353 -4.17195 -3.53092 0 -1.44319 -0.32154 -2.57878 -0.96 -3.39045 -0.528 -0.67124 -0.96 -1.49047 -0.96 -1.8205 0 -0.33004 -0.54 -0.95389 -1.2 -1.38634 -0.7646 -0.50098 -1.2 -1.23373 -1.2 -2.01949 0 -0.67827 -0.432 -1.78243 -0.96 -2.45367 -0.528 -0.67124 -0.96 -1.5865 -0.96 -2.03391 0 -0.44741 -1.15388 -2.09228 -2.56419 -3.65527 -2.97648 -3.29873 -3.67581 -4.47263 -3.67581 -6.17024 0 -1.04577 -0.21517 -1.23156 -1.42631 -1.23156 -0.78448 0 -2.67448 -0.56194 -4.2 -1.24877 -3.87341 -1.74389 -9.21645 -3.55123 -10.49851 -3.55123 -1.57962 0 -2.59518 -0.491 -2.59518 -1.2547 0 -0.53914 0.68803 -0.61839 3.48 -0.40086 3.2635 0.25428 3.40535 0.22572 2.28 -0.45912 -0.66 -0.40165 -2.226 -0.87399 -3.48 -1.04964 -2.96604 -0.41545 -2.93747 -1.15568 0.0446 -1.15568 1.92868 0 9.64234 2.10373 13.15539 3.58785 0.50332 0.21263 0.84 0.14513 0.84 -0.16841 0 -0.28779 -1.13158 -1.09668 -2.51463 -1.79753 -2.92533 -1.48238 -12.13912 -7.58751 -12.61637 -8.35971 -1.35099 -2.18595 3.01241 -0.0675 12.14639 5.89721 3.24247 2.1174 6.04388 3.70133 6.22536 3.51984 0.18149 -0.18148 -0.38708 -0.89116 -1.26349 -1.57704 -2.20209 -1.7234 -10.13726 -10.73208 -10.13726 -11.50869 0 -1.14242 0.85579 -0.66795 2.72266 1.5095 2.27855 2.65762 9.24491 8.66726 13.01433 11.22703 2.8929 1.96453 11.64578 6.78995 12.31636 6.78995 0.20542 0 0.23167 -0.756 0.0583 -1.68 -0.22647 -1.20719 -0.14019 -1.69436 0.30658 -1.73102 0.34197 -0.0281 1.03481 -0.0821 1.53965 -0.12 1.86068 -0.13982 1.16626 -1.06327 -1.60872 -2.13929 -1.56874 -0.6083 -3.78307 -1.85532 -4.92072 -2.77115 -1.13765 -0.91584 -3.09446 -2.43544 -4.34846 -3.37688 -4.34658 -3.2632 -1.75366 -4.17202 3.18156 -1.11514 2.26983 1.40594 3.91431 1.53202 1.97844 0.15169 -6.31808 -4.50497 -6.96 -5.05256 -6.96 -5.93721 0 -0.52855 0.11494 -0.961 0.25542 -0.961 0.78964 0 4.15067 1.74166 8.39825 4.35188 2.65524 1.63171 4.93892 2.85554 5.07483 2.71963 0.13591 -0.13592 -1.94842 -2.37661 -4.63184 -4.97931 -5.53891 -5.37229 -7.03228 -7.22857 -6.35791 -7.90295 0.56718 -0.56718 1.61175 0.22173 8.939 6.7512 3.12276 2.78275 5.93076 5.14466 6.24 5.24868 0.30924 0.10402 -1.50978 -1.95528 -4.04226 -4.57623 -4.62994 -4.79166 -7.54368 -8.5847 -7.00693 -9.12146 0.15897 -0.15897 2.25393 1.41143 4.65545 3.48976 4.14801 3.58979 5.79244 4.76276 5.09498 3.63424 -0.17306 -0.28001 -0.11466 -0.6327 0.12976 -0.78376 0.64416 -0.39811 17.86024 17.63295 19.07981 19.98301 1.60753 3.09765 1.75025 5.81492 0.61158 11.64343 -0.65753 3.36572 -0.90221 5.90827 -0.699 7.26344 0.29317 1.95498 0.42327 2.10307 2.08577 2.37409 0.9752 0.15898 2.42109 0.39924 3.21309 0.5339 5.1256 0.87155 13.65736 4.80211 12.94067 5.96174 -0.15253 0.24679 -1.93858 0.44985 -3.969 0.45124 -3.88293 0.003 -3.90932 0.0128 -8.39867 3.23101 -1.6107 1.15463 -3.37986 1.81494 -6.89008 2.5716 -4.81503 1.03793 -7.97908 2.51326 -12.88292 6.00704 -4.80978 3.42677 -4.95621 3.84823 -2.4 6.90782 2.66507 3.18989 2.14762 5.66217 -1.51355 7.23153 -2.68358 1.15032 -2.89394 1.15032 -3.50956 0.00003zm4.78311 -5.20219c0 -0.57904 -2.89719 -3.94937 -3.39495 -3.94937 -0.77051 0 -0.49203 0.68428 1.0299 2.53064 1.38291 1.67772 2.36505 2.26687 2.36505 1.41873z" + android:fillColor="#000000" /> + </group> + +</vector>
\ No newline at end of file diff --git a/app/src/custom/res/drawable/ravens2.xml b/app/src/custom/res/drawable/ravens2.xml new file mode 100644 index 00000000..0a3cbb7e --- /dev/null +++ b/app/src/custom/res/drawable/ravens2.xml @@ -0,0 +1,24 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:viewportWidth="342" + android:viewportHeight="206" + android:width="342dp" + android:height="206dp"> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-224.2934" + android:translateY="11.72371"> + <path + android:pathData="M385.13834 197.43106c-0.72897 -1.36208 -0.61597 -2.15071 0.51401 -3.58724l1.0109 -1.28515 -2.7045 -3.53096c-1.67306 -2.18432 -3.16903 -3.64755 -3.92253 -3.83667 -0.78962 -0.19818 -1.46242 -0.8906 -1.91284 -1.96862 -0.78944 -1.88939 -0.68998 -1.87306 -7.21616 -1.18532 -3.17774 0.33487 -5.21281 0.85767 -7.44 1.9113 -3.28857 1.55574 -5.44061 1.80404 -6.78577 0.78292 -1.02537 -0.77836 -1.06491 -1.42761 -0.13401 -2.20019 0.38829 -0.32225 0.65829 -1.03611 0.6 -1.58634 -0.0805 -0.75951 0.24078 -1.07485 1.33401 -1.3095 0.792 -0.17 1.87322 -0.54195 2.40272 -0.82656 0.66764 -0.35886 1.7028 -0.37114 3.37723 -0.0401 3.1702 0.62683 7.16506 -0.46946 9.11061 -2.50018 0.98579 -1.02893 1.81957 -1.42897 2.97837 -1.42897 0.88512 0 2.4561 -0.432 3.49107 -0.96 1.03497 -0.528 2.21436 -0.96 2.62088 -0.96 0.40651 0 0.73912 -0.30839 0.73912 -0.68532 0 -0.54071 -0.53763 -0.62982 -2.54805 -0.42233 -3.2514 0.33557 -4.17195 -0.44353 -4.17195 -3.53092 0 -1.44319 -0.32154 -2.57878 -0.96 -3.39045 -0.528 -0.67124 -0.96 -1.49047 -0.96 -1.8205 0 -0.33004 -0.54 -0.95389 -1.2 -1.38634 -0.7646 -0.50098 -1.2 -1.23373 -1.2 -2.01949 0 -0.67827 -0.432 -1.78243 -0.96 -2.45367 -0.528 -0.67124 -0.96 -1.5865 -0.96 -2.03391 0 -0.44741 -1.15388 -2.09228 -2.56419 -3.65527 -2.97648 -3.29873 -3.67581 -4.47263 -3.67581 -6.17024 0 -1.04577 -0.21517 -1.23156 -1.42631 -1.23156 -0.78448 0 -2.67448 -0.56194 -4.2 -1.24877 -3.87341 -1.74389 -9.21645 -3.55123 -10.49851 -3.55123 -1.57962 0 -2.59518 -0.491 -2.59518 -1.2547 0 -0.53914 0.68803 -0.61839 3.48 -0.40086 3.2635 0.25428 3.40535 0.22572 2.28 -0.45912 -0.66 -0.40165 -2.226 -0.87399 -3.48 -1.04964 -2.96604 -0.41545 -2.93747 -1.15568 0.0446 -1.15568 1.92868 0 9.64234 2.10373 13.15539 3.58785 0.50332 0.21263 0.84 0.14513 0.84 -0.16841 0 -0.28779 -1.13158 -1.09668 -2.51463 -1.79753 -2.92533 -1.48238 -12.13912 -7.58751 -12.61637 -8.35971 -1.35099 -2.18595 3.01241 -0.0675 12.14639 5.89721 3.24247 2.1174 6.04388 3.70133 6.22536 3.51984 0.18149 -0.18148 -0.38708 -0.89116 -1.26349 -1.57704 -2.20209 -1.7234 -10.13726 -10.73208 -10.13726 -11.50869 0 -1.14242 0.85579 -0.66795 2.72266 1.5095 2.27855 2.65762 9.24491 8.66726 13.01433 11.22703 2.8929 1.96453 11.64578 6.78995 12.31636 6.78995 0.20542 0 0.23167 -0.756 0.0583 -1.68 -0.22647 -1.20719 -0.14019 -1.69436 0.30658 -1.73102 0.34197 -0.0281 1.03481 -0.0821 1.53965 -0.12 1.86068 -0.13982 1.16626 -1.06327 -1.60872 -2.13929 -1.56874 -0.6083 -3.78307 -1.85532 -4.92072 -2.77115 -1.13765 -0.91584 -3.09446 -2.43544 -4.34846 -3.37688 -4.34658 -3.2632 -1.75366 -4.17202 3.18156 -1.11514 2.26983 1.40594 3.91431 1.53202 1.97844 0.15169 -6.31808 -4.50497 -6.96 -5.05256 -6.96 -5.93721 0 -0.52855 0.11494 -0.961 0.25542 -0.961 0.78964 0 4.15067 1.74166 8.39825 4.35188 2.65524 1.63171 4.93892 2.85554 5.07483 2.71963 0.13591 -0.13592 -1.94842 -2.37661 -4.63184 -4.97931 -5.53891 -5.37229 -7.03228 -7.22857 -6.35791 -7.90295 0.56718 -0.56718 1.61175 0.22173 8.939 6.7512 3.12276 2.78275 5.93076 5.14466 6.24 5.24868 0.30924 0.10402 -1.50978 -1.95528 -4.04226 -4.57623 -4.62994 -4.79166 -7.54368 -8.5847 -7.00693 -9.12146 0.15897 -0.15897 2.25393 1.41143 4.65545 3.48976 4.14801 3.58979 5.79244 4.76276 5.09498 3.63424 -0.17306 -0.28001 -0.11466 -0.6327 0.12976 -0.78376 0.64416 -0.39811 17.86024 17.63295 19.07981 19.98301 1.60753 3.09765 1.75025 5.81492 0.61158 11.64343 -0.65753 3.36572 -0.90221 5.90827 -0.699 7.26344 0.29317 1.95498 0.42327 2.10307 2.08577 2.37409 0.9752 0.15898 2.42109 0.39924 3.21309 0.5339 5.1256 0.87155 13.65736 4.80211 12.94067 5.96174 -0.15253 0.24679 -1.93858 0.44985 -3.969 0.45124 -3.88293 0.003 -3.90932 0.0128 -8.39867 3.23101 -1.6107 1.15463 -3.37986 1.81494 -6.89008 2.5716 -4.81503 1.03793 -7.97908 2.51326 -12.88292 6.00704 -4.80978 3.42677 -4.95621 3.84823 -2.4 6.90782 2.66507 3.18989 2.14762 5.66217 -1.51355 7.23153 -2.68358 1.15032 -2.89394 1.15032 -3.50956 0.00003zm4.78311 -5.20219c0 -0.57904 -2.89719 -3.94937 -3.39495 -3.94937 -0.77051 0 -0.49203 0.68428 1.0299 2.53064 1.38291 1.67772 2.36505 2.26687 2.36505 1.41873z" + android:fillColor="#000000" /> + </group> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-14.21506" + android:translateY="22.70211"> + <path + android:pathData="M242.17687 151.65225c-1.74028 -2.28162 -2.178 -4.03768 -2.178 -8.73776 0 -2.17974 -0.18432 -3.96317 -0.4096 -3.96317 -0.22529 0 -0.71129 2.81516 -1.08 6.25591 -0.36872 3.44074 -0.8864 6.28072 -1.1504 6.31105 -1.04841 0.12049 -2.28619 -3.10071 -2.57984 -6.71376l-0.30016 -3.6932 -1.07056 1.81145c-2.08936 3.5353 -3.47008 2.84679 -3.48209 -1.73638 -0.006 -2.37601 -0.1508 -2.84246 -0.94546 -3.05027 -0.61539 -0.16092 -1.21919 -1.09153 -1.75512 -2.70506 -0.44935 -1.35286 -1.32319 -2.85792 -1.94188 -3.34458 -0.78894 -0.62057 -1.12489 -1.37616 -1.12489 -2.53 0 -2.06355 -0.60376 -2.09129 -1.85358 -0.0852 -1.18439 1.90109 -2.71192 2.89912 -3.87313 2.53057 -0.64166 -0.20366 -1.0246 0.1062 -1.47495 1.19345 -0.7302 1.76286 -2.63143 3.35598 -4.00504 3.35598 -0.54848 0 -1.46581 0.58765 -2.03851 1.30588 -0.89827 1.12654 -1.14794 1.21735 -1.81803 0.66123 -0.42722 -0.35456 -0.77543 -1.32021 -0.7738 -2.14588 0.003 -1.54988 0.31834 -2.30174 2.59201 -6.18123 2.37785 -4.05724 0.51183 -2.41446 -2.48575 2.18836 -3.12365 4.79641 -4.09991 5.87182 -4.88819 5.38464 -1.17655 -0.72715 -0.0446 -4.77763 2.18334 -7.813 1.22554 -1.66965 0.0938 -1.27585 -1.72437 0.6 -2.65534 2.73963 -4.34104 1.74204 -2.45575 -1.4533 0.93339 -1.58198 0.94531 -1.72299 0.1698 -2.00903 -1.26447 -0.4664 -1.46738 -1.03369 -1.04291 -2.91573 0.30278 -1.34248 0.21909 -1.84412 -0.38085 -2.28281 -0.75536 -0.55233 -0.9059 -1.41732 -1.24948 -7.17913 -0.20592 -3.45317 -1.35998 -10.32002 -1.73441 -10.31993 -0.14652 0.00003 -3.1824 0.88931 -6.7464 1.97616 -3.564 1.08684 -6.8656 2.086 -7.33688 2.22033 -0.47128 0.13433 -2.09128 -0.15192 -3.6 -0.63611 -1.50872 -0.48419 -3.01312 -0.8259 -3.34312 -0.75935 -1.2262 0.24726 -0.53956 -1.304 1.32139 -2.98524 1.05676 -0.95472 2.08554 -1.73586 2.28617 -1.73586 0.20064 0 0.57802 -0.486 0.83862 -1.08 0.54254 -1.23661 2.67944 -1.701199 8.15382 -1.772749 5.57725 -0.0729 9.57243 -1.17346 13.90516 -3.83049 4.52997 -2.77799 15.85234 -6.751008 22.57484 -7.921507 2.65339 -0.462 7.19029 -0.754493 11.76 -0.758165 7.33879 -0.0059 7.50857 0.01795 12.48 1.754669 4.64388 1.622275 7.89361 3.607435 7.55725 4.616496 -0.0759 0.227717 -1.8631 0.454018 -3.97155 0.502891 -3.40039 0.07882 -4.27825 0.305799 -7.76936 2.008856 -2.16469 1.056 -3.93825 2.136 -3.94123 2.4 -0.003 0.264 0.9368 1.1895 2.0884 2.056649 1.1516 0.86716 2.32074 2.16316 2.59809 2.88 0.61481 1.58903 2.47015 14.53738 2.49976 17.44571 0.0373 3.66931 1.70932 11.11002 3.22173 14.33764 1.81937 3.88271 1.28959 4.93466 -1.08652 2.15745 -0.90229 -1.05459 -1.64863 -1.65817 -1.65854 -1.34126 -0.0271 0.86542 3.28286 9.82211 4.07847 11.03636 0.38106 0.58156 0.50275 1.17487 0.27043 1.31845 -0.59625 0.3685 -3.42187 -2.90311 -4.8461 -5.611 -0.65955 -1.254 -1.36566 -2.28 -1.56915 -2.28 -0.40909 0 -0.35407 0.31827 1.09899 6.35685 1.05557 4.3867 0.95137 5.67912 -0.36978 4.58646 -0.90254 -0.74644 -2.98958 -5.08951 -2.9962 -6.23498 -0.002 -0.44642 -0.2554 -0.96662 -0.56182 -1.156 -0.41664 -0.2575 -0.47655 0.88529 -0.23759 4.53167 0.18049 2.75413 0.13441 4.876 -0.1059 4.876 -0.23399 0 -1.00861 -0.76458 -1.72138 -1.69907z" + android:fillColor="#000000" /> + </group> +</vector>
\ No newline at end of file diff --git a/app/src/custom/res/drawable/ravens3.xml b/app/src/custom/res/drawable/ravens3.xml new file mode 100644 index 00000000..f97a3532 --- /dev/null +++ b/app/src/custom/res/drawable/ravens3.xml @@ -0,0 +1,33 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:viewportWidth="342" + android:viewportHeight="206" + android:width="342dp" + android:height="206dp"> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-224.2934" + android:translateY="11.72371"> + <path + android:pathData="M385.13834 197.43106c-0.72897 -1.36208 -0.61597 -2.15071 0.51401 -3.58724l1.0109 -1.28515 -2.7045 -3.53096c-1.67306 -2.18432 -3.16903 -3.64755 -3.92253 -3.83667 -0.78962 -0.19818 -1.46242 -0.8906 -1.91284 -1.96862 -0.78944 -1.88939 -0.68998 -1.87306 -7.21616 -1.18532 -3.17774 0.33487 -5.21281 0.85767 -7.44 1.9113 -3.28857 1.55574 -5.44061 1.80404 -6.78577 0.78292 -1.02537 -0.77836 -1.06491 -1.42761 -0.13401 -2.20019 0.38829 -0.32225 0.65829 -1.03611 0.6 -1.58634 -0.0805 -0.75951 0.24078 -1.07485 1.33401 -1.3095 0.792 -0.17 1.87322 -0.54195 2.40272 -0.82656 0.66764 -0.35886 1.7028 -0.37114 3.37723 -0.0401 3.1702 0.62683 7.16506 -0.46946 9.11061 -2.50018 0.98579 -1.02893 1.81957 -1.42897 2.97837 -1.42897 0.88512 0 2.4561 -0.432 3.49107 -0.96 1.03497 -0.528 2.21436 -0.96 2.62088 -0.96 0.40651 0 0.73912 -0.30839 0.73912 -0.68532 0 -0.54071 -0.53763 -0.62982 -2.54805 -0.42233 -3.2514 0.33557 -4.17195 -0.44353 -4.17195 -3.53092 0 -1.44319 -0.32154 -2.57878 -0.96 -3.39045 -0.528 -0.67124 -0.96 -1.49047 -0.96 -1.8205 0 -0.33004 -0.54 -0.95389 -1.2 -1.38634 -0.7646 -0.50098 -1.2 -1.23373 -1.2 -2.01949 0 -0.67827 -0.432 -1.78243 -0.96 -2.45367 -0.528 -0.67124 -0.96 -1.5865 -0.96 -2.03391 0 -0.44741 -1.15388 -2.09228 -2.56419 -3.65527 -2.97648 -3.29873 -3.67581 -4.47263 -3.67581 -6.17024 0 -1.04577 -0.21517 -1.23156 -1.42631 -1.23156 -0.78448 0 -2.67448 -0.56194 -4.2 -1.24877 -3.87341 -1.74389 -9.21645 -3.55123 -10.49851 -3.55123 -1.57962 0 -2.59518 -0.491 -2.59518 -1.2547 0 -0.53914 0.68803 -0.61839 3.48 -0.40086 3.2635 0.25428 3.40535 0.22572 2.28 -0.45912 -0.66 -0.40165 -2.226 -0.87399 -3.48 -1.04964 -2.96604 -0.41545 -2.93747 -1.15568 0.0446 -1.15568 1.92868 0 9.64234 2.10373 13.15539 3.58785 0.50332 0.21263 0.84 0.14513 0.84 -0.16841 0 -0.28779 -1.13158 -1.09668 -2.51463 -1.79753 -2.92533 -1.48238 -12.13912 -7.58751 -12.61637 -8.35971 -1.35099 -2.18595 3.01241 -0.0675 12.14639 5.89721 3.24247 2.1174 6.04388 3.70133 6.22536 3.51984 0.18149 -0.18148 -0.38708 -0.89116 -1.26349 -1.57704 -2.20209 -1.7234 -10.13726 -10.73208 -10.13726 -11.50869 0 -1.14242 0.85579 -0.66795 2.72266 1.5095 2.27855 2.65762 9.24491 8.66726 13.01433 11.22703 2.8929 1.96453 11.64578 6.78995 12.31636 6.78995 0.20542 0 0.23167 -0.756 0.0583 -1.68 -0.22647 -1.20719 -0.14019 -1.69436 0.30658 -1.73102 0.34197 -0.0281 1.03481 -0.0821 1.53965 -0.12 1.86068 -0.13982 1.16626 -1.06327 -1.60872 -2.13929 -1.56874 -0.6083 -3.78307 -1.85532 -4.92072 -2.77115 -1.13765 -0.91584 -3.09446 -2.43544 -4.34846 -3.37688 -4.34658 -3.2632 -1.75366 -4.17202 3.18156 -1.11514 2.26983 1.40594 3.91431 1.53202 1.97844 0.15169 -6.31808 -4.50497 -6.96 -5.05256 -6.96 -5.93721 0 -0.52855 0.11494 -0.961 0.25542 -0.961 0.78964 0 4.15067 1.74166 8.39825 4.35188 2.65524 1.63171 4.93892 2.85554 5.07483 2.71963 0.13591 -0.13592 -1.94842 -2.37661 -4.63184 -4.97931 -5.53891 -5.37229 -7.03228 -7.22857 -6.35791 -7.90295 0.56718 -0.56718 1.61175 0.22173 8.939 6.7512 3.12276 2.78275 5.93076 5.14466 6.24 5.24868 0.30924 0.10402 -1.50978 -1.95528 -4.04226 -4.57623 -4.62994 -4.79166 -7.54368 -8.5847 -7.00693 -9.12146 0.15897 -0.15897 2.25393 1.41143 4.65545 3.48976 4.14801 3.58979 5.79244 4.76276 5.09498 3.63424 -0.17306 -0.28001 -0.11466 -0.6327 0.12976 -0.78376 0.64416 -0.39811 17.86024 17.63295 19.07981 19.98301 1.60753 3.09765 1.75025 5.81492 0.61158 11.64343 -0.65753 3.36572 -0.90221 5.90827 -0.699 7.26344 0.29317 1.95498 0.42327 2.10307 2.08577 2.37409 0.9752 0.15898 2.42109 0.39924 3.21309 0.5339 5.1256 0.87155 13.65736 4.80211 12.94067 5.96174 -0.15253 0.24679 -1.93858 0.44985 -3.969 0.45124 -3.88293 0.003 -3.90932 0.0128 -8.39867 3.23101 -1.6107 1.15463 -3.37986 1.81494 -6.89008 2.5716 -4.81503 1.03793 -7.97908 2.51326 -12.88292 6.00704 -4.80978 3.42677 -4.95621 3.84823 -2.4 6.90782 2.66507 3.18989 2.14762 5.66217 -1.51355 7.23153 -2.68358 1.15032 -2.89394 1.15032 -3.50956 0.00003zm4.78311 -5.20219c0 -0.57904 -2.89719 -3.94937 -3.39495 -3.94937 -0.77051 0 -0.49203 0.68428 1.0299 2.53064 1.38291 1.67772 2.36505 2.26687 2.36505 1.41873z" + android:fillColor="#000000" /> + </group> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-77.92102" + android:translateY="-54.82651"> + <path + android:pathData="M447.80204 216.9559c-0.72269 -0.39213 -1.64623 -1.35548 -2.05233 -2.14078 -0.92258 -1.78409 -1.47725 -1.82526 -1.45263 -0.10784 0.0256 1.78611 -1.56103 1.9993 -3.05379 0.41034 -0.92579 -0.98546 -1.26967 -1.09461 -2.00395 -0.63604 -0.71993 0.4496 -1.15887 0.3521 -2.33731 -0.51916 -1.20317 -0.88954 -1.60809 -0.97455 -2.37139 -0.49787 -0.73689 0.4602 -1.14575 0.42723 -2.0501 -0.16532 -0.64725 -0.42409 -1.74409 -0.64998 -2.56857 -0.52897 -1.09407 0.16058 -1.71749 -0.0853 -2.60113 -1.02589 -0.6392 -0.6804 -1.5772 -1.23709 -2.08445 -1.23709 -0.50725 0 -1.49559 -0.32252 -2.19633 -0.71671 -0.70073 -0.39419 -1.81406 -0.93368 -2.47406 -1.19885 -0.66 -0.26518 -1.524 -0.66225 -1.92 -0.88239 -2.1004 -1.1676 -3.9862 -2.00205 -4.5245 -2.00205 -0.33369 0 -0.99766 -0.432 -1.4755 -0.96 -0.47783 -0.528 -1.16856 -0.96 -1.53495 -0.96 -0.77161 0 -6.74173 -3.13454 -7.86284 -4.12828 -0.89689 -0.79501 -2.53748 -0.86858 -3.83877 -0.17215 -0.51341 0.27477 -1.88229 2.38077 -3.04196 4.68 -1.15968 2.29924 -2.72649 4.76604 -3.4818 5.48179 -1.40184 1.32842 -5.12659 2.93173 -5.63342 2.4249 -0.1543 -0.15429 -1.70398 -0.32663 -3.44374 -0.38296 -2.32752 -0.0754 -3.51734 -0.36424 -4.50361 -1.09342 -0.81562 -0.60301 -1.73721 -0.88722 -2.35394 -0.72594 -1.35459 0.35423 -3.92189 -0.18553 -5.09262 -1.0707 -0.66178 -0.50036 -0.98915 -1.4008 -1.08522 -2.98487 -0.0757 -1.2476 -0.25951 -4.04558 -0.40856 -6.21772 -0.25931 -3.77896 -0.21836 -3.99814 0.94896 -5.07999 1.35121 -1.25225 4.13171 -1.97137 10.61247 -2.74472 5.3395 -0.63715 6.25903 -0.85126 8.52 -1.98381 1.76578 -0.8845 2.45969 -2.32213 1.12084 -2.32213 -0.37355 0 -1.5596 -1.134 -2.63568 -2.52 -2.13022 -2.74373 -2.50653 -3.16958 -3.62217 -4.09893 -0.40864 -0.3404 -0.74299 -1.12556 -0.74299 -1.74479 0 -0.67126 -0.48454 -1.44336 -1.2 -1.91214 -0.66 -0.43245 -1.2 -1.23621 -1.2 -1.78612 0 -0.54992 -0.54 -1.42462 -1.2 -1.94378 -0.66 -0.51916 -1.2 -1.34367 -1.2 -1.83225 0 -0.48859 -0.54 -1.53009 -1.2 -2.31445 -0.66 -0.78437 -1.2 -1.85934 -1.2 -2.38883 0 -0.52949 -0.756 -1.71871 -1.68 -2.64271 -0.924 -0.924 -1.68 -2.09595 -1.68 -2.60433 0 -0.50838 -0.55232 -1.44321 -1.22738 -2.07739 -0.81219 -0.76302 -1.14213 -1.47902 -0.97538 -2.11669 0.17148 -0.65575 -0.2374 -1.46856 -1.27973 -2.54398 -1.31288 -1.35454 -1.4494 -1.71218 -0.95549 -2.50306 0.48388 -0.77482 0.38564 -1.14926 -0.61288 -2.33593 -1.29697 -1.54136 -1.48117 -2.47059 -0.65374 -3.29802 0.39386 -0.39386 0.19307 -0.98422 -0.75958 -2.2332 -0.88414 -1.15917 -1.19604 -2.00954 -0.98311 -2.68042 0.2246 -0.70765 -0.16728 -1.56735 -1.40042 -3.07223 -2.52054 -3.076 -2.28628 -3.69399 0.92771 -2.44729 0.528 0.20481 -0.498 -1.15368 -2.28 -3.01887 -2.97172 -3.11045 -3.98593 -4.92459 -2.75312 -4.92459 0.26778 0 2.38692 1.48253 4.7092 3.29452 6.33422 4.94234 8.3162 5.80749 3.95158 1.7249 -4.36141 -4.07959 -8.0677 -9.81942 -6.34054 -9.81942 0.28116 0 2.49842 2.05416 4.92723 4.5648 2.42882 2.51065 4.49954 4.48131 4.60161 4.37925 0.10205 -0.10206 -0.98133 -1.73668 -2.40752 -3.63249 -1.42619 -1.89581 -2.85494 -4.32096 -3.17499 -5.38921 -0.32005 -1.06825 -0.69762 -2.24379 -0.83904 -2.61231 -0.72243 -1.88264 1.03187 -0.1508 4.3051 4.24996 2.01269 2.706 4.67913 5.892 5.92543 7.08l2.266 2.16 -1.79464 -2.4c-2.2233 -2.97326 -4.5686 -7.73418 -4.94128 -10.03072 -0.44513 -2.74301 0.50313 -2.04466 2.37988 1.75269 1.66581 3.37055 8.26211 12.81454 9.47338 13.56314 0.32795 0.20269 0.50635 0.17645 0.39644 -0.0583 -0.1099 -0.23474 -1.00191 -2.04072 -1.98227 -4.01327 -0.98034 -1.97255 -1.78245 -3.86255 -1.78245 -4.2 0 -1.51072 0.98617 -0.31134 2.75157 3.34646 2.25366 4.66945 5.11203 8.56401 10.59899 14.44126 4.9305 5.28122 8.54604 10.06515 10.94256 14.47874 6.17495 11.37222 8.31949 13.01948 14.29789 10.98244 2.27587 -0.77547 3.24479 -0.75419 9.27398 0.20364 2.25404 0.35809 4.45501 1.59731 4.45501 2.50832 0 0.19008 -0.60035 0.46567 -1.3341 0.61242 -0.73377 0.14675 -1.86777 0.78823 -2.52 1.42549 -1.81377 1.77213 -5.26658 5.9971 -5.26039 6.43677 0.006 0.39975 0.80419 0.80728 7.34031 3.74603 4.42236 1.98837 8.73868 4.82625 10.41418 6.84709 2.22226 2.68029 9.70388 8.73695 12.42297 10.05689 2.10404 1.02137 2.46767 1.34537 1.65388 1.47363 -0.57373 0.0904 -1.97773 -0.30571 -3.12 -0.88029l-2.07685 -1.04469 1.3513 1.43507c0.74321 0.78928 2.79521 2.15598 4.56 3.03711 2.62921 1.31274 3.00331 1.63456 2.07139 1.78197 -0.62552 0.099 -2.40778 -0.44981 -3.96059 -1.21945 -2.26132 -1.12081 -2.65597 -1.21281 -1.9827 -0.4622 0.46233 0.51543 1.9746 1.57936 3.3606 2.36428 1.386 0.78492 2.52 1.65077 2.52 1.92411 0 0.83627 -3.35317 0.0235 -5.34728 -1.29618 -2.37621 -1.5725 -2.35309 -0.95606 0.0673 1.79363 2.28368 2.59439 2.44317 3.37594 0.6 2.94004 -1.49775 -0.3542 -4.44 -2.40221 -4.44 -3.09054 0 -0.25057 -0.23446 -0.45558 -0.52103 -0.45558 -0.28658 0 0.0374 0.99921 0.72 2.22046 0.68257 1.22125 1.24103 2.40925 1.24103 2.64 0 0.63619 -1.52046 0.46767 -2.99396 -0.33184z" + android:fillColor="#000000" /> + </group> + <group + android:scaleX="0.8" + android:scaleY="0.8" + android:translateX="-14.21506" + android:translateY="22.70211"> + <path + android:pathData="M242.17687 151.65225c-1.74028 -2.28162 -2.178 -4.03768 -2.178 -8.73776 0 -2.17974 -0.18432 -3.96317 -0.4096 -3.96317 -0.22529 0 -0.71129 2.81516 -1.08 6.25591 -0.36872 3.44074 -0.8864 6.28072 -1.1504 6.31105 -1.04841 0.12049 -2.28619 -3.10071 -2.57984 -6.71376l-0.30016 -3.6932 -1.07056 1.81145c-2.08936 3.5353 -3.47008 2.84679 -3.48209 -1.73638 -0.006 -2.37601 -0.1508 -2.84246 -0.94546 -3.05027 -0.61539 -0.16092 -1.21919 -1.09153 -1.75512 -2.70506 -0.44935 -1.35286 -1.32319 -2.85792 -1.94188 -3.34458 -0.78894 -0.62057 -1.12489 -1.37616 -1.12489 -2.53 0 -2.06355 -0.60376 -2.09129 -1.85358 -0.0852 -1.18439 1.90109 -2.71192 2.89912 -3.87313 2.53057 -0.64166 -0.20366 -1.0246 0.1062 -1.47495 1.19345 -0.7302 1.76286 -2.63143 3.35598 -4.00504 3.35598 -0.54848 0 -1.46581 0.58765 -2.03851 1.30588 -0.89827 1.12654 -1.14794 1.21735 -1.81803 0.66123 -0.42722 -0.35456 -0.77543 -1.32021 -0.7738 -2.14588 0.003 -1.54988 0.31834 -2.30174 2.59201 -6.18123 2.37785 -4.05724 0.51183 -2.41446 -2.48575 2.18836 -3.12365 4.79641 -4.09991 5.87182 -4.88819 5.38464 -1.17655 -0.72715 -0.0446 -4.77763 2.18334 -7.813 1.22554 -1.66965 0.0938 -1.27585 -1.72437 0.6 -2.65534 2.73963 -4.34104 1.74204 -2.45575 -1.4533 0.93339 -1.58198 0.94531 -1.72299 0.1698 -2.00903 -1.26447 -0.4664 -1.46738 -1.03369 -1.04291 -2.91573 0.30278 -1.34248 0.21909 -1.84412 -0.38085 -2.28281 -0.75536 -0.55233 -0.9059 -1.41732 -1.24948 -7.17913 -0.20592 -3.45317 -1.35998 -10.32002 -1.73441 -10.31993 -0.14652 0.00003 -3.1824 0.88931 -6.7464 1.97616 -3.564 1.08684 -6.8656 2.086 -7.33688 2.22033 -0.47128 0.13433 -2.09128 -0.15192 -3.6 -0.63611 -1.50872 -0.48419 -3.01312 -0.8259 -3.34312 -0.75935 -1.2262 0.24726 -0.53956 -1.304 1.32139 -2.98524 1.05676 -0.95472 2.08554 -1.73586 2.28617 -1.73586 0.20064 0 0.57802 -0.486 0.83862 -1.08 0.54254 -1.23661 2.67944 -1.701199 8.15382 -1.772749 5.57725 -0.0729 9.57243 -1.17346 13.90516 -3.83049 4.52997 -2.77799 15.85234 -6.751008 22.57484 -7.921507 2.65339 -0.462 7.19029 -0.754493 11.76 -0.758165 7.33879 -0.0059 7.50857 0.01795 12.48 1.754669 4.64388 1.622275 7.89361 3.607435 7.55725 4.616496 -0.0759 0.227717 -1.8631 0.454018 -3.97155 0.502891 -3.40039 0.07882 -4.27825 0.305799 -7.76936 2.008856 -2.16469 1.056 -3.93825 2.136 -3.94123 2.4 -0.003 0.264 0.9368 1.1895 2.0884 2.056649 1.1516 0.86716 2.32074 2.16316 2.59809 2.88 0.61481 1.58903 2.47015 14.53738 2.49976 17.44571 0.0373 3.66931 1.70932 11.11002 3.22173 14.33764 1.81937 3.88271 1.28959 4.93466 -1.08652 2.15745 -0.90229 -1.05459 -1.64863 -1.65817 -1.65854 -1.34126 -0.0271 0.86542 3.28286 9.82211 4.07847 11.03636 0.38106 0.58156 0.50275 1.17487 0.27043 1.31845 -0.59625 0.3685 -3.42187 -2.90311 -4.8461 -5.611 -0.65955 -1.254 -1.36566 -2.28 -1.56915 -2.28 -0.40909 0 -0.35407 0.31827 1.09899 6.35685 1.05557 4.3867 0.95137 5.67912 -0.36978 4.58646 -0.90254 -0.74644 -2.98958 -5.08951 -2.9962 -6.23498 -0.002 -0.44642 -0.2554 -0.96662 -0.56182 -1.156 -0.41664 -0.2575 -0.47655 0.88529 -0.23759 4.53167 0.18049 2.75413 0.13441 4.876 -0.1059 4.876 -0.23399 0 -1.00861 -0.76458 -1.72138 -1.69907z" + android:fillColor="#000000" /> + </group> +</vector>
\ No newline at end of file diff --git a/app/src/main/res/layout-port/f_eip.xml b/app/src/custom/res/layout-port/f_eip.xml index cb99a700..cb99a700 100644 --- a/app/src/main/res/layout-port/f_eip.xml +++ b/app/src/custom/res/layout-port/f_eip.xml diff --git a/app/src/main/res/layout-xlarge-port/f_eip.xml b/app/src/custom/res/layout-xlarge-port/f_eip.xml index 10b7a7e3..10b7a7e3 100644 --- a/app/src/main/res/layout-xlarge-port/f_eip.xml +++ b/app/src/custom/res/layout-xlarge-port/f_eip.xml diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/custom/res/layout-xlarge/f_eip.xml index e6b28c67..e6b28c67 100644 --- a/app/src/main/res/layout-xlarge/f_eip.xml +++ b/app/src/custom/res/layout-xlarge/f_eip.xml diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/custom/res/layout/f_eip.xml index 9a823b65..9a823b65 100644 --- a/app/src/main/res/layout/f_eip.xml +++ b/app/src/custom/res/layout/f_eip.xml diff --git a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java index e2fa0783..28b981be 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java @@ -34,6 +34,7 @@ import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_LOG_IN; import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.base.utils.PreferenceHelper.storeProviderInPreferences; +import static se.leap.bitmaskclient.base.utils.ViewHelper.isBrightColor; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_INVALID_VPN_CERTIFICATE; import static se.leap.bitmaskclient.eip.EIP.EIPErrors.ERROR_VPN_PREPARE; import static se.leap.bitmaskclient.providersetup.ProviderAPI.ERRORID; @@ -47,12 +48,18 @@ import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.drawable.ColorDrawable; +import android.os.Build; import android.os.Bundle; import android.util.Log; +import android.view.Window; +import android.view.WindowManager; +import androidx.annotation.ColorRes; import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; @@ -74,6 +81,7 @@ import se.leap.bitmaskclient.base.fragments.SettingsFragment; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.models.ProviderObservable; import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.utils.ViewHelper; import se.leap.bitmaskclient.eip.EIP; import se.leap.bitmaskclient.eip.EipCommand; import se.leap.bitmaskclient.eip.EipSetupListener; @@ -82,7 +90,6 @@ import se.leap.bitmaskclient.providersetup.ProviderAPI; import se.leap.bitmaskclient.providersetup.activities.LoginActivity; import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; - public class MainActivity extends AppCompatActivity implements EipSetupListener, Observer { public final static String TAG = MainActivity.class.getSimpleName(); @@ -96,6 +103,8 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener, public final static String ACTION_SHOW_DIALOG_FRAGMENT = "action_show_dialog_fragment"; public final static String ACTION_SHOW_MOTD_FRAGMENT = "action_show_motd_fragment"; + private @ColorRes int actionBarTextColor = R.color.colorActionBarTitleFont; + /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ @@ -227,6 +236,41 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener, } } + public @ColorRes int getActionBarTitleColor() { + return actionBarTextColor; + } + + public void setDefaultActivityBarColor() { + setActivityBarColor(R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorActionBarTitleFont); + } + + public void setActivityBarColor(@ColorRes int primaryColor, @ColorRes int secondaryColor, @ColorRes int textColor) { + ActionBar bar = getSupportActionBar(); + if (bar == null) { + return; + } + int color = ContextCompat.getColor(this, secondaryColor); + bar.setBackgroundDrawable(new ColorDrawable(color)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + Window window = this.getWindow(); + window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + window.setStatusBarColor(ContextCompat.getColor(this, primaryColor)); + } + + if (bar.getTitle() == null) { + return; + } + + if (textColor == 0) { + actionBarTextColor = isBrightColor(color) ? R.color.actionbar_dark_color : R.color.actionbar_light_color; + } else { + actionBarTextColor = textColor; + } + + ViewHelper.setActionBarTextColor(bar, actionBarTextColor); + } + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java index cdfee7b2..fe36e00a 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java @@ -38,6 +38,9 @@ import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; import android.os.Handler; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -45,12 +48,15 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.ColorRes; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.appcompat.widget.ViewUtils; +import androidx.core.content.ContextCompat; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; @@ -64,6 +70,7 @@ import se.leap.bitmaskclient.base.FragmentManagerEnhanced; import se.leap.bitmaskclient.base.MainActivity; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.base.utils.ViewHelper; import se.leap.bitmaskclient.base.views.IconSwitchEntry; import se.leap.bitmaskclient.base.views.IconTextEntry; import se.leap.bitmaskclient.eip.EipStatus; @@ -443,6 +450,12 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.app_name); + Activity activity = getActivity(); + if (activity == null) { + return; + } + @ColorRes int titleColor = ((MainActivity) activity).getActionBarTitleColor(); + ViewHelper.setActionBarTextColor(actionBar, titleColor); } private ActionBar getActionBar() { diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java index 7410172f..8076f99e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ViewHelper.java @@ -1,11 +1,18 @@ package se.leap.bitmaskclient.base.utils; +import android.app.Notification; import android.content.Context; +import android.graphics.Color; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; +import androidx.annotation.ColorRes; import androidx.annotation.DimenRes; import androidx.annotation.StringRes; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; /** @@ -33,4 +40,34 @@ public class ViewHelper { } } + public static boolean isBrightColor(int color) { + if (android.R.color.transparent == color) + return true; + + boolean rtnValue = false; + + int[] rgb = { Color.red(color), Color.green(color), Color.blue(color) }; + + int brightness = (int) Math.sqrt(rgb[0] * rgb[0] * .241 + rgb[1] + * rgb[1] * .691 + rgb[2] * rgb[2] * .068); + + // color is light + if (brightness >= 200) { + rtnValue = true; + } + + return rtnValue; + } + + public static void setActionBarTextColor(ActionBar bar, @ColorRes int titleColor) { + CharSequence titleCharSequence = bar.getTitle(); + if (titleCharSequence == null) { + return; + } + String title = titleCharSequence.toString(); + Spannable spannableTitle = new SpannableString(title); + spannableTitle.setSpan(new ForegroundColorSpan(ContextCompat.getColor(bar.getThemedContext(), titleColor)), 0, spannableTitle.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + bar.setTitle(spannableTitle); + } + } diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java index b2182d61..7ad044bd 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationButton.java @@ -3,15 +3,16 @@ package se.leap.bitmaskclient.base.views; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; -import android.view.View; import android.widget.RelativeLayout; +import androidx.annotation.ColorRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatTextView; +import androidx.core.content.ContextCompat; -import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.databinding.VLocationButtonBinding; import se.leap.bitmaskclient.eip.GatewaysManager; public class LocationButton extends RelativeLayout { @@ -31,13 +32,16 @@ public class LocationButton extends RelativeLayout { } private void initLayout(Context context) { - LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View rootview = inflater.inflate(R.layout.v_location_button, this, true); - locationIndicator = rootview.findViewById(R.id.load_indicator); - textView = rootview.findViewById(R.id.text_location); - bridgeView = rootview.findViewById(R.id.bridge_icn); - recommendedView = rootview.findViewById(R.id.recommended_icn); + VLocationButtonBinding binding = VLocationButtonBinding.inflate(LayoutInflater.from(context), this, true); + locationIndicator = binding.loadIndicator; + textView = binding.textLocation; + bridgeView = binding.bridgeIcn; + recommendedView = binding.recommendedIcn; + + } + + public void setTextColor(@ColorRes int color) { + textView.setTextColor(ContextCompat.getColor(getContext(), color)); } public void setLocationLoad(GatewaysManager.Load load) { diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/VpnStateImage.java b/app/src/main/java/se/leap/bitmaskclient/base/views/VpnStateImage.java deleted file mode 100644 index 2f8a4448..00000000 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/VpnStateImage.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2018 LEAP Encryption Access Project and contributers - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package se.leap.bitmaskclient.base.views; - -import android.content.Context; -import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.appcompat.widget.AppCompatImageView; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.view.animation.AlphaAnimation; -import android.view.animation.Animation; -import android.widget.ProgressBar; - -import se.leap.bitmaskclient.R; - -/** - * Created by cyberta on 12.02.18. - */ - - -public class VpnStateImage extends ConstraintLayout { - - ProgressBar progressBar; - AppCompatImageView stateIcon; - - public VpnStateImage(Context context) { - super(context); - initLayout(context); - } - - public VpnStateImage(Context context, AttributeSet attrs) { - super(context, attrs); - initLayout(context); - } - - public VpnStateImage(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initLayout(context); - } - - void initLayout(Context context) { - LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View rootview = inflater.inflate(R.layout.v_main_button, this, true); - stateIcon = rootview.findViewById(R.id.vpn_state_key); - progressBar = rootview.findViewById(R.id.progressBar); - progressBar.setIndeterminate(true); - } - - public void showProgress() { - progressBar.setVisibility(VISIBLE); - } - - - public void stopProgress(boolean animated) { - if (!animated) { - progressBar.setVisibility(GONE); - return; - } - - AlphaAnimation fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f); - fadeOutAnimation.setDuration(1000); - fadeOutAnimation.setAnimationListener(new Animation.AnimationListener() { - @Override - public void onAnimationStart(Animation animation) {} - - @Override - public void onAnimationEnd(Animation animation) { - progressBar.setVisibility(GONE); - } - - @Override - public void onAnimationRepeat(Animation animation) {} - }); - - progressBar.startAnimation(fadeOutAnimation); - } - - public void setStateIcon(int resource) { - stateIcon.setImageResource(resource); - } - - -} diff --git a/app/src/main/res/drawable-hdpi/bg_connected.png b/app/src/main/res/drawable-hdpi/bg_connected.png Binary files differnew file mode 100644 index 00000000..0e98f705 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/bg_connected.png diff --git a/app/src/main/res/drawable-hdpi/bg_connecting.png b/app/src/main/res/drawable-hdpi/bg_connecting.png Binary files differnew file mode 100644 index 00000000..24632712 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/bg_connecting.png diff --git a/app/src/main/res/drawable-hdpi/bg_disconnected.png b/app/src/main/res/drawable-hdpi/bg_disconnected.png Binary files differnew file mode 100644 index 00000000..de96be57 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/bg_disconnected.png diff --git a/app/src/main/res/drawable-hdpi/green_mask.png b/app/src/main/res/drawable-hdpi/green_mask.png Binary files differnew file mode 100644 index 00000000..fccc060a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/green_mask.png diff --git a/app/src/main/res/drawable-hdpi/ic_btn_cancel.png b/app/src/main/res/drawable-hdpi/ic_btn_cancel.png Binary files differnew file mode 100644 index 00000000..00feedcd --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_btn_cancel.png diff --git a/app/src/main/res/drawable-hdpi/ic_btn_on.png b/app/src/main/res/drawable-hdpi/ic_btn_on.png Binary files differnew file mode 100644 index 00000000..2b37d25e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_btn_on.png diff --git a/app/src/main/res/drawable-hdpi/red_mask.png b/app/src/main/res/drawable-hdpi/red_mask.png Binary files differnew file mode 100644 index 00000000..d2ef7d99 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/red_mask.png diff --git a/app/src/main/res/drawable-hdpi/yellow_mask.png b/app/src/main/res/drawable-hdpi/yellow_mask.png Binary files differnew file mode 100644 index 00000000..72e3ae45 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/yellow_mask.png diff --git a/app/src/main/res/drawable-xhdpi/bg_connected.png b/app/src/main/res/drawable-xhdpi/bg_connected.png Binary files differnew file mode 100644 index 00000000..915dff95 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/bg_connected.png diff --git a/app/src/main/res/drawable-xhdpi/bg_connecting.png b/app/src/main/res/drawable-xhdpi/bg_connecting.png Binary files differnew file mode 100644 index 00000000..be4469df --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/bg_connecting.png diff --git a/app/src/main/res/drawable-xhdpi/bg_disconnected.png b/app/src/main/res/drawable-xhdpi/bg_disconnected.png Binary files differnew file mode 100644 index 00000000..433c776f --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/bg_disconnected.png diff --git a/app/src/main/res/drawable-xhdpi/green_mask.png b/app/src/main/res/drawable-xhdpi/green_mask.png Binary files differnew file mode 100644 index 00000000..c852459d --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/green_mask.png diff --git a/app/src/main/res/drawable-xhdpi/ic_btn_cancel.png b/app/src/main/res/drawable-xhdpi/ic_btn_cancel.png Binary files differnew file mode 100644 index 00000000..d623f8f5 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_btn_cancel.png diff --git a/app/src/main/res/drawable-xhdpi/ic_btn_on.png b/app/src/main/res/drawable-xhdpi/ic_btn_on.png Binary files differnew file mode 100644 index 00000000..4fdc9464 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_btn_on.png diff --git a/app/src/main/res/drawable-xhdpi/red_mask.png b/app/src/main/res/drawable-xhdpi/red_mask.png Binary files differnew file mode 100644 index 00000000..c0d57a03 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/red_mask.png diff --git a/app/src/main/res/drawable-xhdpi/yellow_mask.png b/app/src/main/res/drawable-xhdpi/yellow_mask.png Binary files differnew file mode 100644 index 00000000..d81190fe --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/yellow_mask.png diff --git a/app/src/main/res/drawable-xxhdpi/bg_connected.png b/app/src/main/res/drawable-xxhdpi/bg_connected.png Binary files differnew file mode 100644 index 00000000..cd78d865 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/bg_connected.png diff --git a/app/src/main/res/drawable-xxhdpi/bg_connecting.png b/app/src/main/res/drawable-xxhdpi/bg_connecting.png Binary files differnew file mode 100644 index 00000000..718e102f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/bg_connecting.png diff --git a/app/src/main/res/drawable-xxhdpi/bg_disconnected.png b/app/src/main/res/drawable-xxhdpi/bg_disconnected.png Binary files differnew file mode 100644 index 00000000..ffbcdb79 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/bg_disconnected.png diff --git a/app/src/main/res/drawable-xxhdpi/green_mask.png b/app/src/main/res/drawable-xxhdpi/green_mask.png Binary files differnew file mode 100644 index 00000000..32286177 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/green_mask.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_btn_cancel.png b/app/src/main/res/drawable-xxhdpi/ic_btn_cancel.png Binary files differnew file mode 100644 index 00000000..af604d9b --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_btn_cancel.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_btn_on.png b/app/src/main/res/drawable-xxhdpi/ic_btn_on.png Binary files differnew file mode 100644 index 00000000..d6cfc10b --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_btn_on.png diff --git a/app/src/main/res/drawable-xxhdpi/red_mask.png b/app/src/main/res/drawable-xxhdpi/red_mask.png Binary files differnew file mode 100644 index 00000000..ac560317 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/red_mask.png diff --git a/app/src/main/res/drawable-xxhdpi/yellow_mask.png b/app/src/main/res/drawable-xxhdpi/yellow_mask.png Binary files differnew file mode 100644 index 00000000..75cf3782 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/yellow_mask.png diff --git a/app/src/main/res/drawable-xxxhdpi/bg_connected.png b/app/src/main/res/drawable-xxxhdpi/bg_connected.png Binary files differnew file mode 100644 index 00000000..3c9d97b4 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/bg_connected.png diff --git a/app/src/main/res/drawable-xxxhdpi/bg_connecting.png b/app/src/main/res/drawable-xxxhdpi/bg_connecting.png Binary files differnew file mode 100644 index 00000000..bff2004c --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/bg_connecting.png diff --git a/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png b/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png Binary files differnew file mode 100644 index 00000000..2503f135 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/bg_disconnected.png diff --git a/app/src/main/res/drawable-xxxhdpi/green_mask.png b/app/src/main/res/drawable-xxxhdpi/green_mask.png Binary files differnew file mode 100644 index 00000000..f5a5adaf --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/green_mask.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_btn_cancel.png b/app/src/main/res/drawable-xxxhdpi/ic_btn_cancel.png Binary files differnew file mode 100644 index 00000000..6c17bd78 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_btn_cancel.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_btn_on.png b/app/src/main/res/drawable-xxxhdpi/ic_btn_on.png Binary files differnew file mode 100644 index 00000000..b0e54b8c --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/ic_btn_on.png diff --git a/app/src/main/res/drawable-xxxhdpi/red_mask.png b/app/src/main/res/drawable-xxxhdpi/red_mask.png Binary files differnew file mode 100644 index 00000000..9e216955 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/red_mask.png diff --git a/app/src/main/res/drawable-xxxhdpi/yellow_mask.png b/app/src/main/res/drawable-xxxhdpi/yellow_mask.png Binary files differnew file mode 100644 index 00000000..806dcbf4 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/yellow_mask.png diff --git a/app/src/main/res/drawable/bg_connected.png b/app/src/main/res/drawable/bg_connected.png Binary files differnew file mode 100644 index 00000000..6da7878d --- /dev/null +++ b/app/src/main/res/drawable/bg_connected.png diff --git a/app/src/main/res/drawable/bg_connecting.png b/app/src/main/res/drawable/bg_connecting.png Binary files differnew file mode 100644 index 00000000..c371f3f0 --- /dev/null +++ b/app/src/main/res/drawable/bg_connecting.png diff --git a/app/src/main/res/drawable/bg_disconnected.png b/app/src/main/res/drawable/bg_disconnected.png Binary files differnew file mode 100644 index 00000000..de96be57 --- /dev/null +++ b/app/src/main/res/drawable/bg_disconnected.png diff --git a/app/src/main/res/drawable/button_circle_cancel.xml b/app/src/main/res/drawable/button_circle_cancel.xml new file mode 100644 index 00000000..1d94abca --- /dev/null +++ b/app/src/main/res/drawable/button_circle_cancel.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/button_circle_cancel_pressed" android:state_pressed="true"/> + <item android:drawable="@drawable/button_circle_cancel_released"/> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_cancel_pressed.xml b/app/src/main/res/drawable/button_circle_cancel_pressed.xml new file mode 100644 index 00000000..690baa0c --- /dev/null +++ b/app/src/main/res/drawable/button_circle_cancel_pressed.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- <item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item> --> + <item + android:left="-23dp" + android:right="-23dp" + android:top="-8dp" + android:bottom="-8dp" + > + <animated-rotate + android:drawable="@drawable/rotate_progress_image" + android:pivotX="50.0%" + android:pivotY="50.0%" + android:fromDegrees="0.0" + android:toDegrees="360.0" + > + </animated-rotate> + </item> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_cancel_dark"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="3dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.50" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="68dp" + android:bottom="62dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_cancel" + /> + </item> + + +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_cancel_released.xml b/app/src/main/res/drawable/button_circle_cancel_released.xml new file mode 100644 index 00000000..833a9076 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_cancel_released.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- <item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item>--> + + <item + android:left="-23dp" + android:right="-23dp" + android:top="-8dp" + android:bottom="-8dp" + > + <animated-rotate + android:drawable="@drawable/rotate_progress_image" + android:pivotX="50.0%" + android:pivotY="50.0%" + android:fromDegrees="0.0" + android:toDegrees="360.0" + > + </animated-rotate> + </item> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_cancel"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="10dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.51" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="65dp" + android:bottom="65dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_cancel" /> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_start.xml b/app/src/main/res/drawable/button_circle_start.xml new file mode 100644 index 00000000..6d8482f4 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_start.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/button_circle_start_pressed" android:state_pressed="true"> + </item> + <item android:drawable="@drawable/button_circle_start_released"> + </item> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_start_pressed.xml b/app/src/main/res/drawable/button_circle_start_pressed.xml new file mode 100644 index 00000000..4157ffe0 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_start_pressed.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!--<item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item>--> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_start_dark"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="3dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.50" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="68dp" + android:bottom="62dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_on" + /> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_start_released.xml b/app/src/main/res/drawable/button_circle_start_released.xml new file mode 100644 index 00000000..671d06dc --- /dev/null +++ b/app/src/main/res/drawable/button_circle_start_released.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!--<item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item>--> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_start"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="10dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.51" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="65dp" + android:bottom="65dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_on" /> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_stop.xml b/app/src/main/res/drawable/button_circle_stop.xml new file mode 100644 index 00000000..674cbf15 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_stop.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/button_circle_stop_pressed" android:state_pressed="true"/> + <item android:drawable="@drawable/button_circle_stop_released"/> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_stop_pressed.xml b/app/src/main/res/drawable/button_circle_stop_pressed.xml new file mode 100644 index 00000000..ce7583f1 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_stop_pressed.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!--<item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item>--> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_stop_dark"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:top="18dp" + android:bottom="12dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="3dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.51" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="68dp" + android:bottom="62dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_cancel" + /> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/button_circle_stop_released.xml b/app/src/main/res/drawable/button_circle_stop_released.xml new file mode 100644 index 00000000..ed786ee0 --- /dev/null +++ b/app/src/main/res/drawable/button_circle_stop_released.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <!--<item> + <shape android:shape="rectangle"> + <solid android:color="@color/white"/> + <size android:width="250dp" android:height="250dp"/> + </shape> + </item>--> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape android:shape="oval"> + <solid android:color="@color/btn_stop"/> + <size android:width="250dp" android:height="250dp" /> + </shape> + </item> + <item + android:bottom="15dp" + android:top="15dp" + > + <shape + android:shape="ring" + android:innerRadius="125dp" + android:useLevel="false" + android:thickness="10dp"> + <gradient + android:type="radial" + android:gradientRadius="125dp" + android:centerX="0.51" + android:centerY="0.54" + android:startColor="#000000" + android:centerColor="#000000" + android:endColor="@color/transparent" /> + + </shape> + </item> + <item + android:top="65dp" + android:bottom="65dp" + android:left="50dp" + android:right="50dp" + > + <bitmap android:src="@drawable/ic_btn_cancel" /> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_light_rect.xml b/app/src/main/res/drawable/cust_button_light_rect.xml new file mode 100644 index 00000000..dd66c739 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_light_rect.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android" > + <item android:state_pressed="true" > + <layer-list + android:paddingLeft="@dimen/button_bevel" + android:paddingRight="@dimen/button_bevel"> + <item> + <shape android:shape="rectangle"> + <solid android:color="@color/black_transparent"/> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <solid android:color="@color/btn_light_transparent_dark"/> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + </layer-list> + </item> + <item android:state_focused="true"> + <layer-list + android:paddingLeft="@dimen/button_bevel" + android:paddingRight="@dimen/button_bevel"> + <item> + <shape android:shape="rectangle" > + <solid android:color="@color/black_transparent"/> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <solid android:color="@color/btn_light_transparent_dark"/> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + + </layer-list> + </item> + <item > + <layer-list + android:paddingLeft="@dimen/button_bevel" + android:paddingRight="@dimen/button_bevel"> + <!-- shadow --> + <item + android:top="@dimen/button_bevel" + android:left="1dp" + > + <shape android:shape="rectangle" > + <corners android:radius="@dimen/stdpadding" /> + <solid android:color="@color/black_transparent"/> + </shape> + </item> + <!-- fill --> + <item + android:bottom="@dimen/button_bevel" + android:right="1dp" + > + <shape android:shape="rectangle" > + <solid android:color="@color/btn_light_transparent"/> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + <!-- gradient --> + <item + android:bottom="@dimen/button_bevel" + android:right="1dp" + > + <shape android:shape="rectangle"> + <gradient android:startColor="@color/btn_light_transparent_dark" + android:endColor="@color/white_transparent" + android:angle="90" + /> + <corners android:radius="@dimen/stdpadding"/> + </shape> + </item> + </layer-list> + </item> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/green_mask.png b/app/src/main/res/drawable/green_mask.png Binary files differnew file mode 100644 index 00000000..e515f3f5 --- /dev/null +++ b/app/src/main/res/drawable/green_mask.png diff --git a/app/src/main/res/drawable/ic_btn_cancel.png b/app/src/main/res/drawable/ic_btn_cancel.png Binary files differnew file mode 100644 index 00000000..0b55460a --- /dev/null +++ b/app/src/main/res/drawable/ic_btn_cancel.png diff --git a/app/src/main/res/drawable/ic_btn_on.png b/app/src/main/res/drawable/ic_btn_on.png Binary files differnew file mode 100644 index 00000000..be160a33 --- /dev/null +++ b/app/src/main/res/drawable/ic_btn_on.png diff --git a/app/src/main/res/drawable/red_mask.png b/app/src/main/res/drawable/red_mask.png Binary files differnew file mode 100644 index 00000000..a4bd4a78 --- /dev/null +++ b/app/src/main/res/drawable/red_mask.png diff --git a/app/src/main/res/drawable/rotate_progress_image.xml b/app/src/main/res/drawable/rotate_progress_image.xml new file mode 100644 index 00000000..7b539720 --- /dev/null +++ b/app/src/main/res/drawable/rotate_progress_image.xml @@ -0,0 +1,12 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:name="circle" + android:viewportWidth="91" + android:viewportHeight="91" + android:width="91dp" + android:height="91dp"> + +<!-- + // implement your rotation animation vector image here +--> + +</vector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/yellow_mask.png b/app/src/main/res/drawable/yellow_mask.png Binary files differnew file mode 100644 index 00000000..98dd7978 --- /dev/null +++ b/app/src/main/res/drawable/yellow_mask.png diff --git a/app/src/main/res/layout/f_test_layout.xml b/app/src/main/res/layout/f_test_layout.xml new file mode 100644 index 00000000..6ec91259 --- /dev/null +++ b/app/src/main/res/layout/f_test_layout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/splash_page" + > + +</FrameLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/v_location_button.xml b/app/src/main/res/layout/v_location_button.xml index d304d429..aa4af10c 100644 --- a/app/src/main/res/layout/v_location_button.xml +++ b/app/src/main/res/layout/v_location_button.xml @@ -6,9 +6,8 @@ android:layout_width="match_parent" android:layout_gravity="center_vertical" android:padding="@dimen/stdpadding" - android:background="@drawable/cust_button_primary_rect" + android:background="@drawable/cust_button_light_rect" android:layout_height="match_parent" - tools:viewBindingIgnore="true" > <androidx.appcompat.widget.AppCompatImageView @@ -39,31 +38,30 @@ android:visibility="gone" tools:visibility="visible" /> + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/text_location" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_centerInParent="true" + android:layout_gravity="center_vertical" + android:layout_toStartOf="@+id/bridge_icn" + android:layout_toLeftOf="@+id/bridge_icn" + android:layout_toEndOf="@id/recommended_icn" + android:layout_toRightOf="@+id/recommended_icn" + android:ellipsize="end" + android:gravity="center_vertical" + android:maxLines="1" android:paddingStart="@dimen/stdpadding" android:paddingLeft="@dimen/stdpadding" android:paddingEnd="@dimen/stdpadding" android:paddingRight="@dimen/stdpadding" - android:maxLines="1" - android:ellipsize="end" - android:layout_height="match_parent" - android:layout_width="match_parent" - app:autoSizeTextType="uniform" - android:gravity="center_vertical" - app:autoSizeMinTextSize="15sp" - app:autoSizeMaxTextSize="24sp" - android:layout_toEndOf="@id/recommended_icn" - android:layout_toRightOf="@+id/recommended_icn" - android:layout_toLeftOf="@+id/bridge_icn" - android:layout_toStartOf="@+id/bridge_icn" - android:layout_gravity="center_vertical" - android:layout_centerInParent="true" android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textStyle="bold" - android:textColor="@color/white" - tools:text="Seattle along message" - /> + app:autoSizeMaxTextSize="24sp" + app:autoSizeMinTextSize="15sp" + app:autoSizeTextType="uniform" + tools:text="Seattle along message" /> <androidx.appcompat.widget.AppCompatImageView android:id="@+id/bridge_icn" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 40b51436..c3a519cf 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,6 +14,7 @@ <color name="black800_secondary">#3b3b3b</color> <color name="black800_transparent">#AA424242</color> <color name="black800_high_transparent">#22424242</color> + <color name="transparent">#00000000</color> <color name="red200">#ef9a9a</color> <color name="pink200">#f48fb1</color> @@ -31,14 +32,12 @@ <color name="amber200">#ffe082</color> <color name="orange200">#ffcc80</color> <color name="deepOrange200">#ffab91</color> - <color name="white">#ffffff</color> <color name="white_transparent">#20ffffff</color> <color name="black_transparent">#20000000</color> <color name="black_high_transparent">#05000000</color> - <color name="colorActionBarTitleFont">@color/white</color> - <color name="colorActionBarSubtitleFont">@color/black800</color> + <color name="colorEipFragmentFont">@color/black800</color> <color name="colorFontBtn">@color/black800</color> <color name="colorFontBtnEnabled">@color/white</color> @@ -46,4 +45,30 @@ <color name="colorLocationButtonTintTransparent">@color/black800_high_transparent</color> <color name="colorWarning">#B33A3A</color> + <!-- main UI on/off button colors --> + <color name="btn_start">#FF7D7D</color> + <color name="btn_start_dark">#c84c51</color> + <color name="btn_cancel">#FFBF00</color> + <color name="btn_cancel_dark">#C78F00</color> + <color name="btn_stop">#9FC17F</color> + <color name="btn_stop_dark">#709152</color> + + <!-- location button background colors --> + <color name="btn_light_transparent">#CCFFFEFE</color> + <color name="btn_light_transparent_dark">#CCCCCBCB</color> + + <!-- actionbar and status bar colors for different connection states --> + <color name="bg_disconnected_top">#EC6767</color> + <color name="bg_disconnected_top_light_transparent">#CCff9895</color> + <color name="bg_connecting_top">#FADD85</color> + <color name="bg_connecting_top_light_transparent">#CCffffb6</color> + <color name="bg_running_top">#CCDCB8</color> + <color name="bg_running_top_light_transparent">#ffffea</color> + + <!-- action bar text colors for per state colored action bar --> + <color name="actionbar_dark_color">@color/black800</color> + <color name="actionbar_light_color">@color/white</color> + <!-- default action bar colors used in other fragments than EipFragment --> + <color name="colorActionBarTitleFont">@color/white</color> + <color name="colorActionBarSubtitleFont">@color/black800</color> </resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 92229e44..722f10ed 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -67,6 +67,9 @@ <string name="authentication_failed_message">Authentication failed</string> <string name="registration_failed_message">Registration failed</string> <string name="eip_status_start_pending">Initiating connection</string> + <string name="eip_status_connecting">Connecting VPN</string> + <string name="eip_status_unsecured">Unsecured Connection</string> + <string name="eip_status_secured">Secured Connection</string> <string name="eip_cancel_connect_title">Cancel connection?</string> <string name="eip_cancel_connect_text">There is a connection attempt in progress. Do you wish to cancel it?</string> <string name="eip.warning.browser_inconsistency">Turn off VPN connection? When the VPN is off, you may leak personal information to your Internet provider or local network.</string> diff --git a/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java b/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java new file mode 100644 index 00000000..0210077c --- /dev/null +++ b/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java @@ -0,0 +1,654 @@ +/** + * Copyright (c) 2018 LEAP Encryption Access Project and contributers + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package se.leap.bitmaskclient.base.fragments; + +import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_NONETWORK; +import static se.leap.bitmaskclient.R.string.vpn_certificate_user_message; +import static se.leap.bitmaskclient.base.models.Constants.ASK_TO_CANCEL_VPN; +import static se.leap.bitmaskclient.base.models.Constants.EIP_ACTION_START; +import static se.leap.bitmaskclient.base.models.Constants.EIP_EARLY_ROUTES; +import static se.leap.bitmaskclient.base.models.Constants.EIP_RESTART_ON_BOOT; +import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_KEY; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_CONFIGURE_LEAP; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_LOG_IN; +import static se.leap.bitmaskclient.base.models.Constants.REQUEST_CODE_SWITCH_PROVIDER; +import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; +import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask; +import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity; +import static se.leap.bitmaskclient.eip.EipSetupObserver.reconnectingWithDifferentGateway; +import static se.leap.bitmaskclient.eip.GatewaysManager.Load.UNKNOWN; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.DOWNLOAD_GEOIP_JSON; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.UPDATE_INVALID_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.providersetup.ProviderAPI.USER_MESSAGE; + +import android.app.Activity; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.ServiceConnection; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.IBinder; +import android.text.Spannable; +import android.text.SpannableString; +import android.text.TextUtils; +import android.text.style.RelativeSizeSpan; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.ColorRes; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.AppCompatTextView; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + +import java.util.Observable; +import java.util.Observer; +import java.util.concurrent.atomic.AtomicBoolean; + +import de.blinkt.openvpn.core.ConnectionStatus; +import de.blinkt.openvpn.core.IOpenVPNServiceInternal; +import de.blinkt.openvpn.core.OpenVPNService; +import de.blinkt.openvpn.core.VpnStatus; +import de.blinkt.openvpn.core.connection.Connection; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.base.FragmentManagerEnhanced; +import se.leap.bitmaskclient.base.MainActivity; +import se.leap.bitmaskclient.base.models.Provider; +import se.leap.bitmaskclient.base.models.ProviderObservable; +import se.leap.bitmaskclient.base.utils.PreferenceHelper; +import se.leap.bitmaskclient.base.views.LocationButton; +import se.leap.bitmaskclient.base.views.MainButton; +import se.leap.bitmaskclient.databinding.FEipBinding; +import se.leap.bitmaskclient.eip.EipCommand; +import se.leap.bitmaskclient.eip.EipStatus; +import se.leap.bitmaskclient.eip.GatewaysManager; +import se.leap.bitmaskclient.providersetup.ProviderAPICommand; +import se.leap.bitmaskclient.providersetup.ProviderListActivity; +import se.leap.bitmaskclient.providersetup.activities.CustomProviderSetupActivity; +import se.leap.bitmaskclient.providersetup.activities.LoginActivity; +import se.leap.bitmaskclient.providersetup.models.LeapSRPSession; +import se.leap.bitmaskclient.tor.TorServiceCommand; +import se.leap.bitmaskclient.tor.TorStatusObservable; + +public class EipFragment extends Fragment implements Observer { + + public final static String TAG = EipFragment.class.getSimpleName(); + + + private SharedPreferences preferences; + private Provider provider; + + AppCompatImageView background; + AppCompatImageView stateView; + MainButton mainButton; + LocationButton locationButton; + AppCompatTextView mainDescription; + AppCompatTextView subDescription; + + private EipStatus eipStatus; + private ProviderObservable providerObservable; + private TorStatusObservable torStatusObservable; + + private GatewaysManager gatewaysManager; + + //---saved Instance ------- + private final String KEY_SHOW_PENDING_START_CANCELLATION = "KEY_SHOW_PENDING_START_CANCELLATION"; + private final String KEY_SHOW_ASK_TO_STOP_EIP = "KEY_SHOW_ASK_TO_STOP_EIP"; + private boolean showPendingStartCancellation = false; + private boolean showAskToStopEip = false; + //------------------------ + AlertDialog alertDialog; + + private IOpenVPNServiceInternal mService; + // We use this service connection to detect if openvpn is running without network + private EipFragmentServiceConnection openVpnConnection; + + @Override + public void onAttach(Context context) { + super.onAttach(context); + Bundle arguments = getArguments(); + Activity activity = getActivity(); + if (activity != null) { + if (arguments != null) { + provider = arguments.getParcelable(PROVIDER_KEY); + if (provider == null) { + handleNoProvider(activity); + } else { + Log.d(TAG, provider.getName() + " configured as provider"); + } + } else { + handleNoProvider(activity); + } + } + } + + private void handleNoProvider(Activity activity) { + if (isDefaultBitmask()) { + activity.startActivityForResult(new Intent(activity, ProviderListActivity.class), REQUEST_CODE_SWITCH_PROVIDER); + } else { + Log.e(TAG, "no provider given - try to reconfigure custom provider"); + startActivityForResult(new Intent(activity, CustomProviderSetupActivity.class), REQUEST_CODE_CONFIGURE_LEAP); + + } + + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + openVpnConnection = new EipFragmentServiceConnection(); + eipStatus = EipStatus.getInstance(); + providerObservable = ProviderObservable.getInstance(); + torStatusObservable = TorStatusObservable.getInstance(); + Activity activity = getActivity(); + if (activity != null) { + preferences = getActivity().getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + } else { + Log.e(TAG, "activity is null in onCreate - no preferences set!"); + } + + gatewaysManager = new GatewaysManager(getContext()); + + + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + FEipBinding binding = FEipBinding.inflate(LayoutInflater.from(getContext()), container, false); + background = binding.background; + mainButton = binding.mainButton; + locationButton = binding.gatewayLocationButton; + locationButton.setTextColor(R.color.black800); + mainDescription = binding.mainDescription; + subDescription = binding.subDescription; + stateView = binding.stateView; + + eipStatus.addObserver(this); + torStatusObservable.addObserver(this); + providerObservable.addObserver(this); + + try { + Bundle arguments = getArguments(); + if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { + arguments.remove(ASK_TO_CANCEL_VPN); + setArguments(arguments); + askToStopEIP(); + } + } catch (IllegalStateException e) { + // probably setArguments failed because the fragments state is already saved + e.printStackTrace(); + } + + restoreFromSavedInstance(savedInstanceState); + locationButton.setOnClickListener(v -> { + FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager()); + Fragment fragment = new GatewaySelectionFragment(); + fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG); + }); + + mainButton.setOnClickListener(v -> { + handleIcon(); + }); + return binding.getRoot(); + } + + @Override + public void onStart() { + super.onStart(); + if (DonationReminderDialog.isCallable(getContext())) { + showDonationReminderDialog(); + } + } + + @Override + public void onResume() { + super.onResume(); + if (!eipStatus.isDisconnected()) { + openVpnConnection.bindService(); + } + handleNewState(); + } + + @Override + public void onPause() { + super.onPause(); + openVpnConnection.unbindService(); + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + if (showAskToStopEip) { + outState.putBoolean(KEY_SHOW_ASK_TO_STOP_EIP, true); + alertDialog.dismiss(); + } else if (showPendingStartCancellation) { + outState.putBoolean(KEY_SHOW_PENDING_START_CANCELLATION, true); + alertDialog.dismiss(); + } + } + + private void restoreFromSavedInstance(Bundle savedInstanceState) { + if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_PENDING_START_CANCELLATION)) { + showPendingStartCancellation = true; + askPendingStartCancellation(); + } else if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOW_ASK_TO_STOP_EIP)) { + showAskToStopEip = true; + askToStopEIP(); + } + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + Activity activity = getActivity(); + if (activity != null) { + ((MainActivity) activity).setDefaultActivityBarColor(); + } + eipStatus.deleteObserver(this); + providerObservable.deleteObserver(this); + torStatusObservable.deleteObserver(this); + background = null; + mainButton = null; + locationButton = null; + mainDescription = null; + subDescription = null; + stateView = null; + } + + private void saveStatus(boolean restartOnBoot) { + preferences.edit().putBoolean(EIP_RESTART_ON_BOOT, restartOnBoot).apply(); + } + + void handleIcon() { + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnected() || eipStatus.isConnecting() || eipStatus.isUpdatingVpnCert()) + handleSwitchOff(); + else + handleSwitchOn(); + } + + private void handleSwitchOn() { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when switch turning on"); + return; + } + + if (canStartEIP()) { + startEipFromScratch(); + } else if (canLogInToStartEIP()) { + askUserToLogIn(getString(vpn_certificate_user_message)); + } else { + // provider has no VpnCertificate but user is logged in + updateInvalidVpnCertificate(); + } + } + + private boolean canStartEIP() { + boolean certificateExists = provider.hasVpnCertificate(); + boolean isAllowedAnon = provider.allowsAnonymous(); + return (isAllowedAnon || certificateExists) && !eipStatus.isConnected() && !eipStatus.isConnecting(); + } + + private boolean canLogInToStartEIP() { + boolean isAllowedRegistered = provider.allowsRegistered(); + boolean isLoggedIn = LeapSRPSession.loggedIn(); + return isAllowedRegistered && !isLoggedIn && !eipStatus.isConnecting() && !eipStatus.isConnected(); + } + + private void handleSwitchOff() { + if (isOpenVpnRunningWithoutNetwork() || eipStatus.isConnecting() || eipStatus.isUpdatingVpnCert()) { + askPendingStartCancellation(); + } else if (eipStatus.isConnected()) { + askToStopEIP(); + } + } + + private void setMainButtonEnabled(boolean enabled) { + locationButton.setEnabled(enabled); + mainButton.setEnabled(enabled); + } + + public void startEipFromScratch() { + saveStatus(true); + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when trying to start VPN"); + return; + } + if (!provider.getGeoipUrl().isDefault() && provider.shouldUpdateGeoIpJson()) { + Bundle bundle = new Bundle(); + bundle.putBoolean(EIP_ACTION_START, true); + bundle.putBoolean(EIP_EARLY_ROUTES, false); + ProviderAPICommand.execute(context, DOWNLOAD_GEOIP_JSON, bundle, provider); + } else { + EipCommand.startVPN(context, false); + } + EipStatus.getInstance().updateState("UI_CONNECTING", "", 0, ConnectionStatus.LEVEL_START); + } + + protected void stopEipIfPossible() { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "context is null when trying to stop EIP"); + return; + } + EipCommand.stopVPN(context); + } + + private void askPendingStartCancellation() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when asking to cancel"); + return; + } + + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); + showPendingStartCancellation = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_cancel_connect_text)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> { + Context context = getContext(); + if (context != null && eipStatus.isUpdatingVpnCert() && + TorStatusObservable.isRunning()) { + TorServiceCommand.stopTorServiceAsync(context.getApplicationContext()); + } + stopEipIfPossible(); + }) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showPendingStartCancellation = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + + } + + protected void askToStopEIP() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when asking to stop EIP"); + return; + } + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); + showAskToStopEip = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_warning_browser_inconsistency)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showAskToStopEip = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + + } + + @Override + public void update(Observable observable, Object data) { + if (observable instanceof EipStatus) { + eipStatus = (EipStatus) observable; + handleNewStateOnMain(); + + if (eipStatus.isConnecting()) { + openVpnConnection.bindService(); + } + if ("NOPROCESS".equals(EipStatus.getInstance().getState())) { + //assure that the Service is shutdown completely if openvpn was stopped + openVpnConnection.unbindService(); + } + } else if (observable instanceof ProviderObservable) { + provider = ((ProviderObservable) observable).getCurrentProvider(); + } else if (observable instanceof TorStatusObservable && EipStatus.getInstance().isUpdatingVpnCert()) { + handleNewStateOnMain(); + } + } + + private void handleNewStateOnMain() { + Activity activity = getActivity(); + if (activity != null) { + activity.runOnUiThread(this::handleNewState); + } else { + Log.e("EipFragment", "activity is null"); + } + } + + private void setActivityBarColor(@ColorRes int primaryColor, @ColorRes int secondaryColor) { + Activity activity = getActivity(); + if (activity == null) { + return; + } + ((MainActivity) getActivity()).setActivityBarColor(primaryColor, secondaryColor, R.color.actionbar_dark_color); + } + + private void handleNewState() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null while trying to handle new state"); + return; + } + + Log.d(TAG, "eip fragment eipStatus state: " + eipStatus.getState() + " - level: " + eipStatus.getLevel() + " - is reconnecting: " + eipStatus.isReconnecting()); + if (eipStatus.isUpdatingVpnCert()) { + setMainButtonEnabled(true); + String city = getPreferredCity(getContext()); + String locationName = VpnStatus.getCurrentlyConnectingVpnName() != null ? + VpnStatus.getCurrentlyConnectingVpnName() : + city == null ? getString(R.string.gateway_selection_recommended_location) : city; + locationButton.setText(locationName); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + String torStatus = TorStatusObservable.getStringForCurrentStatus(getContext()); + if (!TextUtils.isEmpty(torStatus)) { + Spannable spannable = new SpannableString(torStatus); + spannable.setSpan(new RelativeSizeSpan(0.75f), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + subDescription.setText(TextUtils.concat(getString(R.string.updating_certificate_message) + "\n", spannable)); + } else { + subDescription.setText(getString(R.string.updating_certificate_message)); + } + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + mainButton.updateState(false, true, false); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isConnecting()) { + setMainButtonEnabled(true); + String city = getPreferredCity(getContext()); + String locationName = VpnStatus.getCurrentlyConnectingVpnName() != null ? + VpnStatus.getCurrentlyConnectingVpnName() : + city == null ? getString(R.string.gateway_selection_recommended_location) : city; + locationButton.setText(locationName); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.yellow_mask)); + mainButton.updateState(false, true, false); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isConnected()) { + setMainButtonEnabled(true); + mainButton.updateState(true, false, false); + Connection.TransportType transportType = PreferenceHelper.getUseBridges(getContext()) ? Connection.TransportType.OBFS4 : Connection.TransportType.OPENVPN; + locationButton.setLocationLoad(PreferenceHelper.useObfuscationPinning(getContext()) ? GatewaysManager.Load.UNKNOWN : gatewaysManager.getLoadForLocation(VpnStatus.getLastConnectedVpnName(), transportType)); + locationButton.setText(VpnStatus.getLastConnectedVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showRecommendedIndicator(getPreferredCity(getContext()) == null); + mainDescription.setText(R.string.eip_status_secured); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.green_mask)); + setActivityBarColor(R.color.bg_running_top, R.color.bg_running_top_light_transparent); + } else if(isOpenVpnRunningWithoutNetwork()) { + Log.d(TAG, "eip fragment eipStatus - isOpenVpnRunningWithoutNetwork"); + setMainButtonEnabled(true); + mainButton.updateState(true, false, true); + locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showBridgeIndicator(VpnStatus.isUsingBridges()); + locationButton.showRecommendedIndicator(getPreferredCity(getContext())== null); + mainDescription.setText(R.string.eip_state_connected); + subDescription.setText(R.string.eip_state_no_network); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + } else if (eipStatus.isDisconnected() && reconnectingWithDifferentGateway()) { + locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_connecting); + subDescription.setText(R.string.reconnecting); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); + + } else if (eipStatus.isDisconnecting()) { + setMainButtonEnabled(false); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + mainButton.updateState(false, false, false); + mainDescription.setText(R.string.eip_status_unsecured); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } else if (eipStatus.isBlocking()) { + setMainButtonEnabled(true); + mainButton.updateState(true, false, true); + locationButton.setText(getString(R.string.no_location)); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_state_connected); + subDescription.setText(getString(R.string.eip_state_blocking, getString(R.string.app_name))); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } else { + locationButton.setText(getContext().getString(R.string.vpn_button_turn_on)); + setMainButtonEnabled(true); + mainButton.updateState(false, false, false); + locationButton.setLocationLoad(UNKNOWN); + locationButton.showBridgeIndicator(false); + String city = getPreferredCity(getContext()); + locationButton.setText(city == null ? getString(R.string.gateway_selection_recommended_location) : city); + locationButton.showRecommendedIndicator(false); + mainDescription.setText(R.string.eip_status_unsecured); + subDescription.setText(null); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); + stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); + } + } + + private boolean isOpenVpnRunningWithoutNetwork() { + boolean isRunning = false; + try { + isRunning = eipStatus.getLevel() == LEVEL_NONETWORK && + mService.isVpnRunning(); + } catch (Exception e) { + //eat me + e.printStackTrace(); + } + + return isRunning; + } + + private void updateInvalidVpnCertificate() { + eipStatus.setUpdatingVpnCert(true); + ProviderAPICommand.execute(getContext(), UPDATE_INVALID_VPN_CERTIFICATE, provider); + } + + private void askUserToLogIn(String userMessage) { + Intent intent = new Intent(getContext(), LoginActivity.class); + intent.putExtra(PROVIDER_KEY, provider); + + if(userMessage != null) { + intent.putExtra(USER_MESSAGE, userMessage); + } + + Activity activity = getActivity(); + if (activity != null) { + activity.startActivityForResult(intent, REQUEST_CODE_LOG_IN); + } + } + + private class EipFragmentServiceConnection implements ServiceConnection { + private final AtomicBoolean bind = new AtomicBoolean(false); + + void bindService() { + Activity activity = getActivity(); + if (activity == null) { + Log.e(TAG, "activity is null when binding OpenVpn"); + return; + } + if (!bind.get()) { + activity.runOnUiThread(() -> { + Intent intent = new Intent(activity, OpenVPNService.class); + intent.setAction(OpenVPNService.START_SERVICE); + + activity.bindService(intent, EipFragmentServiceConnection.this, Context.BIND_AUTO_CREATE); + bind.set(true); + }); + } + } + + void unbindService() { + Activity activity = getActivity(); + if (activity == null) { + return; + } + if (bind.get()) { + activity.runOnUiThread(() -> { + activity.unbindService(EipFragmentServiceConnection.this); + bind.set(false); + }); + } + } + + @Override + public void onServiceConnected(ComponentName className, + IBinder service) { + mService = IOpenVPNServiceInternal.Stub.asInterface(service); + handleNewState(); + } + + @Override + public void onServiceDisconnected(ComponentName arg0) { + mService = null; + } + } + + public void showDonationReminderDialog() { + try { + FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( + getActivity().getSupportFragmentManager()).removePreviousFragment( + DonationReminderDialog.TAG); + DialogFragment newFragment = new DonationReminderDialog(); + newFragment.setCancelable(false); + newFragment.show(fragmentTransaction, DonationReminderDialog.TAG); + } catch (IllegalStateException | NullPointerException e) { + e.printStackTrace(); + } + } +} diff --git a/app/src/normal/java/se/leap/bitmaskclient/base/views/MainButton.java b/app/src/normal/java/se/leap/bitmaskclient/base/views/MainButton.java new file mode 100644 index 00000000..715063b5 --- /dev/null +++ b/app/src/normal/java/se/leap/bitmaskclient/base/views/MainButton.java @@ -0,0 +1,57 @@ +package se.leap.bitmaskclient.base.views; + +import android.annotation.TargetApi; +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.RelativeLayout; + +import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; + +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.databinding.VMainButtonBinding; + +public class MainButton extends RelativeLayout { + + private static final String TAG = MainButton.class.getSimpleName(); + + AppCompatImageView button; + + public MainButton(Context context) { + super(context); + initLayout(context); + } + + public MainButton(Context context, AttributeSet attrs) { + super(context, attrs); + initLayout(context); + } + + public MainButton(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + initLayout(context); + } + + + @TargetApi(21) + public MainButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + initLayout(context); + } + + private void initLayout(Context context) { + VMainButtonBinding binding = VMainButtonBinding.inflate(LayoutInflater.from(context), this, true); + button = binding.button; + } + + public void updateState(boolean isOn, boolean isProcessing, boolean isError) { + if (isProcessing) { + button.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.button_circle_cancel)); + } else { + button.setImageDrawable( + ContextCompat.getDrawable(getContext(), + isOn ? R.drawable.button_circle_stop : R.drawable.button_circle_start)); + } + } +} diff --git a/app/src/normal/res/drawable/rotate_progress_image.xml b/app/src/normal/res/drawable/rotate_progress_image.xml new file mode 100644 index 00000000..44a35ba9 --- /dev/null +++ b/app/src/normal/res/drawable/rotate_progress_image.xml @@ -0,0 +1,103 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" + android:name="circle" + android:viewportWidth="91" + android:viewportHeight="91" + android:width="91dp" + android:height="91dp"> + <path + android:pathData="M83.9459 61.7492C81.6735 67.1718 78.2509 72.0496 73.9091 76.0535L45.5808 46.0417L83.9459 61.7492Z" + android:fillColor="#FFCC80" /> + <path + android:pathData="M74.9439 75.0657C70.7802 79.1812 65.7785 82.3744 60.2709 84.4334L45.5806 46.0421L74.9439 75.0657Z" + android:fillColor="#FFE082" /> + <path + android:pathData="M61.4719 83.9632C55.9543 86.2222 50.0087 87.2783 44.0406 87.0594L45.5806 46.0421L61.4719 83.9632Z" + android:fillColor="#FFF59D" /> + <path + android:pathData="M45.5803 87.088C39.516 87.088 33.5253 85.7751 28.0292 83.2417L45.5803 46.0425L45.5803 87.088Z" + android:fillColor="#E6EE9C" /> + <path + android:pathData="M29.6888 83.9635C24.2224 81.7254 19.303 78.3586 15.2601 74.0885L45.5801 46.0424L29.6888 83.9635Z" + android:fillColor="#C5E1A5" /> + <path + android:pathData="M16.2165 75.0658C11.9261 70.825 8.62802 65.7065 6.55433 60.0703L45.5798 46.0422L16.2165 75.0658Z" + android:fillColor="#A5D6A7" /> + <path + android:pathData="M7.21455 61.7497C4.89145 56.2061 3.82625 50.2265 4.09398 44.232L45.5796 46.0422L7.21455 61.7497Z" + android:fillColor="#80CBC4" /> + <path + android:pathData="M4.05357 46.0421C4.05357 40.2602 5.28944 34.5435 7.68023 29.2665L45.5796 46.0421L4.05357 46.0421Z" + android:fillColor="#80DEEA" /> + <path + android:pathData="M7.21454 30.3342C9.56893 24.716 13.1569 19.685 17.7191 15.6051L45.5796 46.0416L7.21454 30.3342Z" + android:fillColor="#81D4FA" /> + <path + android:pathData="M16.216 17.0181C20.5162 12.7677 25.7084 9.50267 31.4256 7.45389L45.5793 46.0416L16.216 17.0181Z" + android:fillColor="#90CAF9" /> + <path + android:pathData="M29.6883 8.12016C35.3597 5.79816 41.4814 4.7479 47.6127 5.04498L45.5796 46.0413L29.6883 8.12016Z" + android:fillColor="#9FA8DA" /> + <path + android:pathData="M45.5798 4.99576C51.3771 4.99576 57.1101 6.19555 62.4099 8.51791L45.5798 46.0413L45.5798 4.99576Z" + android:fillColor="#B39DDB" /> + <path + android:pathData="M61.4714 8.11991C66.8116 10.3063 71.6312 13.5706 75.6218 17.7038L45.5801 46.041L61.4714 8.11991Z" + android:fillColor="#CE93D8" /> + <path + android:pathData="M74.9437 17.0175C79.0466 21.0729 82.2441 25.9333 84.3301 31.2851L45.5803 46.041L74.9437 17.0175Z" + android:fillColor="#F48FB1" /> + <path + android:pathData="M83.9456 30.3337C86.2094 35.7356 87.2793 41.5533 87.0839 47.3971L45.5806 46.0411L83.9456 30.3337Z" + android:fillColor="#EF9A9A" /> + <path + android:pathData="M87.1066 46.0416C87.1066 51.4632 86.02 56.831 83.9094 61.8351L45.5806 46.0416L87.1066 46.0416Z" + android:fillColor="#FFAB91" /> + <path + android:pathData="M83.8543 60.835C81.5944 66.2576 78.1907 71.1354 73.8728 75.1393L45.7004 45.1276L83.8543 60.835Z" + android:fillColor="#FFCC80" /> + <path + android:pathData="M74.9019 74.1516C70.7611 78.2671 65.787 81.4604 60.3097 83.5193L45.7002 45.1281L74.9019 74.1516Z" + android:fillColor="#FFE082" /> + <path + android:pathData="M61.5041 83.0491C56.0168 85.3082 50.1039 86.3642 44.1687 86.1453L45.7002 45.1281L61.5041 83.0491Z" + android:fillColor="#FFF59D" /> + <path + android:pathData="M45.7002 86.1734C39.6693 86.1734 33.7115 84.8606 28.2457 82.3272L45.7002 45.1279L45.7002 86.1734Z" + android:fillColor="#E6EE9C" /> + <path + android:pathData="M29.8961 83.049C24.4598 80.811 19.5675 77.4442 15.5469 73.1741L45.7 45.1279L29.8961 83.049Z" + android:fillColor="#C5E1A5" /> + <path + android:pathData="M16.4977 74.1517C12.231 69.911 8.95103 64.7924 6.88875 59.1563L45.6995 45.1282L16.4977 74.1517Z" + android:fillColor="#A5D6A7" /> + <path + android:pathData="M7.54558 60.8351C5.23527 55.2915 4.17593 49.3119 4.44219 43.3175L45.6995 45.1277L7.54558 60.8351Z" + android:fillColor="#80CBC4" /> + <path + android:pathData="M4.40175 45.1277C4.40175 39.3457 5.63082 33.6291 8.00845 28.3521L45.6992 45.1277L4.40175 45.1277Z" + android:fillColor="#80DEEA" /> + <path + android:pathData="M7.54533 29.4201C9.88677 23.8019 13.455 18.7709 17.992 14.691L45.6992 45.1276L7.54533 29.4201Z" + android:fillColor="#81D4FA" /> + <path + android:pathData="M16.4972 16.104C20.7738 11.8536 25.9374 8.5886 31.6231 6.53981L45.699 45.1276L16.4972 16.104Z" + android:fillColor="#90CAF9" /> + <path + android:pathData="M29.8956 7.20611C35.5358 4.88411 41.6238 3.83384 47.7214 4.13092L45.6995 45.1272L29.8956 7.20611Z" + android:fillColor="#9FA8DA" /> + <path + android:pathData="M45.6997 4.08133C51.465 4.08133 57.1665 5.28113 62.4371 7.60349L45.6997 45.1268L45.6997 4.08133Z" + android:fillColor="#B39DDB" /> + <path + android:pathData="M61.5036 7.20587C66.8144 9.39225 71.6074 12.6565 75.576 16.7898L45.6997 45.127L61.5036 7.20587Z" + android:fillColor="#CE93D8" /> + <path + android:pathData="M74.9017 16.1034C78.982 20.1589 82.162 25.0192 84.2365 30.3711L45.7 45.127L74.9017 16.1034Z" + android:fillColor="#F48FB1" /> + <path + android:pathData="M83.8541 29.4196C86.1054 34.8216 87.1695 40.6392 86.9751 46.4831L45.7002 45.1271L83.8541 29.4196Z" + android:fillColor="#EF9A9A" /> + <path + android:pathData="M86.9979 45.1272C86.9979 50.5487 85.9172 55.9166 83.8183 60.9207L45.7004 45.1272L86.9979 45.1272Z" + android:fillColor="#FFAB91" /> +</vector>
\ No newline at end of file diff --git a/app/src/normal/res/layout-port/f_eip.xml b/app/src/normal/res/layout-port/f_eip.xml new file mode 100644 index 00000000..eed5fde6 --- /dev/null +++ b/app/src/normal/res/layout-port/f_eip.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout 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" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/eipServiceFragment" + > + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.3" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.175" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintGuide_percent="0.125" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.875" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.66" + /> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.7" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/background" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:srcCompat="@drawable/bg_disconnected" + android:scaleType="fitXY" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + + /> + + + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/main_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/sub_description" + android:padding="@dimen/activity_margin" + android:layout_marginTop="@dimen/activity_margin" + android:textAppearance="@android:style/TextAppearance.Large" + android:textStyle="bold" + android:textSize="34sp" + android:autoSizeMinTextSize="28sp" + android:autoSizeTextType="uniform" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="Connection secure" + android:gravity="center" + android:maxLines="1" + /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/sub_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/main_description" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + android:padding="@dimen/activity_margin" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk \n kdjfkj \n kjdfkjdf" + android:gravity="center" + android:maxLines="3" + android:ellipsize="end" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toTopOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_outer_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_outer_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/red_mask" + /> + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@+id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@id/gateway_location_button" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + /> + + <se.leap.bitmaskclient.base.views.LocationButton + android:id="@+id/gateway_location_button" + android:layout_width="match_parent" + android:layout_height="64dp" + android:layout_marginBottom="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:text="SEATTLE" + android:gravity="center_vertical" /> + +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/normal/res/layout-xlarge-port/f_eip.xml b/app/src/normal/res/layout-xlarge-port/f_eip.xml new file mode 100644 index 00000000..ae548c82 --- /dev/null +++ b/app/src/normal/res/layout-xlarge-port/f_eip.xml @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent" + android:id="@+id/eipServiceFragment" + > + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.3" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.025" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.175" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintGuide_percent="0.15" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_outer_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.85" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.66" + /> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.7" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/background" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:srcCompat="@drawable/bg_disconnected" + android:scaleType="fitXY" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + + /> + + + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/main_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="@id/guideline_horizontal_top" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/sub_description" + android:padding="@dimen/activity_margin" + android:layout_marginTop="@dimen/activity_margin" + android:textAppearance="@android:style/TextAppearance.Large" + android:textSize="45sp" + android:textStyle="bold" + android:autoSizeMinTextSize="38sp" + android:autoSizeTextType="uniform" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="Connection secure" + android:gravity="center" + android:maxLines="1" + /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/sub_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/main_description" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + android:padding="@dimen/activity_margin" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk \n kdjfkj \n kjdfkjdf" + android:gravity="center" + android:maxLines="2" + android:ellipsize="end" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toTopOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_outer_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_outer_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/red_mask" + /> + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@+id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@id/gateway_location_button" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + /> + + <se.leap.bitmaskclient.base.views.LocationButton + android:id="@+id/gateway_location_button" + android:layout_width="match_parent" + android:layout_height="64dp" + android:layout_marginBottom="@dimen/stdpadding" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + android:layout_marginTop="@dimen/stdpadding" + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:text="SEATTLE" + android:gravity="center_vertical" /> + +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/normal/res/layout-xlarge/f_eip.xml b/app/src/normal/res/layout-xlarge/f_eip.xml new file mode 100644 index 00000000..a4d94394 --- /dev/null +++ b/app/src/normal/res/layout-xlarge/f_eip.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + This is the layout for extra large landscape, extra large portrait + can be found in layout-xlarge-port +--> +<androidx.constraintlayout.widget.ConstraintLayout 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" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/eipServiceFragment" + > + + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.25" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.3" /> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.55" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.875" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.98" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintGuide_percent="0.7" /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/background" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitXY" + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + app:srcCompat="@drawable/bg_disconnected" /> + + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/main_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/sub_description" + android:padding="@dimen/stdpadding" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" + android:textSize="45sp" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="Connection secure" + /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/sub_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/main_description" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_center" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + android:paddingLeft="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingBottom="@dimen/stdpadding" + app:layout_constraintDimensionRatio="1:1" + tools:text="Your traffic is securly routed through \n another" + android:maxLines="2" + android:gravity="center" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/red_mask" + /> + + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_button_top" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + app:layout_constraintDimensionRatio="1:1" + /> + + + <se.leap.bitmaskclient.base.views.LocationButton + android:id="@+id/gateway_location_button" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_button_top" + app:layout_constraintBottom_toBottomOf="@+id/guideline_horizontal_button_bottom" + tools:text="SEATTLE" + android:gravity="center_vertical" /> + +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/normal/res/layout/f_eip.xml b/app/src/normal/res/layout/f_eip.xml new file mode 100644 index 00000000..9c921721 --- /dev/null +++ b/app/src/normal/res/layout/f_eip.xml @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + This is the default layout for landscape, portrait can be found + in layout-port +--> +<androidx.constraintlayout.widget.ConstraintLayout 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" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/eipServiceFragment" + > + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.1" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_center" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.25" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_left" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.3" /> + + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.45" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_top" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.8" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_horizontal_button_bottom" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="horizontal" + app:layout_constraintGuide_percent="0.98" + /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline_vertical_right" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintGuide_percent="0.7" /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/background" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitXY" + android:layout_marginLeft="-300dp" + android:layout_marginRight="-300dp" + android:layout_marginTop="-300dp" + android:layout_marginBottom="-300dp" + app:srcCompat="@drawable/bg_disconnected" /> + + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/main_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/sub_description" + android:paddingLeft="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" + android:textSize="26sp" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + app:layout_constraintDimensionRatio="1:1" + tools:text="Connection secure" + /> + + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/sub_description" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:layout_constraintTop_toBottomOf="@id/main_description" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_center" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" + android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" + android:paddingLeft="@dimen/stdpadding" + android:paddingStart="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingBottom="@dimen/stdpadding" + app:layout_constraintDimensionRatio="1:1" + tools:text="Your traffic is securly routed through \n another" + android:maxLines="2" + android:gravity="center" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/state_view" + android:layout_width="0dp" + android:layout_height="0dp" + app:layout_constraintBottom_toTopOf="@id/guideline_horizontal_bottom" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_center" + app:layout_constraintLeft_toLeftOf="@id/guideline_vertical_left" + app:layout_constraintRight_toRightOf="@id/guideline_vertical_right" + app:layout_constraintVertical_bias="1" + app:srcCompat="@drawable/red_mask" + /> + + <se.leap.bitmaskclient.base.views.MainButton + android:id="@+id/main_button" + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_margin="@dimen/stdpadding" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_bottom" + app:layout_constraintBottom_toTopOf="@+id/guideline_horizontal_button_top" + app:layout_constraintEnd_toStartOf="@+id/guideline_vertical_right" + app:layout_constraintStart_toStartOf="@+id/guideline_vertical_left" + app:layout_constraintDimensionRatio="1:1" + /> + + + <se.leap.bitmaskclient.base.views.LocationButton + android:id="@+id/gateway_location_button" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginEnd="@dimen/stdpadding" + android:layout_marginStart="@dimen/stdpadding" + + android:layout_marginLeft="@dimen/stdpadding" + android:layout_marginRight="@dimen/stdpadding" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/guideline_horizontal_button_top" + app:layout_constraintBottom_toBottomOf="@+id/guideline_horizontal_button_bottom" + tools:text="SEATTLE" + android:gravity="center_vertical" /> + +</androidx.constraintlayout.widget.ConstraintLayout> diff --git a/app/src/normal/res/layout/v_location_button.xml b/app/src/normal/res/layout/v_location_button.xml new file mode 100644 index 00000000..8aaf4978 --- /dev/null +++ b/app/src/normal/res/layout/v_location_button.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_gravity="center_vertical" + android:layout_height="match_parent" + android:padding="@dimen/stdpadding" + android:background="@drawable/cust_button_light_rect" + > + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/world_icn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/text_location" + android:layout_alignBottom="@+id/text_location" + android:scaleType="fitCenter" + android:src="@drawable/ic_web" + android:layout_gravity="center" + app:tint="@color/colorLocationButtonTint" + /> + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/recommended_icn" + android:scaleType="fitCenter" + android:layout_marginRight="-13dp" + android:layout_marginEnd="-13dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@id/text_location" + android:layout_alignBottom="@+id/text_location" + android:layout_toEndOf="@id/world_icn" + android:layout_toRightOf="@id/world_icn" + android:src="@drawable/ic_lightning_bolt" + app:tint="@color/colorLocationButtonTint" + + android:visibility="gone" + tools:visibility="visible" + /> + <androidx.appcompat.widget.AppCompatTextView + android:id="@+id/text_location" + android:paddingStart="@dimen/stdpadding" + android:paddingLeft="@dimen/stdpadding" + android:paddingEnd="@dimen/stdpadding" + android:paddingRight="@dimen/stdpadding" + android:maxLines="1" + android:ellipsize="end" + android:layout_height="match_parent" + android:layout_width="match_parent" + app:autoSizeTextType="uniform" + android:gravity="center_vertical" + app:autoSizeMinTextSize="15sp" + app:autoSizeMaxTextSize="24sp" + android:layout_toEndOf="@id/recommended_icn" + android:layout_toRightOf="@+id/recommended_icn" + android:layout_toLeftOf="@+id/bridge_icn" + android:layout_toStartOf="@+id/bridge_icn" + android:layout_gravity="center_vertical" + android:layout_centerInParent="true" + android:textAppearance="@style/TextAppearance.AppCompat.Large" + android:textStyle="bold" + android:textColor="@color/white" + tools:text="Seattle along message" + /> + + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/bridge_icn" + + android:paddingStart="@dimen/compact_padding" + android:paddingLeft="@dimen/compact_padding" + android:paddingRight="@dimen/compact_padding" + android:paddingEnd="@dimen/compact_padding" + android:scaleType="fitCenter" + android:layout_width="48dp" + android:layout_height="wrap_content" + android:layout_alignTop="@id/text_location" + android:layout_alignBottom="@+id/text_location" + android:layout_toStartOf="@id/load_indicator" + android:layout_toLeftOf="@id/load_indicator" + android:src="@drawable/ic_bridge_36" + android:visibility="gone" + tools:visibility="visible" + app:tint="@color/colorLocationButtonTint" + /> + + <se.leap.bitmaskclient.base.views.LocationIndicator + android:id="@+id/load_indicator" + android:layout_marginBottom="4dp" + android:layout_width="48dp" + android:layout_height="40dp" + android:layout_alignParentEnd="true" + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:paddingTop="@dimen/stdpadding" + android:paddingBottom="@dimen/stdpadding" + android:visibility="visible" + android:layout_gravity="center_vertical" + app:tint="@color/colorLocationButtonTintTransparent" + /> + + + +</RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/v_main_button.xml b/app/src/normal/res/layout/v_main_button.xml index 741fc88f..e3f96693 100644 --- a/app/src/main/res/layout/v_main_button.xml +++ b/app/src/normal/res/layout/v_main_button.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto"> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> <androidx.constraintlayout.widget.Guideline @@ -92,7 +92,7 @@ app:layout_constraintGuide_percent="0.975" /> - <ProgressBar + <!-- <ProgressBar android:id="@+id/progressBar" style="@style/Widget.AppCompat.ProgressBar.Horizontal" @@ -108,10 +108,23 @@ android:indeterminateDrawable="@drawable/progressbar_circle" android:interpolator="@android:anim/decelerate_interpolator" android:indeterminateBehavior="cycle" - /> + />--> + + <!--<androidx.appcompat.widget.AppCompatImageView + android:id="@+id/progress_circular" + android:layout_width="0dp" + android:layout_height="0dp" + android:scaleType="fitXY" + + app:layout_constraintTop_toTopOf="@+id/button" + app:layout_constraintBottom_toBottomOf="@+id/button" + app:layout_constraintLeft_toLeftOf="@+id/button" + app:layout_constraintRight_toRightOf="@+id/button" + app:layout_constraintDimensionRatio="1:1" + android:src="@drawable/rainbow_circle" />--> <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/circle" + android:id="@+id/button" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toTopOf="@+id/vpn_btn_guideline_bottom" @@ -119,18 +132,11 @@ app:layout_constraintStart_toStartOf="@+id/vpn_btn_guideline_left" app:layout_constraintTop_toTopOf="@+id/vpn_btn_guideline_top" app:layout_constraintDimensionRatio="1:1" - app:srcCompat="@drawable/black_circle" /> + app:srcCompat="@drawable/button_circle_start" + /> + + + - <androidx.appcompat.widget.AppCompatImageView - android:id="@+id/vpn_state_key" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_constraintBottom_toTopOf="@+id/icn_guideline_bottom" - app:layout_constraintEnd_toStartOf="@+id/icn_guideline_right" - app:layout_constraintStart_toStartOf="@+id/icn_guideline_left" - app:layout_constraintTop_toTopOf="@+id/icn_guideline_top" - app:layout_constraintDimensionRatio="1:1" - app:layout_constraintVertical_bias="0.35" - app:srcCompat="@drawable/ic_btn_on_disabled" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file |