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