SlideShare una empresa de Scribd logo
1 de 14
Android Query



   Makes Android coding
simpler, easier, and more fun!


     Michal CoPLaS Pavlasek
     www.pavlasek.sk/devel/
      twitter.com/pavlasek
About me



Java, Android, Grails (etc...) developer

I'm not creator of Android Query :)

Just fan of it
Android Query

Light-weight library for doing asynchronous tasks
    and manipulating UI elements in Android

    http://code.google.com/p/android-query/



   Inspired by jQuery, a javascript framework for web site,
                  hence the name "Query".
Android Query
                Things I really like:
Less Code
Chaining
AJAX Callback
Image Loading
In-app Version Check
Multiple UI, One Piece of Code
Less Code - Before
public void renderContent(Content content, View view) {


     ImageView tbView = (ImageView) view.findViewById(R.id.icon);
     if(tbView != null){

          tbView.setImageBitmap(R.drawable.icon);
          tbView.setVisibility(View.VISIBLE);

          tbView.setOnClickListener(new OnClickListener() {

                     @Override
                     public void onClick(View v) {
                          someMethod(v);
                     }
               });

     }

     TextView nameView = (TextView) view.findViewById(R.id.name);
     if(nameView != null){
          nameView.setText(content.getPname());
     }

     TextView timeView = (TextView) view.findViewById(R.id.time);

     if(timeView != null){
           long now = System.currentTimeMillis();
           timeView.setText(FormatUtility.relativeTime(now, content.getCreate()));
           timeView.setVisibility(View.VISIBLE);
     }

     TextView descView = (TextView) view.findViewById(R.id.desc);

     if(descView != null){
           descView.setText(content.getDesc());
           descView.setVisibility(View.VISIBLE);
     }
}
Less Code - After

public void renderContent(Content content, View view) {
     AQuery aq = new AQuery(view);

    aq.id(R.id.icon).image(R.drawable.icon).visible().clicked(this,
          "someMethod");
    aq.id(R.id.name).text(content.getPname());
    aq.id(R.id.time).text(FormatUtility.relativeTime(
          System.currentTimeMillis(),
          content.getCreate())).visible();
    aq.id(R.id.desc).text(content.getDesc()).visible();
}
Chaining

All "set" methods in AQuery returns itself.

String name = "My name in black text, red
background, visible, and invoke nameClicked
when clicked";

aq.id(R.id.name).text(name).background(
R.color.red).textColor(R.color.black).enabled(true)
.visible().clicked(this, "nameClicked");
AJAX Callback - JSON Example
public void asyncJson(){
     //perform a Google search in just a few lines of code
     String url = "http://www.google.com/uds/GnewsSearch?
q=Obama&v=1.0";
     aq.ajax(url, JSONObject.class, this, "jsonCallback");
}

public void jsonCallback(String url, JSONObject json,
AjaxStatus status){
     if(json != null){
           //successful ajax call
     }else{
           //ajax error
     }
}
Image Loading
Simple
Memory & File Caching
Down Sampling
Zoomable (WebView)
Fallback Image
Preloading
Animation
Dynamic Aspect Ratio
Avoid Duplicated Simultaneous Fetches
Custom Callback
Image Loading
aq.id(R.id.image1).image(
    "http://www.vikispot.com/z/images/vikispot/android-w.png");

//this image is huge, avoid memory caching
boolean memCache = false;
boolean fileCache = true;
aq.id(R.id.image1).image(
         "http://www.vikispot.com/z/images/vikispot/android-w.png",
         memCache, fileCache);

aq.id( R.id.image).image("https://graph.facebook.com/" + item.fromId + "/
picture?type=large", true, true, 0, 0, null, Aquery.FADE_IN);

See more: http://code.google.com/p/android-query/wiki/ImageLoading
In-app Version Check

@Override
public void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);

      MarketService ms = new MarketService(this);
      ms.level(MarketService.MINOR).checkVersion();
}

