Rename
This commit is contained in:
26
calculatorpp/misc/other/prepare_avds.sh
Executable file
26
calculatorpp/misc/other/prepare_avds.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
declare -a skins=("WVGA854" "WQVGA400" "HVGA" "WQVGA432" "WVGA800" "QVGA")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for skin in ${skins[@]}
|
||||
do
|
||||
$ANDROID_HOME/tools/android -s create avd -n AVD_$skin -t $target -b x86 -s $skin --force
|
||||
done
|
||||
done
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for skin in ${skins[@]}
|
||||
do
|
||||
avdDeviceName=AVD_$skin
|
||||
$ANDROID_HOME/tools/emulator -avd $avdDeviceName &
|
||||
$ANDROID_HOME/tools/monkeyrunner ./wait_device.py
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill
|
||||
done
|
||||
done
|
||||
|
||||
|
15
calculatorpp/misc/other/remove_avds.sh
Executable file
15
calculatorpp/misc/other/remove_avds.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
declare -a skins=("WVGA854" "WQVGA400" "HVGA" "WQVGA432" "WVGA800" "QVGA")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for skin in ${skins[@]}
|
||||
do
|
||||
$ANDROID_HOME/tools/android -s delete avd -n AVD_$skin
|
||||
done
|
||||
done
|
||||
|
||||
|
58
calculatorpp/misc/other/take_screenshots.py
Normal file
58
calculatorpp/misc/other/take_screenshots.py
Normal file
@@ -0,0 +1,58 @@
|
||||
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/target/calculatorpp-1.5.2-SNAPSHOT.apk'
|
||||
package = 'org.solovyev.android.calculator'
|
||||
activity = 'org.solovyev.android.calculator.CalculatorActivity'
|
||||
deviceName = 'emulator-5554'
|
||||
|
||||
def takeScreenshot (folder, filename):
|
||||
screenshot = device.takeSnapshot()
|
||||
screenshot.writeToFile(folder + '/' + filename + '.png','png')
|
||||
return
|
||||
|
||||
print 'Waiting for device ' + deviceName + '...'
|
||||
device = MonkeyRunner.waitForConnection(30, deviceName)
|
||||
|
||||
if device:
|
||||
# unlock device
|
||||
device.wake()
|
||||
device.drag((130, 620), (500, 620), 1.0, 120)
|
||||
|
||||
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)
|
||||
|
||||
# close all dialogs
|
||||
device.shell('input keyevent 4')
|
||||
|
||||
# sleep while application will be loaded
|
||||
MonkeyRunner.sleep(2);
|
||||
|
||||
print 'Taking screenshot...'
|
||||
takeScreenshot(outFolder, outFilename + '_' + str(time.time()) );
|
||||
|
||||
print 'Changing orientation...'
|
||||
|
||||
print '#########'
|
||||
print 'Finished!'
|
||||
print '#########'
|
||||
else:
|
||||
print '#########'
|
||||
print 'Failure!'
|
||||
print '#########'
|
15
calculatorpp/misc/other/take_screenshots.sh
Executable file
15
calculatorpp/misc/other/take_screenshots.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare -a skins=("WVGA854" "WQVGA400" "HVGA" "WQVGA432" "WVGA800" "QVGA")
|
||||
declare -a targets=("android-16")
|
||||
|
||||
for target in ${targets[@]}
|
||||
do
|
||||
for skin in ${skins[@]}
|
||||
do
|
||||
avdDeviceName=AVD_$skin
|
||||
$ANDROID_HOME/tools/emulator -avd $avdDeviceName &
|
||||
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/aux/tmp $avdDeviceName
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill
|
||||
done
|
||||
done
|
13
calculatorpp/misc/other/take_screenshots2.sh
Executable file
13
calculatorpp/misc/other/take_screenshots2.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# "AVD_4.1_x86_6" "AVD_4.0.3_x86" "AVD_4.1_x86" "Default" "AVD_4.0.3_x86_7" "AVD_4.1_x86_7" "AVD_4.1_x86_9.5" "Galaxy_Tab" "AVD_4.1_x86_4"
|
||||
# "AVD_4.1_x86_6" "AVD_4.1_x86_7" "AVD_4.1_x86_9.5" "AVD_4.1_x86_4"
|
||||
|
||||
declare -a names=("AVD_4.1_x86_4")
|
||||
|
||||
for name in ${names[@]}
|
||||
do
|
||||
$ANDROID_HOME/tools/emulator -avd $name &
|
||||
$ANDROID_HOME/tools/monkeyrunner ./take_screenshots.py ~/projects/java/android/calculatorpp/calculatorpp/misc/aux/tmp $name
|
||||
$ANDROID_HOME/platform-tools/adb -s emulator-5554 emu kill
|
||||
done
|
10
calculatorpp/misc/other/wait_device.py
Normal file
10
calculatorpp/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-5554')
|
||||
print 'Finished'
|
||||
if device :
|
||||
print 'Success'
|
||||
else :
|
||||
print 'Failure'
|
||||
|
Reference in New Issue
Block a user