setVisibility ( )源码实例Demo

android.widget.Button#setVisibility ( )源码实例Demo

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

源代码1 项目: confirmdialog   文件: ConfirmView.java
private View getVwContent() {
  View contentView = LayoutInflater.from(context).inflate(R.layout.view_confirm, this, false);
  ViewGroup cntViewGroup = (ViewGroup) contentView.findViewById(R.id.alert_content);
  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(WRAP_CONTENT,
      WRAP_CONTENT);
  layoutParams.gravity = Gravity.CENTER;
  cntViewGroup.addView(vwContent, layoutParams);
  btnPositive = (Button) contentView.findViewById(R.id.btn_confirm);
  btnNegative = (Button) contentView.findViewById(R.id.btn_cancel);
  btnPositive.setText(positive);
  btnNegative.setText(negative);
  btnPositive.setOnClickListener(this);
  btnNegative.setOnClickListener(this);

  if (TextUtils.isEmpty(positive)) {
    btnPositive.setVisibility(View.GONE);
  }
  if (TextUtils.isEmpty(negative)) {
    btnNegative.setVisibility(View.GONE);
  }
  return contentView;
}
 
源代码2 项目: Awesome-WanAndroid   文件: CommonAlertDialog.java
/**
 * Show alertDialog
 *
 * @param mActivity activity instance
 * @param content show content
 * @param btnContent btn content
 * @param onClickListener btn onClickListener
 */
public void showDialog(Activity mActivity, String content, String btnContent, final View.OnClickListener onClickListener) {
    if (mActivity == null) {
        return;
    }
    if (alertDialog == null) {
        alertDialog = new AlertDialog.Builder(mActivity, R.style.myCorDialog).create();
    }
    if (!alertDialog.isShowing()) {
        alertDialog.show();
    }
    alertDialog.setCanceledOnTouchOutside(false);
    Window window = alertDialog.getWindow();
    if (window != null) {
        window.setContentView(R.layout.common_alert_dialog);
        TextView contentTv = (TextView) window.findViewById(R.id.dialog_content);
        contentTv.setText(content);
        Button mOkBtn = (Button) window.findViewById(R.id.dialog_btn);
        mOkBtn.setText(btnContent);
        mOkBtn.setOnClickListener(onClickListener);
        View btnDivider = window.findViewById(R.id.dialog_btn_divider);
        btnDivider.setVisibility(View.GONE);
        Button mNeBtn = (Button) window.findViewById(R.id.dialog_negative_btn);
        mNeBtn.setVisibility(View.GONE);
    }
}
 
private void displayImportAction()
{
    Token token = viewModel.getImportToken();
    Button importTickets = findViewById(R.id.import_ticket);
    importTickets.setVisibility(View.VISIBLE);
    importTickets.setAlpha(1.0f);

    MagicLinkData data = viewModel.getSalesOrder();
    //Customise button text
    View baseView = findViewById(android.R.id.content);

    switch (data.contractType)
    {
        case spawnable:
            importTickets.setText(R.string.action_import);
            if (token != null) 
                tokenView.displayTicketHolder(token, ticketRange, viewModel.getAssetDefinitionService());
            break;
        case currencyLink:
            importTickets.setText(R.string.action_import);
            break;
        default:
            importTxt.setText(R.string.ticket_import_valid);
            if (token != null) 
                tokenView.displayTicketHolder(token, ticketRange, viewModel.getAssetDefinitionService());
            break;
    }
}
 
源代码4 项目: qingyang   文件: CustomDialog.java
/**
 * 设置dialog的确定按钮
 */
public void setPositiveButton(String text, OnClickListener onClickListener) {
	final Button buttonOk = (Button) mRootLayout
			.findViewById(R.id.custom_dialog_btn_ok);
	buttonOk.setText(text);
	buttonOk.setOnClickListener(onClickListener);
	buttonOk.setVisibility(View.VISIBLE);
}
 
源代码5 项目: browser   文件: ECAlertDialog.java
/**
 * 设置按钮
 * @param id 按钮号
 * @param text 按钮显示文本
 * @param listener
 * @return
 */
public final Button setButton(int id , CharSequence text , OnClickListener listener) {
    Button button = mButtons.get(id);
    button.setText(text);
    button.setVisibility(View.VISIBLE);
    setButtonTag(id, listener);
    mLayoutButton.setVisibility(View.VISIBLE);
    return button;
}
 
源代码6 项目: smartcoins-wallet   文件: SendScreen.java
private void showDialogPin(final Boolean fundTransfer) {
    final ArrayList<AccountDetails> accountDetails = tinyDB.getListObject(getString(R.string.pref_wallet_accounts), AccountDetails.class);
    final Dialog dialog = new Dialog(SendScreen.this);
    dialog.setTitle(R.string.title_prompt_pin);
    dialog.setContentView(R.layout.activity_alert_pin_dialog);
    Button btnDone = (Button) dialog.findViewById(R.id.btnDone);
    btnDone.setVisibility(View.VISIBLE);
    final EditText etPin = (EditText) dialog.findViewById(R.id.etPin);
    btnDone.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            for (int i = 0; i < accountDetails.size(); i++) {
                if (accountDetails.get(i).isSelected) {
                    if (etPin.getText().toString().equals(accountDetails.get(i).pinCode)) {
                        dialog.cancel();
                        if (fundTransfer) {
                            String transferFunds = getString(R.string.transfer_funds) + "...";
                            showDialog("", transferFunds);
                            tradeAsset();
                        } else {
                            sendFunds(false);
                        }
                        break;
                    }
                }
            }

        }
    });
    dialog.setCancelable(true);

    dialog.show();
}
 
源代码7 项目: commcare-android   文件: SelectOneWidget.java
private void addClearButton(Context context, boolean show) {
    clearButton = (Button) LayoutInflater.from(context).inflate(R.layout.blue_outlined_button, this, false);
    clearButton.setText(Localization.get("button.clear.title"));
    clearButton.setVisibility(show ? VISIBLE : GONE);
    clearButton.setOnClickListener(view -> {
        clearAnswer();
        widgetEntryChanged();
    });
    addView(clearButton);
}
 
源代码8 项目: BotLibre   文件: GraphicActivity.java
public void resetView() {
	setContentView(R.layout.activity_graphic);

	playBtn = (Button)findViewById(R.id.playButton);
	downloadBtn = (Button)findViewById(R.id.downloadButton);
	try{
		super.resetView();
		
	}catch(Exception e){
		MainActivity.showMessage(e.getMessage(), this);
	}
	
	
	if (instance.isExternal) {
		findViewById(R.id.playButton).setVisibility(View.GONE);
		findViewById(R.id.downloadButton).setVisibility(View.GONE);
	}
	
	if(gInstance.isVideo() || gInstance.isAudio()){
		downloadBtn.setVisibility(View.VISIBLE);
		playBtn.setText(R.string.play);
	}else {
		downloadBtn.setVisibility(View.VISIBLE);
		playBtn.setText(R.string.view);
	}
	
}
 
源代码9 项目: echo   文件: SettingsActivity.java
private void initSampleRateButton(ViewGroup layout, int buttonId, int primarySampleRate, int secondarySampleRate) {
    Button button = (Button) layout.findViewById(buttonId);
    button.setOnClickListener(qualityClickListener);
    if(testSampleRateValid(primarySampleRate)) {
        button.setText(String.format("%d kHz", primarySampleRate / 1000));
        button.setTag(primarySampleRate);
    } else if(testSampleRateValid(secondarySampleRate)) {
        button.setText(String.format("%d kHz", secondarySampleRate / 1000));
        button.setTag(secondarySampleRate);
    } else {
        button.setVisibility(View.GONE);
    }
}
 
源代码10 项目: YiBo   文件: HotStatusesActivity.java
private void bindEvent() {
	Button btnBack = (Button)this.findViewById(R.id.btnBack);
	btnBack.setOnClickListener(new GoBackClickListener());

	Button btnOperate = (Button) this.findViewById(R.id.btnOperate);
	btnOperate.setVisibility(View.VISIBLE);
	btnOperate.setText(R.string.btn_home);
	btnOperate.setOnClickListener(new GoHomeClickListener());
	
	ListView  lvMicroBlog = (ListView)this.findViewById(R.id.lvMicroBlog);
	lvMicroBlog.setOnItemClickListener(new MicroBlogItemClickListener(this));
	MicroBlogContextMenuListener contextMenuListener =
		new MicroBlogContextMenuListener(lvMicroBlog);
	lvMicroBlog.setOnCreateContextMenuListener(contextMenuListener);
}
 
源代码11 项目: Awesome-WanAndroid   文件: CommonAlertDialog.java
/**
 * Show alertDialog
 *
 * @param mActivity activity instance
 * @param content show content
 * @param btnContent btn content
 */
public void showDialog(Activity mActivity, String content, String btnContent) {
    if (mActivity == null) {
        return;
    }
    if (alertDialog == null) {
        alertDialog = new AlertDialog.Builder(mActivity, R.style.myCorDialog).create();
    }
    if (!alertDialog.isShowing()) {
        alertDialog.show();
    }
    alertDialog.setCanceledOnTouchOutside(false);
    Window window = alertDialog.getWindow();
    if (window != null) {
        window.setContentView(R.layout.common_alert_dialog);
        TextView contentTv = (TextView) window.findViewById(R.id.dialog_content);
        contentTv.setText(content);
        Button mOkBtn = (Button) window.findViewById(R.id.dialog_btn);
        mOkBtn.setText(btnContent);
        mOkBtn.setOnClickListener(v -> {
            if (alertDialog != null) {
                alertDialog.cancel();
                alertDialog = null;
            }
        });
        View btnDivider = window.findViewById(R.id.dialog_btn_divider);
        btnDivider.setVisibility(View.GONE);
        Button mNeBtn = (Button) window.findViewById(R.id.dialog_negative_btn);
        mNeBtn.setVisibility(View.GONE);
    }
}
 
源代码12 项目: DebugRank   文件: SolveActivity.java
private void showShowcase(ViewTarget viewTarget, @StringRes int titleResId, @StringRes int descriptionResId)
{
    Button button = new Button(this);
    button.setVisibility(View.GONE);

    compileShowcaseView = new ShowcaseView.Builder(this)
            .withNewStyleShowcase()
            .setStyle(R.style.CustomShowcaseTheme2)
            .setTarget(viewTarget)
            .setContentTitle(titleResId)
            .setContentText(descriptionResId)
            .replaceEndButton(button)
            .build();
}
 
public void newData(View view) {
    EditText edit = (EditText) findViewById(R.id.EditS);
    TextView newName = (TextView) findViewById(R.id.bestName);
    TextView newScore = (TextView) findViewById(R.id.bestScore);
    TextView currScore = (TextView) findViewById(R.id.nowScore);
    newName.setText(edit.getText());
    newScore.setText(currScore.getText());
    saved.edit().putString("Name", edit.getText() + "").apply();
    saved.edit().putInt("Score", Integer.parseInt(currScore.getText() + "")).apply();
    TextView high2 = (TextView) findViewById(R.id.newHighS2);
    Button btn = (Button) findViewById(R.id.button);
    edit.setVisibility(View.INVISIBLE);
    high2.setVisibility(View.INVISIBLE);
    btn.setVisibility(View.INVISIBLE);
}
 
