Java 类android.widget.Button 实例源码
项目:GongXianSheng
文件:RunwiseDialog.java
@Inject
public RunwiseDialog(@ActivityContext Context context) {
super(context, R.style.CustomProgressDialog);
setContentView(R.layout.dialog_layout);
Window window = getWindow();
window.getAttributes().gravity = Gravity.CENTER;
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
this.setCancelable(true);
this.setCanceledOnTouchOutside(false);
this.context = (TextView) this.findViewById(R.id.context);
cancle = (Button) this.findViewById(R.id.cancle);
okBtn = (Button) this.findViewById(R.id.ok);
vLine = this.findViewById(R.id.vline);
hLine = this.findViewById(R.id.hline);
title = (TextView) this.findViewById(R.id.title);
btnLayout = (LinearLayout) this.findViewById(R.id.dialog_btn_layout);
setLeftBtnListener("取消",null);
}
项目:GitHub
文件:HWAdatper.java
@Override
protected void convert(BaseViewHolder viewHolder, final Wares wares) {
SimpleDraweeView draweeView = (SimpleDraweeView) viewHolder.getView(R.id.drawee_view);
draweeView.setImageURI(Uri.parse(wares.getImgUrl()));
viewHolder.getTextView(R.id.text_title).setText(wares.getName());
viewHolder.getTextView(R.id.text_price).setText("¥ "+wares.getPrice());
Button button =viewHolder.getButton(R.id.btn_add);
if(button !=null) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
provider.put(wares);
ToastUtils.show(context, "已添加到购物车");
}
});
}
}
项目:scab
文件:InfoFromFacebookActivity.java
@Override
public void onSuccess(com.facebook.login.LoginResult loginResult) {
Profile facebookProfile = Profile.getCurrentProfile();
if (facebookProfile == null) {
String errorMsg = InfoFromFacebookActivity.this.getResources().getString(R.string.facebook_error);
errorMsg = errorMsg + ".";
Snackbar.make(textViewFacebookName, errorMsg, Snackbar.LENGTH_LONG).show();
textViewFacebookName.setText(errorMsg);
} else {
facebookProfilePhoto.setProfileId(facebookProfile.getId());
textViewFacebookName.setText(facebookProfile.getName());
buttonAck.setEnabled(true);
buttonSwitch.setVisibility(Button.VISIBLE);
}
// TODO: Do not store access token - it is a security issue storing this
// TODO and appears to be of no benefit.
// AccessToken token = loginResult.getAccessToken();
// DataHolder data = DataHolder.getInstance(InfoFromFacebookActivity.this.getApplicationContext());
// data.setFacebookToken(token.getToken());
// data.persist();
}
项目:ulogger-android
文件:MainActivity.java
/**
* Display About dialog
*/
private void showAbout() {
final AlertDialog dialog = showAlert(MainActivity.this,
getString(R.string.app_name),
R.layout.about,
R.drawable.ic_ulogger_logo_24dp);
final TextView versionLabel = (TextView) dialog.findViewById(R.id.about_version);
versionLabel.setText(getString(R.string.about_version, BuildConfig.VERSION_NAME));
final TextView descriptionLabel = (TextView) dialog.findViewById(R.id.about_description);
final TextView description2Label = (TextView) dialog.findViewById(R.id.about_description2);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
descriptionLabel.setText(fromHtmlDepreciated(getString(R.string.about_description)));
description2Label.setText(fromHtmlDepreciated(getString(R.string.about_description2)));
} else {
descriptionLabel.setText(Html.fromHtml(getString(R.string.about_description), android.text.Html.FROM_HTML_MODE_LEGACY));
description2Label.setText(Html.fromHtml(getString(R.string.about_description2), android.text.Html.FROM_HTML_MODE_LEGACY));
}
final Button okButton = (Button) dialog.findViewById(R.id.about_button_ok);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
项目:Android-Gank-Share
文件:EmptyView.java
public EmptyView build(){
if(parent == null)
throw new IllegalArgumentException("No parent viewGroup");
emptyView.view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.empty_view, parent, false);
TextView textView = ButterKnife.findById(emptyView.view, R.id.text_empty_hint);
textView.setText(emptyHint);
Button button = ButterKnife.findById(emptyView.view, R.id.btn_empty_view);
button.setText(buttonText);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(mOnClickListener != null)
mOnClickListener.onClick(v);
}
});
parent.addView(emptyView.view);
return emptyView;
}
项目:Java-9-Programming-Blueprints
文件:InstagramPreferencesFragment.java
private void updateUI() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
final Button button = (Button) getView().findViewById(R.id.connectButton);
if (!InstagramClient.instance().isAuthenticated()) {
button.setText(getString(R.string.login));
button.setOnClickListener(new LoginClickListener());
} else {
button.setText(getString(R.string.logout));
button.setOnClickListener(new LogoutClickListener(button));
}
}
});
}
项目:Material-Calendar-View
文件:RangePickerActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.range_picker_activity);
CalendarView calendarView = (CalendarView) findViewById(R.id.calendarView);
Button getDateButton = (Button) findViewById(R.id.getDateButton);
getDateButton.setOnClickListener(v -> {
for (Calendar calendar : calendarView.getSelectedDates()) {
System.out.println(calendar.getTime().toString());
Toast.makeText(getApplicationContext(),
calendar.getTime().toString(),
Toast.LENGTH_SHORT).show();
}
});
}
项目:treetracker-android
文件:ExitFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_exit, container, false);
mSharedPreferences = getActivity().getSharedPreferences(
"org.greenstand.android", Context.MODE_PRIVATE);
Button yesBtn = (Button) v.findViewById(R.id.fragment_exit_yes);
yesBtn.setOnClickListener(ExitFragment.this);
Button noBtn = (Button) v.findViewById(R.id.fragment_exit_no);
noBtn.setOnClickListener(ExitFragment.this);
return v;
}
项目:Nird2
文件:ChangePasswordActivityTest.java
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
changePasswordActivity =
Robolectric.setupActivity(TestChangePasswordActivity.class);
passwordConfirmationWrapper = (TextInputLayout) changePasswordActivity
.findViewById(R.id.new_password_confirm_wrapper);
currentPassword = (EditText) changePasswordActivity
.findViewById(R.id.current_password_entry);
newPassword = (EditText) changePasswordActivity
.findViewById(R.id.new_password_entry);
newPasswordConfirmation = (EditText) changePasswordActivity
.findViewById(R.id.new_password_confirm);
strengthMeter = (StrengthMeter) changePasswordActivity
.findViewById(R.id.strength_meter);
changePasswordButton = (Button) changePasswordActivity
.findViewById(R.id.change_password);
}
项目:boohee_v5.6
文件:BaseTimelineAdapter.java
protected void initDeleteButton(Button button, final Post post) {
if (post.own) {
button.setVisibility(0);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (AccountUtils.isVisitorAccount(BaseTimelineAdapter.this.activity)) {
CheckAccountPopwindow.showVisitorPopWindow(BaseTimelineAdapter.this
.activity);
} else {
BaseTimelineAdapter.this.showDeleteDialog(post);
}
}
});
return;
}
button.setVisibility(8);
}
项目:ThunderMusic
文件:OnlineSearchClearHistory.java
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
setContentView(R.layout.confirm_delete);
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT);
activity = this;
mPrompt = (TextView) findViewById(R.id.prompt);
mButton = (Button) findViewById(R.id.delete);
mButton.setOnClickListener(mButtonClicked);
(findViewById(R.id.cancel)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
}
});
mPrompt.setText(getString(R.string.clear_online_dialog));
}
项目:LucaHome-AndroidApplication
文件:DownloadYoutubeVideoTask.java
private void displayYoutubeIdDialog(@NonNull ArrayList<YoutubeVideoData> youtubeVideoDataList) {
final Dialog dialog = new Dialog(_context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dialog_listview);
TextView title = dialog.findViewById(R.id.dialog_title_text_view);
title.setText(_context.getResources().getString(R.string.select_youtube_video));
final YoutubeVideoListAdapter listAdapter = new YoutubeVideoListAdapter(_context, youtubeVideoDataList, dialog::dismiss);
ListView listView = dialog.findViewById(R.id.dialog_list_view);
listView.setAdapter(listAdapter);
listView.setVisibility(View.VISIBLE);
Button closeButton = dialog.findViewById(R.id.dialog_button_close);
closeButton.setOnClickListener(view -> dialog.dismiss());
dialog.setCancelable(true);
dialog.show();
Window window = dialog.getWindow();
if (window != null) {
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
} else {
Logger.getInstance().Warning(TAG, "Window is null!");
}
}
项目:CIA
文件:FollowersRequestAdapter.java
public ViewHolder(final View itemView) {
super(itemView);
followRequestee = (TextView) itemView.findViewById(R.id.followRequesteeName);
approveButton = (Button) itemView.findViewById(R.id.approveButton);
declineButton = (Button) itemView.findViewById(R.id.declineButton);
// listens when an item is clicked
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onItemClick(itemView, position);
}
}
}
});
}
项目:firebase-testlab-instr-lib
文件:TitleEditor.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.title_editor);
// Get the uri of the note whose title we want to edit
mUri = getIntent().getData();
// Get a cursor to access the note
mCursor = managedQuery(mUri, PROJECTION, null, null, null);
// Set up click handlers for the text field and button
mText = (EditText) this.findViewById(R.id.title);
mText.setOnClickListener(this);
Button b = (Button) findViewById(R.id.ok);
b.setOnClickListener(this);
}
项目:GitHub
文件:MockLocationsActivity.java
private void initViews() {
latitudeInput = (EditText) findViewById(R.id.latitude_input);
longitudeInput = (EditText) findViewById(R.id.longitude_input);
mockLocationView = (TextView) findViewById(R.id.mock_location_view);
updatedLocationView = (TextView) findViewById(R.id.updated_location_view);
mockModeToggleButton = (ToggleButton) findViewById(R.id.toggle_button);
setLocationButton = (Button) findViewById(R.id.set_location_button);
mockModeToggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setMockMode(isChecked);
setLocationButton.setEnabled(isChecked);
}
});
setLocationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addMockLocation();
}
});
}
项目:IPCCommunication
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextView = (TextView) findViewById(R.id.tv_service);
tv_state = (TextView) findViewById(R.id.tv_state);
btnGet = (Button) findViewById(R.id.btn_getService);
btn_bind = (Button) findViewById(R.id.btn_bind);
btn_unbind = (Button) findViewById(R.id.btn_unbind);
btnGet.setEnabled(false);
tv_state.setText(" 服务未绑定 ");
mClientUtils = new ClientUtils(this);
mClientUtils.setConnectListener(mConnectListener);
btn_bind.setEnabled(true);
btn_unbind.setEnabled(false);
}
项目:2017.2-codigo
文件:AdicionarEstadoActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alterar_estado);
db = SQLEstadosHelper.getInstance(this);
UF = (EditText) findViewById(R.id.txtUF);
nomeEstado = (EditText) findViewById(R.id.txtNome);
Button b = (Button) findViewById(R.id.btnInserirEstado);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new InsereTask().execute(UF.getText().toString(), nomeEstado.getText().toString());
}
});
}
项目:CSkin
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
probar = (ProgressBar) findViewById(R.id.probar);
button.setOnClickListener(v -> {
probar.setVisibility(View.VISIBLE);
update();
probar.setVisibility(View.GONE);
});
}
项目:InstaLikeView
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mInstaLikeView = (InstaLikeView) findViewById(R.id.insta_like_view);
mButton = (Button) findViewById(R.id.button);
mInstaLikeView.setLikeColor(ContextCompat.getColor(this, R.color.colorAccent));
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mInstaLikeView.start();
}
});
}
项目:SystemUITuner2
文件:SetupActivity.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);
// TextView adb_instructions = (TextView) (view != null ? view.findViewById(R.id.adb_instructions) : null);
// if (adb_instructions != null) adb_instructions.setMovementMethod(LinkMovementMethod.getInstance());
Button instructions = (Button) (view != null ? view.findViewById(R.id.adb_instructions_button) : null);
if (instructions != null) instructions.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://developer.android.com/studio/command-line/adb.html");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
});
return view;
}
项目:pius1
文件:MaterialDialog.java
/**
* set negative button
*
* @param text the name of button
*/
public void setNegativeButton(String text, final View.OnClickListener listener)
{
Button button = new Button(mContext);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
button.setLayoutParams(params);
button.setBackgroundResource(R.drawable.material_card);
button.setText(text);
button.setTextColor(Color.argb(222, 0, 0, 0));
button.setTextSize(14);
button.setGravity(Gravity.CENTER);
button.setPadding(0, 0, 0, dip2px(8));
button.setOnClickListener(listener);
if (mButtonLayout.getChildCount() > 0)
{
params.setMargins(20, 0, 10, dip2px(BUTTON_BOTTOM));
button.setLayoutParams(params);
mButtonLayout.addView(button, 1);
}
else
{
button.setLayoutParams(params);
mButtonLayout.addView(button);
}
}
项目:chromium-for-android-56-debug-video
文件:SadTabViewFactory.java
/**
* @param context Context of the resulting Sad Tab view.
* @param suggestionAction Action to be executed when user clicks "try these suggestions".
* @param reloadButtonAction Action to be executed when Reload button is pressed.
* (e.g., refreshing the page)
* @return A "Sad Tab" view instance which is used in place of a crashed renderer.
*/
public static View createSadTabView(
Context context, final OnClickListener suggestionAction,
OnClickListener reloadButtonAction) {
// Inflate Sad tab and initialize.
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
View sadTabView = inflater.inflate(R.layout.sad_tab, null);
TextView messageText = (TextView) sadTabView.findViewById(R.id.sad_tab_message);
messageText.setText(getHelpMessage(context, suggestionAction));
messageText.setMovementMethod(LinkMovementMethod.getInstance());
Button reloadButton = (Button) sadTabView.findViewById(R.id.sad_tab_reload_button);
reloadButton.setOnClickListener(reloadButtonAction);
return sadTabView;
}
项目:spinify_android
文件:DialogUtils.java
private static void setTypeface(TypefaceHelper helper, AlertDialog alertDialog, String typefaceName, int style) {
Button positive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
Button negative = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
Button neutral = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL);
TextView message = (TextView) alertDialog.findViewById(android.R.id.message);
if (positive != null) {
helper.setTypeface(positive, typefaceName, style);
}
if (negative != null) {
helper.setTypeface(negative, typefaceName, style);
}
if (neutral != null) {
helper.setTypeface(neutral, typefaceName, style);
}
if (message != null) {
helper.setTypeface(message, typefaceName, style);
}
}
项目:browser
文件:ECAlertDialog.java
/**
*
*/
private void initView() {
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(layoutParams);
mButtons = new ArrayList<Button>();
Button leftBtn = (Button) findViewById(R.id.dilaog_button1);
leftBtn.setOnClickListener(this);
mButtons.add(leftBtn);
Button middleBtn = (Button) findViewById(R.id.dilaog_button2);
middleBtn.setOnClickListener(this);
mButtons.add(middleBtn);
Button rightBtn = (Button) findViewById(R.id.dilaog_button3);
rightBtn.setOnClickListener(this);
mButtons.add(rightBtn);
mLayoutTitle = findViewById(R.id.dialog_layout_title);
mLayoutContent = ((ViewGroup) findViewById(R.id.dialog_layout_content));
mLayoutButton = findViewById(R.id.dialog_layout_button);
setCancelable(true);
setCanceledOnTouchOutside(true);
setTitle(R.string.dialog_title_alert);
}
项目:GSB-2017-Android
文件:ClientsAdapter.java
ClientVieHolder(View itemView) {
super(itemView);
textView_clientName = (TextView) itemView.findViewById(R.id.textView_nomClient);
textView_clientName_title = (TextView) itemView.findViewById(R.id.textView_nomClient_titre);
textView_clientTelephone = (TextView) itemView.findViewById(R.id.textView_telClient);
textView_clientTelephone_title = (TextView) itemView.findViewById(R.id.textView_telClient_titre);
textView_clientAddresse = (TextView) itemView.findViewById(R.id.textView_adrClient);
textView_clientAddresse_title = (TextView) itemView.findViewById(R.id.textView_adrClient_titre);
textView_clientTitle = (TextView) itemView.findViewById(R.id.textView_titreClient);
textView_clientTitle_title = (TextView) itemView.findViewById(R.id.textView_titreClient_titre);
textView_clientMobile = (TextView) itemView.findViewById(R.id.textView_mobileClient);
textView_clientMobile_title = (TextView) itemView.findViewById(R.id.textView_mobileClient_titre);
textView_clientEmail = (TextView) itemView.findViewById(R.id.textView_emailClient);
textView_clientEmail_title = (TextView) itemView.findViewById(R.id.textView_email_titre);
buttonUndo = (Button) itemView.findViewById(R.id.undo_button);
cardView_client = (CardView) itemView.findViewById(R.id.cardView_client);
linearLayout_iconBackground = (LinearLayout) itemView.findViewById(R.id.linearLayout_iconBackground);
}
项目:LocationTracking
文件:CustomDialog.java
public static void buildSingleButtonDialog(Activity activity, String title, String message) {
final Dialog dialog = buildDialog(activity, title, message);
Button cancelButton = ButterKnife.findById(dialog, R.id.btn_cancel);
cancelButton.setVisibility(View.INVISIBLE);
Button okButton = ButterKnife.findById(dialog, R.id.btn_yes);
okButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}
项目:HeadlineNews
文件:MineMineFragment.java
@Override
protected void initViews() {
/** 1、头像区域 */
/** 2、动态粉丝区域*/
/** 3、收藏、历史、夜间 区域*/
Button collectBtn = (Button) findViewById(R.id.id_my_collect_btn);
Button historyBtn = (Button) findViewById(R.id.id_my_history_btn);
Button nightModeBtn = (Button) findViewById(R.id.id_night_mode_btn);
CompoundDrawableUtil.changeCompoundDrawableSize(collectBtn, 1, 20);
CompoundDrawableUtil.changeCompoundDrawableSize(historyBtn, 1, 20);
CompoundDrawableUtil.changeCompoundDrawableSize(nightModeBtn, 1, 20);
collectBtn.setOnClickListener(this);
historyBtn.setOnClickListener(this);
nightModeBtn.setOnClickListener(this);
/** 4、cells */
}
项目:NetworkStateView
文件:MainActivity.java
private void initView() {
networkStateView = (NetworkStateView) findViewById(R.id.nsv_state_view);
Button bt_loading = (Button) findViewById(R.id.bt_loading);
Button bt_error = (Button) findViewById(R.id.bt_error);
Button bt_noNetwork = (Button) findViewById(R.id.bt_no_network);
Button bt_empty = (Button) findViewById(R.id.bt_empty);
bt_loading.setOnClickListener(this);
bt_error.setOnClickListener(this);
bt_noNetwork.setOnClickListener(this);
bt_empty.setOnClickListener(this);
networkStateView.setOnRefreshListener(this);
networkStateView.showLoading();
showSuccess();
}
项目:BBSSDK-for-Android
文件:TestActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MobSDK.init(this);
setContentView(ResHelper.getLayoutRes(this, "layout_test"));
cleverImageView = (CleverImageView) findViewById(ResHelper.getIdRes(this, "cleverImageView"));
btnTest = (Button) findViewById(ResHelper.getIdRes(this, "btnTest"));
btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// cleverImageView.setOval(false);
cleverImageView.setBorderColor(Color.BLUE);
cleverImageView.setBorderWidthDP(2);
cleverImageView.setCornerRadiiDP(10, 5, 20, 30);
cleverImageView.setImageUrl(IMAGE_URL);
}
});
}
项目:oma-riista-android
文件:HomeViewFragment.java
private void updateObservationQuickButtons(final View view) {
ObservationDatabase.getInstance().loadLatestObservationSpecimens(2, new ObservationsListener() {
@Override
public void onObservations(List<GameObservation> observations) {
if (isAdded()) {
List<Integer> latest = new ArrayList<>();
for (GameObservation observation : observations) {
latest.add(observation.gameSpeciesCode);
}
setupQuickButtons(view.findViewById(R.id.layout_quick_observation), latest, R.string.logobservation_template, new OnQuickButtonInitListener() {
@Override
public void onInit(Button button, final Species species) {
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startObservationEditActivity(species);
}
});
}
});
}
}
});
}
项目:Nird2
文件:InvitationViewHolder.java
public InvitationViewHolder(View v) {
super(v);
avatar = (TextAvatarView) v.findViewById(R.id.avatarView);
name = (TextView) v.findViewById(R.id.forumNameView);
sharedBy = (TextView) v.findViewById(R.id.sharedByView);
subscribed = (TextView) v.findViewById(R.id.forumSubscribedView);
accept = (Button) v.findViewById(R.id.acceptButton);
decline = (Button) v.findViewById(R.id.declineButton);
}
项目:boohee_v5.6
文件:AlertController.java
private void setupButtons(ViewGroup buttonPanel) {
boolean hasButtons = false;
int whichButtons = 0;
this.mButtonPositive = (Button) buttonPanel.findViewById(16908313);
this.mButtonPositive.setOnClickListener(this.mButtonHandler);
if (TextUtils.isEmpty(this.mButtonPositiveText)) {
this.mButtonPositive.setVisibility(8);
} else {
this.mButtonPositive.setText(this.mButtonPositiveText);
this.mButtonPositive.setVisibility(0);
whichButtons = 0 | 1;
}
this.mButtonNegative = (Button) buttonPanel.findViewById(16908314);
this.mButtonNegative.setOnClickListener(this.mButtonHandler);
if (TextUtils.isEmpty(this.mButtonNegativeText)) {
this.mButtonNegative.setVisibility(8);
} else {
this.mButtonNegative.setText(this.mButtonNegativeText);
this.mButtonNegative.setVisibility(0);
whichButtons |= 2;
}
this.mButtonNeutral = (Button) buttonPanel.findViewById(16908315);
this.mButtonNeutral.setOnClickListener(this.mButtonHandler);
if (TextUtils.isEmpty(this.mButtonNeutralText)) {
this.mButtonNeutral.setVisibility(8);
} else {
this.mButtonNeutral.setText(this.mButtonNeutralText);
this.mButtonNeutral.setVisibility(0);
whichButtons |= 4;
}
if (whichButtons != 0) {
hasButtons = true;
}
if (!hasButtons) {
buttonPanel.setVisibility(8);
}
}
项目:Android_watch_magpie
文件:AddValueFragment.java
private void setAcceptAction(Button acceptButton, final EditText dateEditText,
final EditText timeEditText, final TextInputLayout... textInputLayouts) {
acceptButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Validate the values
if (!areValuesValid(dateEditText, timeEditText, textInputLayouts)) {
return;
}
switch (type) {
case GLUCOSE:
case WEIGHT:
SingleValue newSingleValue = newSingleValueInstance(textInputLayouts[0], dateEditText, timeEditText);
// Store the new glucose measurement in the database
valueDAO.createValue(newSingleValue);
// Send it to the ListValuesFragment
callback.addSingleValue(newSingleValue);
break;
case BLOOD_PRESSURE:
DoubleValue newDoubleValue = newDoubleValueInstance(dateEditText, timeEditText, textInputLayouts);
valueDAO.createValue(newDoubleValue);
callback.addDoubleValue(newDoubleValue);
break;
}
// Remove the values from the UI elements
for (TextInputLayout textInputLayout : textInputLayouts) {
textInputLayout.getEditText().setText("");
textInputLayout.clearFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(textInputLayout.getWindowToken(), 0);
}
dateEditText.setText("");
timeEditText.setText("");
}
});
}
项目:Sistema-de-Comercializacion-Negocios-Jhordan
文件:ChangePasswordDialog.java
private void initViews(View v) {
mEtOldPassword = (EditText) v.findViewById(R.id.et_old_password);
mEtNewPassword = (EditText) v.findViewById(R.id.et_new_password);
mTiOldPassword = (TextInputLayout) v.findViewById(R.id.ti_old_password);
mTiNewPassword = (TextInputLayout) v.findViewById(R.id.ti_new_password);
mTvMessage = (TextView) v.findViewById(R.id.tv_message);
mBtChangePassword = (Button) v.findViewById(R.id.btn_change_password);
mBtCancel = (Button) v.findViewById(R.id.btn_cancel);
mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
mBtChangePassword.setOnClickListener(view -> changePassword());
mBtCancel.setOnClickListener(view -> dismiss());
}
项目:XFrame
文件:XLogDemoActivity.java
@Override
public void initView() {
button = (Button) findViewById(R.id.button);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button5 = (Button) findViewById(R.id.button5);
button4 = (Button) findViewById(R.id.button4);
textView = (TextView) findViewById(R.id.textView);
button.setOnClickListener(this);
button2.setOnClickListener(this);
button3.setOnClickListener(this);
button4.setOnClickListener(this);
button5.setOnClickListener(this);
}
项目:RxJava2-Android-Sample
文件:BehaviorSubjectExampleActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
btn = (Button) findViewById(R.id.btn);
textView = (TextView) findViewById(R.id.textView);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
doSomeWork();
}
});
}
项目:pracler
文件:FindUserActivity.java
private void viewInitialize()
{
editText = (EditText) findViewById(R.id.findText);
listView = (ListView) findViewById(R.id.listview);
button = (Button) findViewById(R.id.commit);
loadingbar = (AVLoadingIndicatorView) findViewById(R.id.loadingBar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(getString(R.string.search_user));
}
项目:Demos
文件:FillBlankView.java
@Override
public void onClick(final View widget) {
View view = LayoutInflater.from(context).inflate(R.layout.layout_input, null);
final EditText etInput = (EditText) view.findViewById(R.id.et_answer);
Button btnFillBlank = (Button) view.findViewById(R.id.btn_fill_blank);
// 显示原有答案
String oldAnswer = answerList.get(position);
if (!TextUtils.isEmpty(oldAnswer)) {
etInput.setText(oldAnswer);
etInput.setSelection(oldAnswer.length());
}
final PopupWindow popupWindow = new PopupWindow(view, LayoutParams.MATCH_PARENT, dp2px(40));
// 获取焦点
popupWindow.setFocusable(true);
// 为了防止弹出菜单获取焦点之后,点击Activity的其他组件没有响应
popupWindow.setBackgroundDrawable(new PaintDrawable());
// 设置PopupWindow在软键盘的上方
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
// 弹出PopupWindow
popupWindow.showAtLocation(tvContent, Gravity.BOTTOM, 0, 0);
btnFillBlank.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 填写答案
String answer = etInput.getText().toString();
fillAnswer(answer, position);
popupWindow.dismiss();
}
});
// 显示软键盘
InputMethodManager inputMethodManager =
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
项目:polling-station-app
文件:ManualInputActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manual_input);
Toolbar appBar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(appBar);
Util.setupAppBar(appBar, this);
Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf");
docNumber = (EditText) findViewById(R.id.doc_num);
docNumber.setTypeface(typeFace);
TextView docNumTitle = (TextView) findViewById(R.id.doc_num_title);
TextView dobTitle = (TextView) findViewById(R.id.dob_title);
TextView expDateTitle = (TextView) findViewById(R.id.exp_date_title);
docNumTitle.setTypeface(typeFace);
dobTitle.setTypeface(typeFace);
expDateTitle.setTypeface(typeFace);
Button submitBut = (Button) findViewById(R.id.submit_button);
submitBut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(verifyInput()) {
Intent returnIntent = new Intent();
returnIntent.putExtra(DocumentData.identifier, getData());
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
}
});
setupDOBSpinners();
setupExpirySpinners();
// When docData was previously filled in, update text fields
if(getIntent().hasExtra(DocumentData.identifier)) {
putData(getIntent().getExtras());
}
}
项目:thesis-project
文件:AttendanceAddActivity.java
private void init() {
linearLayoutAttendance = (LinearLayout) findViewById(add_add3);
recyclerView = (RecyclerView) findViewById(R.id.add_recycler3);
btnBackButton = (Button) findViewById(R.id.add_back3);
linearLayoutAttendance.setOnClickListener(this);
btnBackButton.setOnClickListener(this);
progressBar = (ProgressBar) findViewById(R.id.progres_man_att);
progressBar.setVisibility(View.VISIBLE);
}