Example usage for android.content Intent getSerializableExtra

List of usage examples for android.content Intent getSerializableExtra

Introduction

In this page you can find the example usage for android.content Intent getSerializableExtra.

Prototype

public Serializable getSerializableExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:im.neon.activity.VectorHomeActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    mAutomaticallyOpenedRoomParams = (Map<String, Object>) intent
            .getSerializableExtra(EXTRA_JUMP_TO_ROOM_PARAMS);
    intent.removeExtra(EXTRA_JUMP_TO_ROOM_PARAMS);

    mUniversalLinkToOpen = intent.getParcelableExtra(EXTRA_JUMP_TO_UNIVERSAL_LINK);
    intent.removeExtra(EXTRA_JUMP_TO_UNIVERSAL_LINK);

    mMemberIdToOpen = intent.getStringExtra(EXTRA_MEMBER_ID);
    intent.removeExtra(EXTRA_MEMBER_ID);

    // start waiting view
    if (intent.getBooleanExtra(EXTRA_WAITING_VIEW_STATUS, VectorHomeActivity.WAITING_VIEW_STOP)) {
        showWaitingView();/*from ww w . java  2s  .  com*/
    } else {
        stopWaitingView();
    }
    intent.removeExtra(EXTRA_WAITING_VIEW_STATUS);

}

From source file:com.weebly.opus1269.copyeverywhere.ui.main.MainActivity.java

/**
 * Process intents we know about// w  w  w.j a v  a2 s. c om
 */
@SuppressWarnings("CallToStringEquals")
private void handleIntent() {
    final Intent intent = getIntent();
    final String action = intent.getAction();
    final String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && (type != null)) {
        if (ClipItem.TEXT_PLAIN.equals(type)) {
            final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
            if (sharedText != null) {
                final ClipItem item = new ClipItem(sharedText);
                ClipContentProvider.insert(this, item);
                showClipViewer(item);
            }
        }
    } else if (intent.hasExtra(ClipItem.INTENT_EXTRA_CLIP_ITEM)) {
        final ClipItem item = (ClipItem) intent.getSerializableExtra(ClipItem.INTENT_EXTRA_CLIP_ITEM);
        intent.removeExtra(ClipItem.INTENT_EXTRA_CLIP_ITEM);
        showClipViewer(item);
    } else if (intent.hasExtra(Devices.INTENT_FILTER)) {
        showDevices();
    }
}

