High imitation Yahoo weather for Android (2) --- code structure analysis

Source: Internet
Author: User

High imitation Yahoo weather for Android (2) --- code structure analysis

 

 

In this example, six library codes and one master project code are used.

 

Shows the code of one or six databases:

Where

①. MenuDrawer, ViewPagerIndicator, ShowcaseView, and SwipeBack are all well-known open-source libraries on the sidebar menu on Github. I have not made any changes here and I will directly reference them. Thanks for the strength of open-source.

②. PullToRefresh is also a well-known pull-down refresh open-source library on Github. I made some small changes, mainly to add the Yahoo pull-down refresh effect to it. As shown in:

 

③. Weather-lib is the Xiaomi weather source I shared with you earlier. It is only added to the local cache and is not described. For details, see http://blog.csdn.net/way_ping_li/article/details/29669045.

 

2. shows the main code structure:

 

Where:

Com. way. adapter: All adapters, including ListView and ViewPager.

Com. way. beans: where all Java beans are stored.

Com. way. common. util: stores all tool classes, such as network judgment, system tools, and time tools.

Com. way. db: the database management class used in this project. It is a file CityProvider. java, I prefer to use ContentProvider. It is more convenient than directly operating the database. Besides, I can process multiple tables in a database at the same time, but the uri is different. When I switch the case, I just need to judge more.

Com. way. fragment: Fragment used in this project. There is only one file.

Com. way. ui. view: all custom views. It is worth mentioning that TouchDispatchView is the View for allocating touch events, because this Code uses scrollview as the pull-down refresh, and ListView is used to display data, therefore, both views require touch events, and a parent container is required to allocate their touch events.

Com. way. yahoo: the package of all activities.

 

Well, today is the end. We will analyze the following three aspects in detail next time:

①. The main interface is blurred and the background slides.

②. Processing of multiple types of items in ListView and GridView.

③ ViewPager uses fragment cache and optimization.

Thank you!

 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.