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:ca.ualberta.cmput301w14t08.geochan.adapters.ThreadViewAdapter.java

/**
 * Sets the required fields of the orignal post of the thread.
 * Title, creator, comment, timestamp, location.
 * /* w  w w .ja  v  a  2s . c  om*/
 * @param convertView
 *            View container of a listView item.
 */
private void setOPFields(View convertView) {
    // Thread title
    TextView title = (TextView) convertView.findViewById(R.id.thread_view_op_threadTitle);
    // Special case of Viewing a Favourite Comment in ThreadView
    if (thread.getTitle().equals("")) {
        title.setVisibility(View.GONE);
        LinearLayout buttons = (LinearLayout) convertView.findViewById(R.id.thread_view_op_buttons);
        buttons.setVisibility(View.GONE);
    } else {
        title.setText(thread.getTitle());
    }
    // Thread creator
    TextView threadBy = (TextView) convertView.findViewById(R.id.thread_view_op_commentBy);
    threadBy.setText(
            "Posted by " + thread.getBodyComment().getUser() + "#" + thread.getBodyComment().getHash() + "  ");
    if (HashHelper.getHash(thread.getBodyComment().getUser()).equals(thread.getBodyComment().getHash())) {
        threadBy.setBackgroundResource(R.drawable.username_background_thread_rect);
        threadBy.setTextColor(Color.WHITE);
    }

    // Thread body comment
    TextView body = (TextView) convertView.findViewById(R.id.thread_view_op_commentBody);
    body.setText(thread.getBodyComment().getTextPost());
    // Thread timestamp
    TextView threadTime = (TextView) convertView.findViewById(R.id.thread_view_op_commentDate);
    threadTime.setText(thread.getBodyComment().getCommentDateString());
    // Location text
    TextView origPostLocationText = (TextView) convertView.findViewById(R.id.thread_view_op_locationText);
    GeoLocation loc = thread.getBodyComment().getLocation();
    String locDescriptor = loc.getLocationDescription();
    if (loc != null) {
        if (locDescriptor != null) {
            origPostLocationText.setText("near: " + locDescriptor);
        } else {
            // The rounding of long and lat for max 4 decimal digits.
            DecimalFormat format = new DecimalFormat();
            format.setRoundingMode(RoundingMode.HALF_EVEN);
            format.setMinimumFractionDigits(0);
            format.setMaximumFractionDigits(4);

            origPostLocationText.setText("Latitude: " + format.format(loc.getLatitude()) + " Longitude: "
                    + format.format(loc.getLongitude()));
        }
    }

    // Set the thumbnail if there is an image
    if (thread.getBodyComment().hasImage()) {
        ImageButton thumbnail = (ImageButton) convertView.findViewById(R.id.thread_view_comment_thumbnail);
        thumbnail.setVisibility(View.VISIBLE);
        thumbnail.setFocusable(false);
        thumbnail.setImageBitmap(thread.getBodyComment().getImageThumb());
    }
}

From source file:id.nci.stm_9.ExpandableListFragment.java

/**
 * Provide default implementation to return a simple list view. Subclasses can override to
 * replace with their own layout. If doing so, the returned view hierarchy <em>must</em> have a
 * ListView whose id is {@link android.R.id#list android.R.id.list} and can optionally have a
 * sibling view id {@link android.R.id#empty android.R.id.empty} that is to be shown when the
 * list is empty./*  w  w w  . j  a  v a2 s . c  o m*/
 * 
 * <p>
 * If you are overriding this method with your own custom content, consider including the
 * standard layout {@link android.R.layout#list_content} in your layout file, so that you
 * continue to retain all of the standard behavior of ListFragment. In particular, this is
 * currently the only way to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();

    FrameLayout root = new FrameLayout(context);

    // ------------------------------------------------------------------

    LinearLayout pframe = new LinearLayout(context);
    pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setOrientation(LinearLayout.VERTICAL);
    pframe.setVisibility(View.GONE);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    FrameLayout lframe = new FrameLayout(context);
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    // ------------------------------------------------------------------

    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}

From source file:fr.cph.chicago.activity.StationActivity.java

/**
 * Reset arrival layouts//from ww  w.ja v  a2 s  . c om
 * 
 * @param station
 *            the station
 */
