Java Code Examples for android.widget.ViewSwitcher#setVisibility()

The following examples show how to use android.widget.ViewSwitcher#setVisibility() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Id3Writer.java    From QuickLyric with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onPreExecute() {
    MainActivity activity = (MainActivity) mActivity.get();

    ((DrawerLayout) activity.drawer).setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
    mFragment.get().enablePullToRefresh(true);
    activity.findViewById(R.id.refresh_fab).setEnabled(true);
    ((RefreshIcon) activity.findViewById(R.id.refresh_fab)).show();
    activity.invalidateOptionsMenu();

    ViewSwitcher viewSwitcher = activity.findViewById(R.id.switcher);
    EditText newLyrics = activity.findViewById(R.id.edit_lyrics);

    viewSwitcher.setVisibility(View.VISIBLE);
    newLyrics.setVisibility(View.GONE);
}
 
Example 2
Source File: EverythingCard.java    From NotificationPeekPort with Apache License 2.0 5 votes vote down vote up
private void init(Context context) {

        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

        boolean isPeekDisabled = preferences.getBoolean(PreferenceKeys.PREF_DISABLE_PEEK, false);
        String quietHourStr = preferences
                .getString(PreferenceKeys.PREF_QUIET_HOUR, PreferenceKeys.PREF_QUIET_HOUR_DEF);
        boolean isQuietHourSet = !quietHourStr.equals(PreferenceKeys.PREF_QUIET_HOUR_DEF);

        mOptionsShowing = !(isPeekDisabled || isQuietHourSet);
        mQuietHour = QuietHour.createQuietHour(quietHourStr);

        LayoutInflater.from(context).inflate(R.layout.everything_card, this, true);
        mPanelSwitcher = (ViewSwitcher) findViewById(R.id.view_switcher);
        if (!mOptionsShowing) {
            mPanelSwitcher.setVisibility(GONE);
        }

        mFromBtn = (Button) findViewById(R.id.quiet_hour_from_btn);
        mFromBtn.setOnClickListener(this);

        mToBtn = (Button) findViewById(R.id.quiet_hour_to_btn);
        mToBtn.setOnClickListener(this);

        Button mQuietHourBtn = (Button) findViewById(R.id.quiet_hour_btn);
        mQuietHourBtn.setOnClickListener(this);

        Button mDisableBtn = (Button) findViewById(R.id.as_is_btn);
        mDisableBtn.setOnClickListener(this);

        mFromToText = (TextView) findViewById(R.id.from_to_text);
        if (isQuietHourSet) {
            displayTime();
        }
        mFromToText.setOnClickListener(this);
    }
 
Example 3
Source File: LyricsViewFragment.java    From QuickLyric with GNU General Public License v3.0 5 votes vote down vote up
private void startEditTagsMode() {
    ImageButton editButton = getActivity().findViewById(R.id.edit_tags_btn);
    editButton.setImageResource(R.drawable.ic_edit_anim);
    ((Animatable) editButton.getDrawable()).start();

    ((DrawerLayout) ((MainActivity) getActivity()).drawer).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
    mRefreshLayout.setEnabled(false);
    getActivity().findViewById(R.id.refresh_fab).setEnabled(false);
    ((RefreshIcon) getActivity().findViewById(R.id.refresh_fab)).hide();
    ((Toolbar) getActivity().findViewById(R.id.toolbar)).getMenu().clear();

    ViewSwitcher viewSwitcher = getActivity().findViewById(R.id.switcher);
    EditText songTV = getActivity().findViewById(R.id.song);
    TextView artistTV = getActivity().findViewById(R.id.artist);

    EditText newLyrics = getActivity().findViewById(R.id.edit_lyrics);
    newLyrics.setTypeface(LyricsTextFactory.FontCache.get("light", getActivity()));
    newLyrics.setText(Html.fromHtml(TextUtils.isEmpty(mLyrics.getText()) ? "" : mLyrics.getText()), TextView.BufferType.EDITABLE);

    viewSwitcher.setVisibility(View.GONE);
    newLyrics.setVisibility(View.VISIBLE);

    songTV.setInputType(InputType.TYPE_CLASS_TEXT);
    artistTV.setInputType(InputType.TYPE_CLASS_TEXT);
    songTV.setBackgroundResource(R.drawable.abc_textfield_search_material);
    artistTV.setBackgroundResource(R.drawable.abc_textfield_search_material);


    if (songTV.requestFocus()) {
        InputMethodManager imm = (InputMethodManager)
                getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.SHOW_IMPLICIT);
    }
}