當前位置: 首頁>>代碼示例>>Java>>正文


Java OnClientStartedListener類代碼示例

本文整理匯總了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);
        }
    });

}
 
開發者ID:Sonelli,項目名稱:juicessh-pluginexample,代碼行數:20,代碼來源:MainActivity.java

示例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);
            }
        });

    }
 
開發者ID:Sonelli,項目名稱:juicessh-performancemonitor,代碼行數:19,代碼來源:MainActivity.java

示例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);

}
 
開發者ID:Sonelli,項目名稱:juicessh-pluginlibrary,代碼行數:73,代碼來源:SftpPluginClient.java

示例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);

}
 
開發者ID:Sonelli,項目名稱:juicessh-pluginlibrary,代碼行數:54,代碼來源:ConnectionPluginClient.java


注:本文中的com.sonelli.juicessh.pluginlibrary.listeners.OnClientStartedListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。