Example usage for android.widget LinearLayout getChildAt

List of usage examples for android.widget LinearLayout getChildAt

Introduction

In this page you can find the example usage for android.widget LinearLayout getChildAt.

Prototype

public View getChildAt(int index) 

Source Link

Document

Returns the view at the specified position in the group.

Usage

From source file:org.uoyabause.android.YabauseHandler.java

/** Called when the activity is first created. */
@Override//from ww  w  .j a  v  a2  s. co m
public void onCreate(Bundle savedInstanceState) {
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(Yabause.this);
    boolean lock_landscape = sharedPref.getBoolean("pref_landscape", false);
    if (lock_landscape == true) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    super.onCreate(savedInstanceState);
    System.gc();

    YabauseApplication application = (YabauseApplication) getApplication();
    mTracker = application.getDefaultTracker();

    setContentView(R.layout.main);
    getWindow().setSustainedPerformanceMode(true);
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    if (sharedPref.getBoolean("pref_analog_pad", false) == true) {
        mNavigationView.setCheckedItem(R.id.pad_mode);
    }

    DrawerLayout.DrawerListener drawerListener = new DrawerLayout.DrawerListener() {
        @Override
        public void onDrawerSlide(View view, float v) {

        }

        @Override
        public void onDrawerOpened(View view) {
            if (menu_showing == false) {
                menu_showing = true;
                YabauseRunnable.pause();
                audio.mute(audio.SYSTEM);
                String name = YabauseRunnable.getGameTitle();
                TextView tx = (TextView) findViewById(R.id.menu_title);
                if (tx != null) {
                    tx.setText(name);
                }

                if (adView != null) {
                    LinearLayout lp = (LinearLayout) findViewById(R.id.navilayer);
                    if (lp != null) {
                        final int mCount = lp.getChildCount();
                        boolean find = false;
                        for (int i = 0; i < mCount; ++i) {
                            final View mChild = lp.getChildAt(i);
                            if (mChild == adView) {
                                find = true;
                            }
                        }
                        if (find == false) {
                            lp.addView(adView);
                        }
                        AdRequest adRequest = new AdRequest.Builder()
                                .addTestDevice("303A789B146C169D4BDB5652D928FF8E").build();
                        adView.loadAd(adRequest);
                    }
                }

            }
        }

        @Override
        public void onDrawerClosed(View view) {

            if (waiting_reault == false && menu_showing == true) {
                menu_showing = false;
                YabauseRunnable.resume();
                audio.unmute(audio.SYSTEM);
            }

        }

        @Override
        public void onDrawerStateChanged(int i) {
        }
    };
    this.mDrawerLayout.setDrawerListener(drawerListener);

    audio = new YabauseAudio(this);

    Intent intent = getIntent();
    String game = intent.getStringExtra("org.uoyabause.android.FileName");
    if (game != null && game.length() > 0) {
        YabauseStorage storage = YabauseStorage.getStorage();
        gamepath = storage.getGamePath(game);
    } else
        gamepath = "";

    String exgame = intent.getStringExtra("org.uoyabause.android.FileNameEx");
    if (exgame != null) {
        gamepath = exgame;
    }

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    readPreferences();

    padm = PadManager.getPadManager();
    padm.loadSettings();
    waiting_reault = false;

    handler = new YabauseHandler(this);
    yabauseThread = new YabauseRunnable(this);

    UiModeManager uiModeManager = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE);
    if (uiModeManager.getCurrentModeType() != Configuration.UI_MODE_TYPE_TELEVISION) {
        SharedPreferences prefs = getSharedPreferences("private", Context.MODE_PRIVATE);
        Boolean hasDonated = prefs.getBoolean("donated", false);
        if (hasDonated) {
            adView = null;
        } else {
            adView = new AdView(this);
            adView.setAdUnitId(getString(R.string.banner_ad_unit_id2));
            adView.setAdSize(AdSize.BANNER);
            AdRequest adRequest = new AdRequest.Builder().build();
            adView.loadAd(adRequest);
            adView.setAdListener(new AdListener() {
                @Override
                public void onAdOpened() {
                    // Save app state before going to the ad overlay.
                }
            });
        }
    } else {
        adView = null;
    }

}

From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java

