All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.android.controlcenter.preference.DiscoveryPreference Maven / Gradle / Ivy

Go to download

The Jadex rules tools package contains tools for the Jadex active components infrastructure.

The newest version!
package jadex.android.controlcenter.preference;

import jadex.bridge.service.types.awareness.DiscoveryInfo;

import java.text.SimpleDateFormat;

import android.content.Context;

public class DiscoveryPreference extends LongClickablePreference {

	private DiscoveryInfo info;

	public DiscoveryPreference(Context context, DiscoveryInfo info) {
		super(context);
		this.info = info;
		setTitle(info.getComponentIdentifier().getName());
		SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
		StringBuilder summaryString = new StringBuilder("Last info: ");
		summaryString.append(dateFormat.format(info.getTime()));
		if (info.proxy != null && info.proxy.isDone() && info.proxy.getException() == null) {
			summaryString.append("\nHas Proxy");
		}
		if (info.remoteexcluded) {
			summaryString.append("\nRemote excluded");
		}
		setSummary(summaryString);
	}
	
	public DiscoveryInfo getDiscoveryInfo() {
		return info;
	}
	
//	@Override
//	protected View onCreateDialogView() {
//		dialog = new DiscoveryDialog(getContext());
//		return dialog;
//	}
//	
//	@Override
//	protected void onBindDialogView(View view) {
//		dialog.setProxy(info.proxy != null && info.proxy.isDone() && info.proxy.getException() == null);
//		dialog.setExclude(info.isRemoteExcluded());
//	}
//	
//	@Override
//	protected void onDialogClosed(boolean positiveResult) {
//		if (positiveResult) {
//			callChangeListener(dialog.hasProxy());
//		}
//	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy