If I were to redesign an android App

Source: Internet
Author: User

Selection of development tools

Development tools I will choose Android Studio, which is the official Google-designated Android development tool, is currently 1.2.2 stable version, 1.3 of the preview has been released. There's no need to say much about Android studio, and most of the Android open source libraries on GitHub have migrated to Android studio, and using Android Studio makes it extremely easy to integrate open source libraries when no jar files are available. Most importantly, Google has announced that it will stop all support to eclipse Android development tools by the end of the year (Google Ends supports for Android Eclipse tools), so please move to Android soon Studio comes up.

App design Style

For a developer, it seems that there is no right to decide, and the final decision is in the product department. In spite of this, I will try to persuade the product department to design the app into material style. This is a lot of tears, as an Android developer, but all day development of iOS-style apps, I believe many companies, in order to save costs and time, Android and iOS share a set of UI. For one of the most common examples, the Android app has a back button in the top left corner of each page titlebar, which is required in iOS, but Android has a return key, so the design is completely superfluous for Android. Sincerely hope that the product designers respect the style of each operating system and the use of habits, do not design nondescript products. Material design provides just one such specification, since the release of the MD specification, its elegant designs and fresh style has attracted a large number of designers and developers, now MD design not only on Android (the official class Library support MD style), even in CSS, HTML, JavaScript Web design is getting more and more fire. So, for the app design style, Material designs, perhaps you've missed Android design, please don't miss Material design.

A few RELATED links:

Material Design Official website

Material Design Color Templates

MD A Design Case website

MD-style Andorid drawer Source: Android-materialdesign-navigationdrawer

MD style of an app source (with sister OH): Android-materialdesign-dbmz

Version support

For Android to support the minimum version, you can refer to each version of the market share, in fact, the most reliable is based on the Home app statistics to decide, currently our app minimum support 2.2. In personal view, although the 2.x version still has some users, but in fact, the mobile phone replacement is particularly fast, in order to better user experience, but also to apply the updated API (many third-party libraries also have version requirements), should increase the minimum supported version, about 3.0 advisable, that is, API level 11.

App Framework Design

I believe we all have experience, with the increase in function modules, the app is getting bigger, if there is no good architecture design, the code will become bloated and difficult to maintain, the coupling of the functional modules will be more and more high. Therefore, the app can be modularized, and a complete app can be divided into several relatively independent modules, which reduces the coupling between modules and facilitates reuse.

1. Network module

There are very few stand-alone apps, most of which need to be networked and request data from the server, so network module modules are essential. There are also many open source network frameworks on GitHub, and I think we can use the open source framework, and I will now choose okhttp or volley, and perhaps a better network framework will emerge later. Note that if you use an open source framework, you must read its source code, and you must be able to navigate it so that you don't get stuck when bugs occur. Of course, you can also write your own network module, the current application network module is completely self-written, the advantage is that they are familiar with the code written, when there are bugs can quickly locate the problem, while attention to deal with some of the networking process details, such as:

(1) Support for HTTPS, authentication of HTTPS certificate (many of the current practices are the default to allow all HTTPS certificates, in fact, it is not safe to do so, should really do certificate verification)

(2) Support WAP mode Internet, Mobile, Unicom, telecom agent Settings

(3) Support redirection, data compression transmission, etc.

(4) Other notable issues

Writing your own web framework can perfectly handle these details, but the cost of time is relatively large. If you use an open source framework, you generally do not deal with these details, so we can make some changes on the third-party framework so that the cost of time will be much reduced.

2. Image Management Module

The picture is also an important element in the app, and the picture is a big memory, so the picture management framework is of particular importance, and a bad picture frame can cause memory leaks or even crash. Of course, you can implement the picture frame (we also do so at present), to achieve the image download, decoding, caching and other key links. Personal suggestions can be used in some of the better picture library, perhaps more than our own management of the picture is more perfect and efficient. I will recommend the following several image management libraries:

(1) Glide,google Some of the official apps, such as Google Photos, have been used, but also to explain more?

(2) Fresco,facebook open Source Library, features super powerful, support WEBP, GIF, JPEG progressive display, the key is its image memory design idea, make the picture memory overhead greatly reduced.

(3) Android-universal-image-loader, before the appearance of the above image Library, it seems that the most fire bar, the previous personal app also used it.

(4) Picasso,square Open Source Library, it is said that glide is the reference Picasso design.

3. Local Database Module

Perhaps your app needs a local database, so it is recommended that you use a popular ORM framework, such as Activeandroid or Greendao, and using a third-party library will greatly facilitate your operation with SQLite, Personally, we need to pay attention to database upgrade and multi-threaded concurrent operation database in the use of the problem.

4. File Management Module

An app that will definitely involve some files, such as profiles, images, videos, audio, sharedpreferences files, and so on. We can provide a global file management module, responsible for file expansion, deletion, change, check and other operations. Also need to support file compression, file upload and download operations, for download needs to support multi-threaded concurrent Download, breakpoint continued to transmit and other functions.

5. Communication mechanism between components and components

For an app, the component communication is essential, the communication type can be divided into point-to-point and the point opposite the communication, point-to-point that only a unique receiver can respond to the message, the opposite point is similar to the message broadcast, that is, all registered can respond to the message. In Android, the message mechanism is usually used, but the coupling of the message mechanism is higher. There are also communication frameworks, such as Eventbus, Otto, and other event bus frameworks that can greatly reduce coupling between components, but do not achieve the perfect point-to-point communication, so it is recommended that the messaging mechanism be used in conjunction with the event bus mechanism.

6. Data Processing Framework

In fact, there should be a data processing framework, when the request (Walk the child thread), the network module return data (generally JSON format), JSON data is generally not directly to the view layer to use, need to parse into the corresponding model, and if necessary, but also to cache data, So these processes can be abstracted into a framework of data processing. This framework can be considered to accept the URL of the data request and return the data model to the activity or fragment. For JSON data parsing, it is recommended to use Fastjson, which is fast and stable, and the default value is more perfect.

7. Thread Scheduling module

In fact, there are many operations in Android, such as request data, download pictures, clear the cache and so on are required to execute in the sub-thread, often many times is directly from a thread to do, it will be messy and more threads will be difficult to manage. So you can abstract a thread scheduling module, it maintains a pool of threads, if there is a need to thread scheduling module to take the thread to do, so it is convenient for unified management. Of course, thread operations in third-party libraries we will not be able to be managed by the thread dispatch module, but other threading-related operations should be handled uniformly.

8. Business Layer

The business layer is probably the four components, the Fragment, the view, it is recommended to use native components as much as possible, and less custom components, because native component performance is the best. In addition, it is recommended to use the MVC model, as long as the design to manage their own logic, as for the MVP, MVVM and other modes of personal opinion are flawed, in short, seek a compromise, there will be lost.

9.APK Dynamic loading mechanism

As the app grows and the functionality expands, many apps are already using the APK dynamic loading mechanism, which can also be called plug-in. Because I did not apply in the actual app, so inconvenient to post too many comments. But this mechanism is personally considered promising, and this mechanism will be conducive to the decoupling of apps, functional expansion and local upgrades. Refer to a commercially available solution: The apkplug-Mobile application modular solution and an open source apk dynamic loading framework.

Security Considerations for 10.APP

Security issues for Android apps are rarely appreciated, but this is really a serious problem, and some good apps are often cracked. It is recommended to write some core algorithms such as. So library, important logic on the server side, data requests using encryption, and other packaging apk at least to confuse the code, you can also use the APK shell mechanism, in short, this kind of precautions never too much.

A sigh of no logic to write so much, there may be missing content, follow-up will be supplemented. I think if you follow the above principles, at least you can develop a good app.



If I were to redesign an android App

Related Article

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.