Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

In this page you can find the example usage for android.widget TextView setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.afwsamples.testdpc.SetupManagementFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mLogoUri = (Uri) savedInstanceState.getParcelable(EXTRA_PROVISIONING_LOGO_URI);
        mCurrentColor = savedInstanceState.getInt(EXTRA_PROVISIONING_MAIN_COLOR);
    } else {//  ww  w  . j  a  va  2  s . c  o  m
        mLogoUri = resourceToUri(getActivity(), R.drawable.ic_launcher);
        mCurrentColor = getResources().getColor(R.color.teal);
    }

    // Use setupwizard theme
    final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.SetupTheme);
    LayoutInflater themeInflater = inflater.cloneInContext(contextThemeWrapper);
    View view = themeInflater.inflate(R.layout.setup_management_fragment, container, false);
    SetupWizardLayout layout = (SetupWizardLayout) view.findViewById(R.id.setup_wizard_layout);
    NavigationBar navigationBar = layout.getNavigationBar();
    navigationBar.setNavigationBarListener(this);
    navigationBar.getBackButton().setText(R.string.exit);
    mNavigationNextButton = navigationBar.getNextButton();
    mNavigationNextButton.setText(R.string.setup_label);

    mSetupManagementMessage = (TextView) view.findViewById(R.id.setup_management_message_id);
    mSetupOptions = (RadioGroup) view.findViewById(R.id.setup_options);
    mSetupOptions.setOnCheckedChangeListener(this);
    mSkipUserConsent = (CheckBox) view.findViewById(R.id.skip_user_consent);
    mKeepAccountMigrated = (CheckBox) view.findViewById(R.id.keep_account_migrated);
    mSkipEncryption = (CheckBox) view.findViewById(R.id.skip_encryption);

    mParamsView = view.findViewById(R.id.params);
    mParamsIndicator = (ImageButton) view.findViewById(R.id.params_indicator);
    mParamsIndicator.setOnClickListener(this);

    view.findViewById(R.id.color_select_button).setOnClickListener(this);
    mColorValue = (TextView) view.findViewById(R.id.selected_color_value);
    mColorValue.setText(String.format(ColorPicker.COLOR_STRING_FORMATTER, mCurrentColor));
    mColorPreviewView = (ImageView) view.findViewById(R.id.preview_color);
    mColorPreviewView.setImageTintList(ColorStateList.valueOf(mCurrentColor));

    Intent launchIntent = getActivity().getIntent();
    if (LaunchIntentUtil.isSynchronousAuthLaunch(launchIntent)) {
        Account addedAccount = LaunchIntentUtil.getAddedAccount(launchIntent);
        if (addedAccount != null) {
            view.findViewById(R.id.managed_account_desc).setVisibility(View.VISIBLE);
            // Show the user which account needs management.
            TextView managedAccountName = (TextView) view.findViewById(R.id.managed_account_name);
            managedAccountName.setVisibility(View.VISIBLE);
            managedAccountName.setText(addedAccount.name);
        } else {
            // This is not an expected case, sync-auth is triggered by an account being added so
            // we expect to be told which account to migrate in the launch intent. We don't
            // finish() here as it's still technically feasible to continue.
            Toast.makeText(getActivity(), R.string.invalid_launch_intent_no_account, Toast.LENGTH_LONG).show();
        }
    }
    return view;
}

From source file:com.google.android.apps.mytracks.fragments.ChooseActivityDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    packageManager = getActivity().getPackageManager();
    List<DisplayInfo> displayInfos = getDisplayInfos();

    ArrayAdapter<DisplayInfo> arrayAdapter = new ArrayAdapter<DisplayInfo>(getActivity(),
            R.layout.choose_activity_list_item, R.id.choose_activity_list_item_text1, displayInfos) {
        @Override/*from   w w  w  .j  a v a 2  s .c o  m*/
        public View getView(int position, View convertView, ViewGroup parent) {
            View view;
            if (convertView == null) {
                view = getActivity().getLayoutInflater().inflate(R.layout.choose_activity_list_item, parent,
                        false);
            } else {
                view = convertView;
            }
            DisplayInfo displayInfo = getItem(position);
            TextView text1 = (TextView) view.findViewById(R.id.choose_activity_list_item_text1);
            TextView text2 = (TextView) view.findViewById(R.id.choose_activity_list_item_text2);
            ImageView icon = (ImageView) view.findViewById(R.id.choose_activity_list_item_icon);
            text1.setText(displayInfo.primaryLabel);
            if (displayInfo.secondaryLabel != null) {
                text2.setVisibility(View.VISIBLE);
                text2.setText(displayInfo.secondaryLabel);
            } else {
                text2.setVisibility(View.GONE);
            }
            icon.setImageDrawable(displayInfo.icon);
            return view;
        }
    };
    return new AlertDialog.Builder(getActivity())
            .setSingleChoiceItems(arrayAdapter, 0, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    AlertDialog alertDialog = (AlertDialog) dialog;
                    DisplayInfo displayInfo = (DisplayInfo) alertDialog.getListView().getItemAtPosition(which);
                    ActivityInfo activityInfo = displayInfo.resolveInfo.activityInfo;
                    String packageName = activityInfo.applicationInfo.packageName;
                    String className = activityInfo.name;

                    long trackId = getArguments().getLong(KEY_TRACK_ID);
                    String trackUrl = getArguments().getString(KEY_TRACK_URL);
                    if (trackUrl == null) {
                        SendRequest sendRequest = new SendRequest(trackId);
                        sendRequest.setSendMaps(true);
                        sendRequest.setNewMap(true);
                        sendRequest.setSharingAppPackageName(packageName);
                        sendRequest.setSharingAppClassName(className);
                        Intent intent = IntentUtils.newIntent(getActivity(), ConfirmSharingActivity.class)
                                .putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
                        startActivity(intent);
                        dismiss();
                    } else {
                        Intent intent = IntentUtils.newShareUrlIntent(getActivity(), trackId, trackUrl,
                                packageName, className);
                        startActivity(intent);
                        getActivity().finish();
                    }
                }
            }).setTitle(R.string.share_track_picker_title).create();
}

From source file:org.anhonesteffort.flock.SubscriptionStripeFragment.java

private void handleUpdateUiForCreatingSubscription() {
    TextView statusView = (TextView) subscriptionActivity.findViewById(R.id.card_subscription_status);
    statusView.setVisibility(View.GONE);

    Button buttonCancel = (Button) subscriptionActivity.findViewById(R.id.button_card_cancel);
    Button buttonStartSubscription = (Button) subscriptionActivity.findViewById(R.id.button_card_action);

    buttonCancel.setVisibility(View.GONE);

    buttonStartSubscription.setText(R.string.start_subscription);
    buttonStartSubscription.setOnClickListener(new View.OnClickListener() {
        @Override//from  w w w  .  jav  a  2s  . c o m
        public void onClick(View view) {
            handleVerifyCardAndPutToServer();
        }
    });

    initCardNumberHelper();
    initCardExpirationHelper();
}

From source file:com.birkettenterprise.phonelocator.activity.UpdateLogActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    // add controllers before you call super.onCreate()

    mListController = new ListController(this);
    mListController.setContentView(R.layout.update_log_activity);

    addController(mListController);//from   www .  ja  v  a 2 s.co m
    super.onCreate(savedInstanceState);

    setContentView(mListController.getView());

    mResourceCursorAdapter = new ResourceCursorAdapter(UpdateLogActivity.this, R.layout.update_log_list_item,
            null, true) {

        @Override
        public View newView(Context context, Cursor cur, ViewGroup parent) {
            LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            return li.inflate(R.layout.update_log_list_item, parent, false);
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            String errorType = cursor.getString(ERROR_TYPE_COLUMN_INDEX);

            TextView updateTimestampView = (TextView) view.findViewById(R.id.update_log_update_timestamp);
            setTimeStamp(updateTimestampView, cursor, UPDATE_TIMESTAMP_COLUMN_INDEX);

            TextView errorView = (TextView) view.findViewById(R.id.update_log_error);

            if (errorType == null) {
                TextView locationProviderTextView = (TextView) view
                        .findViewById(R.id.update_log_location_provider);
                locationProviderTextView.setText(cursor.getString(PROVIDER_COLUMN_INDEX));
                errorView.setVisibility(View.GONE);
                view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.VISIBLE);
            } else {
                errorView.setVisibility(View.VISIBLE);
                setError(errorView, cursor, errorType);
                view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.GONE);
            }
        }
    };

    getSupportLoaderManager().initLoader(0, null, this);

    mListController.setListAdapter(mResourceCursorAdapter);
}

From source file:com.android.browser.GearsBaseDialog.java

public void setupDialog(TextView message, ImageView icon) {
    message.setText(R.string.unrecognized_dialog_message);
    icon.setImageResource(R.drawable.ic_dialog_menu_generic);
    message.setVisibility(View.VISIBLE);
}

From source file:co.dilaver.quoter.fragments.FavoriteQuotesFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_favorite_quotes, container, false);

    rootLayout = (CoordinatorLayout) view.findViewById(R.id.clFavoriteRoot);
    favoriteQuotesList = new ArrayList<>();
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.rvFavoriteQuotes);
    TextView noFavoriteQuotes = (TextView) view.findViewById(R.id.tvNoFavoriteQuotes);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    quotesAdapter = new QuotesAdapter(getActivity());
    quotesAdapter.setLongClickListener(this);
    recyclerView.setAdapter(quotesAdapter);

    favoriteQuotesList = MyApplication.savedQuotesList;
    quotesAdapter.setList(favoriteQuotesList);

    if (favoriteQuotesList.isEmpty()) {
        noFavoriteQuotes.setVisibility(View.VISIBLE);
    } else {/*w ww.j  a va  2 s .  c om*/
        Toast.makeText(getActivity(), getString(R.string.str_longClickToDelete), Toast.LENGTH_SHORT).show();
    }

    return view;
}

From source file:com.digitalobstaclecourse.bluefinder.FindCar.java

private void refresh_action_view() {
    //Log.d(TAG, "refresh_action_view");
    View actionView = mActionView;
    if (actionView != null) {
        TextView tv = (TextView) actionView.findViewById(R.id.uses_remaining);
        if (hasInfiniteLicense()) {
            actionView.findViewById(R.id.infinity_icon).setVisibility(View.VISIBLE);
            tv.setVisibility(View.INVISIBLE);
        } else {/*from w w w .  j a v a  2 s .  c  om*/
            tv.setVisibility(View.VISIBLE);
            actionView.findViewById(R.id.infinity_icon).setVisibility(View.INVISIBLE);
            //Log.d(TAG, String.format("refresh_action_view - get Uses Remaining %d", getUsesRemaining()));
            tv.setText(String.format("%d", getUsesRemaining()));
        }
    }
}

From source file:com.gh4a.activities.ReleaseInfoActivity.java

private void fillNotes(String bodyHtml) {
    TextView body = (TextView) findViewById(R.id.tv_release_notes);

    if (!StringUtils.isBlank(bodyHtml)) {
        bodyHtml = HtmlUtils.format(bodyHtml).toString();
        mImageGetter.bind(body, bodyHtml, mRelease.getId());
        body.setMovementMethod(UiUtils.CHECKING_LINK_METHOD);
    } else {/*www.  ja v  a2s.  c  om*/
        body.setText(R.string.release_no_releasenotes);
    }

    body.setVisibility(View.VISIBLE);
    findViewById(R.id.pb_releasenotes).setVisibility(View.GONE);
}

