// Path: device-api/src/main/java/com/github/cosysoft/device/android/AndroidApp.java
// public interface AndroidApp {
// 
// 	String getBasePackage();
// 
// 	String getMainActivity();
// 
// 	void setMainActivity(String mainActivity);
// 
// 	String getVersionName();
// 
// 	void deleteFileFromWithinApk(String file);
// 
// 	String getAppId();
// 
// 	/**
// 	 * For testing only
// 	 */
// 	String getAbsolutePath();
// }


import com.github.cosysoft.device.android.AndroidApp;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
package com.github.cosysoft.device.android.impl;



public class InstalledAndroidApp implements AndroidApp {

	private String packageName;
	private String activityName;
	private String version;

	public InstalledAndroidApp(String appInfo) {
		Pattern infoPattern = Pattern.compile("(.+):(.+)/(.+)");
		Matcher patternMatcher = infoPattern.matcher(appInfo);
		if (patternMatcher.matches()) {
			packageName = patternMatcher.group(1);
			version = patternMatcher.group(2);
			activityName = patternMatcher.group(3);
		} else {
			throw new RuntimeException(
					"Format for installed app is:  tld.company.app:version/ActivityClass");
		}
	}

	@Override
	public String getBasePackage() {
		return packageName;
	}

	@Override
	public String getMainActivity() {
		return (activityName.contains(".")) ? activityName : packageName + "."
				+ activityName;
	}

	public void setMainActivity(String mainActivity) {
		this.activityName = mainActivity;
	}

// Path: device-api/src/main/java/com/github/cosysoft/device/android/AndroidApp.java
// public interface AndroidApp {
// 
// 	String getBasePackage();
// 
// 	String getMainActivity();
// 
// 	void setMainActivity(String mainActivity);
// 
// 	String getVersionName();
// 
// 	void deleteFileFromWithinApk(String file);
// 
// 	String getAppId();
// 
// 	/**
// 	 * For testing only
// 	 */
// 	String getAbsolutePath();
// }


// Path: device-api/src/main/java/com/github/cosysoft/device/android/impl/InstalledAndroidApp.java
import com.github.cosysoft.device.android.AndroidApp;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

package com.github.cosysoft.device.android.impl;



public class InstalledAndroidApp implements AndroidApp {

	private String packageName;
	private String activityName;
	private String version;

	public InstalledAndroidApp(String appInfo) {
		Pattern infoPattern = Pattern.compile("(.+):(.+)/(.+)");
		Matcher patternMatcher = infoPattern.matcher(appInfo);
		if (patternMatcher.matches()) {
			packageName = patternMatcher.group(1);
			version = patternMatcher.group(2);
			activityName = patternMatcher.group(3);
		} else {
			throw new RuntimeException(
					"Format for installed app is:  tld.company.app:version/ActivityClass");
		}
	}

	@Override
	public String getBasePackage() {
		return packageName;
	}

	@Override
	public String getMainActivity() {
		return (activityName.contains(".")) ? activityName : packageName + "."
				+ activityName;
	}

	public void setMainActivity(String mainActivity) {
		this.activityName = mainActivity;
	}

	@Override