changes
This commit is contained in:
69
android-app/misc/other/prepare_avds.sh
Normal file
69
android-app/misc/other/prepare_avds.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
declare -a densities=("160" "213" "240" "320")
|
||||
declare -a resolutions=("480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for density in ${densities[@]}
|
||||
do
|
||||
|
||||
for resolution in ${resolutions[@]}
|
||||
do
|
||||
name="AVD"
|
||||
name="$name$density"
|
||||
name="$name$resolution"
|
||||
name="$name$target"
|
||||
|
||||
echo "Creating AVD $name"
|
||||
echo "Density: $density"
|
||||
echo "Resolution: $resolution"
|
||||
echo "Target: $target"
|
||||
|
||||
$ANDROID_HOME/tools/android -s create avd -n $name -t $target -b x86 --force -s $resolution
|
||||
|
||||
if grep -R "hw.lcd.density" $HOME/.android/avd/$name.avd/config.ini
|
||||
then
|
||||
# replace density in config.ini
|
||||
sed -i "s/hw.lcd.density=240/hw.lcd.density=$density/g" $HOME/.android/avd/$name.avd/config.ini
|
||||
else
|
||||
# code if not found
|
||||
echo "hw.lcd.density=$density" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
fi
|
||||
|
||||
echo "sdcard.size=64M" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
echo "vm.heapSize=48" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
echo "hw.ramSize=256" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
|
||||
#arr=(${resolution//x/ })
|
||||
|
||||
#echo "hw.lcd.width = ${arr[0]}" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
#echo "hw.lcd.height = ${arr[1]}" >> $HOME/.android/avd/$name.avd/config.ini
|
||||
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for density in ${densities[@]}
|
||||
do
|
||||
|
||||
for resolution in ${resolutions[@]}
|
||||
do
|
||||
name="AVD"
|
||||
name="$name$density"
|
||||
name="$name$resolution"
|
||||
name="$name$target"
|
||||
|
||||
$ANDROID_HOME/tools/emulator -avd $name &
|
||||
$ANDROID_HOME/tools/monkeyrunner ./wait_device.py
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
|
||||
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
|
24
android-app/misc/other/remove_avds.sh
Normal file
24
android-app/misc/other/remove_avds.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
declare -a densities=("160" "213" "240" "320")
|
||||
declare -a resolutions=("320x480" "480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768" "1536x1152" "1920x1200")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for density in ${densities[@]}
|
||||
do
|
||||
|
||||
for resolution in ${resolutions[@]}
|
||||
do
|
||||
name="AVD"
|
||||
name="$name$density"
|
||||
name="$name$resolution"
|
||||
name="$name$target"
|
||||
|
||||
$ANDROID_HOME/tools/android -s delete avd -n $name
|
||||
|
||||
done
|
||||
done
|
||||
done
|
77
android-app/misc/other/take_screenshots.py
Normal file
77
android-app/misc/other/take_screenshots.py
Normal file
@@ -0,0 +1,77 @@
|
||||
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
|
||||
import time
|
||||
|
||||
import sys
|
||||
|
||||
outFolder = sys.argv[1]
|
||||
outFilename = sys.argv[2]
|
||||
|
||||
print ''
|
||||
print 'Screenshot will be located in ' + outFolder + ' with name ' + outFilename;
|
||||
|
||||
apk = '/home/serso/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25/calculatorpp.apk'
|
||||
package = 'org.solovyev.android.calculator'
|
||||
activity = 'org.solovyev.android.calculator.CalculatorActivity'
|
||||
mobileActivity = 'org.solovyev.android.calculator.CalculatorActivityMobile'
|
||||
operatorsActivity = 'org.solovyev.android.calculator.math.edit.CalculatorOperatorsActivity'
|
||||
deviceName = 'emulator-5580'
|
||||
|
||||
def takeScreenshot (folder, filename):
|
||||
screenshot = device.takeSnapshot()
|
||||
screenshot.writeToFile(folder + '/' + filename + '.png','png')
|
||||
return
|
||||
|
||||
print 'Waiting for device ' + deviceName + '...'
|
||||
device = MonkeyRunner.waitForConnection(100, deviceName)
|
||||
|
||||
if device:
|
||||
|
||||
print 'Device found, removing application if any ' + package + '...'
|
||||
device.removePackage(package)
|
||||
|
||||
print 'Installing apk ' + apk + '...'
|
||||
device.installPackage(apk)
|
||||
|
||||
runComponent = package + '/' + activity
|
||||
|
||||
print 'Starting activity ' + runComponent + '...'
|
||||
device.startActivity(component=runComponent)
|
||||
|
||||
# sleep while application will be loaded
|
||||
MonkeyRunner.sleep(15);
|
||||
|
||||
print 'Taking screenshot...'
|
||||
#outFilename = outFilename + '_' + str(time.time())
|
||||
takeScreenshot(outFolder, outFilename);
|
||||
|
||||
runComponent = package + '/' + operatorsActivity
|
||||
|
||||
print 'Starting activity ' + runComponent + '...'
|
||||
device.startActivity(component=runComponent)
|
||||
|
||||
# sleep while application will be loaded
|
||||
MonkeyRunner.sleep(4);
|
||||
|
||||
print 'Taking screenshot...'
|
||||
#outFilename = outFilename + '_' + str(time.time())
|
||||
takeScreenshot(outFolder, outFilename + '_operators');
|
||||
|
||||
runComponent = package + '/' + mobileActivity
|
||||
|
||||
print 'Starting activity ' + runComponent + '...'
|
||||
device.startActivity(component=runComponent)
|
||||
|
||||
# sleep while application will be loaded
|
||||
MonkeyRunner.sleep(4);
|
||||
|
||||
print 'Taking screenshot...'
|
||||
#outFilename = outFilename + '_' + str(time.time())
|
||||
takeScreenshot(outFolder, outFilename + '_mobile');
|
||||
|
||||
print '#########'
|
||||
print 'Finished!'
|
||||
print '#########'
|
||||
else:
|
||||
print '#########'
|
||||
print 'Failure!'
|
||||
print '#########'
|
49
android-app/misc/other/take_screenshots.sh
Normal file
49
android-app/misc/other/take_screenshots.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
predefined=1
|
||||
scale=0.51
|
||||
|
||||
# first predefined
|
||||
|
||||
if [ $predefined -eq 1 ]
|
||||
then
|
||||
declare -a names=("AVD_Galaxy_Tab" "AVD_Nexus_S_by_Google" "AVD_Nexus_One_by_Google" "AVD_Nexus_7_by_Google" "AVD_Galaxy_Nexus_by_Google")
|
||||
for name in ${names[@]}
|
||||
do
|
||||
$ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name -scale $scale &
|
||||
sleep 50
|
||||
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
|
||||
sleep 3
|
||||
done
|
||||
fi
|
||||
|
||||
# then all others
|
||||
|
||||
declare -a densities=("160" "213" "240" "320")
|
||||
#declare -a densities=("213" "240" "320")
|
||||
declare -a resolutions=("480x640" "480x800" "480x854" "640x960" "1024x600" "1024x768" "1280x768")
|
||||
#declare -a resolutions=("480x640")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for density in ${densities[@]}
|
||||
do
|
||||
|
||||
for resolution in ${resolutions[@]}
|
||||
do
|
||||
name="AVD"
|
||||
name="$name$density"
|
||||
name="$name$resolution"
|
||||
name="$name$target"
|
||||
|
||||
$ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name -scale $scale &
|
||||
sleep 5
|
||||
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
|
||||
sleep 3
|
||||
|
||||
done
|
||||
done
|
||||
done
|
19
android-app/misc/other/take_screenshots2.sh
Normal file
19
android-app/misc/other/take_screenshots2.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
predefined=1
|
||||
scale=0.51
|
||||
|
||||
# first predefined
|
||||
|
||||
if [ $predefined -eq 1 ]
|
||||
then
|
||||
declare -a names=("AVD_Nexus_7_by_Google")
|
||||
for name in ${names[@]}
|
||||
do
|
||||
$ANDROID_HOME/tools/emulator -ports 5580,5581 -avd $name -scale $scale &
|
||||
sleep 50
|
||||
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/other/tmp/2012.11.25 $name
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5580 emu kill
|
||||
sleep 3
|
||||
done
|
||||
fi
|
10
android-app/misc/other/wait_device.py
Normal file
10
android-app/misc/other/wait_device.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
|
||||
|
||||
print 'Waiting for device...'
|
||||
device = MonkeyRunner.waitForConnection(100, 'emulator-5580')
|
||||
print 'Finished'
|
||||
if device :
|
||||
print 'Success'
|
||||
else :
|
||||
print 'Failure'
|
||||
|
Reference in New Issue
Block a user