〖android〗 based on resource information, Mock Android Resources

Source: Internet
Author: User

1#!/bin/bash-2#===============================================================================3 #4# file:mock_res.SH5 # 6# USAGE:./mock_res.SH 7 # 8 # DESCRIPTION:9 # Ten# OPTIONS:--- One# REQUIREMENTS:--- A# BUGS:--- -# NOTES:--- - # author:linkscue (scue), [email protected] the # ORGANIZATION: - # created:2014 August 06 20:37 46 sec CST -# REVISION:--- -#=============================================================================== +  - # Incoming Parameters +# $1: Mock program catalog Android Create Project . A# $2: Mock resource type such as style/appmytheme String/app_name_emm. at Android_res_mock () { -     dir=$1 -res=$2 -restype=$ (Echo$res |awk-F'/' '{print $}') -     Echo "processing $res" -      Case$restypeinch in XML) -# TODO:CP topath=$dir/res/${res}.xml +             mkdir-P $ (dirname$path) -             CP./empty_xml.xml $path the             ;; * drawable) $# TODO:TouchPanax Notoginsengpath=$dir/res/${res}.png -             mkdir-P $ (dirname$path) the             Touch$path +             ;; A         string ) the# TODO:sed-I +path=$dir/res/values/Strings.xml -             mkdir-P $ (dirname$path) $string_name=$ (Echo$res |awk-F'/' '{print $}') $String_model='<string name= "Mock_string_modol" >mock_string_modol</string>' -string_model_file=/tmp/Mock_string_model.txt -string_empty_file=./Empty_strings.xml # TODO: Absolute path the             Echo "$string _model">$string _model_file -             sed-I."s/mock_string_modol/$string _name/g"$string _model_fileWuyiTest! -E $path &&CP$string _empty_file $path the             grep-QF \"$string _name\ "$path | | sed-i"2R $string _model_file"$path -             RM-F $string _model_file Wu             ;; - style) About# TODO:sed-I $path=$dir/res/values/Styles.xml -             mkdir-P $ (dirname$path) -style_name=$ (Echo$res |awk-F'/' '{print $}') -Style_model='<style name= "Mock_style_model" parent= "Android:Theme.Light" ></style>' Astyle_model_file=/tmp/Mock_style_model.txt +style_empty_file=./Empty_styles.xml the             Echo "$style _model">$style _model_file -             sed-I."s/mock_style_model/$style _name/g"$style _model_file $Test! -E $path &&CP$style _empty_file $path the             grep-QF \"$style _name\ "$path | | sed-i"1R $style _model_file"$path the             RM-F $style _model_file the             ;; the* ) -Err"Unknown resource type, please feedback to [email protected]" inExit1 the     Esac the } About  the # Call Method the  forIinch$(Cat./res_list.txt); Do theAndroid_res_mock./app $i +  Done

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.