CN110399130A - A kind of APP skin change method based on android system - Google Patents

A kind of APP skin change method based on android system Download PDF

Info

Publication number
CN110399130A
CN110399130A CN201910641321.2A CN201910641321A CN110399130A CN 110399130 A CN110399130 A CN 110399130A CN 201910641321 A CN201910641321 A CN 201910641321A CN 110399130 A CN110399130 A CN 110399130A
Authority
CN
China
Prior art keywords
skin
resource
change
app
android system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910641321.2A
Other languages
Chinese (zh)
Other versions
CN110399130B (en
Inventor
李君�
谭雪松
朱震宇
张飞龙
余亭亭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guojin Securities Co Ltd
Original Assignee
Guojin Securities Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guojin Securities Co Ltd filed Critical Guojin Securities Co Ltd
Priority to CN201910641321.2A priority Critical patent/CN110399130B/en
Publication of CN110399130A publication Critical patent/CN110399130A/en
Application granted granted Critical
Publication of CN110399130B publication Critical patent/CN110399130B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a kind of APP skin change methods based on android system, include the following steps: S1: creation skin resource, write compilation script, and generation is changed skin file and is packaged;S2: the skin file being packaged in step S1 being loaded into and is changed in skin frame, and the skin frame that changes includes resource manager, skin renewal manager and resource object;S3: the UI component for needing to change skin is adapted to via UI adaptation layer, and loads related resource automatically by changing skin frame to achieve the purpose that change skin.APP skin change method based on android system provided by the invention, complete skin file generation packing, the load of skin file and the replacement of the dynamic of caching and skin, take into account performance and multifarious requirement, take modular design, so that skin operating process is relatively independent with changing in business for the production of skin, the development efficiency of developer is greatly improved.

Description

A kind of APP skin change method based on android system
Technical field
The present invention relates to a kind of APP skin change method more particularly to a kind of APP skin change methods based on android system.
Background technique
In existing Android system, when developing APP, in order to meet the individual demand of user, APP can be generally provided and changed Skin function is used to user.The smart phone of various different operating systems is such.
APP loads different skin, is exactly for refinement: it is required that the different controls in APP can be under different themes Show different patterns.Relatively conventional theme has theme, night theme in the daytime, and the power of ambient light is mainly pressed for user And selection manually or automatically.This is most commonly seen in reading class APP.
Existing APP, Android system is mainly the following skin change method at present:
1. changing skin by the primary Night realization of Google.But the program only supports two kinds of skins of black and white at present, And the problem of may result in splashette when switching;
2. by traversal root layout come the skin of switching at runtime view (View).The program is due to needing since root layout Recursion cycle, therefore can be lossy in performance;
3. the correlation technique of the AssetManager of rewriting system changes skin to realize by way of reflection;It can support more Kind skin, and support dynamic seamless switching, this method is the operational version compared with mainstream at present.But Android 9.0 starts to limit The use for hiding API is made, therefore version of the program in Android 9.0 and later may not will be available.
Due to belonging to a kind of mode of hacker rewriteeing AssetManager correlation API in SDK by way of reflection, According to the evolution of Android version, with certain uncertainty.It is strictly limited in Android 9.0 and its later version, Google APP has been made using API is hidden, can not have been accessed, can only be called by the reflection mechanism of Java by the API Calls mode of display Related API, so in Android 9.0 and its above version, this method faces uncertainty, serious to will lead to APP sudden strain of a muscle and move back.Cause This, need it is a kind of stable, convenient and efficient, can dynamic seamless switching APP skin change method.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of APP skin change methods based on android system, solve current APP Skin change method splashette that may be present, the problem of performance loss and system compatible uncertainty.
The present invention changes the technical solution adopted is that providing a kind of APP based on android system to solve above-mentioned technical problem Skin method includes the following steps: S1: creation skin resource, writes compilation script, and generation is changed skin file and is packaged;S2: by step The skin file being packaged in S1, which is loaded into, to be changed in skin frame, and the skin frame that changes includes resource manager, skin renewal manager And resource object;S3: the page for needing to change skin is adapted to by user interface adaptation layer, via change skin frame load resource object into Row changes skin.
Further, the step S1 is specifically included: S11: in the exploitation environment Android studio of Android system New projects are created, and add the resource file that money needs to change skin, the resource includes color value and picture;S12: in step s 11 The compilation script for compiling skin is write in app gradle file in the project of creation, the compilation script is gradle Script;S13: resource file is packaged to generate and be changed needed for skin by the compilation script by Android studio compilation tool Resource compressed file.
Further, the step S2 is specifically included: S21: user interface adaptation layer is obtained by skin renewal manager User Defined Resource object, and by changing skin resource needed for User Defined Resource object acquisition: User Defined Resource object judges whether It needs to change skin, changes skin if necessary, then skin resource is accordingly changed by resource manager acquisition, otherwise obtained by former resource object Former skin resource;S22: resource manager includes color value and picture according to the resource type for changing skin, in dynamically load step S13 Resource compressed file, and loading velocity is accelerated by the lru algorithm of caching mechanism.
Further, the resource number for needing to change the page of skin is converted into corresponding to by resource manager in the step S22 Resource name, be then matched to corresponding resource in resource compressed file and load by resource name.
Further, the step S3 includes: S31: user interface adaptation layer is made by oneself via the return of skin renewal manager Adopted resource object, while user interface adaptation layer provides application programming interfaces, user interface passes through application programming interfaces acquisition pair The resource answered;S32: it needs to change the page of skin by the User Defined Resource object obtained in S31, is loaded by resource number all kinds of Change skin resource;S33: user interface adaptation layer is in the base class of user interface, to skin renewal manager registration skin renewal Monitor is adjusted back, the base class is Activity or Fragment;S34: changing after the completion of skin, and skin renewal manager notifies institute There is monitor skin to update.
Further, the page for needing to change skin rewrites getResources () by Activity base class to obtain money Source object.
Further, the Business Logic completes corresponding UI refreshing by the monitor of readjustment.
The present invention, which compares the prior art, to be had following the utility model has the advantages that APP based on android system provided by the invention changes skin Method, complete skin file generate be packaged, the load of skin file is replaced with the dynamic of caching and skin, take into account performance and more The requirement of sample takes modular design so that the production of skin in business to change skin operating process relatively independent, Greatly improve the development efficiency of developer.
Detailed description of the invention
Fig. 1 is APP skin change method flow chart based on android system in the embodiment of the present invention;
Fig. 2 is APP skin change method block diagram based on android system in the embodiment of the present invention.
Specific embodiment
The invention will be further described with reference to the accompanying drawings and examples.
Fig. 1 is APP skin change method flow chart based on android system in the embodiment of the present invention;Fig. 2 is the embodiment of the present invention In APP skin change method block diagram based on android system.
Referring to Figure 1, the APP skin change method based on android system of the embodiment of the present invention, includes the following steps:
S1: creation skin resource is write compilation script (gradle script), and generation is changed skin file and is packaged;
S2: the skin file being packaged in step S1 being loaded into and is changed in skin frame, and the skin frame that changes includes resource management Device, skin renewal manager and resource object;
S3: the page for needing to change skin is adapted to by UI adaptation layer, and is carried out eventually by skin frame load resource object is changed Change skin.
It is also most commonly seen one of four big components that Activity, which is most basic in Android component,.Android tetra- is big Component has Activity, Service service, the offer of Content Provider content, BroadcastReceiver broadcast reception Device.
Fig. 2, the APP skin change method based on android system of the embodiment of the present invention are referred to, step S1 is specifically included: S1: Skin resource is created, is write compilation script (gradle script), generation is changed skin file and is packaged;
S2: the skin file being packaged in step S1 being loaded into and is changed in skin frame, and the skin frame that changes includes resource management Device, skin renewal manager, resource object;
S3: the page for needing to change skin is adapted to by UI adaptation layer, and is carried out eventually by skin frame load resource object is changed Change skin.
Specifically, the APP skin change method based on android system of the embodiment of the present invention, step S2 are specifically included: S21:UI Adaptation layer obtains customized resource object by skin renewal manager, and UI is by changing skin resource needed for resource object acquisition (color value, picture etc.);
S22: resource object, which judges, to be analysed whether to change skin, if you do not need to changing skin, then obtains phase by former resource object Answer resource.Otherwise it is obtained by resource manager and accordingly changes skin resource;
S23: resource manager meeting basis is changed in resource type (color value, picture etc.) the dynamically load step S13 of skin Resource compressed file, and loading velocity is accelerated by caching (lru algorithm) mechanism;
The resource number for needing to change the page of skin is converted into corresponding resource name by the User Defined Resource returned in step S23 Claim, corresponding resource is then matched in resource compressed file by resource name.
Specifically, the APP skin change method based on android system of the embodiment of the present invention, step S3 includes: S31:UI adaptation Layer can rewrite getResources method so as to return customized resource object (by update manager return to the resource object), Other API can also be provided simultaneously so that UI obtains corresponding resource (color value, picture etc.);
S32: it needs to change the page of skin by the User Defined Resource object obtained in S31, (is indirectly passed through by resource ID Resource manager in S23) load is all kinds of changes skin resource (resource ID can be converted into resource name by resource manager, and be passed through Skin is changed in the resource completion that resource name is matched in resource compressed file);
S33:UI adaptation layer can be registered in UI base class (Activity or Fragment) to skin renewal manager The readjustment monitor of skin renewal;
S34: changing after the completion of skin, and skin renewal manager notifies all monitor skins to update.
UI adaptation layer obtains customized resource object by rewriteeing the getResources () of Activity.Service logic Layer is completed corresponding UI by the monitor of readjustment and is refreshed.
In conclusion APP skin change method based on android system provided by the invention, completion skin file generation packing, The load of skin file is replaced with the dynamic of caching and skin, is taken into account performance and multifarious requirement, is taken modular Design greatly improves opening for developer so that skin operating process is relatively independent with changing in business for the production of skin Send out efficiency.
Although the present invention is disclosed as above with preferred embodiment, however, it is not to limit the invention, any this field skill Art personnel, without departing from the spirit and scope of the present invention, when can make a little modification and perfect therefore of the invention protection model It encloses to work as and subject to the definition of the claims.

Claims (7)

1. a kind of APP skin change method based on android system, which comprises the steps of:
S1: creation skin resource writes compilation script, and generation is changed skin file and is packaged;
S2: the skin file being packaged in step S1 being loaded into and is changed in skin frame, and the skin frame that changes includes resource manager, skin Skin updates manager and resource object;
S3: the page for needing to change skin is adapted to by user interface adaptation layer, carries out changing skin via skin frame load resource object is changed.
2. APP skin change method based on android system as described in claim 1, which is characterized in that the step S1 is specifically wrapped It includes:
S11: creating new projects in the exploitation environment Android studio of Android system, and add the resource for needing to change skin, The resource includes color value and picture;
S12: writing the compilation script for compiling skin in the app gradle file in the project created in step s 11, The compilation script is gradle script;
S13: resource file is compiled by Android studio compilation tool and is packaged generation and change skin institute by the compilation script The resource compressed file needed.
3. APP skin change method based on android system as described in claim 1, the step S2 are specifically included:
S21: user interface adaptation layer obtains customized resource object by skin renewal manager, and passes through User Defined Resource pair Change skin resource as needed for obtaining: User Defined Resource object judges whether to need to change skin, changes skin if necessary, then pass through resource pipe Reason device acquisition accordingly changes skin resource, otherwise obtains former skin resource by former resource object;
S22: resource manager includes color value and picture according to the resource type for changing skin, the resource pressure in dynamically load step S13 Contracting file, and loading velocity is accelerated by the lru algorithm of caching mechanism.
4. APP skin change method based on android system as claimed in claim 3, which is characterized in that resource in the step S22 The resource number for needing to change the page of skin is converted into corresponding resource name by manager, then by resource name in resource pressure It is matched to corresponding resource in contracting file and loads.
5. APP skin change method based on android system as claimed in claim 4, which is characterized in that the step S3 includes:
S31: user interface adaptation layer returns to customized resource object, while user interface adaptation layer via skin renewal manager Application programming interfaces are provided, user interface obtains corresponding resource by application programming interfaces;
S32: needing to change the page of skin by the User Defined Resource object that obtains in S31, is loaded by resource number and all kinds of changes skin Resource;
S33: user interface adaptation layer is in the base class of user interface, to the readjustment prison of skin renewal manager registration skin renewal Device is listened, the base class is Activity or Fragment;
S34: changing after the completion of skin, and skin renewal manager notifies all monitor skins to update.
6. APP skin change method based on android system as claimed in claim 5, which is characterized in that the page for needing to change skin Face rewrites getResources () by Activity base class to obtain customized resource object.
7. APP skin change method based on android system as claimed in claim 5, which is characterized in that the Business Logic is logical The monitor for crossing readjustment is completed corresponding user interface and is refreshed.
CN201910641321.2A 2019-07-16 2019-07-16 APP skin changing method based on android system Active CN110399130B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910641321.2A CN110399130B (en) 2019-07-16 2019-07-16 APP skin changing method based on android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910641321.2A CN110399130B (en) 2019-07-16 2019-07-16 APP skin changing method based on android system

Publications (2)

Publication Number Publication Date
CN110399130A true CN110399130A (en) 2019-11-01
CN110399130B CN110399130B (en) 2023-10-20

Family

ID=68325695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910641321.2A Active CN110399130B (en) 2019-07-16 2019-07-16 APP skin changing method based on android system

Country Status (1)

Country Link
CN (1) CN110399130B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625312A (en) * 2020-05-19 2020-09-04 小船出海教育科技(北京)有限公司 APP skin changing method and device, electronic equipment and storage medium
CN112231031A (en) * 2020-10-16 2021-01-15 蜂助手股份有限公司 Dynamic skin changing method and device for application program

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020103817A1 (en) * 2001-01-31 2002-08-01 Novak Michael J. Methods and systems for synchronizing skin properties
KR20110114754A (en) * 2010-04-14 2011-10-20 (주)앵글스톤테크놀러지 Media containing a program convert sk-vm and wipi-java application to android application
CN102810060A (en) * 2011-06-01 2012-12-05 腾讯科技(深圳)有限公司 Method and device for configuring Android picture resource
CN103019781A (en) * 2012-12-04 2013-04-03 广东欧珀移动通信有限公司 Rapid skin changing method based on Android system
CN103942037A (en) * 2013-01-17 2014-07-23 阿里巴巴集团控股有限公司 Method and device for theme replacement of mobile device
US20140282371A1 (en) * 2013-03-14 2014-09-18 Media Direct, Inc. Systems and methods for creating or updating an application using a pre-existing application
CN104850440A (en) * 2015-05-25 2015-08-19 广州市久邦数码科技有限公司 Android system based resource loading method and system therefor
CN106802794A (en) * 2016-12-20 2017-06-06 智车优行科技(北京)有限公司 Method for switching theme, device, vehicle and system
CN108804188A (en) * 2018-05-30 2018-11-13 珠海市君天电子科技有限公司 Changing an interface skin method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020103817A1 (en) * 2001-01-31 2002-08-01 Novak Michael J. Methods and systems for synchronizing skin properties
KR20110114754A (en) * 2010-04-14 2011-10-20 (주)앵글스톤테크놀러지 Media containing a program convert sk-vm and wipi-java application to android application
CN102810060A (en) * 2011-06-01 2012-12-05 腾讯科技(深圳)有限公司 Method and device for configuring Android picture resource
CN103019781A (en) * 2012-12-04 2013-04-03 广东欧珀移动通信有限公司 Rapid skin changing method based on Android system
CN103942037A (en) * 2013-01-17 2014-07-23 阿里巴巴集团控股有限公司 Method and device for theme replacement of mobile device
US20140282371A1 (en) * 2013-03-14 2014-09-18 Media Direct, Inc. Systems and methods for creating or updating an application using a pre-existing application
CN104850440A (en) * 2015-05-25 2015-08-19 广州市久邦数码科技有限公司 Android system based resource loading method and system therefor
CN106802794A (en) * 2016-12-20 2017-06-06 智车优行科技(北京)有限公司 Method for switching theme, device, vehicle and system
CN108804188A (en) * 2018-05-30 2018-11-13 珠海市君天电子科技有限公司 Changing an interface skin method and device

Non-Patent Citations (12)

* Cited by examiner, † Cited by third party
Title
80级萌新: "Android Studio概览", Retrieved from the Internet <URL:https://blog.csdn.net/qq_30183767/article/details/88555528> *
ANDY连长: "fragment详解", Retrieved from the Internet <URL:https://blog.csdn.net/u010586698/article/details/51154241?ops_request_misc=&request_id=&biz_id=102&utm_term=%E5%9F%BA%E7%B1%BB%E4%B8%BAfragment%E5%B0%B1%E6%98%AFActivity%E7%9A%84&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-9-51154241.142^v86^control_2,239^v2^insert_chatgpt&spm=1018.2226.3001.4187> *
ANDY连长: "Fragment详解", Retrieved from the Internet <URL:https://blog.csdn.net/u010586698/article/details/51154241> *
ITERHUI: "android studio的安装", Retrieved from the Internet <URL:https://blog.csdn.net/qq_41976613/article/details/91432304?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168352612516800182141662%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=168352612516800182141662&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-8-91432304-null-null.142^v86^control_2,239^v2^insert_chatgpt&utm_term=android%20studio&spm=1018.2226.3001.4187> *
KAYDEN_LI: "Android入门篇", Retrieved from the Internet <URL:https://blog.csdn.net/systemlsy/article/details/78508132> *
YU-KNIGHT: "Android-Fragment基本使用及向下兼容", Retrieved from the Internet <URL:https://blog.csdn.net/u014657752/article/details/48058589> *
张行之: "Fragment的基本使用", Retrieved from the Internet <URL:https://blog.csdn.net/qq_33689414/article/details/73431054> *
愁容: "Fragment基本使用(二)——动态加载", Retrieved from the Internet <URL:https://blog.csdn.net/liuqiang_dd/article/details/52614404> *
派派的生活: "android动态换肤框架实现", 《CSDN博客,HTTPS://BLOG.CSDN.NET/MIKE_CUI_LS/ARTICLE/DETAILS/79688606》 *
派派的生活: "android动态换肤框架实现", 《CSDN博客,HTTPS://BLOG.CSDN.NET/MIKE_CUI_LS/ARTICLE/DETAILS/79688606》, 25 March 2018 (2018-03-25), pages 3 *
羊子雄起: "Android Studio安装配置、环境搭建详细步骤", Retrieved from the Internet <URL:https://blog.csdn.net/comeonyangzi/article/details/91452036> *
陈淡;: "Android机顶盒主题切换的设计与实现", 有线电视技术, no. 12 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625312A (en) * 2020-05-19 2020-09-04 小船出海教育科技(北京)有限公司 APP skin changing method and device, electronic equipment and storage medium
CN112231031A (en) * 2020-10-16 2021-01-15 蜂助手股份有限公司 Dynamic skin changing method and device for application program

Also Published As

Publication number Publication date
CN110399130B (en) 2023-10-20

Similar Documents

Publication Publication Date Title
US10795660B1 (en) Live code updates
Carette et al. Investigating the energy impact of android smells
CN110825362A (en) Low-code application software development system and method
CN109491695A (en) A kind of increment updating method of integrated Android application
CN109670951B (en) Block chain intelligent contract debugging and publishing method and system
CN104731589A (en) Automatic generation method and device of user interface (UI)
Wittern et al. Opportunities in software engineering research for web API consumption
US20100262956A1 (en) Software development support apparatus, function extension method and storage medium for storing function extension program
CN109144533A (en) A kind of method, system and the computer installation of update and the load of application program
WO2019005228A1 (en) Automated source code adaption to inject features between platform versions
CN105512304A (en) Method for generating internet applications on line, system integration method and supporting platform
CN103544100A (en) Method, system and client side for testing APP of portable data processing equipment
Einarsson et al. SmarthomeML: Towards a domain-specific modeling language for creating smart home applications
CN104657384A (en) Dynamic allocation report data processing method based on two-dimension relationship
CN110399130A (en) A kind of APP skin change method based on android system
CN115328454A (en) Program compiling and program loading method
US20180260198A1 (en) Instrumenting program code
CN109871241A (en) A kind of configuration method of Cross-environment application server
CN112860260A (en) Web-based cross-platform application construction tool and method in college scene
CN102999371B (en) Interface Development method and system based on Lua script
WO2022235380A1 (en) Automatic performance telemetry
CN109753281B (en) Micro-grid energy management strategy visualization development tool based on graphical programming
CN101136780A (en) Method, system to obtain user command information, and user command registered device
Mannadiar et al. Domain-specific engineering of domain-specific languages
CN110457013A (en) Program assembly configuration device and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant