android.support.v7.widget.CardView#setVisibility ( )源码实例Demo

下面列出了android.support.v7.widget.CardView#setVisibility ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);
    }
}
 
源代码2 项目: PainlessMusicPlayer   文件: QueueActivity.java
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);
        }
    }
}
 
源代码3 项目: SystemUITuner2   文件: Misc.java
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);
}
 
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);
}
 
源代码5 项目: openlauncher   文件: GroupPopupView.java
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);
}
 
源代码6 项目: xDrip   文件: Reminders.java
@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);
    }
}
 
源代码7 项目: xDrip-plus   文件: Reminders.java
@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);
    }
}
 
源代码8 项目: white-label-event-app   文件: HomeFragment.java
@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();
}
 
源代码9 项目: SystemUITuner2   文件: Misc.java
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);
}
 
源代码10 项目: Hillffair17   文件: ProfileTab2.java
@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;
}
 
源代码11 项目: island   文件: CardViewModel.java
@SuppressWarnings("MethodMayBeStatic") protected void dismiss(final CardView card) {
	card.setVisibility(View.GONE);
}