Screenshots
This commit is contained in:
parent
77167e366c
commit
36772dea1f
@ -1,18 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="110" android:versionName="1.5.1" package="org.solovyev.android.calculator">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="110" android:versionName="1.5.2-SNAPSHOT" package="org.solovyev.android.calculator">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="com.android.vending.BILLING"/>
|
<uses-permission android:name="com.android.vending.BILLING"/>
|
||||||
|
|
||||||
|
<!--TODO: REMOVE IN PRODUCTION-->
|
||||||
|
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
|
||||||
|
|
||||||
<!-- for overlay -->
|
<!-- for overlay -->
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||||
|
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
||||||
|
|
||||||
<application android:debuggable="false" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
|
<application android:debuggable="true" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
|
||||||
|
|
||||||
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
||||||
|
|
||||||
|
26
calculatorpp/misc/aux/prepare_avds.sh
Executable file
26
calculatorpp/misc/aux/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/aux/remove_avds.sh
Executable file
15
calculatorpp/misc/aux/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/aux/take_screenshots.py
Normal file
58
calculatorpp/misc/aux/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/aux/take_screenshots.sh
Executable file
15
calculatorpp/misc/aux/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/aux/take_screenshots2.sh
Executable file
13
calculatorpp/misc/aux/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/aux/wait_device.py
Normal file
10
calculatorpp/misc/aux/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'
|
||||||
|
|
@ -1,7 +1,12 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
|
import android.*;
|
||||||
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -60,6 +65,14 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
|
|||||||
theme = CalculatorPreferences.Gui.theme.getPreferenceNoError(preferences);
|
theme = CalculatorPreferences.Gui.theme.getPreferenceNoError(preferences);
|
||||||
|
|
||||||
preferences.registerOnSharedPreferenceChangeListener(this);
|
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
// let's disable locking of screen for monkeyrunner
|
||||||
|
// NOTE: this code is only for monkeyrunner
|
||||||
|
final String permission = Manifest.permission.DISABLE_KEYGUARD;
|
||||||
|
if (activity.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
|
||||||
|
final KeyguardManager km = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
|
km.newKeyguardLock(activity.getClass().getName()).disableKeyguard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDebug(@NotNull String message) {
|
public void logDebug(@NotNull String message) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import net.robotmedia.billing.BillingController;
|
import net.robotmedia.billing.BillingController;
|
||||||
@ -13,7 +12,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.solovyev.android.ads.AdsController;
|
import org.solovyev.android.ads.AdsController;
|
||||||
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
import org.solovyev.android.calculator.history.AndroidCalculatorHistory;
|
||||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||||
import org.solovyev.android.calculator.overlay.CalculatorOverlayService;
|
|
||||||
import org.solovyev.android.calculator.widget.CalculatorWidgetHelper;
|
import org.solovyev.android.calculator.widget.CalculatorWidgetHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,8 +123,6 @@ public class CalculatorApplication extends android.app.Application {
|
|||||||
public void run() {
|
public void run() {
|
||||||
BillingController.checkBillingSupported(CalculatorApplication.this);
|
BillingController.checkBillingSupported(CalculatorApplication.this);
|
||||||
AdsController.getInstance().isAdFree(CalculatorApplication.this);
|
AdsController.getInstance().isAdFree(CalculatorApplication.this);
|
||||||
|
|
||||||
startService(new Intent(getApplicationContext(), CalculatorOverlayService.class));
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user