源代码14 项目: dynamic-support   文件: DynamicAlertController.java
private void setupButtons(ViewGroup buttonPanel) {
    int BIT_BUTTON_POSITIVE = 1;
    int BIT_BUTTON_NEGATIVE = 2;
    int BIT_BUTTON_NEUTRAL = 4;
    int whichButtons = 0;
    mButtonPositive = (Button) buttonPanel.findViewById(android.R.id.button1);
    mButtonPositive.setOnClickListener(mButtonHandler);

    if (TextUtils.isEmpty(mButtonPositiveText) && mButtonPositiveIcon == null) {
        mButtonPositive.setVisibility(View.GONE);
    } else {
        mButtonPositive.setText(mButtonPositiveText);
        if (mButtonPositiveIcon != null) {
            mButtonPositiveIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
            mButtonPositive.setCompoundDrawables(mButtonPositiveIcon, null, null, null);
        }
        mButtonPositive.setVisibility(View.VISIBLE);
        whichButtons = whichButtons | BIT_BUTTON_POSITIVE;
    }

    mButtonNegative = buttonPanel.findViewById(android.R.id.button2);
    mButtonNegative.setOnClickListener(mButtonHandler);

    if (TextUtils.isEmpty(mButtonNegativeText) && mButtonNegativeIcon == null) {
        mButtonNegative.setVisibility(View.GONE);
    } else {
        mButtonNegative.setText(mButtonNegativeText);
        if (mButtonNegativeIcon != null) {
            mButtonNegativeIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
            mButtonNegative.setCompoundDrawables(mButtonNegativeIcon, null, null, null);
        }
        mButtonNegative.setVisibility(View.VISIBLE);
        whichButtons = whichButtons | BIT_BUTTON_NEGATIVE;
    }

    mButtonNeutral = (Button) buttonPanel.findViewById(android.R.id.button3);
    mButtonNeutral.setOnClickListener(mButtonHandler);

    if (TextUtils.isEmpty(mButtonNeutralText) && mButtonNeutralIcon == null) {
        mButtonNeutral.setVisibility(View.GONE);
    } else {
        mButtonNeutral.setText(mButtonNeutralText);
        if (mButtonPositiveIcon != null) {
            mButtonPositiveIcon.setBounds(0, 0, mButtonIconDimen, mButtonIconDimen);
            mButtonPositive.setCompoundDrawables(mButtonPositiveIcon, null, null, null);
        }
        mButtonNeutral.setVisibility(View.VISIBLE);
        whichButtons = whichButtons | BIT_BUTTON_NEUTRAL;
    }

    if (shouldCenterSingleButton(mContext)) {
        /*
         * If we only have 1 button it should be centered on the layout and
         * expand to fill 50% of the available space.
         */
        if (whichButtons == BIT_BUTTON_POSITIVE) {
            centerButton(mButtonPositive);
        } else if (whichButtons == BIT_BUTTON_NEGATIVE) {
            centerButton(mButtonNegative);
        } else if (whichButtons == BIT_BUTTON_NEUTRAL) {
            centerButton(mButtonNeutral);
        }
    }

    final boolean hasButtons = whichButtons != 0;
    if (!hasButtons) {
        buttonPanel.setVisibility(View.GONE);
    }
}
 
