Java Code Examples for android.support.v7.widget.CardView#setVisibility()

The following examples show how to use android.support.v7.widget.CardView#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: LoginRegistrationActivity.java    From Password-Storage with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_login_registration);
    login = (Button) findViewById(R.id.btn_login);
    register = (Button) findViewById(R.id.btn_register);
    cardView=(CardView)findViewById(R.id.layout2);
    splashActivity=new SplashActivity();

    login.setOnClickListener(this);
    register.setOnClickListener(this);
    b=splashActivity.containsPass("password");

    if(b==true)
    {
        register.setVisibility(View.INVISIBLE);
        cardView.setVisibility(View.INVISIBLE);
    }
}
 
Example 2
Source File: QueueActivity.java    From PainlessMusicPlayer with Apache License 2.0 6 votes vote down vote up
private void onEnterTransitionFinished() {
    if (fab.getScaleX() != 1f) {
        fab.animate().scaleX(1f).scaleY(1f).setDuration(mShortAnimTime).start();
    }
    if (albumArtDim.getAlpha() != 1f) {
        albumArtDim.animate().alpha(1f).setDuration(mShortAnimTime).start();
    }

    final CardView cardView = findViewById(R.id.cardView);
    if (cardView != null && cardView.getVisibility() != View.VISIBLE) {
        if (TransitionUtils.supportsActivityTransitions() && hasCoverTransition) {
            cardView.setTranslationY(SlideFromBottomHelper.getStartTranslation(cardView));
            cardView.setVisibility(View.VISIBLE);
            SlideFromBottomHelper.createAnimator(cardView).setDuration(mMediumAnimTime).start();
        } else {
            cardView.setVisibility(View.VISIBLE);
        }
    }
}
 
Example 3
Source File: Misc.java    From SystemUITuner2 with MIT License 5 votes vote down vote up
private void setupSwitches() {
    Switch show_full_zen = view.findViewById(R.id.show_full_zen);
    Switch hu_notif = view.findViewById(R.id.hu_notif);
    Switch vol_warn = view.findViewById(R.id.vol_warn);
    Switch power_notifs = view.findViewById(R.id.power_notifications);
    Switch clock_seconds = view.findViewById(R.id.clock_seconds);
    Switch battery_percent = view.findViewById(R.id.battery_percent);
    CardView power_notif_controls = view.findViewById(R.id.power_notification_controls_card);

    //noinspection deprecation
    battery_percent.setText(Html.fromHtml(getResources().getText(R.string.battery_percentage) + "<br /><small> <font color=\"#777777\">" + getResources().getText(R.string.reboot_required) + "</font></small>"));

    if (Build.VERSION.SDK_INT > 23) {
        clock_seconds.setVisibility(View.VISIBLE); //only show switch if user is on Nougat or later
        power_notif_controls.setVisibility(View.VISIBLE); //this is a Nougat feature; only show it on Nougat devices
    } else {
        clock_seconds.setVisibility(View.GONE);
        power_notif_controls.setVisibility(View.GONE);
    }

    activity.setThings.switches(show_full_zen, SHOW_FULL_ZEN, SECURE, view); //switch listener
    activity.setThings.switches(hu_notif, HUN_ENABLED, GLOBAL, view);
    activity.setThings.switches(vol_warn, SAFE_AUDIO, GLOBAL, view);

    activity.setThings.switches(clock_seconds, CLOCK_SECONDS, SECURE, view);
    activity.setThings.switches(battery_percent, BATTERY_PERCENT, SYSTEM, view);

    activity.setThings.switches(power_notifs, POW_NOTIFS, SECURE, view);
}
 
Example 4
Source File: InfoRecyclerViewAdapter.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
private void setColor(CardView card, TextView text, int color) {
    if (Color.alpha(color) == 0) {
        //color not found
        card.setVisibility(View.GONE);
        return;
    }

    card.setCardBackgroundColor(color);
    text.setTextColor(getTextColor(text.getContext(), color));
    String colorHex = String.format("#%06X", (0xFFFFFF & color));
    text.setText(colorHex);

    card.setTag(colorHex);
    card.setOnClickListener(onClickListener);
}
 
Example 5
Source File: GroupPopupView.java    From openlauncher with Apache License 2.0 5 votes vote down vote up
private void init() {
    if (isInEditMode()) {
        return;
    }
    _popupCard = (CardView) LayoutInflater.from(getContext()).inflate(R.layout.view_group_popup, this, false);
    // set the CardView color
    int color = Setup.appSettings().getDesktopFolderColor();
    int alpha = Color.alpha(color);
    _popupCard.setCardBackgroundColor(color);
    // remove elevation if CardView's background is transparent to avoid weird shadows because CardView does not support transparent backgrounds
    if (alpha == 0) {
        _popupCard.setCardElevation(0f);
    }
    _cellContainer = _popupCard.findViewById(R.id.group);

    bringToFront();

    setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (_dismissListener != null) {
                _dismissListener.onDismiss();
            }
            collapse();
        }
    });

    addView(_popupCard);
    _popupCard.setVisibility(View.INVISIBLE);
    setVisibility(View.INVISIBLE);

    _textViewGroupName = _popupCard.findViewById(R.id.group_popup_label);
}
 
Example 6
Source File: Reminders.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reminders);
    setTheme(R.style.AppThemeToolBarLite); // for toolbar mode

    //setSupportActionBar((Toolbar)findViewById(R.id.reminder_toolbar));
    JoH.fixActionBar(this);

    setTitle(getString(R.string.xdrip_reminders));
    // TODO subtitle with summary
    recyclerView = (RecyclerView) findViewById(R.id.reminder_recycler);
    floatingsnooze = (CardView) findViewById(R.id.floatingsnooze);
    floaterText = (TextView) findViewById(R.id.floaterText);

    floatingsnooze.setVisibility(View.GONE);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);

    mAdapter = new RecyclerAdapter(this, reminders);

    if (selectedSound == null) {
        if (PersistentStore.getString("reminders-last-sound").length() > 5)
            selectedSound = PersistentStore.getString("reminders-last-sound");
    }

    reloadList();

    postOnCreate();

    final Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);


    if (reminders.size() == 0) {
        //JoH.static_toast_long("No reminders yet, add one!"); // replace with showcase?
        showcase(this, Home.SHOWCASE_REMINDER1);
    }
}
 
Example 7
Source File: Reminders.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reminders);
    setTheme(R.style.AppThemeToolBarLite); // for toolbar mode

    //setSupportActionBar((Toolbar)findViewById(R.id.reminder_toolbar));
    JoH.fixActionBar(this);

    setTitle(getString(R.string.xdrip_reminders));
    // TODO subtitle with summary
    recyclerView = (RecyclerView) findViewById(R.id.reminder_recycler);
    floatingsnooze = (CardView) findViewById(R.id.floatingsnooze);
    floaterText = (TextView) findViewById(R.id.floaterText);

    floatingsnooze.setVisibility(View.GONE);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);

    mAdapter = new RecyclerAdapter(this, reminders);

    if (selectedSound == null) {
        if (PersistentStore.getString("reminders-last-sound").length() > 5)
            selectedSound = PersistentStore.getString("reminders-last-sound");
    }

    reloadList();

    postOnCreate();

    final Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);


    if (reminders.size() == 0) {
        //JoH.static_toast_long("No reminders yet, add one!"); // replace with showcase?
        showcase(this, Home.SHOWCASE_REMINDER1);
    }
}
 
Example 8
Source File: HomeFragment.java    From white-label-event-app with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final Activity activity = getActivity();
    if (activity instanceof ContentHost) {
        host = (ContentHost) activity;
        host.setTitle(title);
    }

    final View root = getView();
    if (root == null) {
        throw new IllegalStateException();
    }

    vgMutex = (MutexViewGroup) root.findViewById(R.id.vg_mutex);

    final View content = root.findViewById(R.id.vg_content);
    vBeforeEvent = content.findViewById(R.id.v_before_event);
    vBeforeEvent.setVisibility(View.GONE);
    vAfterEvent = content.findViewById(R.id.v_after_event);
    vAfterEvent.setVisibility(View.GONE);
    cardHappeningNow = (CardView) content.findViewById(R.id.card_happening_now);
    cardHappeningNow.setVisibility(View.GONE);
    cardHappeningNow.setOnClickListener(new HappeningNowOnClickListener());
    cardUpNext = (CardView) content.findViewById(R.id.card_up_next);
    cardUpNext.setVisibility(View.GONE);
    cardUpNext.setOnClickListener(new UpNextOnClickListener());
    tvDescription = (TextView) content.findViewById(R.id.tv_description);

    updateUi();
}
 
Example 9
Source File: Misc.java    From SystemUITuner2 with MIT License 4 votes vote down vote up
private void setupCustomSettings() {
    boolean customSettingsEnabled = activity.setThings.sharedPreferences.getBoolean("customSettings", false);
    final CardView custom_settings = view.findViewById(R.id.custom_settings);
    custom_settings.setVisibility(customSettingsEnabled ? View.VISIBLE : View.GONE);
}
 
Example 10
Source File: ProfileTab2.java    From Hillffair17 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){


    View view = inflater.inflate(R.layout.fragment_profiletab2, container, false);


    sharedPref = new SharedPref(getContext());

    cardView = (CardView) view.findViewById(R.id.cardview);
    textName = (TextView) view.findViewById(R.id.name);
    textRollno = (TextView) view.findViewById(R.id.rollno);
    textEmail = (TextView) view.findViewById(R.id.email);
    rollnoLayout = (LinearLayout) view.findViewById(R.id.rollnoLayout);

    if(savedInstanceState==null){

       String name="",email="",rollNo="";
        name=sharedPref.getUserName();
        email=sharedPref.getUserEmail();
        rollNo=sharedPref.getUserRollno();
        if(!name.isEmpty() && !email.isEmpty()){
            cardView.setVisibility(View.VISIBLE);
            textName.setText(name);
            textEmail.setText(email);
            if(!rollNo.isEmpty()){
                textRollno.setText(rollNo);
            }
            else {
                rollnoLayout.setVisibility(View.GONE);
            }
        }


    }
    else{

        cardView.setVisibility(View.VISIBLE);
        if(savedInstanceState.getString(USER_NAME)!=null&&!savedInstanceState.getString(USER_NAME).isEmpty()){
            textName.setText(savedInstanceState.getString(USER_NAME));
        }
        else {
            textName.setVisibility(View.GONE);
        }
        if(savedInstanceState.getString(USER_EMAIL)!=null&&!savedInstanceState.getString(USER_EMAIL).isEmpty()){
            textEmail.setText(savedInstanceState.getString(USER_EMAIL));
        }
        else {
            textEmail.setVisibility(View.GONE);
        }
        if(savedInstanceState.getString(USER_ROLLNO)!=null&&!savedInstanceState.getString(USER_ROLLNO).isEmpty()){
            textRollno.setText(savedInstanceState.getString(USER_ROLLNO));
        }
        else {
            textRollno.setVisibility(View.GONE);
        }
    }




    return view;
}
 
Example 11
Source File: CardViewModel.java    From island with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("MethodMayBeStatic") protected void dismiss(final CardView card) {
	card.setVisibility(View.GONE);
}