From a4b39264fe36e7c318643e0a10aba43cb3e85e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=81=E9=97=B7=E5=BE=97=E6=92=9E=E5=A2=99?= <233900743@qq.com> Date: Sat, 23 Mar 2013 14:16:40 +0800 Subject: [PATCH 1/2] Use existed 9Patch pngs in device directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果机型目录下存在经过修改的9Patch png文件,优先使用机型目录下的文件来覆盖,否则在机型目录下对MIUI相应APP里的9Patch png文件作的任何修改将无效,那就无法根据各机型的屏幕特性来调整MIUI APP的UI了 --- fix_9patch_png.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fix_9patch_png.sh b/fix_9patch_png.sh index 1ed011a..765e9a4 100755 --- a/fix_9patch_png.sh +++ b/fix_9patch_png.sh @@ -45,6 +45,10 @@ for file in `find $TMP_ORIGINAL_DIR -name *.9.png`; do targetfile=`echo $file | sed -e "s/-original/-target/"` cp $file $targetfile done +for file in `find $1 -name *.9.png`; do + targetfile=$3/`echo $file | sed -e "s/$1/$1-target/"` + cp $file $targetfile +done cd $TMP_TARGET_DIR #only store all files, not compress files #as raw resource can't be compressed. From 367303fb38288f0584c7183aef626b0af13153b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=81=E9=97=B7=E5=BE=97=E6=92=9E=E5=A2=99?= <233900743@qq.com> Date: Sat, 23 Mar 2013 16:42:06 +0800 Subject: [PATCH 2/2] improve the code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改进循环代码,加入新的判断:当机型目录下存在经过修改的9Patch png文件,则跳过该文件,不用MIUI原来的资源覆盖。 --- fix_9patch_png.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fix_9patch_png.sh b/fix_9patch_png.sh index 765e9a4..2cd9963 100755 --- a/fix_9patch_png.sh +++ b/fix_9patch_png.sh @@ -43,11 +43,16 @@ unzip $TMP_ORIGINAL_FILE -d $TMP_ORIGINAL_DIR unzip $TMP_TARGET_FILE -d $TMP_TARGET_DIR for file in `find $TMP_ORIGINAL_DIR -name *.9.png`; do targetfile=`echo $file | sed -e "s/-original/-target/"` - cp $file $targetfile -done -for file in `find $1 -name *.9.png`; do - targetfile=$3/`echo $file | sed -e "s/$1/$1-target/"` - cp $file $targetfile + flag=0 + for file2 in `find $1 -name *.9.png`; do + if [ $file = $file2 ]; then + flag=1 + break + fi + done + if [ -z $flag ]; then + cp $file $targetfile + fi done cd $TMP_TARGET_DIR #only store all files, not compress files