private final void reset(final Station station) {
    Set<TrainLine> setTL = station.getLines();
    for (TrainLine tl : setTL) {
        for (TrainDirection d : TrainDirection.values()) {
            Integer id = mIds.get(tl.toString() + "_" + d.toString());
            if (id != null) {
                LinearLayout line3View = (LinearLayout) findViewById(id);
                if (line3View != null) {
                    line3View.setVisibility(View.GONE);
                    if (line3View.getChildCount() > 0) {
                        for (int i = 0; i < line3View.getChildCount(); i++) {
                            LinearLayout view = (LinearLayout) line3View.getChildAt(i);
                            TextView timing = (TextView) view.getChildAt(1);
                            if (timing != null) {
                                timing.setText("");
                            }
                        }
                    }
                }
            }
        }
    }
}

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

protected void hiddenOrDisplayStockBar(int k) {
    LinearLayout l = (LinearLayout) findViewById(R.id.zr_userstkbarlayout);
    l.setVisibility(k);
}

From source file:liqui.droid.activity.LiquiDroid.java

@SuppressWarnings("deprecation")
@Override/*w  w w  .  j a  va2 s. co m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getIntent().getAction() != null
            && getIntent().getAction().equals(getString(R.string.action_login_sync))) {
        // we create a new account
    } else {
        Cursor c = getContentResolver().query(ACCOUNT_CONTENT_URI, null, "last_active = 1", null, null);

        c.moveToFirst();

        if (!c.isAfterLast()) {
            mApiName = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_NAME));
            mApiUrl = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_URL));
            mMemberId = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_MEMBER_ID));
            mSessionKey = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_SESSION_KEY));

            Log.d("XXX", "loading old session: " + mMemberId + "@" + mApiName);
        }

        c.close();
    }

    if (isAuthenticated()) {
        Intent intent = new Intent().setClass(LiquiDroid.this, MemberActivity.class);

        Bundle extras = new Bundle();
        extras.putString(Constants.Account.API_NAME, getAPIName());
        extras.putString(Constants.Account.API_URL, getAPIUrl());
        extras.putString(Constants.Account.MEMBER_ID, getMemberId());
        extras.putString(Constants.Account.SESSION_KEY, getSessionKey());
        intent.putExtras(extras);

        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);

        finish();
        return;
    }

    setContentView(R.layout.act_main);

    /*
    ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
            
    actionBar.addAction(new IntentAction(this, new Intent(getApplicationContext(),
        Search.class), R.drawable.ic_search));
                
        */

    mSpinnerLQFBs = (Spinner) findViewById(R.id.sp_lqfb_instance);

    mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, null,
            new String[] { DBSystem.Instance.COLUMN_NAME, DBSystem.Instance.COLUMN_ID },
            new int[] { android.R.id.text1 });

    mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    mSpinnerLQFBs.setAdapter(mAdapter);
    mSpinnerLQFBs.setOnItemSelectedListener(this);

    mEditTextApiKey = (EditText) findViewById(R.id.et_api_token);
    mEditTextApiKey.addTextChangedListener(mPasswortTextWatcher);

    mButtonLogin = (Button) findViewById(R.id.btn_login);
    mButtonLogin.setEnabled(false);
    mButtonLogin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Cursor c = (Cursor) mSpinnerLQFBs.getSelectedItem();

            if (c == null)
                return;

            mApiUrl = c.getString(c.getColumnIndex(DBSystem.Instance.COLUMN_URL));
            mApiName = c.getString(c.getColumnIndex(DBSystem.Instance.COLUMN_NAME));

            hideKeyboard(mButtonLogin.getWindowToken());

            String key = mEditTextApiKey.getText().toString().trim();
            new LoginTask(LiquiDroid.this).execute(getAPIName(), getAPIUrl(), key);
        }
    });

    TextView tvExplore = (TextView) findViewById(R.id.tv_explore);
    tvExplore.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent().setClass(LiquiDroid.this, Explore.class);

            Bundle extras = new Bundle();
            extras.putString(Constants.Account.API_NAME, mApiName);
            extras.putString(Constants.Account.API_URL, mApiUrl);
            extras.putString(Constants.Account.MEMBER_ID, mMemberId);
            extras.putString(Constants.Account.SESSION_KEY, mSessionKey);
            intent.putExtras(extras);

            startActivity(intent);
        }
    });

    if (getIntent().getAction() != null
            && getIntent().getAction().equals(getString(R.string.action_login_sync))) {
        // we create a new account

        LinearLayout llExplore = (LinearLayout) findViewById(R.id.ll_explore);
        llExplore.setVisibility(View.GONE);
    }

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

From source file:org.dvbviewer.controller.ui.base.BaseListFragment.java