private void updateCurrentPage(int index, LinearLayout layout) {
    for (int i = 0; i < layout.getChildCount(); i++) {
        View view = layout.getChildAt(i);
        if (i == index) {
            view.setBackgroundResource(CRes.plugin_chatkeyboard_pages_pointer_focus);
        } else {/*w ww.  ja v a  2s .c o  m*/
            view.setBackgroundResource(CRes.plugin_chatkeyboard_pages_pointer_normal);
        }
    }
}

From source file:org.egov.android.view.activity.CreateComplaintActivity.java

/**
 * Function used to order the images if any one is deleted in between the image list
 *//*from   w  ww .ja va2s. co m*/
private void _reorderFiles() {
    String path = assetPath + File.separator + "current";
    File folder = new File(path);
    File list[] = folder.listFiles();
    imageUrl = new ArrayList<String>();
    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    for (int i = 1; i <= list.length; i++) {
        String newPath = assetPath + File.separator + "current" + File.separator + "photo_" + i + ".jpg";
        list[i - 1].renameTo(new File(newPath));
        imageUrl.add(newPath);
        ((ViewGroup) ((ViewGroup) container.getChildAt(i - 1)).getChildAt(0)).getChildAt(0).setTag(newPath);
    }

    if (imageUrl.size() > 0) {
        ((ImageView) findViewById(R.id.image_container))
                .setImageBitmap((_getBitmapImage(imageUrl.get(imageUrl.size() - 1).toString())));
    } else {
        ((ImageView) findViewById(R.id.image_container)).setImageResource(R.drawable.default_image);
    }
}

From source file:org.onebusaway.android.report.ui.Open311ProblemFragment.java

/**
 * Creates open311 question and answer attributes to submit a report
 * Reads from dynamically created UI/*from   ww  w .j a v  a 2 s  . c  o  m*/
 *
 * @param serviceDescription contains attribute types
 * @return List of code value pair of attributes
 */
private List<Open311AttributePair> createOpen311Attributes(ServiceDescription serviceDescription) {
    List<Open311AttributePair> attributes = new ArrayList<>();

    for (Open311Attribute open311Attribute : serviceDescription.getAttributes()) {

        if (Boolean.valueOf(open311Attribute.getVariable())) {
            if (Open311DataType.STRING.equals(open311Attribute.getDatatype())
                    || Open311DataType.NUMBER.equals(open311Attribute.getDatatype())
                    || Open311DataType.DATETIME.equals(open311Attribute.getDatatype())) {
                EditText et = (EditText) mDynamicAttributeUIMap.get(open311Attribute.getCode());
                if (et != null) {
                    attributes.add(new Open311AttributePair(open311Attribute.getCode(), et.getText().toString(),
                            open311Attribute.getDatatype()));
                }
            } else if (Open311DataType.SINGLEVALUELIST.equals(open311Attribute.getDatatype())) {
                RadioGroup rg = (RadioGroup) mDynamicAttributeUIMap.get(open311Attribute.getCode());
                if (rg != null) {
                    int count = rg.getChildCount();
                    for (int i = 0; i < count; i++) {
                        RadioButton rb = (RadioButton) rg.getChildAt(i);
                        if (rb.isChecked()) {
                            String attributeKey = mOpen311AttributeKeyNameMap
                                    .get(open311Attribute.getCode() + rb.getText().toString());
                            attributes.add(new Open311AttributePair(open311Attribute.getCode(), attributeKey,
                                    open311Attribute.getDatatype()));
                            break;
                        }
                    }
                }
            } else if (Open311DataType.MULTIVALUELIST.equals(open311Attribute.getDatatype())) {
                LinearLayout ll = (LinearLayout) mDynamicAttributeUIMap.get(open311Attribute.getCode());
                if (ll != null) {
                    int count = ll.getChildCount();
                    for (int i = 0; i < count; i++) {
                        CheckBox cb = (CheckBox) ll.getChildAt(i);
                        if (cb.isChecked()) {
                            String attributeKey = mOpen311AttributeKeyNameMap
                                    .get(open311Attribute.getCode() + cb.getText().toString());
                            attributes.add(new Open311AttributePair(open311Attribute.getCode(), attributeKey,
                                    open311Attribute.getDatatype()));
                        }
                    }
                }
            }
        }
    }
    return attributes;
}

