mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
46 lines
1,001 B
Bash
46 lines
1,001 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Generate a java file providing the mapping of class name to xml file
|
||
|
# name that Android's system requires but doesn't provide. I hate
|
||
|
# leaving that sort of thing to chance.
|
||
|
|
||
|
mkClass() {
|
||
|
XMLFILE=$1
|
||
|
NAME=${XMLFILE/.xml/}
|
||
|
cat <<EOF
|
||
|
|
||
|
public static class ${NAME} extends BasePrefsFrag {
|
||
|
@Override
|
||
|
public int getResID() { return R.xml.${NAME}; }
|
||
|
}
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
cat <<EOF
|
||
|
/******************************************************************
|
||
|
* file generated by $0. Changes will be overwritten!!
|
||
|
******************************************************************/
|
||
|
|
||
|
package org.eehouse.android.xw4.gen;
|
||
|
|
||
|
import org.eehouse.android.xw4.PrefsActivity.BasePrefsFrag;
|
||
|
import org.eehouse.android.xw4.R;
|
||
|
|
||
|
public class PrefsWrappers {
|
||
|
EOF
|
||
|
|
||
|
IDS=""
|
||
|
while [ "$#" -gt 0 ]; do
|
||
|
FILE=$(basename $1)
|
||
|
mkClass $FILE
|
||
|
IDS="${IDS} R.xml.${FILE/.xml/}, "
|
||
|
shift
|
||
|
done
|
||
|
|
||
|
cat <<EOF
|
||
|
|
||
|
private static final int[] sIDS = {$IDS};
|
||
|
public static final int[] getPrefsResIDs() { return sIDS; }
|
||
|
}
|
||
|
EOF
|