/**
 * Provide default implementation to return a simple list view.  Subclasses
 * can override to replace with their own layout.  If doing so, the
 * returned view hierarchy <em>must</em> have a ListView whose id
 * is {@link android.R.id#list android.R.id.list} and can optionally
 * have a sibling view id {@link android.R.id#empty android.R.id.empty}
 * that is to be shown when the list is empty.
 * //from  w  w w . j  a  v  a 2s .c om
 * <p>If you are overriding this method with your own custom content,
 * consider including the standard layout {@link android.R.layout#list_content}
 * in your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment.  In particular, this is currently the only
 * way to have the built-in indeterminant progress state be shown.
 *
 * @param inflater the inflater
 * @param container the container
 * @param savedInstanceState the saved instance state
 * @return the view
 * @author RayBa
 * @date 07.04.2013
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Context context = getActivity();
    if (layoutRessource > 0) {
        View v = getLayoutInflater(savedInstanceState).inflate(layoutRessource, null);
        return v;
    } else {
        FrameLayout root = new FrameLayout(context);

        // ------------------------------------------------------------------

        LinearLayout pframe = new LinearLayout(context);
        pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID);
        pframe.setOrientation(LinearLayout.VERTICAL);
        pframe.setVisibility(View.GONE);
        pframe.setGravity(Gravity.CENTER);

        ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyle);
        pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));

        root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        // ------------------------------------------------------------------

        FrameLayout lframe = new FrameLayout(context);
        lframe.setId(INTERNAL_LIST_CONTAINER_ID);

        TextView tv = new TextView(getActivity());
        tv.setId(INTERNAL_EMPTY_ID);
        tv.setGravity(Gravity.CENTER);
        tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
        lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        ListView lv = new ListView(getActivity());
        lv.setId(android.R.id.list);
        lv.setDrawSelectorOnTop(false);
        lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        // ------------------------------------------------------------------

        root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        return root;
    }
}

From source file:blackman.matt.infinitebrowser.InfinityBrowser.java

/**
 * Creates a new board for a post when reply button is hit.
 *
 * @param boardRoot Link to the thread to open up
 * @param threadNo Thread no being opened
 *//*from   www  .j  a v  a  2 s.c  o m*/
@Override
public void onReplyClicked(String boardRoot, String threadNo) {
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
    Boolean ageAccept = preferences.getBoolean("age_guard_accept", false);

    if (ageAccept) {
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        LinearLayout helpText = (LinearLayout) findViewById(R.id.ll_help_add_boards);

        Board newThread = Board.newInstance(boardRoot, threadNo);

        fragmentTransaction.replace(R.id.container, newThread, threadNo);
        fragmentTransaction.addToBackStack(null);

        fragmentTransaction.commit();

        helpText.setVisibility(View.GONE);
        mTitle = boardRoot.replace("https://8chan.co", "") + threadNo;
        setTitle(mTitle);
    }
}

From source file:org.catrobat.paintroid.MainActivity.java

private void setFullScreen(boolean isFullScreen) {

    PaintroidApplication.perspective.setFullscreen(isFullScreen);

    NavigationView mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    ActionBar supportActionBar = getSupportActionBar();

    if (isFullScreen) {
        PaintroidApplication.currentTool.hide();
        if (supportActionBar != null)
            supportActionBar.hide();/*  w  w w .j  av  a2  s  . c  o  m*/
        LinearLayout bottomBarLayout = (LinearLayout) findViewById(R.id.main_bottom_bar);
        if (PaintroidApplication.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            LinearLayout mToolbarContainer = (LinearLayout) (findViewById(R.id.toolbar_container));
            mToolbarContainer.setVisibility(View.GONE);
        }
        bottomBarLayout.setVisibility(View.GONE);
        mToolbarIsVisible = false;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

        mNavigationView.getMenu().findItem(R.id.nav_exit_fullscreen_mode).setVisible(true);
        mNavigationView.getMenu().findItem(R.id.nav_fullscreen_mode).setVisible(false);

    } else {
        if (supportActionBar != null)
            supportActionBar.show();
        LinearLayout bottomBarLayout = (LinearLayout) findViewById(R.id.main_bottom_bar);
        if (PaintroidApplication.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            LinearLayout mToolbarContainer = (LinearLayout) (findViewById(R.id.toolbar_container));
            mToolbarContainer.setVisibility(View.VISIBLE);
        }
        bottomBarLayout.setVisibility(View.VISIBLE);
        mToolbarIsVisible = true;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        mNavigationView.getMenu().findItem(R.id.nav_exit_fullscreen_mode).setVisible(false);
        mNavigationView.getMenu().findItem(R.id.nav_fullscreen_mode).setVisible(true);
    }
}

From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTimeProfile.java

final static private void setViewVisibilityByDateTimeType(final GlobalParameters mGlblParms, Dialog dialog,
        String repeat_type) {//  w  w w  .ja v a 2 s.c  o m
    LinearLayout ll_dw = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_day_of_the_week);
    LinearLayout ll_exec_year = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_year);
    LinearLayout ll_exec_month = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_month);
    LinearLayout ll_exec_day = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_day);
    LinearLayout ll_exec_hour = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_hour);
    LinearLayout ll_exec_ymd = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_ymd);
    LinearLayout ll_exec_hm = (LinearLayout) dialog.findViewById(R.id.edit_profile_time_ll_exec_hm);

    ll_dw.setVisibility(LinearLayout.VISIBLE);
    ll_exec_year.setVisibility(Spinner.VISIBLE);
    ll_exec_month.setVisibility(Spinner.VISIBLE);
    ll_exec_day.setVisibility(Spinner.VISIBLE);
    ll_exec_hour.setVisibility(Spinner.VISIBLE);
    ll_exec_ymd.setVisibility(LinearLayout.VISIBLE);
    ll_exec_hm.setVisibility(LinearLayout.VISIBLE);

    if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_ONE_SHOT)) {
        ll_dw.setVisibility(LinearLayout.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_EVERY_YEAR)) {
        ll_dw.setVisibility(LinearLayout.GONE);
        ll_exec_year.setVisibility(Spinner.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_EVERY_MONTH)) {
        ll_dw.setVisibility(LinearLayout.GONE);
        ll_exec_year.setVisibility(Spinner.GONE);
        ll_exec_month.setVisibility(Spinner.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_DAY_OF_THE_WEEK)) {
        ll_exec_year.setVisibility(Spinner.GONE);
        ll_exec_month.setVisibility(Spinner.GONE);
        ll_exec_day.setVisibility(Spinner.GONE);
        ll_exec_ymd.setVisibility(LinearLayout.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_EVERY_DAY)) {
        ll_dw.setVisibility(LinearLayout.GONE);
        ll_exec_year.setVisibility(Spinner.GONE);
        ll_exec_month.setVisibility(Spinner.GONE);
        ll_exec_day.setVisibility(Spinner.GONE);
        ll_exec_ymd.setVisibility(LinearLayout.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_EVERY_HOUR)) {
        ll_dw.setVisibility(LinearLayout.GONE);
        ll_exec_year.setVisibility(Spinner.GONE);
        ll_exec_month.setVisibility(Spinner.GONE);
        ll_exec_day.setVisibility(Spinner.GONE);
        ll_exec_hour.setVisibility(Spinner.GONE);
        ll_exec_ymd.setVisibility(LinearLayout.GONE);
    } else if (repeat_type.equals(PROFILE_DATE_TIME_TYPE_INTERVAL)) {
        ll_dw.setVisibility(LinearLayout.GONE);
        ll_exec_year.setVisibility(Spinner.GONE);
        ll_exec_month.setVisibility(Spinner.GONE);
        ll_exec_day.setVisibility(Spinner.GONE);
        ll_exec_ymd.setVisibility(LinearLayout.GONE);
    }

}

From source file:com.eng.arab.translator.androidtranslator.ShowDetailsMonth.java

private void showMonthlyDetails(String month) {
    DatabaseAccess db = DatabaseAccess.getInstance(getApplicationContext());
    db.open();// w w w  . j a  va  2s. c om
    List<MonthModel> alpha = db.getAllDetailsByMonth(month);
    TextToSpeak = alpha.get(0).getEnglishMonth();

    textViewKorean = (TextView) findViewById(R.id.textViewKorean);
    textViewPronunciation = (TextView) findViewById(R.id.textViewPronunciation);
    textViewWordType = (TextView) findViewById(R.id.textViewWordType);
    textViewDefinitions = (TextView) findViewById(R.id.textViewDefinitions);
    LinearLayout src_content_details_definitions = (LinearLayout) findViewById(
            R.id.src_content_details_definitions);
    textViewEnglish = (TextView) findViewById(R.id.textViewEnglish);

    // Setting Details for the MONTH
    textViewKorean.setText(month);
    textViewPronunciation.setText("\\" + alpha.get(0).getExample() + "\\");
    textViewWordType.setText("noun");
    // textViewDefinitions.setText("TESTs");
    src_content_details_definitions.setVisibility(View.GONE);
    textViewEnglish.setText(": " + alpha.get(0).getEnglishMonth());

    // Button to Speak
    buttonSpeakKorean = (Button) findViewById(R.id.buttonSpeakKorean);
    buttonSpeakKorean.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            speakWords(TextToSpeak);
        }
    });
}