源代码15 项目: ResearchStack   文件: OnboardingActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.rss_activity_onboarding);

    ImageView logoView = (ImageView) findViewById(R.id.layout_studyoverview_landing_logo);
    TextView titleView = (TextView) findViewById(R.id.layout_studyoverview_landing_title);
    TextView subtitleView = (TextView) findViewById(R.id.layout_studyoverview_landing_subtitle);

    LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layout_studyoverview_main);
    StudyOverviewModel model = parseStudyOverviewModel();

    // The first item is used for the main activity and not the tabbed dialog
    StudyOverviewModel.Question welcomeQuestion = model.getQuestions().remove(0);

    titleView.setText(welcomeQuestion.getTitle());

    if (!TextUtils.isEmpty(welcomeQuestion.getDetails())) {
        subtitleView.setText(welcomeQuestion.getDetails());
    } else {
        subtitleView.setVisibility(View.GONE);
    }

    // add Read Consent option to list and tabbed dialog
    if ("yes".equals(welcomeQuestion.getShowConsent())) {
        StudyOverviewModel.Question consent = new StudyOverviewModel.Question();
        consent.setTitle(getString(R.string.rss_read_consent_doc));
        consent.setDetails(ResourceManager.getInstance().getConsentHtml().getName());
        model.getQuestions().add(0, consent);
    }

    for (int i = 0; i < model.getQuestions().size(); i++) {
        AppCompatButton button = (AppCompatButton) LayoutInflater.from(this)
                .inflate(R.layout.rss_button_study_overview, linearLayout, false);
        button.setText(model.getQuestions().get(i).getTitle());
        // set the index for opening the viewpager to the correct page on click
        button.setTag(i);
        linearLayout.addView(button);
        button.setOnClickListener(this);
    }

    signUp = (Button) findViewById(R.id.intro_sign_up);
    signIn = (TextView) findViewById(R.id.intro_sign_in);

    skip = (Button) findViewById(R.id.intro_skip);
    skip.setVisibility(UiManager.getInstance().isConsentSkippable() ? View.VISIBLE : View.GONE);

    int resId = ResUtils.getDrawableResourceId(this, model.getLogoName());
    logoView.setImageResource(resId);

    pagerContainer = findViewById(R.id.pager_container);
    pagerContainer.setTranslationY(48);
    pagerContainer.setAlpha(0);
    pagerContainer.setScaleX(.9f);
    pagerContainer.setScaleY(.9f);

    pagerFrame = findViewById(R.id.pager_frame);
    pagerFrame.setAlpha(0);
    pagerFrame.setOnClickListener(v -> hidePager());

    OnboardingPagerAdapter adapter = new OnboardingPagerAdapter(this, model.getQuestions());
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setOffscreenPageLimit(2);
    pager.setAdapter(adapter);
    tabStrip = (TabLayout) findViewById(R.id.pager_title_strip);
    tabStrip.setupWithViewPager(pager);
}
 
源代码16 项目: Android   文件: CustomDialog.java
public void setNegativeButton(String text,OnClickListener listener ) {
    final Button buttonCancel = (Button)mRootLayout.findViewById(R.id.CustomDlgButtonCancel);
    buttonCancel.setText(text);
    buttonCancel.setOnClickListener(listener);
    buttonCancel.setVisibility(View.VISIBLE);
}
 
源代码17 项目: Onboarder   文件: OnboardingFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_onboarding, container, false);

    // Inflate the layout for this fragment
    Bundle bundle = getArguments();

    /* The title which is displayed at the top of the fragment */
    String title = bundle.getString(TITLE, null);
    /* The body text which is displayed in the middle of the fragment */
    String bodyText = bundle.getString(BODY_TEXT, null);
    /* The image resource which is displayed in the middle of the fragment, above the text */
    int imageResId = bundle.getInt(IMAGE_RESOURCE_ID, -1);
    /* The position that the fragment is in adapter */
    final int position = bundle.getInt(POSITION, 0);
    /* The button text (if the user set any) */
    String buttonText = bundle.getString(BUTTON_TEXT, null);
    /* Max height for the image (if not, it just scales it up) */
    int maxImageHeight = bundle.getInt(MAX_IMAGE_HEIGHT,-1);

    @ColorRes int titleTextColor = bundle.getInt(TITLE_TEXT_COLOR, -1);
    @ColorRes int bodyTextColor = bundle.getInt(BODY_TEXT_COLOR,-1);

    TextView titleTextView = (TextView) view.findViewById(R.id.onboarding_fragment_title);
    TextView bodyTextView = (TextView) view.findViewById(R.id.onboarding_fragment_body_text);
    ImageView imageView = (ImageView) view.findViewById(R.id.onboarding_fragment_image);
    Button button = (Button) view.findViewById(R.id.onboarding_fragment_button);

    //Set the title
    if (title !=null) {
        titleTextView.setText(title);
        //Set the body text color
        if (titleTextColor!=-1) {
            titleTextView.setTextColor(getResources().getColor(titleTextColor));
        }
    } else {
        titleTextView.setVisibility(View.GONE);
    }

    //Set the body text
    if (bodyText !=null) {
        bodyTextView.setText(bodyText);
        //Set the body text color
        if (bodyTextColor!=-1) {
            bodyTextView.setTextColor(getResources().getColor(bodyTextColor));
        }
    } else {
        bodyTextView.setVisibility(View.GONE);
    }

    //Set the image
    if (imageResId !=-1) {
        imageView.setImageResource(imageResId);
        //Set the max image height (if it was set)
        if (maxImageHeight !=-1) {
            imageView.setMaxHeight(maxImageHeight);
        }
    } else {
        imageView.setVisibility(View.GONE);
    }

    //Set the button text and link it to the method
    if (buttonText!=null) {
        button.setText(buttonText);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                clickOnboardingButton(position);
            }
        });
    } else {
        button.setVisibility(View.GONE);
    }

    return view;
}
 
源代码18 项目: CanDialog   文件: CanDialog.java
/**
 * button的点击事件可返回点击item的position,text,单选中的position,多选的选择状态等。
 *
 * @param button   Button
 * @param text     CharSequence
 * @param dismiss  boolean
 * @param listener CanDialogInterface
 */
private void setButton(Button button, CharSequence text, final boolean dismiss, final CanDialogInterface.OnClickListener listener) {
    mButtonPanel.setVisibility(View.VISIBLE);
    button.setVisibility(View.VISIBLE);
    button.setText(text);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {

            hideSoftInput();

            if (listener != null) {

                switch (mType) {
                    case DIALOG_EDIT:
                        final EditText etPwd = (EditText) findViewById(R.id.et_pwd);
                        listener.onClick(mDialog, 0, etPwd.getText().toString(), null);
                        break;

                    case DIALOG_SINGLE_CHOICE:
                        listener.onClick(mDialog, checkedItem, null, null);
                        break;

                    case DIALOG_MULTI_CHOICE:
                        listener.onClick(mDialog, 0, null, checkedItems);
                        break;
                    default:
                        listener.onClick(mDialog, 0, null, null);
                        break;
                }

            }


            if (dismiss) {
                dismiss();
            }


        }
    });


}
 
private void init() {
	// TODO Auto-generated method stub
	iv_avatar = (SmartImageView) findViewById(R.id.iv_avatar);
	tv_username = (TextView) findViewById(R.id.tv_username);
	lv_topics = (LinearLayout) findViewById(R.id.lv_topics);
	lv_topics.setOnClickListener(this);
	tv_topic = (TextView) findViewById(R.id.tv_topic);
	lv_ifocus_person = (LinearLayout) findViewById(R.id.lv_ifocus_person);
	lv_ifocus_person.setOnClickListener(this);
	tv_ifocus_person = (TextView) findViewById(R.id.tv_ifocus_person);
	lv_focusi_person = (LinearLayout) findViewById(R.id.lv_focusi_person);
	lv_focusi_person.setOnClickListener(this);
	tv_focusi_person = (TextView) findViewById(R.id.tv_focusi_person);

	tv_thanks = (TextView) findViewById(R.id.tv_thanks);
	tv_votes = (TextView) findViewById(R.id.tv_votes);
	tv_collect = (TextView) findViewById(R.id.tv_collect);

	lv_replys = (LinearLayout) findViewById(R.id.lv_replys);
	lv_replys.setOnClickListener(this);
	tv_replys = (TextView) findViewById(R.id.tv_replys);
	lv_asks = (LinearLayout) findViewById(R.id.lv_asks);
	lv_asks.setOnClickListener(this);
	tv_asks = (TextView) findViewById(R.id.tv_asks);
	lv_articles = (LinearLayout) findViewById(R.id.lv_articles);
	lv_articles.setOnClickListener(this);

	lv_news = (LinearLayout) findViewById(R.id.lv_news);
	lv_news.setOnClickListener(this);

	lv_search_friens = (LinearLayout) findViewById(R.id.lv_search_friens);
	lv_search_friens.setOnClickListener(this);

	bt_focus = (Button) findViewById(R.id.bt_focus);
	bt_focus.setOnClickListener(this);
	tv_focusi_person_comment = (TextView) findViewById(R.id.tv_focusi_person_comment);
	tv_ifocus_person_comment = (TextView) findViewById(R.id.tv_ifocus_person_comment);
	tv_topic_comment = (TextView) findViewById(R.id.tv_topic_comment);
	tvSignature = (TextView) findViewById(R.id.tvSignature);
	pb_change_follow = (ProgressBar) findViewById(R.id.pb_change_follow);
	ll_logout = (LinearLayout) findViewById(R.id.ll_logout);
	ll_logout.setOnClickListener(this);
	// �жϱ������ѵ�¼�û�������ǿ��Ա༭�����ع�ע��ť���������ر༭��ť��ʾ��ע��ť��
	if (status == GlobalVariables.AVAILABLE_EDIT) {
		bt_focus.setVisibility(View.INVISIBLE);
		ll_logout.setVisibility(View.VISIBLE);
	} else {
		ll_logout.setVisibility(View.GONE);
		tv_focusi_person_comment.setText("��ע������");
		tv_ifocus_person_comment.setText("����ע����");
		tv_topic_comment.setText("����ע�Ļ���");
	}
	if (haveFrocus == YES) {
		bt_focus.setBackgroundResource(R.drawable.btn_silver_normal);
		bt_focus.setTextColor(android.graphics.Color.BLACK);
		bt_focus.setText("ȡ����ע");
	}
}
 