From source file:name.gumartinm.weather.information.fragment.current.CurrentFragment.java

@Override
public void onResume() {
    super.onResume();

    this.mReceiver = new BroadcastReceiver() {

        @Override/* w ww .j a v a2 s  .  c  o  m*/
        public void onReceive(final Context context, final Intent intent) {
            final String action = intent.getAction();
            if (action.equals(BROADCAST_INTENT_ACTION)) {
                final Current currentRemote = (Current) intent.getSerializableExtra("current");

                // 1. Check conditions. They must be the same as the ones that triggered the AsyncTask.
                final DatabaseQueries query = new DatabaseQueries(context.getApplicationContext());
                final WeatherLocation weatherLocation = query.queryDataBase();
                final PermanentStorage store = new PermanentStorage(context.getApplicationContext());
                final Current current = store.getCurrent();

                if (current == null
                        || !CurrentFragment.this.isDataFresh(weatherLocation.getLastCurrentUIUpdate())) {

                    if (currentRemote != null) {
                        // 2. Update UI.
                        CurrentFragment.this.updateUI(currentRemote);

                        // 3. Update current data.
                        store.saveCurrent(currentRemote);

                        // 4. Update location data.
                        weatherLocation.setLastCurrentUIUpdate(new Date());
                        query.updateDataBase(weatherLocation);
                    } else {
                        // Empty UI and show error message
                        CurrentFragment.this.getActivity().findViewById(R.id.weather_current_data_container)
                                .setVisibility(View.GONE);
                        CurrentFragment.this.getActivity().findViewById(R.id.weather_current_progressbar)
                                .setVisibility(View.GONE);
                        CurrentFragment.this.getActivity().findViewById(R.id.weather_current_error_message)
                                .setVisibility(View.VISIBLE);
                    }
                }
            }
        }
    };

    // Register receiver
    final IntentFilter filter = new IntentFilter();
    filter.addAction(BROADCAST_INTENT_ACTION);
    LocalBroadcastManager.getInstance(this.getActivity().getApplicationContext())
            .registerReceiver(this.mReceiver, filter);

    // Empty UI
    this.getActivity().findViewById(R.id.weather_current_data_container).setVisibility(View.GONE);

    final DatabaseQueries query = new DatabaseQueries(this.getActivity().getApplicationContext());
    final WeatherLocation weatherLocation = query.queryDataBase();
    if (weatherLocation == null) {
        // Nothing to do.
        // Show error message
        final ProgressBar progress = (ProgressBar) getActivity().findViewById(R.id.weather_current_progressbar);
        progress.setVisibility(View.GONE);
        final TextView errorMessage = (TextView) getActivity().findViewById(R.id.weather_current_error_message);
        errorMessage.setVisibility(View.VISIBLE);
        return;
    }

    // If is new location update widgets.
    if (weatherLocation.getIsNew()) {
        WidgetProvider.refreshAllAppWidgets(this.getActivity().getApplicationContext());
        // Update location data.
        weatherLocation.setIsNew(false);
        query.updateDataBase(weatherLocation);
    }

    final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
    final Current current = store.getCurrent();

    if (current != null && this.isDataFresh(weatherLocation.getLastCurrentUIUpdate())) {
        this.updateUI(current);
    } else {
        // Load remote data (asynchronous)
        // Gets the data from the web.
        this.getActivity().findViewById(R.id.weather_current_progressbar).setVisibility(View.VISIBLE);
        this.getActivity().findViewById(R.id.weather_current_error_message).setVisibility(View.GONE);
        final CurrentTask task = new CurrentTask(this.getActivity().getApplicationContext(),
                new CustomHTTPClient(AndroidHttpClient.newInstance(this.getString(R.string.http_client_agent))),
                new ServiceCurrentParser(new JPOSCurrentParser()));

        task.execute(weatherLocation.getLatitude(), weatherLocation.getLongitude());
    }
}