项目:coursera-sustainable-apps
文件:LoginActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
loginButton = (Button) findViewById(R.id.loginButton);
registerButton = (Button) findViewById(R.id.registerButton);
forgotPasswordButton = (Button) findViewById(R.id.forgotPassword);
passwordEditText = (EditText) findViewById(R.id.passwordEditText);
emailEditText = (EditText) findViewById(R.id.emailEditText);
// Does having a single click listener really simplify or
// improve this code's modularity in any helpful way?
forgotPasswordButton.setonClickListener(this);
loginButton.setonClickListener(this);
registerButton.setonClickListener(this);
}
项目:AppTycoon
文件:ChangeProductNameDialog.java
/**
* @param product Product that's being edited
* @param context Activity context
* @param onNameChanged Callback that's called after the name has been changed
*/
public ChangeProductNameDialog(final Product product,Context context,final CustomCallback onNameChanged) {
super(context,R.layout.dialog_change_product_name,"Set product name");
final EditText editTextName = (EditText) findViewById(R.id.editTextName);
editTextName.setText(product.getName());
setokAction(new View.OnClickListener() {
@Override
public void onClick(View v) {
product.setName(editTextName.getText().toString());
onNameChanged.callBack();
dismiss();
}
});
}
@Override
public void onInput(@NonNull MaterialDialog dialog,CharSequence input) {
if (mIsFirstTextChanged) {
mIsFirstTextChanged = false;
return;
}
EditText editText = dialog.getInputEditText();
if (editText == null)
return;
int errorResId = 0;
if (input == null || input.length() == 0) {
errorResId = R.string.text_name_should_not_be_empty;
} else if (!input.equals(mExcluded)) {
if (new File(getCurrentDirectory(),mIsDirectory ? input.toString() : input.toString() + ".js").exists()) {
errorResId = R.string.text_file_exists;
}
}
if (errorResId == 0) {
editText.setError(null);
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
} else {
editText.setError(getString(errorResId));
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
}
}
项目:weex-uikit
文件:AbstractEditComponent.java
private void decideSoftKeyboard() {
View hostView;
if ((hostView = getHostView()) != null) {
final Context context = getContext();
if (context != null && context instanceof Activity) {
hostView.postDelayed(new Runnable() {
@Override
public void run() {
View currentFocus = ((Activity) context).getCurrentFocus();
if (!(currentFocus instanceof EditText)) {
mInputMethodManager.hideSoftInputFromWindow(getHostView().getwindowToken(),0);
}
}
},16);
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_members);
textnorecord = (TextView) findViewById(R.id.textEmpty);
listView = (ListView) findViewById(R.id.list_team_members);
listView.setonItemClickListener(this);
memberList = new ArrayList<>();
editAddMembers = (EditText) findViewById(R.id.editAddTeamMember);
editAddMembers.addTextChangedListener(this);
findViewById(R.id.image_search).setonClickListener(this);
try {
odoo = odoo.createWithUser(this,OUser.current(this));
} catch (odooVersionException e) {
e.printstacktrace();
}
}
项目:RNLearn_Project1
文件:ReactTextInputShadowNode.java
@Override
public void setThemedContext(ThemedReactContext themedContext) {
super.setThemedContext(themedContext);
// Todo #7120264: cache this stuff better
mEditText = new EditText(getThemedContext());
// This is needed to fix an android bug since 4.4.3 which will throw an NPE in measure,// setting the layoutParams fixes it: https://code.google.com/p/android/issues/detail?id=75877
mEditText.setLayoutParams(
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT));
setDefaultPadding(Spacing.START,mEditText.getPaddingStart());
setDefaultPadding(Spacing.TOP,mEditText.getPaddingTop());
setDefaultPadding(Spacing.END,mEditText.getPaddingEnd());
setDefaultPadding(Spacing.BottOM,mEditText.getPaddingBottom());
mEditText.setPadding(0,0);
}
@Override public boolean dispatchTouchEvent(MotionEvent ev) {
if (isAutoHideInputView) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
View v = getCurrentFocus();
if (v != null) {
if ((v instanceof EditText)) {
if (!AppUtils.isEventInVIew(v,ev)) {
if (AppUtils.hideInput(this,v) && isClearFocusWhileAutoHideInputView) {
v.clearFocus();
}
}
}
}
return super.dispatchTouchEvent(ev);
}
// 必不可少,否则所有的组件都不会有TouchEvent了
if (getwindow().superdispatchTouchEvent(ev)) {
return true;
}
}
try {
return super.dispatchTouchEvent(ev);
} catch (Exception e) {
// ignored
}
return false;
}
项目: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();
}
});
}
项目:Nird2
文件:SetupActivityTest.java
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
setupActivity = Robolectric.setupActivity(TestSetupActivity.class);
nicknameEntryWrapper = (TextInputLayout) setupActivity
.findViewById(R.id.nickname_entry_wrapper);
passwordConfirmationWrapper = (TextInputLayout) setupActivity
.findViewById(R.id.password_confirm_wrapper);
nicknameEntry =
(EditText) setupActivity.findViewById(R.id.nickname_entry);
passwordEntry =
(EditText) setupActivity.findViewById(R.id.password_entry);
passwordConfirmation =
(EditText) setupActivity.findViewById(R.id.password_confirm);
strengthMeter =
(StrengthMeter) setupActivity.findViewById(R.id.strength_meter);
createAccountButton =
(Button) setupActivity.findViewById(R.id.create_account);
}
项目:ChromeLikeTabSwitcher
文件:MainActivity.java
@Override
public void onShowTab(@NonNull final Context context,@NonNull final TabSwitcher tabSwitcher,@NonNull final View view,@NonNull final Tab tab,final int index,final int viewType,@Nullable final Bundle savedInstanceState) {
TextView textView = findViewById(android.R.id.title);
textView.setText(tab.getTitle());
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setVisibility(tabSwitcher.isSwitcherShown() ? View.GONE : View.VISIBLE);
if (viewType != 0) {
EditText editText = findViewById(android.R.id.edit);
if (savedInstanceState == null) {
editText.setText(null);
}
editText.requestFocus();
}
}
项目:2017.1-Trezentos
文件:LoginActivity.java
private void loginErrorMessage(String errorMessage,EditText email,EditText password){
if(errorMessage.equals(getString(R.string.msg_len_email_error_message))){
email.requestFocus();
email.setError("Email inválido. Tente novamente");
}
if(errorMessage.equals(getString(R.string.msg_special_characters_email_error_message))){
email.requestFocus();
email.setError("Email inválido. Tente novamente");
}
if(errorMessage.equals(getString(R.string.msg_null_email_error_message))){
email.requestFocus();
email.setError(getString(R.string.msg_null_email_error_message));
}
if(errorMessage.equals(getString(R.string.msg_len_password_error_message))){
password.requestFocus();
password.setError("Senha inválida. Tente Novamente");
}
if(errorMessage.equals(getString(R.string.msg_null_password_error_message))){
password.requestFocus();
password.setError(getString(R.string.msg_null_password_error_message));
}
}
项目:ValueAddSubView
文件:FocusManager.java
@Override
public boolean onTouch(View v,MotionEvent event) {
KeyboardUtils.hideSoftInput(mContext);
View currentFocus = mContext.getCurrentFocus();
//处理列表中的控件需要点击两次才生效的问题
if (currentFocus != v && v.isClickable() && event.getAction() == MotionEvent.ACTION_DOWN) {
v.requestFocus();
return false;
}
if (currentFocus instanceof EditText) {
mRootView.requestFocus();
}
return false;
}
项目:TimeTrix
文件:SectionDetailsActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
ActivitySectionDetailsBinding binding = DataBindingUtil.setContentView (this,R.layout.activity_section_details);
mSectionIndex = getIntent ().getIntExtra (globalData.SECTION_INDEX,1); //Todo do has extra
Toolbar toolbar = (Toolbar) findViewById (R.id.toolbarSubDetail);
setSupportActionBar (toolbar);
android.support.v7.app.ActionBar actionBar = getSupportActionBar ();
Button updateButton = (Button) findViewById (R.id.update);
mSectionNameEditText = (EditText) findViewById (R.id.textViewSectionName);
mSectionDescriptionEditText = (EditText) findViewById (R.id.textViewDescriptionName);
updateButton.setonClickListener (this);
// Toast.makeText (SectionDetailsActivity.this,"file id ="+getIntent ().getLongExtra (globalData.SECTION_INDEX,-1),Toast.LENGTH_LONG).show ();
mSubject = new SectionDetailsBinder (SectionDetailsActivity.this,mSectionIndex + 1);
mSubject.setInputType ("none");
binding.setSubject (mSubject);
if (actionBar != null) {
actionBar.setdisplayHomeAsUpEnabled (true);
}
}
项目:AI_Calorie_Counter_Demo
文件:reguser.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reguser);
System.out.println("reached here1232");
e_name=(EditText) findViewById(R.id.name);
e_username=(EditText) findViewById(R.id.r_userName);
e_password=(EditText) findViewById(R.id.password);
e_lifestyle=(Spinner) findViewById(R.id.lifestyle);
e_current_weight = (EditText) findViewById(R.id.cweight);
e_goal_weight = (EditText) findViewById(R.id.gweight);
e_lifestyle.setonItemSelectedListener(this);
spinner = (ProgressBar)findViewById(R.id.progressBar2);
//getSupportActionBar().setdisplayHomeAsUpEnabled(true);
spinner.setVisibility(View.GONE);
}
项目:Liz
文件:ThemeHelper.java
public static void setCursorColor(EditText editText,int color) {
try {
Field fCursorDrawableRes =
TextView.class.getDeclaredField("mCursorDrawableRes");
fCursorDrawableRes.setAccessible(true);
int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
Field fEditor = TextView.class.getDeclaredField("mEditor");
fEditor.setAccessible(true);
Object editor = fEditor.get(editText);
Class<?> clazz = editor.getClass();
Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
fCursorDrawable.setAccessible(true);
Drawable[] drawables = new Drawable[2];
drawables[0] = ContextCompat.getDrawable(editText.getContext(),mCursorDrawableRes);
drawables[1] = ContextCompat.getDrawable(editText.getContext(),mCursorDrawableRes);
drawables[0].setColorFilter(color,PorterDuff.Mode.SRC_IN);
drawables[1].setColorFilter(color,PorterDuff.Mode.SRC_IN);
fCursorDrawable.set(editor,drawables);
} catch (final Throwable ignored) { }
}
项目:FindCurrencyExa
文件:MainFragment.java
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void onViewCreated(View view,@Nullable Bundle savedInstanceState) {
super.onViewCreated(view,savedInstanceState);
btn_find = (Button) view.findViewById(R.id.btn_find);
et_location_name = (EditText) view.findViewById(R.id.et_location_name);
et_country_code = (EditText) view.findViewById(R.id.et_country_code);
et_countyISO = (EditText) view.findViewById(R.id.et_countyISO);
et_currencyCode = (EditText) view.findViewById(R.id.et_currencyCode);
tv_currencySymbol = (TextView) view.findViewById(R.id.tv_currencySymbol);
tv_currencydisplayName = (TextView) view.findViewById(R.id.tv_currencydisplayName);
tv_currencyCode = (TextView) view.findViewById(R.id.tv_currencyCode);
tv_fractionDigits = (TextView) view.findViewById(R.id.tv_fractionDigits);
tv_numericCode = (TextView) view.findViewById(R.id.tv_numericCode);
tv_noDataFound = (TextView) view.findViewById(R.id.tv_noDataFound);
fl_bottomContents = (FrameLayout) view.findViewById(R.id.fl_bottomContents);
availableCurrenciesSet = Currency.getAvailableCurrencies();
currencyList = new ArrayList<>(availableCurrenciesSet);
btn_find.setonClickListener(this);
}
项目:AppTycoon
文件:EditProductFeatureDialog.java
/**
* @param product Product that the feature belongs to
* @param feature Feature that's being edited
* @param context Activity context
* @param onFeatureChanged Callback that's called when the feature is changed
*/
public EditProductFeatureDialog(final Product product,final ProductFeature feature,final CustomCallback onFeatureChanged) {
super(context,R.layout.dialog_edit_product_feature,"Edit feature");
final EditText editTextLevel = (EditText) findViewById(R.id.editTextFeatureLevel);
String stringCurrentLevel = "" + product.getLevelOfAFeature(feature);
editTextLevel.setText(stringCurrentLevel);
TextView textView = (TextView) findViewById(R.id.textViewFeatureName);
textView.setText(feature.getName());
setokAction(new View.OnClickListener() {
@Override
public void onClick(View v) {
product.addFeature(feature,Integer.parseInt(editTextLevel.getText().toString()));
onFeatureChanged.callBack();
dismiss();
}
});
}
项目:MobileAppForPatient
文件:GuiUtils.java
public static void setKeypadVisibility(Context context,EditText inputNote,int visibility) {
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
switch (visibility) {
case View.VISIBLE:
// 開啟鍵盤
imm.showSoftInput(inputNote,InputMethodManager.SHOW_IMPLICIT);
break;
case View.GONE:
case View.INVISIBLE:
// 關閉鍵盤
imm.hideSoftInputFromWindow(inputNote.getwindowToken(),0);
break;
} /* end of switch */
}
项目:AndroidNetwork
文件:LoginNewActivity.java
@Override
protected void initViews(Bundle savedInstanceState) {
setContentView(R.layout.activity_login);
etEmail = (EditText)findViewById(R.id.email);
etEmail.setText(strEmail);
etPassword = (EditText)findViewById(R.id.password);
//登录事件
btnLogin = (Button)findViewById(R.id.sign_in_button);
btnLogin.setonClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoLoginActivity();
}
});
}
项目:GCSApp
文件:GroupDetailsActivity.java
private void showAnnouncementDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.group_announcement);
if (group.getowner().equals(EMClient.getInstance().getCurrentUser()) ||
group.getAdminList().contains(EMClient.getInstance().getCurrentUser())) {
final EditText et = new EditText(GroupDetailsActivity.this);
et.setText(group.getAnnouncement());
builder.setView(et);
builder.setNegativeButton(R.string.cancel,null)
.setPositiveButton(R.string.save,new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,int which) {
final String text = et.getText().toString();
if (!text.equals(group.getAnnouncement())) {
dialog.dismiss();
updateAnnouncement(text);
}
}
});
} else {
builder.setMessage(group.getAnnouncement());
builder.setPositiveButton(R.string.ok,null);
}
builder.show();
}
项目:OpenHomeAnalysis
文件:OhaEnergyUseBillFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_energy_use_bill,container,false);
this.radioButtonFromDate = (RadioButton) view.findViewById(R.id.radioButtonFromDate);
this.radioButtonToDate = (RadioButton) view.findViewById(R.id.radioButtonToDate);
this.editKwhCost = (EditText) view.findViewById(R.id.editKwhCost);
this.datePicker = (DatePicker) view.findViewById(R.id.datePicker);
this.toolbar = (Toolbar) view.findViewById(R.id.toolbar);
this.setTexTradioButtonDate(radioButtonFromDate,this.fromDate);
this.setTexTradioButtonDate(radioButtonToDate,this.toDate);
this.setCalendarView();
this.editKwhCost.setText(OhaHelper.getEditable(this.kwhCost));
this.radioButtonFromDate.setonClickListener(this);
this.radioButtonToDate.setonClickListener(this);
this.datePicker.setonClickListener(this);
//Remover o date_picker_header do datePicker se o mesmo existir
View viewDayDatePicker = datePicker.findViewById(Resources.getSystem().getIdentifier("date_picker_header","id","android"));
if (viewDayDatePicker != null) {
viewDayDatePicker.setVisibility(View.GONE);
}
this.toolbar.inflateMenu(R.menu.fragment_energy_use_bill);
this.toolbar.setonMenuItemClickListener(this);
return view;
}
@Override
protected void initWidgets() {
super.initWidgets();
mImgContainerLayout = (LinearLayout) findViewById(R.id.kf5_Feed_back_image_layout);
mETContent = (EditText) findViewById(R.id.kf5_Feed_back_content_et);
mETContent.setonTouchListener(this);
mETContent.addTextChangedListener(new ETTextWatcher());
mImgChoiceImg = (ImageView) findViewById(R.id.kf5_Feed_back_choice_img);
mImgChoiceImg.setonClickListener(this);
mParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
mParams.bottomMargin = 1;
mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
mBackImg.setonClickListener(this);
mTVSubmit = (TextView) findViewById(R.id.kf5_right_text_view);
mTVSubmit.setonClickListener(this);
mTVSubmit.setEnabled(false);
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.
setResult(RESULT_CANCELED);
setContentView(R.layout.hi_app_widget_configure);
mAppWidgetText = (EditText) findViewById(R.id.appwidget_text);
findViewById(R.id.add_button).setonClickListener(mOnClickListener);
// Find the widget id from the intent.
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
}
// If this activity was started with an intent without an app widget ID,finish with an error.
if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish();
return;
}
mAppWidgetText.setText(loadTitlePref(HiAppWidgetConfigureActivity.this,mAppWidgetId));
}
项目:MusicX-music-player
文件:ATEDefaultTags.java
@Nullable
private static HashMap<String,String> get(View forView) {
if (forView instanceof EditText)
return getDefaultEditText();
else if (forView instanceof CompoundButton)
return getDefaultCompoundButton();
else if (forView instanceof ProgressBar)
return getDefaultWidget();
else if (forView instanceof CheckedTextView)
return getDefaultCheckedTextView();
else if (forView instanceof FloatingActionButton)
return getDefaultFloatingActionButton();
else if (forView instanceof ScrollView || forView instanceof AbsListView)
return getDefaultScrollableView();
else if (ATEUtil.isInClasspath(EdgeGlowTagProcessor.RECYCLERVIEW_CLASS) &&
RecyclerViewUtil.isRecyclerView(forView)) {
return getDefaultScrollableView();
} else if (ATEUtil.isInClasspath(EdgeGlowTagProcessor.nesTEDSCROLLVIEW_CLASS) &&
nestedScrollViewUtil.isnestedScrollView(forView)) {
return getDefaultScrollableView();
} else if (ATEUtil.isInClasspath(EdgeGlowTagProcessor.VIEWPAGER_CLASS) &&
ViewPagerUtil.isViewPager(forView)) {
return getDefaultScrollableView();
} else if (ATEUtil.isInClasspath(TabLayoutTagProcessor.MAIN_CLASS) &&
TabLayoutUtil.isTabLayout(forView)) {
return getDefaultTabLayout();
} else if (forView instanceof TextView) {
return getDefaultTextView();
}
return null;
}
项目:2017.2-codigo
文件:EditarEstadoActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alterar_estado);
Intent i = getIntent();
codigoEstado = i.getStringExtra(sqlEstadosHelper.STATE_CODE);
db = sqlEstadosHelper.getInstance(this);
UF = (EditText) findViewById(R.id.txtUF);
nomeEstado = (EditText) findViewById(R.id.txtNome);
editar = (Button) findViewById(R.id.btnInserirEstado);
new CarregaTask().execute();
}
项目:FamilyBond
文件:LoginActivity.java
void initView() {
mLoginUsernameEditText = (EditText) findViewById(R.id.login_username_edit_text);
mLoginPasswordEditText = (EditText) findViewById(R.id.login_password_edit_text);
mLoginButton = (Button) findViewById(R.id.login_button);
mForgetpasswordTextView = (TextView) findViewById(R.id.forget_password_text_view);
mLoginCardView = (CardView) findViewById(R.id.login_card_view);
mSwitchFab = (FloatingActionButton) findViewById(R.id.switch_fab);
mLoginInProgressBar = (ProgressBar) findViewById(R.id.login_in_progress_bar);
mLoginButton.setonClickListener(this);
mForgetpasswordTextView.setonClickListener(this);
mSwitchFab.setonClickListener(this);
}
项目:BaseCore
文件:KeyboardUtils.java
/**
* 动态显示软键盘
*
* @param edit 输入框
*/
public static void showSoftInput(EditText edit) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager imm = (InputMethodManager) Utils.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(edit,0);
}
private void initView() {
mProgressBar = findViewById(R.id.progressBar);
mTextViewReceive = (TextView) findViewById(R.id.textViewReceive);
mEditTextSend = (EditText) findViewById(R.id.etSend);
mButtonSend = (Button) findViewById(R.id.buttonSend);
mButtonSend.setonClickListener(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navView = (NavigationView) findViewById(R.id.nav_view);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setdisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
}
navView.setCheckedItem(R.id.nav_call);
navView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
mDrawerLayout.closeDrawers();
return true;
}
});
FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
floatingActionButton.setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mBluetoothLeService != null &&
mConnectionState.equals(BluetoothLeService.ACTION_GATT_CONNECTED)) {
mBluetoothLeService.disconnect();
}
Intent intent = new Intent(MainActivity.this,BluetoothScanActivity.class);
startActivityForResult(intent,REQUEST_CONNECT);
}
});
}
项目:do-road
文件:LoginActivity.java
private void initViews()
{
mEmailInput = (EditText) findViewById(R.id.input_email);
mPasswordInput = (EditText) findViewById(R.id.input_password);
login = (Button) findViewById(R.id.btn_login);
link_register = (TextView) findViewById(R.id.link_signup);
login.setonClickListener(this);
link_register.setonClickListener(this);
}
项目:Pole-Beacon-Android-SDK
文件:QuestionAdapter.java
public TextViewHolder(View view) {
super(view);
answer = (EditText) view.findViewById(R.id.answer);
rootView = (LinearLayout) view.findViewById(R.id.root_view);
title = (TextView) view.findViewById(R.id.title);
}
项目:XERUNG
文件:SearchGroupMember.java
private void findViewIds(){
mLayback = (RelativeLayout)findViewById(R.id.layBack);
listview = (ListView)findViewById(R.id.lvList);
relProgress = (RelativeLayout)findViewById(R.id.layProgressresult);
layMain = (LinearLayout)findViewById(R.id.layMain);
edtSearch = (EditText)findViewById(R.id.edtGroupSearch);
txtType = (TextView)findViewById(R.id.txtTypeSearch);
txtType.setTypeface(ManagerTypeface.getTypeface(SearchGroupMember.this,R.string.typeface_roboto_regular));
}
项目:Utils
文件:KeyboardUtil.java
/**
* 切换键盘显示与否状态
*
* @param edit 输入框
*/
public static void toggleSoftInput(EditText edit) {
edit.setFocusable(true);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
InputMethodManager inputManager = (InputMethodManager)
sContext.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null) {
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
}
项目:SmingZZick_App
文件:AbsControl.java
public AbsControl(TextPreviewView view,ColorPickerView colorPickerView) {
this.textPreviewView = view;
this.colorPickerView = colorPickerView;
ViewGroup pickerLayout = (ViewGroup) colorPickerView.getChildAt(0);
int childCount = pickerLayout.getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
View child = pickerLayout.getChildAt(i);
if (child instanceof EditText) {
((EditText) child).setTextColor(Color.WHITE);
break;
}
}
}
项目:sdk-examples-android-java
文件:MainActivity.java
private void initCall(Boolean videoCall) {
final Bundle otherExtras = new Bundle();
otherExtras.putBoolean(Gruveo.GRV_EXTRA_VIBRATE_IN_CHAT,false);
otherExtras.putBoolean(Gruveo.GRV_EXTRA_disABLE_CHAT,false);
final String code = ((EditText) findViewById(R.id.main_edittext)).getText().toString();
final String result = new Gruveo.Builder(this)
.callCode(code)
.videoCall(videoCall)
.clientId("demo")
.requestCode(REQUEST_CALL)
.otherExtras(otherExtras)
.eventsListener(eventsListener)
.build();
switch (result) {
case Gruveo.GRV_INIT_MISSING_CALL_CODE: {
break;
}
case Gruveo.GRV_INIT_INVALID_CALL_CODE: {
break;
}
case Gruveo.GRV_INIT_MISSING_CLIENT_ID: {
break;
}
case Gruveo.GRV_INIT_OFFLINE: {
break;
}
default: {
break;
}
}
}
项目:memento-app
文件:PersonActivity.java
private void doneAndSave() {
TextView textWarning = (TextView)findViewById(R.id.info);
EditText editTextPersonName = (EditText)findViewById(R.id.edit_person_name);
String newPersonName = editTextPersonName.getText().toString();
if (newPersonName.equals("")) {
textWarning.setText(R.string.person_name_empty_warning_message);
return;
}
StorageHelper.setPersonName(personId,newPersonName,personGroupId,PersonActivity.this);
finish();
}
项目:linkedout_procon
文件:ArrayQuiz.java
@NonNull
@Override
public View getView(int position,View convertView,ViewGroup parent) {
ViewHolder holder = null;
if(convertView == null){
holder = new ViewHolder();
convertView = inflater.inflate(resource,null);
holder.tvQuiz = (TextView)convertView.findViewById(R.id.tvQuiz);
holder.tvChoices = (TextView)convertView.findViewById(R.id.tvChoices);
holder.etAnswer = (EditText)convertView.findViewById(R.id.etAnswer);
convertView.setTag(holder);
}
else{
holder = (ViewHolder)convertView.getTag();
}
//holder for the quiz question
holder.tvQuiz.setText(quizModelList.get(position).getQuestion());
//for loop for multiple answer choices string buffer adds one to letter to lidst A,B,C for answers
StringBuffer stringBuffer = new StringBuffer();
char letter = 'A';
for(QuizModel.Choices choices : quizModelList.get(position).getChoiceList()){
stringBuffer.append( letter + ") " );
stringBuffer.append(choices.getAnswerChoice());
letter++;
stringBuffer.append("\n");
}
holder.tvChoices.setText(stringBuffer);
//holder.etAnswer.setText("Enter Letter Choice Here");
return convertView;
}
项目:keepass2android
文件:FragmentFiles.java
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.afc_fragment_files,false);
/*
* MAP CONTROLS
*/
mBtnGoHome = rootView.findViewById(R.id.afc_textview_home);
mViewGoBack = (ImageView) rootView
.findViewById(R.id.afc_button_go_back);
mViewGoForward = (ImageView) rootView
.findViewById(R.id.afc_button_go_forward);
mViewAddressBar = (ViewGroup) rootView
.findViewById(R.id.afc_view_locations);
mViewLocationsContainer = (horizontalscrollview) rootView
.findViewById(R.id.afc_view_locations_container);
mTextFullDirName = (TextView) rootView
.findViewById(R.id.afc_textview_full_dir_name);
mViewGroupFiles = rootView.findViewById(R.id.afc_viewgroup_files);
mViewFilesContainer = (ViewGroup) rootView
.findViewById(R.id.afc_view_files_container);
mFooterView = (TextView) rootView
.findViewById(R.id.afc_view_files_footer_view);
mViewLoading = rootView.findViewById(R.id.afc_view_loading);
mTextSaveas = (EditText) rootView
.findViewById(R.id.afc_textview_saveas_filename);
mBtnOk = (Button) rootView.findViewById(R.id.afc_button_ok);
/*
* INIT CONTROLS
*/
return rootView;
}
项目:SuspendNotification
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(this);
editor = sharedPreferences.edit();
title = (EditText)findViewById(R.id.title);
content = (EditText)findViewById(R.id.content);
manager = notificationmanagerCompat.from(this);
setIsChecked();
setIsCheckedBoot();
setCheckedHideIcon();
setCheckedHideNew();
clipBoardMonitor();
Log.d(TAG,"onCreate: ");
boolean back = getIntent().getBooleanExtra("moveTaskToBack",false);
if(back){
moveTaskToBack(true);
//Log.i(TAG,"onCreate: veTaskToBack");
}
//当前活动被销毁后再重建时保证调用onNewIntent()方法
onNewIntent(getIntent());
if (!isCheckedHideNew){
notifAddNew();
}
}
private void initViews(){
txtFemale = (TextView) findViewById(R.id.btn_female);
txtMale = (TextView) findViewById(R.id.btn_male);
txtDateOfBirth = (TextView) findViewById(R.id.txt_date_of_birth);
etName = (EditText) findViewById(R.id.chat_sdk_et_name);
etLocation = (EditText) findViewById(R.id.chat_sdk_et_location);
etStatus = (EditText) findViewById(R.id.chat_sdk_et_status);
imageCountryFlag = (ImageView) findViewById(R.id.chat_sdk_country_ic);
}
项目:Open-Weather-API-Wrapper
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Initialize the api
OpenWeatherApi.initialize(getString(R.string.your_open_weather_api_key),Unit.STANDARD);
cityTv = (TextView) findViewById(R.id.city_tv);
tempTv = (TextView) findViewById(R.id.temp_tv);
tempLowTv = (TextView) findViewById(R.id.temp_low_tv);
tempHighTv = (TextView) findViewById(R.id.temp_high_tv);
windSpeedTv = (TextView) findViewById(R.id.wind_speed_tv);
sunriseTv = (TextView) findViewById(R.id.sunrise_tv);
sunsetTv = (TextView) findViewById(R.id.sunset_tv);
final EditText cityEt = (EditText) findViewById(R.id.city_et);
findViewById(R.id.go_btn).setonClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String s = cityEt.getText().toString().trim();
if (!s.isEmpty())
OpenWeatherApi.getCurrentWeather(s,mCurrentWeatherListener);
OpenWeatherApi.getThreeHoursForecast("Landon,uk",new ForecastListener() {
@Override
public void onResponse(WeatherForecast weatherForecasts) {
Log.d("Three hour","Success");
}
@Override
public void onError(String message) {
Log.d("Three hour",message);
}
});
}
});
}