源代码20 项目: o2oa   文件: ImageGridActivity.java
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_grid);

        imagePicker = ImagePicker.getInstance();
        imagePicker.clear();
        imagePicker.addOnImageSelectedListener(this);


        // 新增可直接拍照
        if (getIntent() != null && getIntent().getExtras() != null){
            directPhoto = getIntent().getBooleanExtra(EXTRAS_TAKE_PICKERS,false); // 默认不是直接打开相机
            if (directPhoto){
                if (!(checkPermission(Manifest.permission.CAMERA))) {
                    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, ImageGridActivity.REQUEST_PERMISSION_CAMERA);
                } else {
                    imagePicker.takePicture(this, ImagePicker.REQUEST_CODE_TAKE);
                }
            }
        }


        mRecyclerView = (RecyclerView) findViewById(R.id.recycler);


        findViewById(R.id.btn_back).setOnClickListener(this);
        mBtnOk = (Button) findViewById(R.id.btn_ok);
        mBtnOk.setOnClickListener(this);
        mBtnDir = (Button) findViewById(R.id.btn_dir);
        mBtnDir.setOnClickListener(this);
        mBtnPre = (Button) findViewById(R.id.btn_preview);
        mBtnPre.setOnClickListener(this);
        mGridView = (GridView) findViewById(R.id.gridview);
        mFooterBar = findViewById(R.id.footer_bar);
        if (imagePicker.isMultiMode()) {
            mBtnOk.setVisibility(View.VISIBLE);
            mBtnPre.setVisibility(View.VISIBLE);
        } else {
            mBtnOk.setVisibility(View.GONE);
            mBtnPre.setVisibility(View.GONE);
        }

//        mImageGridAdapter = new ImageGridAdapter(this, null);
        mImageFolderAdapter = new ImageFolderAdapter(this, null);
        mRecyclerAdapter = new ImageRecyclerAdapter(this,null);

        onImageSelected(0, null, false);

        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
            if (checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
                new ImageDataSource(this, null, this);
            } else {
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_PERMISSION_STORAGE);
            }
        }
    }