Example usage for android.widget LinearLayout setVisibility

List of usage examples for android.widget LinearLayout setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.arconus.dicecommander.ui.dialogs.PowerRollResultDialog.java

private void prepareRollResultDialog(View view) {
    if (roll.getHasAttackRoll()) {
        TextView attkRollResult = (TextView) view.findViewById(R.id.attack_roll_result);
        attkRollResult.setText(String.valueOf(roll.getAttackRollResult()));

        TextView targetDefense = (TextView) view.findViewById(R.id.attack_roll_target_defense);
        targetDefense.setText(roll.getTargetDefenseResID());

        showCritStatus(view);/* www  . j  a va2  s . c o m*/
    } else {
        TextView attackRollTitle = (TextView) view.findViewById(R.id.attack_roll_title);
        attackRollTitle.setVisibility(View.GONE);

        LinearLayout attackRollLayout = (LinearLayout) view.findViewById(R.id.attack_roll_result_layout);
        attackRollLayout.setVisibility(View.GONE);
    }

    TextView dmgRollResult = (TextView) view.findViewById(R.id.damage_roll_result);
    if (roll.getHasDamageRoll()) {
        dmgRollResult.setText(String.valueOf(roll.getDamageRollResult()));
    } else {
        TextView damageRollTitle = (TextView) view.findViewById(R.id.damage_roll_title);
        damageRollTitle.setVisibility(View.GONE);

        dmgRollResult.setVisibility(View.GONE);
    }

}

From source file:com.ramdroid.wizardbuilder.WizardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.wb_wizard_page, null);

    final WizardPage page = pageSet.get(pageId);

    int imageId = page.imageId;
    ImageView image = (ImageView) v.findViewById(R.id.image);
    if (image != null) {
        try {//from w  ww.  j a  va  2  s  . c  o m
            image.setImageDrawable(getResources().getDrawable(imageId));
        } catch (Resources.NotFoundException e) {
            image.setVisibility(View.GONE);
        }
    }

    int descriptionId = page.descriptionId;
    ;
    TextView text = (TextView) v.findViewById(R.id.description);
    if (text != null) {
        text.setText(descriptionId);
    }

    LinearLayout layoutButtonPanel = (LinearLayout) v.findViewById(R.id.buttonPanel);
    layoutButtonPanel.setVisibility(page.buttonVisibility);

    Button buttonNoThanks = (Button) v.findViewById(R.id.buttonNoThanks);
    buttonNoThanks.setVisibility(page.dismissButtonVisibility);
    buttonNoThanks.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            getActivity().sendBroadcast(new Intent(ACTION_DISMISS_BUTTON));
            leave();
        }

    });

    if (page.buttonTextId > 0) {
        Button buttonLaunch = (Button) v.findViewById(R.id.buttonLaunch);
        buttonLaunch.setText(page.buttonTextId);
        buttonLaunch.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                getActivity().sendBroadcast(new Intent(ACTION_CLICKED_BUTTON).putExtra("page", page.id));
                leave();
            }

        });
    }

    return v;
}

From source file:ua.com.spacetv.mycookbook.tools.ListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = lInflater.inflate(R.layout.format_list_view, parent, false);
    ListData listData = ((ListData) getItem(position));
    TextView textTitle = (TextView) view.findViewById(R.id.textTitle);
    textTitle.setText(listData.getListTitle());

    /** if any subcategory nof found -> get out TextView 'textSubTitle' */
    TextView textSubTitle = (TextView) view.findViewById(R.id.textSubTitle);
    String subTitle = listData.getListSubTitle();
    if (subTitle.equals(null) | subTitle.equals("")) {
        textSubTitle.setVisibility(view.GONE);
    } else/*from w w  w .  ja  v  a2s.c  o  m*/
        textSubTitle.setText(subTitle);

    /** don't show numbers of recipe if they is 0 */
    TextView textNumber = (TextView) view.findViewById(R.id.textNumber);
    int numberRecipe = listData.getNumber();
    if (numberRecipe == 0) {
        textNumber.setVisibility(view.GONE);
    } else
        textNumber.setText(String.format("%d", numberRecipe));

    /** switch icons between folders and recipes */
    ImageView imageIcon = (ImageView) view.findViewById(R.id.imageIcon);
    if (listData.getImgIcon() == ID_IMG_FOLDER) {
        imageIcon.setImageResource(R.drawable.ic_folder_open_black_24dp);
    } else if (listData.getImgIcon() == ID_IMG_RECIPE) {
        if (isShowingDefaultImageRecipe) {
            imageIcon.setImageResource(R.drawable.ic_document_24);
        } else {
            String path = listData.getPathImage();
            if (path == null || path.equals("") || !ifFileFound(path)) {
                imageIcon.setImageResource(R.drawable.ic_document_24);
            } else {
                setImage(path, imageIcon);
            }
        }
    }

    /** if 'Like' not set on recipe -> disable show layoutImgLike */
    if (listData.getImgLike() == ID_IMG_LIKE_OFF) {
        LinearLayout layoutImgLike = (LinearLayout) view.findViewById(R.id.layoutImgLike);
        layoutImgLike.setVisibility(View.GONE);
    }

    return view;
}

From source file:br.com.testmaster.view.fragment.OffersFragment.java

/**
 *
 *///w  w  w .  j a  v a 2 s .  c o m