From source file:tw.com.geminihsu.app01.fragment.Fragment_PickUpTrain.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
    case Constants.DEPARTURE_QUERY_GPS:
        ArrayList<Address> locationInfo = null;
        if (data != null) {
            //departure_detail = new LocationAddress();
            departure_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            //String add_bookmark = data.getStringExtra(BUNDLE_KEEP_BOOMARK);
            //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE);
            //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE);
            //departure_detail.setLatitude(location.getLatitude());
            //departure_detail.setLongitude(location.getLongitude());
            boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false);
            if (isBookMark) {
                addUserLocationToBookMark(departure_detail);
            }/*from  w w w . ja v  a  2 s  .  c o m*/
            leave_train.setText(departure_detail.getAddress());
            //departure_detail.setLocation(location.getAddress());
            //departure_detail.setAddress(location.getAddress());
            /*if(add_bookmark.equals(true))
            {
                //BookMark
            }*/
            //showAddressList((ArrayList<Address>)locationInfo,departure_address,departure_detail);
        }
        break;
    case Constants.STOP_QUERY_GPS:
        //ArrayList<Address> locationInfo=null;
        if (data != null) {
            //departure_detail = new LocationAddress();
            stop_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            //String add_bookmark = data.getStringExtra(BUNDLE_KEEP_BOOMARK);
            //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE);
            //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE);
            //departure_detail.setLatitude(location.getLatitude());
            //departure_detail.setLongitude(location.getLongitude());
            boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false);
            if (isBookMark) {
                addUserLocationToBookMark(stop_detail);
            }
            stop_train.setText(stop_detail.getAddress());
            //departure_detail.setLocation(location.getAddress());
            //departure_detail.setAddress(location.getAddress());
            /*if(add_bookmark.equals(true))
            {
                //BookMark
            }*/
            //showAddressList((ArrayList<Address>)locationInfo,departure_address,departure_detail);
        }
        break;
    case Constants.DESTINATION_QUERY_GPS:
        ArrayList<Address> locationInfo2 = null;
        if (data != null) {
            //destination_detail = new LocationAddress();
            destination_detail = (LocationAddress) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            //String latitude = data.getStringExtra(Constants.BUNDLE_MAP_LATITUDE);
            //String longitude = data.getStringExtra(Constants.BUNDLE_MAP_LONGITUDE);
            //destination_detail.setLatitude(Double.valueOf(latitude));
            //destination_detail.setLongitude(Double.valueOf(longitude));
            boolean isBookMark = data.getBooleanExtra(BUNDLE_KEEP_BOOMARK, false);
            if (isBookMark) {
                addUserLocationToBookMark(destination_detail);
            }
            destination_train.setText(destination_detail.getAddress());
            //destination_detail.setAddress(locationInfo2.get(0).getAddressLine(0));
            //destination_detail.setLocation(locationInfo2.get(0).getAddressLine(0));
            //showAddressList(locationInfo2,destination_address,destination_detail);
        }
        break;

    case Constants.DEPARTURE_QUERY_BOOKMARK:
        if (data != null) {
            departure_detail = new LocationAddress();
            USerBookmark uSerBookmark = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            leave_train.setText(uSerBookmark.getStreetAddress());
            departure_detail.setLongitude(Double.parseDouble(uSerBookmark.getLng()));
            departure_detail.setLatitude(Double.parseDouble(uSerBookmark.getLat()));
            departure_detail.setAddress(uSerBookmark.getStreetAddress());
            departure_detail.setLocation(uSerBookmark.getLocation());
            departure_detail.setCountryName(uSerBookmark.getCountryName());
            departure_detail.setLocality(uSerBookmark.getLocality());
            departure_detail.setZipCode(uSerBookmark.getZipCode());

        }
        break;
    case Constants.STOP_QUERY_BOOKMARK:
        if (data != null) {
            stop_detail = new LocationAddress();
            USerBookmark uSerBookmark = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            stop_train.setText(uSerBookmark.getStreetAddress());
            stop_detail.setLongitude(Double.parseDouble(uSerBookmark.getLng()));
            stop_detail.setLatitude(Double.parseDouble(uSerBookmark.getLat()));
            stop_detail.setAddress(uSerBookmark.getStreetAddress());
            stop_detail.setLocation(uSerBookmark.getLocation());
            stop_detail.setCountryName(uSerBookmark.getCountryName());
            stop_detail.setLocality(uSerBookmark.getLocality());
            stop_detail.setZipCode(uSerBookmark.getZipCode());

        }
        break;
    case Constants.DESTINATION_QUERY_BOOKMARK:
        if (data != null) {
            destination_detail = new LocationAddress();
            USerBookmark uSerBookmark1 = (USerBookmark) data.getSerializableExtra(Constants.BUNDLE_LOCATION);
            destination_train.setText(uSerBookmark1.getStreetAddress());
            destination_detail.setLongitude(Double.parseDouble(uSerBookmark1.getLng()));
            destination_detail.setLatitude(Double.parseDouble(uSerBookmark1.getLat()));
            destination_detail.setAddress(uSerBookmark1.getStreetAddress());
            destination_detail.setLocation(uSerBookmark1.getLocation());
            destination_detail.setCountryName(uSerBookmark1.getCountryName());
            destination_detail.setLocality(uSerBookmark1.getLocality());
            destination_detail.setZipCode(uSerBookmark1.getZipCode());

        }
        break;
    }
}

From source file:org.csploit.android.core.UpdateService.java

