@Override public void handleMessage(Message msg) { mLoader.setVisibility(View.GONE); if (msg.arg1 == MobileWebApi.SUCCESS) { FormResult result = (FormResult) msg.obj; mThankYouView.setVisibility(View.VISIBLE); mContentResult.setTitle(result.getFeedbackString()); } else { mScrollView.setVisibility(View.VISIBLE); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.library_tell_us); addSecondaryTitle("Tell Us"); mContext = this; mScrollView = (LockingScrollView) findViewById(R.id.scrollView); mSuggestPurchaseButton = (TwoLineActionRow) findViewById(R.id.libraryTellUsSuggestPurchase); mSuggestPurchaseButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { CommonActions.viewURL(mContext, "http://libraries.mit.edu/suggest-purchase"); } }); mFeedbackText = (EditText) findViewById(R.id.feebackText); mFeedbackText.addTextChangedListener(mUpdateSubmitButtonTextWatcher); mStatusSpinner = (Spinner) findViewById(R.id.statusSpinner); mSubmitButton = (Button) findViewById(R.id.submit); mSubmitButton.setEnabled(false); mLoader = (FullScreenLoader) findViewById(R.id.tellUsLoading); mThankYouView = findViewById(R.id.libraryTellUsThankYou); mContentResult = (TwoLineActionRow) findViewById(R.id.librariesThankYouContentActionRow); mGoHomeButton = (TwoLineActionRow) findViewById(R.id.librariesThankYouReturnHome); mGoHomeButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext, getNewModule().getModuleHomeActivity()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); statusArray = getResources().getStringArray(R.array.libraryStatus); String statusTitle = getResources().getString(R.string.libraryStatusTitle); SpinnerAdapter statusAdapter = new SimpleSpinnerAdapter(this, statusTitle, Arrays.asList(statusArray)); mStatusSpinner.setAdapter(statusAdapter); mStatusSpinner.setPrompt(statusTitle); mSubmitButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSubmitButton.getWindowToken(), 0); int position = mStatusSpinner.getSelectedItemPosition() - 1; String status = null; if (position >= 0) { String[] statusCodeArray = getResources().getStringArray(R.array.libraryStatusCode); status = statusCodeArray[position]; } String feedback = mFeedbackText.getText().toString().trim(); if ("".equals(feedback)) { Toast.makeText(TellUsActivity.this, "Description is required!", Toast.LENGTH_LONG) .show(); return; } mScrollView.setVisibility(View.GONE); mLoader.setVisibility(View.VISIBLE); mLoader.showLoading(); LibraryModel.sendTellUsInfo(TellUsActivity.this, uiHandler, status, feedback); } }); /* showLoader(); VerifyUserCredentials.VerifyUserHasFormAccess(mContext, new VerifyUserCredentialsListener() { @Override public void onUserLoggedIn(UserIdentity user) { showForm(); } }); */ }