@Override
public void processFinish(Object output) {

    LinearLayout emptyLay = (LinearLayout) getView().findViewById(R.id.emptyMessageLay);

    if (output == null) {
        emptyLay.setVisibility(View.VISIBLE);
        return;
    } else {
        emptyLay.setVisibility(View.GONE);
    }

    offerWrp = (OfferWrapper) output;
    offerAdapter = new OffersAdapter(offerWrp);
    mRecyclerView.setAdapter(offerAdapter);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mSwipeRefreshLayout.setRefreshing(false);

    mRecyclerView.addOnItemTouchListener(
            new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() {
                @Override
                public void onItemClick(View view, int position) {
                    startActivity(new Intent(getActivity(), OfferDetailActivity.class)
                            .putExtra("offer", offerWrp.getOffers().get(position))
                            .putExtra("state", offerWrp.getOffers().get(position).getState()));
                }
            }));
}

From source file:org.mozilla.focus.fragment.AddToHomescreenDialogFragment.java

@NonNull
@Override//from   w  w  w.jav  a2s  .  c  om
public AlertDialog onCreateDialog(Bundle bundle) {
    final String url = getArguments().getString(URL);
    final String title = getArguments().getString(TITLE);
    final boolean blockingEnabled = getArguments().getBoolean(BLOCKING_ENABLED);

    final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.DialogStyle);
    builder.setCancelable(true);
    builder.setTitle(getActivity().getString(R.string.menu_add_to_home_screen));

    final LayoutInflater inflater = getActivity().getLayoutInflater();
    final View dialogView = inflater.inflate(R.layout.add_to_homescreen, null);
    builder.setView(dialogView);

    final Bitmap icon = IconGenerator.generateLauncherIcon(getActivity(), url);
    final Drawable d = new BitmapDrawable(getResources(), icon);
    final ImageView iconView = (ImageView) dialogView.findViewById(R.id.homescreen_icon);
    iconView.setImageDrawable(d);

    final ImageView blockIcon = (ImageView) dialogView.findViewById(R.id.homescreen_dialog_block_icon);
    blockIcon.setImageResource(R.drawable.ic_tracking_protection_16_disabled);

    final Button addToHomescreenDialogCancelButton = (Button) dialogView
            .findViewById(R.id.addtohomescreen_dialog_cancel);
    final Button addToHomescreenDialogConfirmButton = (Button) dialogView
            .findViewById(R.id.addtohomescreen_dialog_add);
    addToHomescreenDialogCancelButton.setText(getString(R.string.dialog_addtohomescreen_action_cancel));
    addToHomescreenDialogConfirmButton.setText(getString(R.string.dialog_addtohomescreen_action_add));

    final LinearLayout warning = (LinearLayout) dialogView.findViewById(R.id.homescreen_dialog_warning_layout);
    warning.setVisibility(blockingEnabled ? View.GONE : View.VISIBLE);

    final EditText editableTitle = (EditText) dialogView.findViewById(R.id.edit_title);

    if (!TextUtils.isEmpty(title)) {
        editableTitle.setText(title);
        editableTitle.setSelection(title.length());
    }

    addToHomescreenDialogCancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            TelemetryWrapper.cancelAddToHomescreenShortcutEvent();
            dismiss();
        }
    });

    addToHomescreenDialogConfirmButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            HomeScreen.installShortCut(getActivity(), icon, url, editableTitle.getText().toString().trim(),
                    blockingEnabled);
            TelemetryWrapper.addToHomescreenShortcutEvent();
            dismiss();
        }
    });

    return builder.create();
}

From source file:es.ubiqua.atractivas.AppdiaActivity.java

public void showButtons() {
    LinearLayout botonera = (LinearLayout) findViewById(R.id.botonera);
    botonera.setVisibility(View.VISIBLE);
}

From source file:es.ubiqua.atractivas.AppdiaActivity.java

public void hideButtons() {
    LinearLayout botonera = (LinearLayout) findViewById(R.id.botonera);
    botonera.setVisibility(View.GONE);
}

From source file:org.cowboycoders.cyclisimo.TurboTrainerListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list_select);

    mHandler = new Handler();

    sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);

    listView = (ListView) findViewById(R.id.generic_list);

    this.setTitle(this.getString(R.string.turbotrainer_select_title));

    LinearLayout bottomButtons = (LinearLayout) this.findViewById(R.id.generic_list_buttons_container);
    bottomButtons.setVisibility(View.GONE);

    Resources res = getResources();
    String[] trainers = res.getStringArray(R.array.turbotrainer_opions);

    resourceCursorAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, trainers);

    listView.setAdapter(resourceCursorAdapter);

}

From source file:org.cowboycoders.cyclismo.TurboTrainerListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list_select);

    mHandler = new Handler();

    sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);

    listView = (ListView) findViewById(R.id.generic_list);

    this.setTitle(this.getString(R.string.turbotrainer_select_title));

    LinearLayout bottomButtons = (LinearLayout) this.findViewById(R.id.generic_list_buttons_container);
    bottomButtons.setVisibility(View.GONE);

    Resources res = getResources();
    String[] trainers = res.getStringArray(R.array.turbotrainer_options);

    resourceCursorAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, trainers);

    listView.setAdapter(resourceCursorAdapter);

}

From source file:com.packpublishing.asynchronousandroid.chapter6.SMSDispatchActivity.java

void initUI() {

    LinearLayout permLL = (LinearLayout) findViewById(R.id.ownPermissionsLL);
    LinearLayout noPermLL = (LinearLayout) findViewById(R.id.noPermissionsLL);
    permLL.setVisibility(View.VISIBLE);
    noPermLL.setVisibility(View.GONE);
    Button submit = (Button) findViewById(R.id.submit);
    submit.setOnClickListener(mSubmit);//from  www.ja  va  2  s .c  o  m
}