@Override
protected void onHandleIntent(Intent intent) {
    action what_to_do = (action) intent.getSerializableExtra(ACTION);
    boolean exitForError = true;

    if (what_to_do == null) {
        Logger.error("received null action");
        return;/*from w  w  w  .  j av a  2s  .  c  o m*/
    }

    mRunning = true;

    switch (what_to_do) {
    case apk_update:
        mCurrentTask = mApkInfo;
        break;
    case core_update:
        mCurrentTask = mCoreInfo;
        break;
    case ruby_update:
        mCurrentTask = mRubyInfo;
        break;
    case msf_update:
        mCurrentTask = mMsfInfo;
        break;
    case gems_update:
        mCurrentTask = new ArchiveMetadata();
        break;
    }

    try {
        setupNotification();

        synchronized (mCurrentTask) {
            mCurrentTask.errorOccurred = true;
            if (!haveLocalFile())
                downloadFile();

            if (what_to_do == action.core_update)
                System.shutdownCoreDaemon();

            extract();

            if (what_to_do == action.msf_update)
                installGems();
            else if (what_to_do == action.gems_update)
                updateGems();
            else if (what_to_do == action.core_update)
                System.initCore();

            deleteTemporaryFiles();
            createVersionFile();

            mCurrentTask.errorOccurred = exitForError = false;
        }

        sendDone(what_to_do);
    } catch (SecurityException e) {
        sendError(what_to_do, R.string.bad_permissions);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (KeyException e) {
        sendError(what_to_do, R.string.checksum_failed);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (NoSuchAlgorithmException e) {
        sendError(what_to_do, R.string.error_occured);
        System.errorLogging(e);
    } catch (CancellationException e) {
        sendError(what_to_do, R.string.update_cancelled);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (IOException e) {
        sendError(what_to_do, R.string.error_occured);
        System.errorLogging(e);
    } catch (RuntimeException e) {
        sendError(what_to_do, R.string.error_occured);

        StackTraceElement[] stack = e.getStackTrace();
        StackTraceElement frame = e.getStackTrace()[0];

        for (StackTraceElement f : stack) {
            if (f.getClassName().startsWith("org.csploit.android")) {
                frame = f;
                break;
            }
        }

        Logger.error(String.format("%s: %s [%s:%d]", e.getClass().getName(), e.getMessage(),
                frame.getFileName(), frame.getLineNumber()));
    } catch (InterruptedException e) {
        sendError(what_to_do, R.string.error_occured);
        System.errorLogging(e);
    } catch (ChildManager.ChildNotStartedException e) {
        sendError(what_to_do, R.string.error_occured);
        System.errorLogging(e);
    } catch (ChildManager.ChildDiedException e) {
        sendError(what_to_do, R.string.error_occured);
        System.errorLogging(e);
    } catch (System.SuException e) {
        sendError(what_to_do, R.string.only_4_root);
    } catch (System.DaemonException e) {
        sendError(what_to_do, R.string.heart_attack);
        Logger.error(e.getMessage());
    } finally {
        if (exitForError) {
            if (what_to_do == action.msf_update || what_to_do == action.gems_update)
                clearGemsCache();
            if (what_to_do != action.core_update)
                wipe();
        }
        stopSelf();
        mRunning = false;
    }
}

From source file:ru.tinkoff.acquiring.sdk.EnterCardFragment.java

private InitRequestBuilder createInitRequestBuilder(Intent intent) {
    final String password = intent.getStringExtra(PayFormActivity.EXTRA_PASSWORD);
    final String terminalKey = intent.getStringExtra(PayFormActivity.EXTRA_TERMINAL_KEY);

    final InitRequestBuilder builder = new InitRequestBuilder(password, terminalKey);

    final String orderId = intent.getStringExtra(PayFormActivity.EXTRA_ORDER_ID);
    final String customerKey = intent.getStringExtra(PayFormActivity.EXTRA_CUSTOMER_KEY);
    String title = intent.getStringExtra(PayFormActivity.EXTRA_TITLE);
    if (title != null && title.length() > PAY_FORM_MAX_LENGTH) {
        title = title.substring(0, PAY_FORM_MAX_LENGTH);
    }//  w  ww  .  j  ava2s  .co m
    final Money amount = (Money) intent.getSerializableExtra(PayFormActivity.EXTRA_AMOUNT);
    final boolean recurrentPayment = intent.getBooleanExtra(PayFormActivity.EXTRA_RECURRENT_PAYMENT, false);

    builder.setOrderId(orderId).setCustomerKey(customerKey).setPayForm(title).setAmount(amount.getCoins())
            .setRecurrent(recurrentPayment);

    final Language language = resolveLanguage();
    if (language != null) {
        builder.setLanguage(language.toString());
    }

    final Receipt receiptValue = (Receipt) intent.getSerializableExtra(PayFormActivity.EXTRA_RECEIPT_VALUE);
    if (receiptValue != null) {
        builder.setReceipt(receiptValue);
    }

    final List<Receipt> receipts = (List<Receipt>) intent
            .getSerializableExtra(PayFormActivity.EXTRA_RECEIPTS_VALUE);
    final List<Shop> shops = (List<Shop>) intent.getSerializableExtra(PayFormActivity.EXTRA_SHOPS_VALUE);
    if (shops != null) {
        builder.setShops(shops, receipts);
    }

    final Map<String, String> dataValue = (Map<String, String>) intent
            .getSerializableExtra(PayFormActivity.EXTRA_DATA_VALUE);
    if (dataValue != null) {
        builder.setData(dataValue);
    }

    if (rejectedPaymentInfo != null) { // rejected recurrent payment
        HashMap<String, String> map = new HashMap<>();
        map.put(RECURRING_TYPE_KEY, RECURRING_TYPE_VALUE);
        map.put(FAIL_MAPI_SESSION_ID, Long.toString(rejectedPaymentInfo.getPaymentId()));
        builder.addData(map);
        rejectedPaymentInfo = null;
    }

    return builder;
}

From source file:gwind.windalarm.RegistrationIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    try {//from w  w w  .  ja v  a  2s.c  o m
        // [START register_for_gcm]
        // Initially this call goes out to the network to retrieve the token, subsequent calls
        // are local.
        // R.string.gcm_defaultSenderId (the Sender ID) is typically derived from google-services.json.
        // See https://developers.google.com/cloud-messaging/android/start for details on this file.
        // [START get_token]
        InstanceID instanceID = InstanceID.getInstance(this);
        String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
                GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
        // [END get_token]

        AlarmPreferences.setRegId(SplashActivity.getContext(), token);
        Log.i(TAG, "GCM Registration Token: " + token);
        boolean sentToken = sharedPreferences.getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false);
        Log.i(TAG, "sentToken=" + sentToken);

        long deviceId = AlarmPreferences.getDeviceId(SplashActivity.getContext());
        Log.i(TAG, "deviceid=" + deviceId);

        String personId, personName, personEmail, authCode;
        Uri personPhoto = null;

        UserProfile profile = (UserProfile) intent.getSerializableExtra("userProfile");

        /*if (SplashActivity.getAcct() == null) {
        personId = AlarmPreferences.getPersonId(SplashActivity.getContext());;
        personName = null;
        personEmail = null;
        personPhoto = null;
        authCode = null;
        } else {
        personId = SplashActivity.getAcct().getId();
        personName = SplashActivity.getAcct().getDisplayName();
        personEmail = SplashActivity.getAcct().getEmail();
        personPhoto = SplashActivity.getAcct().getPhotoUrl();
        authCode = SplashActivity.getAcct().getServerAuthCode();
        }*/

        sendRegistrationToServer(profile.personId, profile.userName, profile.email, profile.photoUrl, null);

        // Subscribe to topic channels
        subscribeTopics(token);

        // You should store a boolean that indicates whether the generated token has been
        // sent to your server. If the boolean is false, send the token to your server,
        // otherwise your server should have already received the token.
        sharedPreferences.edit().putBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, true).apply();
        // [END register_for_gcm]
    } catch (Exception e) {
        Log.d(TAG, "Failed to complete token refresh", e);

        /*AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("Do you want to logout?");
        alert.setMessage("Message: " + e.toString());
        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            //Your action here
        }
        });
                
        alert.show();*/

        // If an exception happens while fetching the new token or updating our registration data
        // on a third-party server, this ensures that we'll attempt the update at a later time.
        sharedPreferences.edit().putBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false).apply();
    }
    // Notify UI that registration has completed, so the progress indicator can be hidden.
    Intent registrationComplete = new Intent(QuickstartPreferences.REGISTRATION_COMPLETE);
    LocalBroadcastManager.getInstance(this).sendBroadcast(registrationComplete);
}