From source file:com.irccloud.android.activity.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, 0xff0b2e60));//w ww  .ja va2s .  com
        cloud.recycle();
    }

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    setContentView(R.layout.activity_login);

    loading = findViewById(R.id.loading);

    connecting = findViewById(R.id.connecting);
    connectingMsg = (TextView) findViewById(R.id.connectingMsg);
    progressBar = (ProgressBar) findViewById(R.id.connectingProgress);

    loginHint = (LinearLayout) findViewById(R.id.loginHint);
    signupHint = (LinearLayout) findViewById(R.id.signupHint);
    hostHint = (TextView) findViewById(R.id.hostHint);

    login = findViewById(R.id.login);
    name = (EditText) findViewById(R.id.name);
    if (savedInstanceState != null && savedInstanceState.containsKey("name"))
        name.setText(savedInstanceState.getString("name"));
    email = (AutoCompleteTextView) findViewById(R.id.email);
    if (BuildConfig.ENTERPRISE)
        email.setHint(R.string.email_enterprise);
    ArrayList<String> accounts = new ArrayList<String>();
    AccountManager am = (AccountManager) getSystemService(Context.ACCOUNT_SERVICE);
    for (Account a : am.getAccounts()) {
        if (a.name.contains("@") && !accounts.contains(a.name))
            accounts.add(a.name);
    }
    if (accounts.size() > 0)
        email.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
                accounts.toArray(new String[accounts.size()])));

    if (savedInstanceState != null && savedInstanceState.containsKey("email"))
        email.setText(savedInstanceState.getString("email"));

    password = (EditText) findViewById(R.id.password);
    password.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                new LoginTask().execute((Void) null);
                return true;
            }
            return false;
        }
    });
    if (savedInstanceState != null && savedInstanceState.containsKey("password"))
        password.setText(savedInstanceState.getString("password"));

    host = (EditText) findViewById(R.id.host);
    if (BuildConfig.ENTERPRISE)
        host.setText(NetworkConnection.IRCCLOUD_HOST);
    else
        host.setVisibility(View.GONE);
    host.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView exampleView, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                new LoginTask().execute((Void) null);
                return true;
            }
            return false;
        }
    });
    if (savedInstanceState != null && savedInstanceState.containsKey("host"))
        host.setText(savedInstanceState.getString("host"));
    else
        host.setText(getSharedPreferences("prefs", 0).getString("host", BuildConfig.HOST));

    if (host.getText().toString().equals("api.irccloud.com")
            || host.getText().toString().equals("www.irccloud.com"))
        host.setText("");

    loginBtn = (Button) findViewById(R.id.loginBtn);
    loginBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            new LoginTask().execute((Void) null);
        }
    });
    loginBtn.setFocusable(true);
    loginBtn.requestFocus();

    sendAccessLinkBtn = (Button) findViewById(R.id.sendAccessLink);
    sendAccessLinkBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            new ResetPasswordTask().execute((Void) null);
        }
    });

    nextBtn = (Button) findViewById(R.id.nextBtn);
    nextBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (host.getText().length() > 0) {
                NetworkConnection.IRCCLOUD_HOST = host.getText().toString();
                trimHost();

                new EnterpriseConfigTask().execute((Void) null);
            }
        }
    });

    TOS = (TextView) findViewById(R.id.TOS);
    TOS.setMovementMethod(new LinkMovementMethod());

    forgotPassword = (TextView) findViewById(R.id.forgotPassword);
    forgotPassword.setOnClickListener(forgotPasswordClickListener);

    enterpriseLearnMore = (TextView) findViewById(R.id.enterpriseLearnMore);
    enterpriseLearnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (isPackageInstalled("com.irccloud.android", LoginActivity.this)) {
                startActivity(getPackageManager().getLaunchIntentForPackage("com.irccloud.android"));
            } else {
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("market://details?id=com.irccloud.android")));
                } catch (Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW,
                            Uri.parse("http://play.google.com/store/apps/details?id=com.irccloud.android")));
                }
            }
        }

        private boolean isPackageInstalled(String packagename, Context context) {
            PackageManager pm = context.getPackageManager();
            try {
                pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
                return true;
            } catch (NameNotFoundException e) {
                return false;
            }
        }
    });
    enterpriseHint = (LinearLayout) findViewById(R.id.enterpriseHint);

    EnterYourEmail = (TextView) findViewById(R.id.enterYourEmail);

    signupHint.setOnClickListener(signupHintClickListener);
    loginHint.setOnClickListener(loginHintClickListener);

    signupBtn = (Button) findViewById(R.id.signupBtn);
    signupBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            new LoginTask().execute((Void) null);
        }
    });

    TextView version = (TextView) findViewById(R.id.version);
    try {
        version.setText("Version " + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
    } catch (NameNotFoundException e) {
        version.setVisibility(View.GONE);
    }

    Typeface LatoRegular = Typeface.createFromAsset(getAssets(), "Lato-Regular.ttf");
    Typeface LatoLightItalic = Typeface.createFromAsset(getAssets(), "Lato-LightItalic.ttf");

    for (int i = 0; i < signupHint.getChildCount(); i++) {
        View v = signupHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    for (int i = 0; i < loginHint.getChildCount(); i++) {
        View v = loginHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    LinearLayout IRCCloud = (LinearLayout) findViewById(R.id.IRCCloud);
    for (int i = 0; i < IRCCloud.getChildCount(); i++) {
        View v = IRCCloud.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
        }
    }

    notAProblem = (LinearLayout) findViewById(R.id.notAProblem);
    for (int i = 0; i < notAProblem.getChildCount(); i++) {
        View v = notAProblem.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface((i == 0) ? LatoRegular : LatoLightItalic);
        }
    }

    loginSignupHint = (LinearLayout) findViewById(R.id.loginSignupHint);
    for (int i = 0; i < loginSignupHint.getChildCount(); i++) {
        View v = loginSignupHint.getChildAt(i);
        if (v instanceof TextView) {
            ((TextView) v).setTypeface(LatoRegular);
            ((TextView) v).setOnClickListener((i == 0) ? loginHintClickListener : signupHintClickListener);
        }
    }

    name.setTypeface(LatoRegular);
    email.setTypeface(LatoRegular);
    password.setTypeface(LatoRegular);
    host.setTypeface(LatoRegular);
    loginBtn.setTypeface(LatoRegular);
    signupBtn.setTypeface(LatoRegular);
    TOS.setTypeface(LatoRegular);
    EnterYourEmail.setTypeface(LatoRegular);
    hostHint.setTypeface(LatoLightItalic);

    if (BuildConfig.ENTERPRISE) {
        name.setVisibility(View.GONE);
        email.setVisibility(View.GONE);
        password.setVisibility(View.GONE);
        loginBtn.setVisibility(View.GONE);
        signupBtn.setVisibility(View.GONE);
        TOS.setVisibility(View.GONE);
        signupHint.setVisibility(View.GONE);
        loginHint.setVisibility(View.GONE);
        forgotPassword.setVisibility(View.GONE);
        loginSignupHint.setVisibility(View.GONE);
        EnterYourEmail.setVisibility(View.GONE);
        sendAccessLinkBtn.setVisibility(View.GONE);
        notAProblem.setVisibility(View.GONE);
        enterpriseLearnMore.setVisibility(View.VISIBLE);
        enterpriseHint.setVisibility(View.VISIBLE);
        host.setVisibility(View.VISIBLE);
        nextBtn.setVisibility(View.VISIBLE);
        hostHint.setVisibility(View.VISIBLE);
        host.requestFocus();
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("signup")
            && savedInstanceState.getBoolean("signup")) {
        signupHintClickListener.onClick(null);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("login")
            && savedInstanceState.getBoolean("login")) {
        loginHintClickListener.onClick(null);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("forgotPassword")
            && savedInstanceState.getBoolean("forgotPassword")) {
        forgotPasswordClickListener.onClick(null);
    }

    mResolvingError = savedInstanceState != null && savedInstanceState.getBoolean("resolving_error", false);

    mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Auth.CREDENTIALS_API)
            .addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
}

