• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Button类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.holoeverywhere.widget.Button的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Button类属于org.holoeverywhere.widget包,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onStart

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
@Override
public void onStart() {
	super.onStart(); // super.onStart() is where dialog.show() is actually
						// called on the underlying dialog, so we have to do
						// it after this point
	AlertDialog d = (AlertDialog) getDialog();
	if (d != null) {
		Button positiveButton = (Button) d
				.getButton(Dialog.BUTTON_POSITIVE);
		positiveButton.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				String login = ((EditText) view.findViewById(R.id.username))
						.getText().toString();
				String password = ((EditText) view
						.findViewById(R.id.password)).getText().toString();
				mListener.onLogin(login, password);
			}
		});
	}
}
 
开发者ID:johan12345,项目名称:ls-vertretungsplan,代码行数:22,代码来源:LoginDialogFragment.java


示例2: onLoginClick

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
/**
 * Called when clicking on the login button in the login screen.
 * @param v The button that was pressed.
 */
public void onLoginClick(View v)
{
	EditText vEdit = (EditText)this.findViewById(R.id.loginEdit);
	EditText vPword = (EditText)this.findViewById(R.id.pwordEdit);
	if (vEdit == null || vPword == null)
		return;
	
	String login = vEdit.getText().toString().trim().toLowerCase();
	String pWord = vPword.getText().toString().trim();
	if (StatMethods.IsStringNullOrEmpty(login)) {
		StatMethods.hotBread(this, "Login field is empty", Toast.LENGTH_SHORT);
		return;
	}
	else if (StatMethods.IsStringNullOrEmpty(pWord)) {
		StatMethods.hotBread(this, "Password field is empty", Toast.LENGTH_SHORT);
		return;
	}
	
	if (!StatMethods.isNetworkAvailable(this, true))
		return;
	
	Button loginButton = (Button)this.findViewById(R.id.button1);
	loginButton.setVisibility(View.INVISIBLE);
	ProgressBar pb1 = (ProgressBar)this.findViewById(R.id.progressBar1);
	pb1.setVisibility(View.VISIBLE);
	//new BGLogin(this.getApplicationContext(), null).execute("login", login, pWord);
       new LoginTask(this.getApplicationContext(), login, pWord).execute();
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:33,代码来源:LaunchActivity.java


示例3: onLoginComplete

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
public void onLoginComplete(boolean wasSuccessful) {
    if (wasSuccessful) {
        if (GCMUtil.checkPlayServices(this)) {
            new SnapGCMRegistrar(this).setupGoogleCloudManager(true);
        }

        LoadMenu(3, 1);
    } else {
        ProgressBar pb = (ProgressBar)this.findViewById(R.id.progressBar1);
        pb.setVisibility(View.INVISIBLE);
        Button butt = (Button)this.findViewById(R.id.button1);
        butt.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:saltisgood,项目名称:opensnap,代码行数:15,代码来源:LaunchActivity.java


示例4: centerButton

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
private void centerButton(Button button) {
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) button
            .getLayoutParams();
    params.gravity = Gravity.CENTER_HORIZONTAL;
    params.weight = 0.5f;
    button.setLayoutParams(params);
    View leftSpacer = mWindow.findViewById(R.id.leftSpacer);
    if (leftSpacer != null) {
        leftSpacer.setVisibility(View.VISIBLE);
    }
    View rightSpacer = mWindow.findViewById(R.id.rightSpacer);
    if (rightSpacer != null) {
        rightSpacer.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:16,代码来源:AlertController.java


示例5: getButton

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
public Button getButton(int whichButton) {
    switch (whichButton) {
        case DialogInterface.BUTTON_POSITIVE:
            return mButtonPositive;
        case DialogInterface.BUTTON_NEGATIVE:
            return mButtonNegative;
        case DialogInterface.BUTTON_NEUTRAL:
            return mButtonNeutral;
        default:
            return null;
    }
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:13,代码来源:AlertController.java


示例6: onCreateView

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_section_now, container, false);
    Button b = (Button) rootView.findViewById(R.id.button);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try{
                String uri = prefs.getString("pref_general_sound_key", "");
                Uri ringtone = Uri.parse(uri);
                if(uri.isEmpty()) {
                    ringtone = RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION);
                }
                mPlayer = new MediaPlayer();
                mPlayer.setDataSource(context, ringtone);
                AudioManager aManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
                if(aManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION) !=0 ) {
                    mPlayer.setAudioStreamType(AudioManager.STREAM_NOTIFICATION);
                    mPlayer.setLooping(false);
                    mPlayer.prepare();
                    mPlayer.start();
                }
            }
            catch(IOException e) {

            }
            finally {
                //mPlayer.release();
            }
        }
    });
    return rootView;
}
 
