本文整理汇总了Java中com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnClientStartedListener类的具体用法?Java OnClientStartedListener怎么用?Java OnClientStartedListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnClientStartedListener类属于com.sonelli.juicessh.pluginlibrary.listeners包,在下文中一共展示了OnClientStartedListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
client.start(this, new OnClientStartedListener() {
@Override
public void onClientStarted() {
isClientStarted = true;
connectButton.setEnabled(true);
}
@Override
public void onClientStopped() {
isClientStarted = false;
connectButton.setEnabled(false);
}
});
}
示例2: startPluginClient
import com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener; //导入依赖的package包/类
public void startPluginClient(){
client.start(this, new OnClientStartedListener() {
@Override
public void onClientStarted() {
isClientStarted = true;
connectButton.setText(R.string.connect);
connectButton.setEnabled(true);
}
@Override
public void onClientStopped() {
isClientStarted = false;
connectButton.setEnabled(false);
}
});
}
示例3: start
import com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener; //导入依赖的package包/类
/**
* Start SftpPluginClient and connect to the JuiceSSH Sftp Plugin Service.
* This should be run in Activity.onStart();
* @param context
* @param listener
*/
@Override
public void start(final Context context, final OnClientStartedListener listener){
// Dual service listener only triggers when both the connection plugin service and
// this plugin service (dis)connects
final OnClientStartedListener dualServiceListener = new OnClientStartedListener() {
@Override
public void onClientStarted() {
if (isConnected())
listener.onClientStarted();
}
@Override
public void onClientStopped() {
if (!isConnected())
listener.onClientStopped();
}
};
// Connect the Connection Plugin Service
super.start(context, dualServiceListener);
this.connection = new ServiceConnection(){
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
Log.d(TAG, "Bound to the JuiceSSH SFTP plugin service");
isConnected = true;
service = ISftpPluginService.Stub.asInterface(iBinder);
handler.post(new Runnable() {
@Override
public void run() {
dualServiceListener.onClientStarted();
}
});
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
Log.d(TAG, "Unbound from the JuiceSSH SFTP plugin service");
isConnected = false;
service = null;
handler.post(new Runnable() {
@Override
public void run() {
dualServiceListener.onClientStopped();
}
});
}
};
// Attempt to lookup the explicit service information
ResolveInfo resolve = context.getPackageManager().resolveService(
new Intent("com.sonelli.juicessh.sftppluginservice"),
0
);
if (resolve == null) {
Log.e(TAG, "Could not look up explicit intent for com.sonelli.juicessh.sftppluginservice service");
return;
}
// Create an explicit intent for the service
Intent serviceIntent = new Intent();
serviceIntent.setComponent(new ComponentName(resolve.serviceInfo.packageName, resolve.serviceInfo.name));
context.bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE);
}
示例4: start
import com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener; //导入依赖的package包/类
/**
* Start PluginClient and connect to the JuiceSSH Plugin Service.
* This should be run in your Activity.onStart();
* @param context
* @param listener
*/
public void start(final Context context, final OnClientStartedListener listener){
this.connection = new ServiceConnection(){
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
Log.d(TAG, "Bound to the JuiceSSH connection plugin service");
isConnected = true;
service = IConnectionPluginService.Stub.asInterface(iBinder);
handler.post(new Runnable() {
@Override
public void run() {
listener.onClientStarted();
}
});
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
Log.d(TAG, "Unbound from the JuiceSSH connection plugin service");
isConnected = false;
service = null;
handler.post(new Runnable() {
@Override
public void run() {
listener.onClientStopped();
}
});
}
};
// Attempt to lookup the explicit service information
ResolveInfo resolve = context.getPackageManager().resolveService(
new Intent("com.sonelli.juicessh.connectionpluginservice"),
0
);
if (resolve == null) {
Log.e(TAG, "Could not look up explicit intent for com.sonelli.juicessh.connectionpluginservice service");
return;
}
// Create an explicit intent for the service
Intent serviceIntent = new Intent();
serviceIntent.setComponent(new ComponentName(resolve.serviceInfo.packageName, resolve.serviceInfo.name));
context.bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE);
}