From source file:com.sdspikes.fireworks.FireworksActivity.java

private void updateDisplay() {
    // In case it's called too early
    if (mTurnData == null || fragments == null) {
        return;/* ww  w  .  ja  v  a 2 s.com*/
    }
    for (Map.Entry<String, GameState.HandNode> entry : mTurnData.state.hands.entrySet()) {
        fragments.get(entry.getKey()).updateHand(entry.getValue().hand);
    }
    LinearLayout played = (LinearLayout) findViewById(R.id.played_pile);
    for (int i = 1; i < played.getChildCount(); i++) {
        ((TextView) played.getChildAt(i)).setText(String.valueOf(mTurnData.state.played[i - 1]));
    }
    ((TextView) findViewById(R.id.deck)).setText(String.valueOf(mTurnData.state.deck.size()));
    ((TextView) findViewById(R.id.hints)).setText(String.valueOf(mTurnData.state.hintsRemaining));
    ((TextView) findViewById(R.id.misplays)).setText(String.valueOf(mTurnData.state.explosionsRemaining));
    if (mDiscardWidthR1 != 0) {
        displayDiscardPiles();
    }
    // TODO(sdspikes): add log

    String logString = "";
    for (String log : actionLog) {
        logString += log + "\n";
    }
    ((TextView) findViewById(R.id.log)).setText(logString);
}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

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

    if (mCurrentMessage.form != null) {
        LinearLayout widgetLayout = (LinearLayout) findViewById(R.id.widget_layout);
        Widget widget = (Widget) widgetLayout.getChildAt(0);
        widget.onActivityResult(requestCode, resultCode, data);
    }/*from ww  w.jav  a2 s. c o m*/
}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