See more: http://code.google.com/p/android-query/wiki/Service
Multiple UI, One Piece of Code
public void renderContent(Content content, View view) {

     //this is a phone!

     //this view exists
     aq.id(R.id.textInMobileLayoutOnly).text(
           "Welcome to my Mobile App!");

     //this button exist in tablet layout only, but it's ok
     //AQuery will ignore all the operations on this view
     aq.id(R.id.butttonInTabletOnly).text("Open a new tab!");

}
And many more...
Binding
XML Parsing
Authentication
Alleviate Fragmentation
Extendable
Light Weight
Non-intrusive
Open Source
More info


  http://code.google.com/p/android-query/

       http://twitter.com/AndroidQuery

http://groups.google.com/group/android-query

Más contenido relacionado

La actualidad más candente

Using script db as a deaddrop to pass data between GAS, JS and Excel
Using script db as a deaddrop to pass data between GAS, JS and ExcelUsing script db as a deaddrop to pass data between GAS, JS and Excel
Using script db as a deaddrop to pass data between GAS, JS and ExcelBruce McPherson
 
Node.js 與 google cloud storage
Node.js 與 google cloud storageNode.js 與 google cloud storage
Node.js 與 google cloud storageonlinemad
 
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Sirar Salih
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapWebFrameworks
 
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaPraktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaMuhammad Yusuf
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolboxShem Magnezi
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Joao Lucas Santana
 
VBA API for scriptDB primer
VBA API for scriptDB primerVBA API for scriptDB primer
VBA API for scriptDB primerBruce McPherson
 
Client Side MVC & Angular
Client Side MVC & AngularClient Side MVC & Angular
Client Side MVC & AngularAlexe Bogdan
 
Cервер на Go для мобильной стратегии
Cервер на Go для мобильной стратегииCервер на Go для мобильной стратегии
Cервер на Go для мобильной стратегииArtem Kovardin
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Startedguest1af57e
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web developmentJohannes Brodwall
 
Android Developer Toolbox 2017
Android Developer Toolbox 2017Android Developer Toolbox 2017
Android Developer Toolbox 2017Shem Magnezi
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015Matt Raible
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 

La actualidad más candente (19)

Using script db as a deaddrop to pass data between GAS, JS and Excel
Using script db as a deaddrop to pass data between GAS, JS and ExcelUsing script db as a deaddrop to pass data between GAS, JS and Excel
Using script db as a deaddrop to pass data between GAS, JS and Excel
 
Node.js 與 google cloud storage
Node.js 與 google cloud storageNode.js 與 google cloud storage
Node.js 與 google cloud storage
 
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
 
Docker & Azure
Docker & AzureDocker & Azure
Docker & Azure
 
Parse Advanced
Parse AdvancedParse Advanced
Parse Advanced
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-Bootstrap
 
Client Web
Client WebClient Web
Client Web
 
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaPraktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
 
Android dev toolbox
Android dev toolboxAndroid dev toolbox
Android dev toolbox
 
Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)Desenvolvimento web com Ruby on Rails (extras)
Desenvolvimento web com Ruby on Rails (extras)
 
VBA API for scriptDB primer
VBA API for scriptDB primerVBA API for scriptDB primer
VBA API for scriptDB primer
 
Client Side MVC & Angular
Client Side MVC & AngularClient Side MVC & Angular
Client Side MVC & Angular
 
Cервер на Go для мобильной стратегии
Cервер на Go для мобильной стратегииCервер на Go для мобильной стратегии
Cервер на Go для мобильной стратегии
 
The Big Picture and How to Get Started
The Big Picture and How to Get StartedThe Big Picture and How to Get Started
The Big Picture and How to Get Started
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Android Developer Toolbox 2017
Android Developer Toolbox 2017Android Developer Toolbox 2017
Android Developer Toolbox 2017
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 

Destacado

Preliminary task
Preliminary taskPreliminary task
Preliminary task261094
 
Presentation1.ppt media coursework
Presentation1.ppt media courseworkPresentation1.ppt media coursework
Presentation1.ppt media coursework261094
 
Presentatie infoavond21fe2012
Presentatie infoavond21fe2012Presentatie infoavond21fe2012
Presentatie infoavond21fe2012SSleiden
 
Spb living the afterlife with liwa-raya
Spb living the afterlife with liwa-rayaSpb living the afterlife with liwa-raya
Spb living the afterlife with liwa-rayasyahrul Fitriyadi
 
Профилирование и оптимизация jQuery–кода
Профилирование и оптимизация jQuery–кодаПрофилирование и оптимизация jQuery–кода
Профилирование и оптимизация jQuery–кодаprivate_face
 

Destacado (6)

Preliminary task
Preliminary taskPreliminary task
Preliminary task
 
Presentation1.ppt media coursework
Presentation1.ppt media courseworkPresentation1.ppt media coursework
Presentation1.ppt media coursework
 
Presentatie infoavond21fe2012
Presentatie infoavond21fe2012Presentatie infoavond21fe2012
Presentatie infoavond21fe2012
 
Spb living the afterlife with liwa-raya
Spb living the afterlife with liwa-rayaSpb living the afterlife with liwa-raya
Spb living the afterlife with liwa-raya
 
Профилирование и оптимизация jQuery–кода
Профилирование и оптимизация jQuery–кодаПрофилирование и оптимизация jQuery–кода
Профилирование и оптимизация jQuery–кода
 
Spb the way to belief
Spb the way to beliefSpb the way to belief
Spb the way to belief
 

Similar a Android query

Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Robert DeLuca
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developersDarryl Bayliss
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Elyse Kolker Gordon
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-senseBen Lin
 
Gdg dev fest hybrid apps your own mini-cordova
Gdg dev fest hybrid apps  your own mini-cordovaGdg dev fest hybrid apps  your own mini-cordova
Gdg dev fest hybrid apps your own mini-cordovaAyman Mahfouz
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaAyman Mahfouz
 
Responsive mobile design in practice
Responsive mobile design in practiceResponsive mobile design in practice
Responsive mobile design in practiceKirill Grouchnikov
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかYukiya Nakagawa
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of usOSCON Byrum
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQueryPhDBrown
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAERon Reiter
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsScott Gardner
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)Beau Lebens
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJSBoris Dinkevich
 

Similar a Android query (20)

Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developers
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Android crashcourse
Android crashcourseAndroid crashcourse
Android crashcourse
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-sense
 
Gdg dev fest hybrid apps your own mini-cordova
Gdg dev fest hybrid apps  your own mini-cordovaGdg dev fest hybrid apps  your own mini-cordova
Gdg dev fest hybrid apps your own mini-cordova
 
Hybrid apps - Your own mini Cordova
Hybrid apps - Your own mini CordovaHybrid apps - Your own mini Cordova
Hybrid apps - Your own mini Cordova
 
Responsive mobile design in practice
Responsive mobile design in practiceResponsive mobile design in practice
Responsive mobile design in practice
 
React Native Androidはなぜ動くのか
React Native Androidはなぜ動くのかReact Native Androidはなぜ動くのか
React Native Androidはなぜ動くのか
 
List adapter with multiple objects
List adapter with multiple objectsList adapter with multiple objects
List adapter with multiple objects
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
droidQuery: The Android port of jQuery
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQuery
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
React native by example by Vadim Ruban
React native by example by Vadim RubanReact native by example by Vadim Ruban
React native by example by Vadim Ruban
 
Writing HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAEWriting HTML5 Web Apps using Backbone.js and GAE
Writing HTML5 Web Apps using Backbone.js and GAE
 
Android development
Android developmentAndroid development
Android development
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the Things
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJS
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Android query

  • 1. Android Query Makes Android coding simpler, easier, and more fun! Michal CoPLaS Pavlasek www.pavlasek.sk/devel/ twitter.com/pavlasek
  • 2. About me Java, Android, Grails (etc...) developer I'm not creator of Android Query :) Just fan of it
  • 3. Android Query Light-weight library for doing asynchronous tasks and manipulating UI elements in Android http://code.google.com/p/android-query/ Inspired by jQuery, a javascript framework for web site, hence the name "Query".
  • 4. Android Query Things I really like: Less Code Chaining AJAX Callback Image Loading In-app Version Check Multiple UI, One Piece of Code
  • 5. Less Code - Before public void renderContent(Content content, View view) { ImageView tbView = (ImageView) view.findViewById(R.id.icon); if(tbView != null){ tbView.setImageBitmap(R.drawable.icon); tbView.setVisibility(View.VISIBLE); tbView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { someMethod(v); } }); } TextView nameView = (TextView) view.findViewById(R.id.name); if(nameView != null){ nameView.setText(content.getPname()); } TextView timeView = (TextView) view.findViewById(R.id.time); if(timeView != null){ long now = System.currentTimeMillis(); timeView.setText(FormatUtility.relativeTime(now, content.getCreate())); timeView.setVisibility(View.VISIBLE); } TextView descView = (TextView) view.findViewById(R.id.desc); if(descView != null){ descView.setText(content.getDesc()); descView.setVisibility(View.VISIBLE); } }
  • 6. Less Code - After public void renderContent(Content content, View view) { AQuery aq = new AQuery(view); aq.id(R.id.icon).image(R.drawable.icon).visible().clicked(this, "someMethod"); aq.id(R.id.name).text(content.getPname()); aq.id(R.id.time).text(FormatUtility.relativeTime( System.currentTimeMillis(), content.getCreate())).visible(); aq.id(R.id.desc).text(content.getDesc()).visible(); }
  • 7. Chaining All "set" methods in AQuery returns itself. String name = "My name in black text, red background, visible, and invoke nameClicked when clicked"; aq.id(R.id.name).text(name).background( R.color.red).textColor(R.color.black).enabled(true) .visible().clicked(this, "nameClicked");
  • 8. AJAX Callback - JSON Example public void asyncJson(){ //perform a Google search in just a few lines of code String url = "http://www.google.com/uds/GnewsSearch? q=Obama&v=1.0"; aq.ajax(url, JSONObject.class, this, "jsonCallback"); } public void jsonCallback(String url, JSONObject json, AjaxStatus status){ if(json != null){ //successful ajax call }else{ //ajax error } }
  • 9. Image Loading Simple Memory & File Caching Down Sampling Zoomable (WebView) Fallback Image Preloading Animation Dynamic Aspect Ratio Avoid Duplicated Simultaneous Fetches Custom Callback
  • 10. Image Loading aq.id(R.id.image1).image( "http://www.vikispot.com/z/images/vikispot/android-w.png"); //this image is huge, avoid memory caching boolean memCache = false; boolean fileCache = true; aq.id(R.id.image1).image( "http://www.vikispot.com/z/images/vikispot/android-w.png", memCache, fileCache); aq.id( R.id.image).image("https://graph.facebook.com/" + item.fromId + "/ picture?type=large", true, true, 0, 0, null, Aquery.FADE_IN); See more: http://code.google.com/p/android-query/wiki/ImageLoading
  • 11. In-app Version Check @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MarketService ms = new MarketService(this); ms.level(MarketService.MINOR).checkVersion(); } See more: http://code.google.com/p/android-query/wiki/Service
  • 12. Multiple UI, One Piece of Code public void renderContent(Content content, View view) { //this is a phone! //this view exists aq.id(R.id.textInMobileLayoutOnly).text( "Welcome to my Mobile App!"); //this button exist in tablet layout only, but it's ok //AQuery will ignore all the operations on this view aq.id(R.id.butttonInTabletOnly).text("Open a new tab!"); }
  • 13. And many more... Binding XML Parsing Authentication Alleviate Fragmentation Extendable Light Weight Non-intrusive Open Source
  • 14. More info http://code.google.com/p/android-query/ http://twitter.com/AndroidQuery http://groups.google.com/group/android-query