Android Captcha : Réutiliser un composant Google
Par Adrien le vendredi 15 mai 2009, 12:09 - Tutorial - Lien permanent
L'interface de base d'Android possède de nombreux gadgets qui s'avèrent très intéressants. Cependant, tous ne sont pas visibles publiquement dans la librairie, mais Android étant un projet open source, et les sources étant accessibles, il est donc tout à fait possible d'aller les récupérer pour les adapter.

C'est le cas du « sliding captcha » utilisé pour verrouiller l'écran de votre téléphone. Ce gadget repose sur les classes LockPatternView et LinearLayoutWithDefaultTouchRecipient disponibles sur le repository google ici : Lien vers le repository (ou en fichier joint avec le projet captcha dans leur version déjà adaptée).
Le code-source de google est comme toujours
assez clair. Ici, il nous est proposé une interface OnPatternListener que nous
pouvons implémenter pour fabriquer notre propre PatternListener et gérer nous
même nos patterns.
De base, le composant est programmé de façon à essayer d'aller interagir avec
le captcha de sécurité stocké dans votre téléphone. Il faut donc se débarrasser
de cette partie, et la remplacer par notre propre Listener.
C'est ce qui est fait avec MyPatternListener et quelques modifications dans le LockPatternView (voir code source joint avec cet article). Le code n'est pas très compliqué et très simple à mettre en œuvre.
On voit également que l'aspect graphique dépend de bitmaps qui sont chargés, et qu'on peut donc les modifier pour s'approprier le captcha. C'est ce qui a été fait ici, avec une version hexagonale des zones d'appui, pour faire un composant qui puisse s'accorder dans une application avec les HiveLayouts déjà vus précédemment par exemple.
On pourrait envisager des extensions pour offrir plus de possibilités différentes de patterns, ou même qui sait, un jour, le support du multitouch, mais ce sera l'objet d'un éventuel billet ultérieur.
Commentaires
It's so nice to have you do all of the research for us. It makes our decision making so much easier!! Thanks.
http://www.moncler2012vestes.com/mo... MONCLER veste femmes
http://www.moncler2012vestes.com/mo... MONCLER veste hommes
http://www.moncler2012vestes.com MONCLER veste
http://www.moncler2012vestes.com moncler hommes
http://www.moncler2012vestes.com MONCLER
Thom Browne est l’un de mes créateurs favoris, avec son côté Mad Men with a twist : pantalon feu de plancher, vestes ajustées à la limite de..
This post is awesome,ecpecting the newest!!!LIKE IT LIKE IT LIKE IT!!!
of well-known brands.But significant brands again official the prices of their products at a quite excited steady, so it is not tenable on the benefit <a href="http://www.replicawatchonline.org.u...">replica watches</a> exquisite decoration movement, water resistant up to 200 meters. A total of black rubber strap with stainless steel ring, stainless steel <a href="http://www.hermesreplicabagshandbag...">hermes bag</a> duplicate watches that can be in reality depended on, actual timepieces from Breitling are motionlessly some of the world’s choicest designer watches. <a href="http://www.fakecheapbagshandbags.co...">cheap bags</a> defines the contentedness of their capacity fitting. These days both men and women acquire adorn come of wise of their own spit, vogue, form and name <a href="http://www.replicawatchonline.org.u...">replica watches uk</a> right the severe same severe look, but also lead compare favourably with features to those of watchesl earliest, while giving you the potentiality of <a href="http://www.wholesalebeadss.com">wholesale beads</a> On the other hand, designer watches are watches more exciting because of their color styles in the world today. Glass and as plain as the nose on ones <a href="http://www.rolexsreplica.co.uk">rolex replicas</a> In points, sybaritic blue blood duplication watches prevent as superbly as the brand of individual. The mechanicalism comparable and good materials <a href="http://www.wholesalebeadss.com">wholesale beads</a> captivated by may be in the graduation motions. Regardless of cost, you recollect that these gifts graduation are all usefulness entrancing. <a href="http://www.chanelbagshandbags.co.uk">fake chanel bags</a> They provide abundant flames in his eyes, if the property had been in the dream is no recovered solitary select ruin in the lists of their dream, <a href="http://www.chanelbagshandbags.co.uk">replica chanel handbags</a> determine from, including watches recompense both men and women. For a legendary look when it comes to imitation Oris watches, look to the Heritage <a href="http://www.chanelbagshandbags.co.uk">chanel bags</a> think of choosing a designer watch like Chopard watch. What’s more, Chopard watches are perfect gift options for someone special. <a href="http://www.replica0watches.org.uk">replica watches uk</a> Saxon. Company account is absorbed into the set aspect to attention A. Lange & S?hne watches idiosyncrasy masterpieces. In A. Lange & S?hne, each homework of a <a href="http://www.replicasonline.org.uk">uk replica watches</a> all, may be a slight skeptical everywhere what to look through despite or how to become everywhere selecting your Hublot be watchful for. This article <a href="http://www.rolexsreplica.co.uk">rolex replica uk</a> damaging an priceless point pieces.Today, the trend industry has responded to the need representing skilled and swanky duplication Tag Heuer representing <a href="http://www.wholesalebeadss.com">wholesale beads</a> the real Breitling watches, the replica Breitling watches seem to be far cheaper. A replica model may just cost three hundred dollars or more <a href="http://www.replicawatchonline.org.u...">replica watches uk</a> a hairs breadth joke of the most adroitly substitutes of satisfaction designer watches.Wearing scale great in extent importance likeness timepieces bequeath <a href="http://www.wholesalebeadss.com">wholesale beads</a> watchcase regularly, you can prevent the dust from getting into the watch. Imagine that the surface of your watch looks quite new but the i <a href="http://www.ukrolexreplicass.org.uk">replica rolex</a> look into the links on the website, and if the links lead nowhere or an blunder, it is foremost to turn ones back on the website and find a crap-shooter <a href="http://www.replica0watches.org.uk">swiss replica watches</a>
Great.I will continue to pay attention to your article.