List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:com.forum.fiend.osp.SettingsFragment.java
private void setupUserCard() { if (getActivity() == null) { return;/*from w w w.ja va 2s . c o m*/ } LinearLayout userLayout = (LinearLayout) getActivity().findViewById(R.id.settings_user_box); if (application.getSession().getServer().serverUserId.contentEquals("0")) { userLayout.setVisibility(View.GONE); } else { ImageView ivAvatar = (ImageView) getActivity().findViewById(R.id.settings_user_avatar); TextView tvUsername = (TextView) getActivity().findViewById(R.id.settings_user_name); ImageView ivLogout = (ImageView) getActivity().findViewById(R.id.settings_user_logout); tvUsername.setText(application.getSession().getServer().serverUserName); if (application.getSession().getServer().serverAvatar.contains("http")) { ImageLoader.getInstance().displayImage(application.getSession().getServer().serverAvatar, ivAvatar); } else { ivAvatar.setImageResource(R.drawable.no_avatar); } ivLogout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { logOut(); } }); userLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadMyWall(); } }); } }
From source file:org.cyanogenmod.theme.chooser.ChooserDetailFragment.java
private void refreshChecksForCheckboxes() { LinearLayout ll = (LinearLayout) getActivity().findViewById(R.id.details_applied); ll.setVisibility(View.GONE); boolean allApplied = true; //Apply checks for (Map.Entry<String, CheckBox> entry : mComponentToCheckbox.entrySet()) { String componentName = entry.getKey(); CheckBox componentCheckbox = entry.getValue(); if (mAppliedComponents.contains(componentName)) { componentCheckbox.setChecked(true); componentCheckbox.setEnabled(false); ((LinearLayout) componentCheckbox.getParent()).removeView(componentCheckbox); ll.addView(componentCheckbox); ll.setVisibility(View.VISIBLE); } else {//w ww. j a v a 2 s.com //Ignore unavailable components if (componentCheckbox.getVisibility() != View.GONE) { allApplied = false; } } if (mLoadInitialCheckboxStates) { mInitialCheckboxStates.put(componentCheckbox.getId(), componentCheckbox.isChecked()); } mCurrentCheckboxStates.put(componentCheckbox.getId(), componentCheckbox.isChecked()); } //Hide available column if it is empty ll = (LinearLayout) getActivity().findViewById(R.id.details); ll.setVisibility(allApplied ? View.GONE : View.VISIBLE); }
From source file:org.sufficientlysecure.keychain.ui.ViewKeyFragment.java
private void initCardButtonsVisibility(boolean isSecret) { LinearLayout buttonsUserIdsLayout = (LinearLayout) getActivity() .findViewById(R.id.view_key_card_user_ids_buttons); LinearLayout buttonsLinkedIdsLayout = (LinearLayout) getActivity() .findViewById(R.id.view_key_card_linked_ids_buttons); if (isSecret) { buttonsUserIdsLayout.setVisibility(View.VISIBLE); buttonsLinkedIdsLayout.setVisibility(View.VISIBLE); } else {/* ww w.j a va 2s. com*/ buttonsUserIdsLayout.setVisibility(View.GONE); buttonsLinkedIdsLayout.setVisibility(View.GONE); } }
From source file:com.gh4a.IssueLabelListActivity.java
private void clearOtherSelected(boolean all) { for (Map<String, Object> m : mAllLabelLayout) { LinearLayout llEdit2 = (LinearLayout) m.get("llEdit"); TextView tvLabel2 = (TextView) m.get("tvLabel"); View viewColor2 = (View) m.get("viewColor"); Label label2 = (Label) m.get("label"); if (all) { unselectLabel(tvLabel2, viewColor2, label2.getColor()); llEdit2.setVisibility(View.GONE); } else {/* w ww. j a va2 s. c o m*/ if (!tvLabel2.getText().toString().equals(mSelectedLabel)) { unselectLabel(tvLabel2, viewColor2, label2.getColor()); llEdit2.setVisibility(View.GONE); } else { llEdit2.setVisibility(View.VISIBLE); } } } if (mActionMode != null) { mActionMode.finish(); } mSelectedLabel = null; }
From source file:com.google.sample.devicelab.MainActivity.java
private void refreshUI() { mLoginProgressBar.setVisibility(View.GONE); mLoginStatus.setVisibility(View.GONE); mLogoutProgressBar.setVisibility(View.GONE); mLogoutStatus.setVisibility(View.GONE); LinearLayout loggedOut = (LinearLayout) findViewById(R.id.loggedOut); LinearLayout loggedIn = (LinearLayout) findViewById(R.id.loggedIn); if (UserSettings.isDeviceAddedToLab(this)) { loggedIn.setVisibility(View.VISIBLE); loggedOut.setVisibility(View.GONE); } else {//from www . ja va2 s . c om loggedIn.setVisibility(View.GONE); loggedOut.setVisibility(View.VISIBLE); String appEngineId = UserSettings.getAppEngineId(this); LinearLayout gaeVerifyingLL = (LinearLayout) findViewById(R.id.gaeVerificationLL); if (appEngineId.equals("")) { ((TextView) findViewById(R.id.gaeUrl)).setText(R.string.gae_id_label_hint); gaeVerifyingLL.setVisibility(View.GONE); } else { ((TextView) findViewById(R.id.gaeUrl)).setText(appEngineId); gaeVerifyingLL.setVisibility(View.VISIBLE); ((TextView) findViewById(R.id.gaeNumber)).setText(UserSettings.getAppEngineNumber(this)); //Update the UI for the gaeVerification linear layout TextView verificationStatus = (TextView) findViewById(R.id.gaeVerificationStatus); ProgressBar verificationProgressBar = (ProgressBar) findViewById(R.id.gaeVerificationProgress); GAEIdVerificationStatus idStatus = UserSettings.getAppEngineIdStatus(this); verificationStatus.setText(idStatus.getDisplayString(this)); verificationProgressBar.setVisibility(idStatus.showProgressBar() ? View.VISIBLE : View.GONE); //We set on click listened to redo verification gaeVerifyingLL.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new GAEIdVerifier(MainActivity.this).execute(); } }); //If verification passed, we allow user to log in; otherwise, we block it TextView loginDescription = (TextView) findViewById(R.id.loginDescription); SignInButton signInButton = (SignInButton) findViewById(R.id.signInButton); if (idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED && UserSettings.getAppEngineNumber(this).equals("")) { loginDescription.setText(R.string.description_logged_out4); signInButton.setVisibility(View.GONE); } else if (idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED) { loginDescription.setText(R.string.description_logged_out3); signInButton.setVisibility(View.VISIBLE); } else { loginDescription.setText(R.string.description_logged_out2); signInButton.setVisibility(View.GONE); } //Show reason logged in failed if (!UserSettings.getLoginFailureReason(this).equals("") && idStatus == GAEIdVerificationStatus.VERIFICATION_PASSED) { mLoginStatus.setVisibility(View.VISIBLE); mLoginStatus.setText(UserSettings.getLoginFailureReason(this)); } } } }
From source file:edu.berkeley.boinc.StatusFragment.java
private void loadLayout(Boolean forceUpdate) { //load layout, if if ClientStatus can be accessed. //if this is not the case, the broadcast receiver will call "loadLayout" again try {/*www. j a v a 2 s .c om*/ int currentSetupStatus = BOINCActivity.monitor.getSetupStatus(); int currentComputingStatus = BOINCActivity.monitor.getComputingStatus(); int currentComputingSuspendReason = BOINCActivity.monitor.getComputingSuspendReason(); int currentNetworkSuspendReason = BOINCActivity.monitor.getNetworkSuspendReason(); // layout only if client RPC connection is established // otherwise BOINCActivity does not start Tabs if (currentSetupStatus == ClientStatus.SETUP_STATUS_AVAILABLE) { // return in cases nothing has changed if (forceUpdate || computingStatus != currentComputingStatus || currentComputingSuspendReason != computingSuspendReason || currentNetworkSuspendReason != networkSuspendReason) { // set layout and retrieve elements LinearLayout statusWrapper = (LinearLayout) getView().findViewById(R.id.status_wrapper); LinearLayout centerWrapper = (LinearLayout) getView().findViewById(R.id.center_wrapper); LinearLayout restartingWrapper = (LinearLayout) getView().findViewById(R.id.restarting_wrapper); TextView statusHeader = (TextView) getView().findViewById(R.id.status_header); ImageView statusImage = (ImageView) getView().findViewById(R.id.status_image); TextView statusDescriptor = (TextView) getView().findViewById(R.id.status_long); restartingWrapper.setVisibility(View.GONE); // adapt to specific computing status switch (currentComputingStatus) { case ClientStatus.COMPUTING_STATUS_NEVER: statusWrapper.setVisibility(View.VISIBLE); statusHeader.setText(BOINCActivity.monitor.getCurrentStatusTitle()); statusHeader.setVisibility(View.VISIBLE); statusImage.setImageResource(R.drawable.playb48); statusImage.setContentDescription(BOINCActivity.monitor.getCurrentStatusTitle()); statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); centerWrapper.setVisibility(View.VISIBLE); centerWrapper.setOnClickListener(runModeOnClickListener); break; case ClientStatus.COMPUTING_STATUS_SUSPENDED: statusWrapper.setVisibility(View.VISIBLE); statusHeader.setText(BOINCActivity.monitor.getCurrentStatusTitle()); statusHeader.setVisibility(View.VISIBLE); statusImage.setImageResource(R.drawable.pauseb48); statusImage.setContentDescription(BOINCActivity.monitor.getCurrentStatusTitle()); statusImage.setClickable(false); centerWrapper.setVisibility(View.VISIBLE); switch (currentComputingSuspendReason) { case BOINCDefs.SUSPEND_REASON_BATTERIES: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); statusImage.setImageResource(R.drawable.notconnectedb48); statusHeader.setVisibility(View.GONE); break; case BOINCDefs.SUSPEND_REASON_USER_ACTIVE: Boolean suspendDueToScreenOn = false; try { suspendDueToScreenOn = BOINCActivity.monitor.getSuspendWhenScreenOn(); } catch (RemoteException e) { } if (suspendDueToScreenOn) { statusImage.setImageResource(R.drawable.screen48b); statusHeader.setVisibility(View.GONE); } statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_USER_REQ: // state after user stops and restarts computation centerWrapper.setVisibility(View.GONE); restartingWrapper.setVisibility(View.VISIBLE); break; case BOINCDefs.SUSPEND_REASON_TIME_OF_DAY: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_BENCHMARKS: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); statusImage.setImageResource(R.drawable.watchb48); statusHeader.setVisibility(View.GONE); break; case BOINCDefs.SUSPEND_REASON_DISK_SIZE: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_CPU_THROTTLE: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_NO_RECENT_INPUT: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_INITIAL_DELAY: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_EXCLUSIVE_APP_RUNNING: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_CPU_USAGE: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_NETWORK_QUOTA_EXCEEDED: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_OS: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_WIFI_STATE: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case BOINCDefs.SUSPEND_REASON_BATTERY_CHARGING: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); statusImage.setImageResource(R.drawable.batteryb48); statusHeader.setVisibility(View.GONE); break; case BOINCDefs.SUSPEND_REASON_BATTERY_OVERHEATED: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); statusImage.setImageResource(R.drawable.batteryb48); statusHeader.setVisibility(View.GONE); break; default: statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; } break; case ClientStatus.COMPUTING_STATUS_IDLE: statusWrapper.setVisibility(View.VISIBLE); centerWrapper.setVisibility(View.VISIBLE); statusHeader.setText(BOINCActivity.monitor.getCurrentStatusTitle()); statusHeader.setVisibility(View.VISIBLE); statusImage.setImageResource(R.drawable.pauseb48); statusImage.setContentDescription(BOINCActivity.monitor.getCurrentStatusTitle()); statusImage.setClickable(false); statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusDescription()); break; case ClientStatus.COMPUTING_STATUS_COMPUTING: statusWrapper.setVisibility(View.GONE); break; } //save new computing status computingStatus = currentComputingStatus; computingSuspendReason = currentComputingSuspendReason; networkSuspendReason = currentNetworkSuspendReason; setupStatus = -1; // invalidate to force update next time no project } } else if (currentSetupStatus == ClientStatus.SETUP_STATUS_NOPROJECT) { if (setupStatus != ClientStatus.SETUP_STATUS_NOPROJECT) { // set layout and retrieve elements LinearLayout statusWrapper = (LinearLayout) getView().findViewById(R.id.status_wrapper); LinearLayout centerWrapper = (LinearLayout) getView().findViewById(R.id.center_wrapper); LinearLayout restartingWrapper = (LinearLayout) getView().findViewById(R.id.restarting_wrapper); TextView statusHeader = (TextView) getView().findViewById(R.id.status_header); ImageView statusImage = (ImageView) getView().findViewById(R.id.status_image); TextView statusDescriptor = (TextView) getView().findViewById(R.id.status_long); statusWrapper.setVisibility(View.VISIBLE); restartingWrapper.setVisibility(View.GONE); centerWrapper.setVisibility(View.VISIBLE); centerWrapper.setOnClickListener(addProjectOnClickListener); statusImage.setImageResource(R.drawable.projectsb48); statusHeader.setVisibility(View.GONE); statusDescriptor.setText(BOINCActivity.monitor.getCurrentStatusTitle()); setupStatus = ClientStatus.SETUP_STATUS_NOPROJECT; computingStatus = -1; } } else { // BOINC client is not available //invalid computingStatus, forces layout on next event setupStatus = -1; computingStatus = -1; } } catch (Exception e) { } }
From source file:com.nadmm.airports.wx.TafFragment.java
protected void showTaf(Intent intent) { if (getActivity() == null) { return;//from ww w. j a v a 2 s.c o m } Taf taf = (Taf) intent.getSerializableExtra(NoaaService.RESULT); if (taf == null) { return; } View detail = findViewById(R.id.wx_detail_layout); LinearLayout layout = (LinearLayout) findViewById(R.id.wx_status_layout); TextView tv = (TextView) findViewById(R.id.status_msg); layout.removeAllViews(); if (!taf.isValid) { tv.setVisibility(View.VISIBLE); layout.setVisibility(View.VISIBLE); tv.setText("Unable to get TAF for this location."); addRow(layout, "This could be due to the following reasons:"); addBulletedRow(layout, "Network connection is not available"); addBulletedRow(layout, "ADDS does not publish TAF for this station"); addBulletedRow(layout, "Station is currently out of service"); addBulletedRow(layout, "Station has not updated the TAF for more than 12 hours"); detail.setVisibility(View.GONE); stopRefreshAnimation(); setFragmentContentShown(true); return; } else { tv.setText(""); tv.setVisibility(View.GONE); layout.setVisibility(View.GONE); detail.setVisibility(View.VISIBLE); } tv = (TextView) findViewById(R.id.wx_age); tv.setText(TimeUtils.formatElapsedTime(taf.issueTime)); // Raw Text tv = (TextView) findViewById(R.id.wx_raw_taf); tv.setText(taf.rawText.replaceAll("(FM|BECMG|TEMPO)", "\n $1")); layout = (LinearLayout) findViewById(R.id.taf_summary_layout); layout.removeAllViews(); String fcstType; if (taf.rawText.startsWith("TAF AMD ")) { fcstType = "Amendment"; } else if (taf.rawText.startsWith("TAF COR ")) { fcstType = "Correction"; } else { fcstType = "Normal"; } addRow(layout, "Forecast type", fcstType); addRow(layout, "Issued at", TimeUtils.formatDateTime(getActivity(), taf.issueTime)); addRow(layout, "Valid from", TimeUtils.formatDateTime(getActivity(), taf.validTimeFrom)); addRow(layout, "Valid to", TimeUtils.formatDateTime(getActivity(), taf.validTimeTo)); if (taf.remarks != null && taf.remarks.length() > 0 && !taf.remarks.equals("AMD")) { addRow(layout, "\u2022 " + taf.remarks); } LinearLayout topLayout = (LinearLayout) findViewById(R.id.taf_forecasts_layout); topLayout.removeAllViews(); StringBuilder sb = new StringBuilder(); for (Forecast forecast : taf.forecasts) { RelativeLayout grp_layout = (RelativeLayout) inflate(R.layout.grouped_detail_item); // Keep track of forecast conditions across all change groups if (mLastForecast == null || forecast.changeIndicator == null || forecast.changeIndicator.equals("FM")) { mLastForecast = forecast; } else { if (forecast.visibilitySM < Float.MAX_VALUE) { mLastForecast.visibilitySM = forecast.visibilitySM; } if (forecast.skyConditions.size() > 0) { mLastForecast.skyConditions = forecast.skyConditions; } } sb.setLength(0); if (forecast.changeIndicator != null) { sb.append(forecast.changeIndicator); sb.append(" "); } sb.append(TimeUtils.formatDateRange(getActivity(), forecast.timeFrom, forecast.timeTo)); tv = (TextView) grp_layout.findViewById(R.id.group_extra); tv.setVisibility(View.GONE); tv = (TextView) grp_layout.findViewById(R.id.group_name); tv.setText(sb.toString()); String flightCategory = WxUtils.computeFlightCategory(mLastForecast.skyConditions, mLastForecast.visibilitySM); WxUtils.setFlightCategoryDrawable(tv, flightCategory); LinearLayout fcst_layout = (LinearLayout) grp_layout.findViewById(R.id.group_details); if (forecast.probability < Integer.MAX_VALUE) { addRow(fcst_layout, "Probability", String.format("%d%%", forecast.probability)); } if (forecast.changeIndicator != null && forecast.changeIndicator.equals("BECMG")) { addRow(fcst_layout, "Becoming at", TimeUtils.formatDateTime(getActivity(), forecast.timeBecoming)); } if (forecast.windSpeedKnots < Integer.MAX_VALUE) { String wind; if (forecast.windDirDegrees == 0 && forecast.windSpeedKnots == 0) { wind = "Calm"; } else if (forecast.windDirDegrees == 0) { wind = String.format(Locale.US, "Variable at %d knots", forecast.windSpeedKnots); } else { wind = String.format(Locale.US, "%s (%s true) at %d knots", GeoUtils.getCardinalDirection(forecast.windDirDegrees), FormatUtils.formatDegrees(forecast.windDirDegrees), forecast.windSpeedKnots); } String gust = ""; if (forecast.windGustKnots < Integer.MAX_VALUE) { gust = String.format(Locale.US, "Gusting to %d knots", forecast.windGustKnots); } addRow(fcst_layout, "Winds", wind, gust); } if (forecast.visibilitySM < Float.MAX_VALUE) { String value = forecast.visibilitySM > 6 ? "6+ SM" : FormatUtils.formatStatuteMiles(forecast.visibilitySM); addRow(fcst_layout, "Visibility", value); } if (forecast.vertVisibilityFeet < Integer.MAX_VALUE) { addRow(fcst_layout, "Visibility", FormatUtils.formatFeetAgl(forecast.vertVisibilityFeet)); } for (WxSymbol wx : forecast.wxList) { addRow(fcst_layout, "Weather", wx.toString()); } for (SkyCondition sky : forecast.skyConditions) { addRow(fcst_layout, "Clouds", sky.toString()); } if (forecast.windShearSpeedKnots < Integer.MAX_VALUE) { String shear = String.format(Locale.US, "%s (%s true) at %d knots", GeoUtils.getCardinalDirection(forecast.windShearDirDegrees), FormatUtils.formatDegrees(forecast.windShearDirDegrees), forecast.windShearSpeedKnots); String height = FormatUtils.formatFeetAgl(forecast.windShearHeightFeetAGL); addRow(fcst_layout, "Wind shear", shear, height); } if (forecast.altimeterHg < Float.MAX_VALUE) { addRow(fcst_layout, "Altimeter", FormatUtils.formatAltimeter(forecast.altimeterHg)); } for (TurbulenceCondition turbulence : forecast.turbulenceConditions) { String value = WxUtils.decodeTurbulenceIntensity(turbulence.intensity); String height = FormatUtils.formatFeetRangeAgl(turbulence.minAltitudeFeetAGL, turbulence.maxAltitudeFeetAGL); addRow(fcst_layout, "Turbulence", value, height); } for (IcingCondition icing : forecast.icingConditions) { String value = WxUtils.decodeIcingIntensity(icing.intensity); String height = FormatUtils.formatFeetRangeAgl(icing.minAltitudeFeetAGL, icing.maxAltitudeFeetAGL); addRow(fcst_layout, "Icing", value, height); } topLayout.addView(grp_layout, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } tv = (TextView) findViewById(R.id.wx_fetch_time); tv.setText("Fetched on " + TimeUtils.formatDateTime(getActivity(), taf.fetchTime)); tv.setVisibility(View.VISIBLE); stopRefreshAnimation(); setFragmentContentShown(true); }
From source file:com.nadmm.airports.wx.WxMapFragmentBase.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflate(R.layout.wx_map_detail_view); if (mLabel != null && mLabel.length() > 0) { TextView tv = (TextView) v.findViewById(R.id.wx_map_label); tv.setText(mLabel);//w ww .ja v a 2 s .com tv.setVisibility(View.VISIBLE); } if (mHelpText != null && mHelpText.length() > 0) { TextView tv = (TextView) v.findViewById(R.id.help_text); tv.setText(mHelpText); tv.setVisibility(View.VISIBLE); } OnClickListener listener = new OnClickListener() { @Override public void onClick(View v) { if (mPendingRow == null) { mPendingRow = v; String code = getMapCode(v); requestWxMap(code); } } }; LinearLayout layout = (LinearLayout) v.findViewById(R.id.wx_map_layout); for (int i = 0; i < mWxMapCodes.length; ++i) { View row = addProgressRow(layout, mWxMapNames[i]); row.setTag(mWxMapCodes[i]); row.setOnClickListener(listener); row.setBackgroundResource(R.drawable.row_selector_middle); } if (mWxTypeCodes != null) { TextView tv = (TextView) v.findViewById(R.id.wx_map_type_label); tv.setVisibility(View.VISIBLE); layout = (LinearLayout) v.findViewById(R.id.wx_map_type_layout); layout.setVisibility(View.VISIBLE); mSpinner = (Spinner) v.findViewById(R.id.map_type); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, mWxTypeNames); adapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item); mSpinner.setAdapter(adapter); } return v; }
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 .jav a2s . co 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:com.cachirulop.moneybox.activity.MovementDetailActivity.java
/** * Change the visibility of the get date fields (date and time), including * the title and separator./*from w w w .j av a 2 s. c om*/ * * @param visible * Tells if the fields should be visible (true) or not (false) */ private void setVisibleGetDate(boolean visible) { LinearLayout detailLayout; int visibility; if (visible) { visibility = View.VISIBLE; } else { visibility = View.GONE; } detailLayout = (LinearLayout) findViewById(R.id.llGetDate); detailLayout.setVisibility(visibility); }