开发者ID:wuyingren,项目名称:WhatsAnnoyProject,代码行数:34,代码来源:NowFragment.java


示例7: findViews

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
private void findViews() {
    mAlertTitle = (EditText) getView().findViewById(R.id.alert_title);
    mDaySelectorView = (DaySelectorView) getView().findViewById(R.id.day_selector_view);
    mLineSelectorView = (LineSelectorView) getView().findViewById(R.id.line_selector_view);
    mTimeInputField = (TimeInputField) getView().findViewById(R.id.time_input);
    mCancelButton = (Button) getView().findViewById(R.id.cancel_button);
    mSaveButton = (Button) getView().findViewById(R.id.save_button);
    mOnlyNotifyForDisruptionsView = (CheckBox) getView().findViewById(R.id.only_notify_for_disruptions_view);
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:10,代码来源:EditAlertFragment.java


示例8: getNextButton

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
protected Button getNextButton() {
    return mNextButton;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:PreferenceActivity.java


示例9: getButton

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
public Button getButton(int whichButton) {
    return mAlert.getButton(whichButton);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:AlertDialog.java


示例10: onCreate

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState, Intent intent,
                        CharSequence title, Intent[] initialIntents, List<ResolveInfo> rList,
                        boolean alwaysUseOption) {
    super.onCreate(savedInstanceState);
    try {
        mLaunchedFromUid = getPackageManager().getApplicationInfo(getPackageName(), 0).uid;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
        mLaunchedFromUid = -1;
    }
    mPm = getPackageManager();
    mAlwaysUseOption = alwaysUseOption;
    mMaxColumns = getResources().getInteger(R.integer.config_maxResolverActivityColumns);
    intent.setComponent(null);
    AlertController.AlertParams ap = mAlertParams;
    ap.mTitle = title;
    final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    mIconDpi = getLauncherLargeIconDensity(am);
    mIconSize = getLauncherLargeIconSize(am);
    mAdapter = new ResolveListAdapter(this, intent, initialIntents, rList,
            mLaunchedFromUid);
    int count = mAdapter.getCount();
    if (mLaunchedFromUid < 0 || isIsolated(mLaunchedFromUid)) {
        finish();
        return;
    } else if (count > 1) {
        ap.mView = getLayoutInflater().inflate(R.layout.resolver_grid, null);
        mGrid = (GridView) ap.mView.findViewById(R.id.resolver_grid);
        mGrid.setAdapter(mAdapter);
        mGrid.setOnItemClickListener(this);
        mGrid.setOnItemLongClickListener(new ItemLongClickListener());
        if (alwaysUseOption) {
            mGrid.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        }
        resizeGrid();
    } else if (count == 1) {
        startActivity(mAdapter.intentForPosition(0));
        finish();
        return;
    } else {
        ap.mMessage = getResources().getText(R.string.noApplications);
    }
    setupAlert();
    if (alwaysUseOption) {
        final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
        if (buttonLayout != null) {
            buttonLayout.setVisibility(View.VISIBLE);
            mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
            mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
        } else {
            mAlwaysUseOption = false;
        }
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:55,代码来源:ResolverActivity.java


示例11: onInitializeAccessibilityEvent

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    event.setClassName(Button.class.getName());
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:7,代码来源:AccessibleLinearLayout.java


示例12: onInitializeAccessibilityNodeInfo

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.setClassName(Button.class.getName());
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:7,代码来源:AccessibleLinearLayout.java


示例13: onCreateView

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

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

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_week);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearView.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
        mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
        mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
        mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
    }

    final Activity activity = getActivity();
    mDayPickerView = new DayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.day_picker_description);
    mSelectDay = res.getString(R.string.select_day);
    mYearPickerDescription = res.getString(R.string.year_picker_description);
    mSelectYear = res.getString(R.string.select_year);

    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    mDoneButton = (Button) view.findViewById(R.id.done);
    mDoneButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
                mCallBack.onDateSet(DatePickerDialog.this, mCalendar.get(Calendar.YEAR),
                        mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
        }
    });

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        } else if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelection(listPosition);
        }
    }
    return view;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:78,代码来源:DatePickerDialog.java


