Sha256: 8ef748a3efd07c7bf36f66dd7b5b91f41892bb94a3a70992a2c8f44beb164693

Contents?: true

Size: 1005 Bytes

Versions: 37

Compression:

Stored size: 1005 Bytes

Contents

package sh.calaba.instrumentationbackend;

import sh.calaba.instrumentationbackend.actions.preferences.PreferencesUtils;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;
import android.util.Log;

/**
 * Allows clearing SharedPreferences.
 * 
 * See Ruby API docs for more info:
 * https://github.com/calabash/calabash-android/blob/master/documentation/ruby_api.md
 * 
 * @author Juan Delgado (juan@ustwo.co.uk)
 */
public class ClearPreferences extends InstrumentationTestRunner {

	@Override
    public void onCreate(Bundle arguments) {
		
		SharedPreferences preferences = null;

		try{
			preferences = PreferencesUtils.getPreferencesFromBundle(arguments, getTargetContext());
		} catch(Exception e){
			e.printStackTrace();
			return;
		}
		
		preferences.edit().clear().commit();
		
		String logcat = arguments.getString(PreferencesUtils.BUNDLE_LOGCAT_ID);
		Log.d(logcat, PreferencesUtils.resultToJson(Result.successResult()));
	}	
}

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
calabash-android-0.4.15.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.14 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.13 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.12 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.11 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.10.pre5 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.10.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.10.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.10.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.10.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.9 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.9.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.9.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.9.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.9.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java
calabash-android-0.4.7.pre10 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/ClearPreferences.java