From source file:org.rm3l.maoni.ui.MaoniActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    final Intent intent = getIntent();

    setTheme(intent.getIntExtra(THEME, R.style.Maoni_AppTheme_Light));

    setContentView(R.layout.maoni_activity_feedback);

    mRootView = findViewById(R.id.maoni_container);
    if (mRootView == null) {
        throw new IllegalStateException(
                "Layout must contain a root view with the following id: maoni_container");
    }/*from  w w  w . j  av a2 s  .  c  o m*/

    mHighlightColor = ContextCompat.getColor(this, R.color.maoni_highlight_transparent_semi);
    mBlackoutColor = ContextCompat.getColor(this, R.color.maoni_black);

    if (intent.hasExtra(WORKING_DIR)) {
        mWorkingDir = new File(intent.getStringExtra(WORKING_DIR));
    } else {
        mWorkingDir = getCacheDir();
    }

    if (intent.hasExtra(SHARED_PREFERENCES)) {
        //noinspection unchecked
        mSharedPreferences = (HashMap<String, Object>) intent.getSerializableExtra(SHARED_PREFERENCES);
    }

    final ImageView headerImageView = (ImageView) findViewById(R.id.maoni_toolbar_header_image);
    if (headerImageView != null && intent.hasExtra(HEADER)) {
        final int headerLayoutId = intent.getIntExtra(HEADER, -1);
        if (headerLayoutId != -1) {
            headerImageView.setImageResource(headerLayoutId);
        }
    }

    if (intent.hasExtra(EXTRA_LAYOUT)) {
        final View extraContentView = findViewById(R.id.maoni_content_extra);
        if (extraContentView instanceof LinearLayout) {
            final int extraLayout = intent.getIntExtra(EXTRA_LAYOUT, -1);
            if (extraLayout != -1) {
                final LinearLayout extraContent = (LinearLayout) extraContentView;
                extraContent.setVisibility(View.VISIBLE);
                extraContent.addView(getLayoutInflater().inflate(extraLayout, extraContent, false));
            }
        }
    }

    final CallbacksConfiguration maoniConfiguration = CallbacksConfiguration.getInstance(this);
    mListener = maoniConfiguration.getListener();
    mValidator = maoniConfiguration.getValidator();

    final Toolbar toolbar = (Toolbar) findViewById(R.id.maoni_toolbar);
    if (toolbar != null) {
        toolbar.setTitle(intent.hasExtra(WINDOW_TITLE) ? intent.getCharSequenceExtra(WINDOW_TITLE)
                : getString(R.string.maoni_send_feedback));
        if (intent.hasExtra(WINDOW_SUBTITLE)) {
            toolbar.setSubtitle(intent.getCharSequenceExtra(WINDOW_SUBTITLE));
        }
        if (intent.hasExtra(TOOLBAR_TITLE_TEXT_COLOR)) {
            toolbar.setTitleTextColor(intent.getIntExtra(TOOLBAR_TITLE_TEXT_COLOR, R.color.maoni_white));
        }
        if (intent.hasExtra(TOOLBAR_SUBTITLE_TEXT_COLOR)) {
            toolbar.setSubtitleTextColor(intent.getIntExtra(TOOLBAR_SUBTITLE_TEXT_COLOR, R.color.maoni_white));
        }
        setSupportActionBar(toolbar);
    }

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setHomeButtonEnabled(true);
    }

    if (intent.hasExtra(MESSAGE)) {
        final CharSequence message = intent.getCharSequenceExtra(MESSAGE);
        final TextView activityMessageTv = (TextView) findViewById(R.id.maoni_feedback_message);
        if (activityMessageTv != null) {
            activityMessageTv.setText(message);
        }
    }

    if (intent.hasExtra(SCREENSHOT_HINT)) {
        final CharSequence screenshotInformationalHint = intent.getCharSequenceExtra(SCREENSHOT_HINT);
        final TextView screenshotInformationalHintTv = (TextView) findViewById(
                R.id.maoni_screenshot_informational_text);
        if (screenshotInformationalHintTv != null) {
            screenshotInformationalHintTv.setText(screenshotInformationalHint);
        }
    }

    mContentInputLayout = (TextInputLayout) findViewById(R.id.maoni_content_input_layout);
    mContent = (EditText) findViewById(R.id.maoni_content);

    if (intent.hasExtra(CONTENT_HINT)) {
        final CharSequence contentHint = intent.getCharSequenceExtra(CONTENT_HINT);
        if (mContentInputLayout != null) {
            mContentInputLayout.setHint(contentHint);
        }
    }

    if (intent.hasExtra(CONTENT_ERROR_TEXT)) {
        mContentErrorText = intent.getCharSequenceExtra(CONTENT_ERROR_TEXT);
    } else {
        mContentErrorText = getString(R.string.maoni_validate_must_not_be_blank);
    }

    mIncludeLogs = (CheckBox) findViewById(R.id.maoni_include_logs);
    if (mIncludeLogs != null && intent.hasExtra(INCLUDE_LOGS_TEXT)) {
        mIncludeLogs.setText(intent.getCharSequenceExtra(INCLUDE_LOGS_TEXT));
    }

    mIncludeScreenshot = (CheckBox) findViewById(R.id.maoni_include_screenshot);
    if (mIncludeScreenshot != null && intent.hasExtra(INCLUDE_SCREENSHOT_TEXT)) {
        mIncludeScreenshot.setText(intent.getCharSequenceExtra(INCLUDE_SCREENSHOT_TEXT));
    }

    mScreenshotFilePath = intent.getCharSequenceExtra(SCREENSHOT_FILE);

    mShowKeyboardOnStart = intent.getBooleanExtra(SHOW_KEYBOARD_ON_START, false);

    mScreenCapturingFeatureEnabled = intent.getBooleanExtra(SCREEN_CAPTURING_FEATURE_ENABLED, true);
    final Integer[] screenCapturingRelatedFields = new Integer[] { R.id.maoni_include_screenshot,
            R.id.maoni_include_screenshot_content };
    if (mScreenCapturingFeatureEnabled) {
        initScreenCaptureView(intent);
    }
    final int visibilityForScreenCapturingRelatedFields = (mScreenCapturingFeatureEnabled ? View.VISIBLE
            : View.GONE);
    for (final Integer screenCapturingRelatedField : screenCapturingRelatedFields) {
        final View view = findViewById(screenCapturingRelatedField);
        if (view == null) {
            continue;
        }
        view.setVisibility(visibilityForScreenCapturingRelatedFields);
    }

    mLogsCapturingFeatureEnabled = intent.getBooleanExtra(LOGS_CAPTURING_FEATURE_ENABLED, true);
    final Integer[] logsCapturingRelatedFields = new Integer[] { R.id.maoni_include_logs };
    final int visibilityForLogsCapturingRelatedFields = (mLogsCapturingFeatureEnabled ? View.VISIBLE
            : View.GONE);
    for (final Integer logsCapturingRelatedField : logsCapturingRelatedFields) {
        final View view = findViewById(logsCapturingRelatedField);
        if (view == null) {
            continue;
        }
        view.setVisibility(visibilityForLogsCapturingRelatedFields);
    }

    mFeedbackUniqueId = UUID.randomUUID().toString();

    final View fab = findViewById(R.id.maoni_fab);
    if (fab != null) {
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                validateAndSubmitForm();
            }
        });
    }

    setAppRelatedInfo();

    final UiListener uiListener = maoniConfiguration.getUiListener();
    if (uiListener != null) {
        uiListener.onCreate(mRootView, savedInstanceState);
    }
}

From source file:ch.uzh.supersede.feedbacklibrary.FeedbackActivity.java

@Override
@SuppressWarnings("unchecked")
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == REQUEST_PHOTO) {
            onSelectFromGalleryResult(data);
        } else if (requestCode == REQUEST_CAMERA) {
        } else if (requestCode == REQUEST_ANNOTATE && data != null) {
            // If mechanismViewId == -1, an error occurred
            int mechanismViewId = data.getIntExtra(Utils.EXTRA_KEY_MECHANISM_VIEW_ID, -1);
            if (mechanismViewId != -1) {
                ScreenshotMechanismView screenshotMechanismView = (ScreenshotMechanismView) allMechanismViews
                        .get(mechanismViewId);

                // Sticker annotations
                if (data.getBooleanExtra(Utils.EXTRA_KEY_HAS_STICKER_ANNOTATIONS, false)) {
                    screenshotMechanismView.setAllStickerAnnotations((HashMap<Integer, String>) data
                            .getSerializableExtra(Utils.EXTRA_KEY_ALL_STICKER_ANNOTATIONS));
                }//from  ww  w  . j  av a2s . c o m
                // Text annotations
                if (data.getBooleanExtra(Utils.EXTRA_KEY_HAS_TEXT_ANNOTATIONS, false)) {
                    screenshotMechanismView.setAllTextAnnotations((HashMap<Integer, String>) data
                            .getSerializableExtra(Utils.EXTRA_KEY_ALL_TEXT_ANNOTATIONS));
                }

                // Annotated image with stickers
                String tempPathWithStickers = data
                        .getStringExtra(Utils.EXTRA_KEY_ANNOTATED_IMAGE_PATH_WITH_STICKERS) + "/"
                        + mechanismViewId + ANNOTATED_IMAGE_NAME_WITH_STICKERS;
                screenshotMechanismView.setAnnotatedImagePath(tempPathWithStickers);
                screenshotMechanismView.setPicturePath(tempPathWithStickers);
                Bitmap annotatedBitmap = Utils.loadImageFromStorage(tempPathWithStickers);
                if (annotatedBitmap != null) {
                    screenshotMechanismView.setPictureBitmap(annotatedBitmap);
                    screenshotMechanismView.getScreenShotPreviewImageView().setImageBitmap(annotatedBitmap);
                }

                // Annotated image without stickers
                if (data.getStringExtra(Utils.EXTRA_KEY_ANNOTATED_IMAGE_PATH_WITHOUT_STICKERS) == null) {
                    screenshotMechanismView.setPicturePathWithoutStickers(null);
                } else {
                    String tempPathWithoutStickers = data
                            .getStringExtra(Utils.EXTRA_KEY_ANNOTATED_IMAGE_PATH_WITHOUT_STICKERS) + "/"
                            + mechanismViewId + ANNOTATED_IMAGE_NAME_WITHOUT_STICKERS;
                    screenshotMechanismView.setPicturePathWithoutStickers(tempPathWithoutStickers);
                }
            } else {
                Log.e(TAG, "Failed to annotate the image. No mechanismViewID provided");
            }
        }
    }
}

From source file:com.brandroidtools.filemanager.activities.NavigationActivity.java

/**
 * {@inheritDoc}//from www. j av a  2  s .  c o  m
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (data != null) {
        switch (requestCode) {
        case INTENT_REQUEST_BOOKMARK:
            if (resultCode == RESULT_OK) {
                FileSystemObject fso = (FileSystemObject) data.getSerializableExtra(EXTRA_BOOKMARK_SELECTION);
                if (fso != null) {
                    //Open the fso
                    getCurrentNavigationFragment().open(fso);
                }
            }
            break;

        case INTENT_REQUEST_HISTORY:
            if (resultCode == RESULT_OK) {
                //Change current directory
                History history = (History) data.getSerializableExtra(EXTRA_HISTORY_ENTRY_SELECTION);
                navigateToHistory(history);
            } else if (resultCode == RESULT_CANCELED) {
                boolean clear = data.getBooleanExtra(EXTRA_HISTORY_CLEAR, false);
                if (clear) {
                    clearHistory();
                }
            }
            break;

        case INTENT_REQUEST_SEARCH:
            if (resultCode == RESULT_OK) {
                //Change directory?
                FileSystemObject fso = (FileSystemObject) data
                        .getSerializableExtra(EXTRA_SEARCH_ENTRY_SELECTION);
                SearchInfoParcelable searchInfo = data.getParcelableExtra(EXTRA_SEARCH_LAST_SEARCH_DATA);
                if (fso != null) {
                    //Goto to new directory
                    getCurrentNavigationFragment().open(fso, searchInfo);
                }
            } else if (resultCode == RESULT_CANCELED) {
                SearchInfoParcelable searchInfo = data.getParcelableExtra(EXTRA_SEARCH_LAST_SEARCH_DATA);
                if (searchInfo != null && searchInfo.isSuccessNavigation()) {
                    //Navigate to previous history
                    back();
                } else {
                    // I don't know is the search view was changed, so try to do a refresh
                    // of the navigation view
                    getCurrentNavigationFragment().refresh(true);
                }
            }
            break;

        default:
            break;
        }
    }
}

From source file:eu.power_switch.gui.fragment.configure_receiver.ConfigureReceiverDialogPage4TabbedSummaryFragment.java

@Nullable
@Override//  ww w . java  2s .  c om
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.dialog_fragment_configure_receiver_page_4_summary, container, false);

    // BroadcastReceiver to get notifications from background service if room data has changed
    broadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(LocalBroadcastConstants.INTENT_BRAND_MODEL_CHANGED)) {
                String brand = intent.getStringExtra("brand");
                String model = intent.getStringExtra("model");

                currentBrand = Receiver.Brand.getEnum(brand);
                currentModel = model;

                try {
                    Receiver receiver = ReceiverReflectionMagic.getDummy(getActivity(),
                            Receiver.getJavaPath(currentModel));
                    currentType = receiver.getType();
                } catch (Exception e) {
                    StatusMessageHandler.showErrorMessage(getActivity(), e);
                }
            } else if (intent.getAction().equals(LocalBroadcastConstants.INTENT_NAME_ROOM_CHANGED)) {
                String name = intent.getStringExtra("name");
                String roomName = intent.getStringExtra("roomName");

                currentName = name;
                currentRoomName = roomName;
            } else if (intent.getAction().equals(LocalBroadcastConstants.INTENT_CHANNEL_DETAILS_CHANGED)) {
                char channelMaster = intent.getCharExtra("channelMaster", 'A');
                int channelSlave = intent.getIntExtra("channelSlave", 0);
                ArrayList<DipSwitch> dips = (ArrayList<DipSwitch>) intent.getSerializableExtra("dips");

                long seed = intent.getLongExtra("seed", -1);

                ArrayList<UniversalButton> universalButtons = (ArrayList<UniversalButton>) intent
                        .getSerializableExtra("universalButtons");

                currentMaster = channelMaster;
                currentSlave = channelSlave;
                currentDips = dips;
                currentSeed = seed;
                currentUniversalButtons = universalButtons;
            }

            updateUi();
            notifyConfigurationChanged();
        }
    };

    name = (TextView) rootView.findViewById(R.id.textView_name);
    roomName = (TextView) rootView.findViewById(R.id.textView_roomName);
    brand = (TextView) rootView.findViewById(R.id.textView_brand);
    model = (TextView) rootView.findViewById(R.id.textView_model);
    channelMaster = (TextView) rootView.findViewById(R.id.textView_channelMaster);
    channelSlave = (TextView) rootView.findViewById(R.id.textView_channelSlave);

    linearLayoutMasterSlaveReceiver = (LinearLayout) rootView
            .findViewById(R.id.linearLayout_masterSlaveReceiver);

    linearLayoutDipReceiver = (LinearLayout) rootView.findViewById(R.id.linearLayout_dipReceiver);
    linearLayoutDips = (LinearLayout) rootView.findViewById(R.id.linearLayout_dips);

    linearLayoutAutoPairReceiver = (LinearLayout) rootView.findViewById(R.id.linearLayout_autoPair);
    seed = (TextView) rootView.findViewById(R.id.textView_seed);

    linearLayoutUniversalReceiver = (LinearLayout) rootView.findViewById(R.id.linearLayout_universalReceiver);
    linearLayoutUniversalButtons = (LinearLayout) rootView.findViewById(R.id.linearLayout_universalButtons);

    updateUi();

    Bundle args = getArguments();
    if (args != null && args.containsKey(ConfigureReceiverDialog.RECEIVER_ID_KEY)) {
        long receiverId = args.getLong(ConfigureReceiverDialog.RECEIVER_ID_KEY);
        currentId = receiverId;
        initializeReceiverData(receiverId);
    }

    return rootView;
}