示例14: onCreate

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState, Intent intent,
        CharSequence title, Intent[] initialIntents, List<ResolveInfo> rList,
        boolean alwaysUseOption) {
    super.onCreate(savedInstanceState);
    try {
        mLaunchedFromUid = getPackageManager().getApplicationInfo(getPackageName(), 0).uid;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
        mLaunchedFromUid = -1;
    }
    mPm = getPackageManager();
    mAlwaysUseOption = alwaysUseOption;
    mMaxColumns = getResources().getInteger(R.integer.config_maxResolverActivityColumns);
    intent.setComponent(null);
    AlertController.AlertParams ap = mAlertParams;
    ap.mTitle = title;
    final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    mIconDpi = getLauncherLargeIconDensity(am);
    mIconSize = getLauncherLargeIconSize(am);
    mAdapter = new ResolveListAdapter(this, intent, initialIntents, rList,
            mLaunchedFromUid);
    int count = mAdapter.getCount();
    if (mLaunchedFromUid < 0 || isIsolated(mLaunchedFromUid)) {
        finish();
        return;
    } else if (count > 1) {
        ap.mView = getLayoutInflater().inflate(R.layout.resolver_grid, null);
        mGrid = (GridView) ap.mView.findViewById(R.id.resolver_grid);
        mGrid.setAdapter(mAdapter);
        mGrid.setOnItemClickListener(this);
        mGrid.setOnItemLongClickListener(new ItemLongClickListener());
        if (alwaysUseOption) {
            mGrid.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        }
        resizeGrid();
    } else if (count == 1) {
        startActivity(mAdapter.intentForPosition(0));
        finish();
        return;
    } else {
        ap.mMessage = getResources().getText(R.string.noApplications);
    }
    setupAlert();
    if (alwaysUseOption) {
        final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
        if (buttonLayout != null) {
            buttonLayout.setVisibility(View.VISIBLE);
            mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
            mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
        } else {
            mAlwaysUseOption = false;
        }
    }
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:55,代码来源:ResolverActivity.java


示例15: setupButtons

import org.holoeverywhere.widget.Button; //导入依赖的package包/类
private boolean setupButtons() {
    int BIT_BUTTON_POSITIVE = 1;
    int BIT_BUTTON_NEGATIVE = 2;
    int BIT_BUTTON_NEUTRAL = 4;
    int whichButtons = 0;
    mButtonPositive = (Button) mWindow.findViewById(R.id.button1);
    mButtonPositive.setOnClickListener(mButtonHandler);
    if (TextUtils.isEmpty(mButtonPositiveText)) {
        mButtonPositive.setVisibility(View.GONE);
    } else {
        mButtonPositive.setText(mButtonPositiveText);
        mButtonPositive.setVisibility(View.VISIBLE);
        whichButtons = whichButtons | BIT_BUTTON_POSITIVE;
    }
    mButtonNegative = (Button) mWindow.findViewById(R.id.button2);
    mButtonNegative.setOnClickListener(mButtonHandler);
    if (TextUtils.isEmpty(mButtonNegativeText)) {
        mButtonNegative.setVisibility(View.GONE);
    } else {
        mButtonNegative.setText(mButtonNegativeText);
        mButtonNegative.setVisibility(View.VISIBLE);

        whichButtons = whichButtons | BIT_BUTTON_NEGATIVE;
    }
    mButtonNeutral = (Button) mWindow.findViewById(R.id.button3);
    mButtonNeutral.setOnClickListener(mButtonHandler);
    if (TextUtils.isEmpty(mButtonNeutralText)) {
        mButtonNeutral.setVisibility(View.GONE);
    } else {
        mButtonNeutral.setText(mButtonNeutralText);
        mButtonNeutral.setVisibility(View.VISIBLE);

        whichButtons = whichButtons | BIT_BUTTON_NEUTRAL;
    }
    if (AlertController.shouldCenterSingleButton(mContext)) {
        if (whichButtons == BIT_BUTTON_POSITIVE) {
            centerButton(mButtonPositive);
        } else if (whichButtons == BIT_BUTTON_NEGATIVE) {
            centerButton(mButtonNeutral);
        } else if (whichButtons == BIT_BUTTON_NEUTRAL) {
            centerButton(mButtonNeutral);
        }
    }
    return whichButtons != 0;
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:46,代码来源:AlertController.java



注:本文中的org.holoeverywhere.widget.Button类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Cubemap类代码示例发布时间:2022-05-23
下一篇:
Java DiagnosticCommand类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap