当前位置: 首页>>代码示例>>Java>>正文


Java Dialog.show方法代码示例

本文整理汇总了Java中com.codename1.ui.Dialog.show方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.show方法的具体用法?Java Dialog.show怎么用?Java Dialog.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codename1.ui.Dialog的用法示例。


在下文中一共展示了Dialog.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listenToMessages

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private void listenToMessages() {
    try {
        pb = new Pubnub(PUBNUB_PUB_KEY, PUBNUB_SUB_KEY);
        pb.subscribe(tokenPrefix + uniqueId, new Callback() {
            @Override
            public void successCallback(String channel, Object message, String timetoken) {
                if(message instanceof String) {
                    pendingAck.remove(channel);
                    return;
                }
                Message m = new Message((JSONObject)message);
                pb.publish(tokenPrefix + m.getSenderId(),  "ACK", new Callback() {});
                Display.getInstance().callSerially(() -> {
                    addMessage(m);
                    respond(m);
                });
            }
        });
    } catch(PubnubException err) {
        Log.e(err);
        Dialog.show("Error", "There was a communication error: " + err, "OK", null);
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:SocialChat.java

示例2: authenticate

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * This method preforms the actual authentication, this method is a blocking
 * method that will display the user the html authentication pages.
 *
 * @return the method if passes authentication will return the access token
 * or null if authentication failed.
 *
 * @throws IOException the method will throw an IOException if something
 * went wrong in the communication.
 * @deprecated use createAuthComponent or showAuthentication which work
 * asynchronously and adapt better to different platforms
 */
public String authenticate() {

    if (token == null) {
        login = new Dialog();
        boolean i = Dialog.isAutoAdjustDialogSize();
        Dialog.setAutoAdjustDialogSize(false);
        login.setLayout(new BorderLayout());
        login.setScrollable(false);

        Component html = createLoginComponent(null, null, null, null);
        login.addComponent(BorderLayout.CENTER, html);
        login.setScrollable(false);
        login.setDialogUIID("Container");
        login.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
        login.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL, false, 300));
        login.show(0, 0, 0, 0, false, true);
        Dialog.setAutoAdjustDialogSize(i);
    }

    return token;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:Oauth2.java

示例3: createDetailsButtonActionListener

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
ActionListener createDetailsButtonActionListener(final long imageId) {
    return new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                InfiniteProgress ip = new InfiniteProgress();
                Dialog dlg = ip.showInifiniteBlocking();
                try {
                    String[] data = WebServiceProxy.getPhotoDetails(imageId);
                    String s = "";
                    for(String d : data) {
                        s += d;
                        s += "\n";
                    }
                    dlg.dispose();
                    Dialog.show("Data", s, "OK", null);
                } catch(IOException err) {
                    dlg.dispose();
                    Dialog.show("Error", "Error connecting to server", "OK", null);
                }
            }
        };
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:22,代码来源:PhotoShare.java

示例4: captureAudio

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void captureAudio(ActionListener response) {
    String p = FileSystemStorage.getInstance().getAppHomePath();
    if(!p.endsWith("/")) {
        p += "/";
    }
    try {
        final Media media = MediaManager.createMediaRecorder(p + "cn1TempAudioFile", MediaManager.getAvailableRecordingMimeTypes()[0]);
        media.play();

        boolean b = Dialog.show("Recording", "", "Save", "Cancel");
        final Dialog d = new Dialog("Recording");

        media.pause();
        media.cleanup();
        d.dispose();
        if(b) {
            response.actionPerformed(new ActionEvent(p + "cn1TempAudioFile"));
        } else {
            FileSystemStorage.getInstance().delete(p + "cn1TempAudioFile");
            response.actionPerformed(null);
        }
    } catch(IOException err) {
        err.printStackTrace();
        response.actionPerformed(null);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:IOSImplementation.java

示例5: share

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
@Override
public void share(String text, String image, String mimeType){
    if(image != null && image.length() > 0) {
        try {
            Image img = Image.createImage(image);
            if(img == null) {
                nativeInstance.socialShare(text, 0);
                return;
            }
            NativeImage n = (NativeImage)img.getImage();
            nativeInstance.socialShare(text, n.peer);
        } catch(IOException err) {
            err.printStackTrace();
            Dialog.show("Error", "Error loading image: " + image, "OK", null);
        }
    } else {
        nativeInstance.socialShare(text, 0);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:IOSImplementation.java

示例6: showOn

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Install the glass tutorial on a form and seamlessly dismiss it when no longer necessary
 * @param f the form
 */
public void showOn(Form f) {
    Painter oldPane = f.getGlassPane();
    f.setGlassPane(this);
    Dialog dummy = new Dialog() {
        public void keyReleased(int i) {
            dispose();
        }
    };
    int oldTint = f.getTintColor();
    f.setTintColor(0);
    
    dummy.getDialogStyle().setBgTransparency(0);
    dummy.setDisposeWhenPointerOutOfBounds(true);
    dummy.show(0, Display.getInstance().getDisplayHeight() - 2, 0, Display.getInstance().getDisplayWidth() - 2, true, true);
    
    f.setTintColor(oldTint);
    f.setGlassPane(oldPane);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:GlassTutorial.java

示例7: handleErrorResponseCode

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Handles a server response code that is not 200 and not a redirect (unless redirect handling is disabled)
 *
 * @param code the response code from the server
 * @param message the response message from the server
 */
protected void handleErrorResponseCode(int code, String message) {
    if(failSilently) {
        return;
    }
    if(responseCodeListeners != null) {
        if(!isKilled()) {
            NetworkEvent n = new NetworkEvent(this, code, message);
            responseCodeListeners.fireActionEvent(n);
        }
        return;
    }
    if(Display.isInitialized() &&
            Dialog.show("Error", code + ": " + message, "Retry", "Cancel")) {
        retry();
    } else {
        retrying = false;
        killed = true;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:ConnectionRequest.java

示例8: handleException

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Handles an exception thrown when performing a network operation, the default
 * implementation shows a retry dialog.
 *
 * @param err the exception thrown
 */
protected void handleException(Exception err) {
    if(killed || failSilently) {
        return;
    }
    err.printStackTrace();
    if(silentRetryCount > 0) {
        silentRetryCount--;
        NetworkManager.getInstance().resetAPN();
        retry();
        return;
    }
    if(Display.isInitialized() &&
            Dialog.show("Exception", err.toString() + ": for URL " + url + "\n" + err.getMessage(), "Retry", "Cancel")) {
        retry();
    } else {
        retrying = false;
        killed = true;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:ConnectionRequest.java

示例9: registeredForPush

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void registeredForPush(String deviceId) {
    Dialog.show("Push Registered", "Device ID: " + deviceId + "\nDevice Key: " + Push.getPushKey(), "OK", null);
    String k = Push.getPushKey();
    if(k != null) {
        s.findDeviceKey().setText("Device Key: " + k);
    }
    
    Message m = new Message(Push.getPushKey());
    Display.getInstance().sendMessage(new String[] {"[email protected]"}, "Push key", m);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:11,代码来源:PushDemo.java

示例10: sendLog

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Sends the current log to the cloud regardless of the reporting level
 */
public static void sendLog() {
    if(Display.getInstance().getProperty("cloudServerURL", null) != null) {
        sendLogLegacy();
        return;
    }
    try {
        // this can cause a crash
        if(!Display.isInitialized()) {
            return;
        }
        if(!instance.logDirty) {
            return;
        }
        instance.logDirty = false;
        long devId = getUniqueDeviceId();
        if(devId < 0) {
            Dialog.show("Send Log Error", "Device Not Registered: Sending a log from an unregistered device is impossible", "OK", null);
            return;
        }
        ConnectionRequest r = new ConnectionRequest();
        r.setPost(false);
        MultipartRequest m = new MultipartRequest();
        m.setUrl("https://crashreport.codenameone.com/CrashReporterEmail/sendCrashReport");
        byte[] read = Util.readInputStream(Storage.getInstance().createInputStream("CN1Log__$"));
        m.addArgument("i", "" + devId);
        m.addArgument("u",Display.getInstance().getProperty("built_by_user", ""));
        m.addArgument("p", Display.getInstance().getProperty("package_name", ""));
        m.addArgument("v", Display.getInstance().getProperty("AppVersion", "0.1"));
        m.addData("log", read, "text/plain");
        m.setFailSilently(true);
        NetworkManager.getInstance().addToQueueAndWait(m);
    } catch (Throwable ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:39,代码来源:Log.java

示例11: handleException

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Handles an exception thrown when performing a network operation, the default
 * implementation shows a retry dialog.
 *
 * @param err the exception thrown
 */
protected void handleException(Exception err) {
    if(exceptionListeners != null) {
        if(!isKilled()) {
            NetworkEvent n = new NetworkEvent(this, err);
            exceptionListeners.fireActionEvent(n);
        }
        return;
    }
    if(killed || failSilently) {
        failureException = err;
        return;
    }
    Log.e(err);
    if(silentRetryCount > 0) {
        silentRetryCount--;
        NetworkManager.getInstance().resetAPN();
        retry();
        return;
    }
    if(Display.isInitialized() && !Display.getInstance().isMinimized() &&
            Dialog.show("Exception", err.toString() + ": for URL " + url + "\n" + err.getMessage(), "Retry", "Cancel")) {
        retry();
    } else {
        retrying = false;
        killed = true;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:ConnectionRequest.java

示例12: captureAudio

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void captureAudio(ActionListener response) {
    dropEvents = false;
    String p = FileSystemStorage.getInstance().getAppHomePath();
    if(!p.endsWith("/")) {
        p += "/";
    }
    try {
        final Media media = MediaManager.createMediaRecorder(p + "cn1TempAudioFile", MediaManager.getAvailableRecordingMimeTypes()[0]);
        media.play();

        boolean b = Dialog.show("Recording", "", "Save", "Cancel");
        final Dialog d = new Dialog("Recording");

        media.pause();
        media.cleanup();
        d.dispose();
        if(b) {
            response.actionPerformed(new ActionEvent(p + "cn1TempAudioFile"));
        } else {
            FileSystemStorage.getInstance().delete(p + "cn1TempAudioFile");
            response.actionPerformed(null);
        }
    } catch(IOException err) {
        err.printStackTrace();
        response.actionPerformed(null);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:IOSImplementation.java

示例13: showDownloadDialog

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
private void showDownloadDialog() {
    Dialog d = new Dialog();
    d.setTitle(title);
    if (Dialog.show(title, message, "Yes", "No")) {
        Uri uri = Uri.parse("market://details?id=" + BS_PACKAGE);
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        try {
            activity.startActivity(intent);
        } catch (ActivityNotFoundException anfe) {
            // Hmm, market is not installed
            Log.w(TAG, "Android Market is not installed; cannot install Barcode Scanner");
        }
    }

}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:IntentIntegrator.java

示例14: registeredForPush

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
public void registeredForPush(String deviceId) {
    Dialog.show("Push Registered", "Device ID: " + deviceId + "\nDevice Key: " + Push.getDeviceKey() , "OK", null);
    String k = Push.getDeviceKey();
    if(k != null) {
        s.findDeviceKey().setText("Device Key: " + k);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:PushDemo.java

示例15: sendLog

import com.codename1.ui.Dialog; //导入方法依赖的package包/类
/**
 * Sends the current log to the cloud regardless of the reporting level
 */
public static void sendLog() {
    try {
        // this can cause a crash
        if(!Display.isInitialized()) {
            return;
        }
        if(!instance.logDirty) {
            return;
        }
        instance.logDirty = false;
        long devId = getUniqueDeviceId();
        if(devId < 0) {
            Dialog.show("Send Log Error", "Device Not Registered: Sending a log from an unregistered device is impossible", "OK", null);
            return;
        }
        ConnectionRequest r = new ConnectionRequest();
        r.setPost(false);
        r.setUrl(Display.getInstance().getProperty("cloudServerURL", "https://codename-one.appspot.com/") + "uploadLogRequest");
        r.setFailSilently(true);
        NetworkManager.getInstance().addToQueueAndWait(r);
        String url = new String(r.getResponseData());
        
        MultipartRequest m = new MultipartRequest();
        m.setUrl(url);
        byte[] read = Util.readInputStream(Storage.getInstance().createInputStream("CN1Log__$"));
        m.addArgument("i", "" + devId);
        m.addData("log", read, "text/plain");
        m.setFailSilently(true);
        NetworkManager.getInstance().addToQueueAndWait(m);
    } catch (Throwable ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:Log.java


注:本文中的com.codename1.ui.Dialog.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。