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!