@Override
protected void onServiceUnbound() {
    T.UI();//from  w  w  w .  j a v  a2  s  .  c om
    if (mBroadcastReceiver != null)
        unregisterReceiver(mBroadcastReceiver);

    if (mCurrentMessage.form != null) {
        LinearLayout widgetLayout = (LinearLayout) findViewById(R.id.widget_layout);
        Widget widget = (Widget) widgetLayout.getChildAt(0);
        widget.onServiceUnbound();
    }
}

From source file:com.cssweb.android.base.DialogActivity.java

protected void openPopup() {
    LayoutInflater factory = LayoutInflater.from(DialogActivity.this);
    final LinearLayout sortDialogView = (LinearLayout) factory.inflate(R.layout.sort_dialog, null);

    dlg = new AlertDialog.Builder(DialogActivity.this).setTitle("?").setView(sortDialogView)
            .setPositiveButton(getResources().getString(R.string.alert_dialog_ok),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            handleClick(true);
                        }//from  www.j  a va2  s .  com
                    })
            .setNegativeButton(getResources().getString(R.string.alert_dialog_cancel),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                        }
                    })
            .create();
    ///dlg.show();

    timeSpinner = (Spinner) sortDialogView.getChildAt(1);
    stateSpinner = (Spinner) sortDialogView.getChildAt(3);
    timeTextView = (TextView) sortDialogView.getChildAt(0);
    stateTextView = (TextView) sortDialogView.getChildAt(2);

    if (activityKind == Global.QUOTE_PAIMING) {
        timeTextView.setText("");
        stateTextView.setText("?");
        setAdapter(timeSpinner, zhouqi);
        setAdapter(stateSpinner, xuanx);
    } else if (activityKind == Global.QUOTE_FENLEI || activityKind == Global.HK_MAINBOARD
            || activityKind == Global.HK_CYB) {
        timeTextView.setText("");
        stateTextView.setText("?");
        setAdapter(timeSpinner, paiming);
        setAdapter(stateSpinner, desc);
    }
}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

private boolean submitForm(final ButtonTO button) {
    LinearLayout widgetLayout = (LinearLayout) findViewById(R.id.widget_layout);
    Widget widget = (Widget) widgetLayout.getChildAt(0);

    if (Message.POSITIVE.equals(button.id)) {
        widget.putValue();/*from  www. j av  a 2  s .co m*/
    }

    if (!widget.proceedWithSubmit(button.id)) {
        return false;
    }

    if (Message.POSITIVE.equals(button.id)) {
        try {
            final IJSONable formResult = widget.getFormResult();
            if (formResult != null) {
                String validationError = mMessagingPlugin.validateFormResult(mCurrentMessage, formResult);
                if (validationError != null) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(ServiceMessageDetailActivity.this);
                    builder.setTitle(R.string.validation_failed);
                    builder.setMessage(validationError);
                    builder.setPositiveButton(R.string.ok, new SafeDialogInterfaceOnClickListener() {
                        @Override
                        public void safeOnClick(DialogInterface dialog, int which) {
                            T.UI();
                            dialog.dismiss();
                        }
                    });
                    builder.create().show();

                    return false;
                }
            }
        } catch (Exception e) {
            L.bug(e);
        }
    }

    try {
        widget.submit(button.id, mService.currentTimeMillis() / 1000);
    } catch (Exception e) {
        L.bug(e);
        dismissTransferingDialog();
        return false;
    }

    mMessagingPlugin.formSubmitted(mCurrentMessage, button.id);
    return true;
}