List of usage examples for android.text InputType TYPE_NULL
int TYPE_NULL
To view the source code for android.text InputType TYPE_NULL.
Click Source Link
From source file:org.mifos.androidclient.templates.OperationFormActivity.java
public CheckBox addCheckBoxFormField(String fieldLabel) { LinearLayout field = (LinearLayout) getLayoutInflater().inflate(R.layout.check_box_form_field, null); CheckBox input = (CheckBox) field.findViewById(R.id.checkBox_label); input.setText(fieldLabel);/*www . j a va 2s .com*/ input.setInputType(InputType.TYPE_NULL); mFormFields.addView(field, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); return input; }
From source file:me.tipi.kiosk.ui.fragments.IdentityFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_identity, container, false); ButterKnife.bind(this, rootView); typeface.setTypeface(container, getResources().getString(R.string.font_regular)); fillDetailsFromPassport();/*from w w w . ja v a2 s. com*/ if (results == null) { titleTextView.setText(R.string.enter_details); passportLabel.setText(R.string.license_no); } else { titleTextView.setText(R.string.your_details); passportLabel.setText(R.string.passport_no); yourCountryLabel.setText(R.string.your_country); homeTownACView.addTextChangedListener(new MyTextWatcher()); } birthDayPickerView.setInputType(InputType.TYPE_NULL); birthDayPickerView.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { if (birthDayPickerView.getText().toString().equals("")) { showDobDialog(); } } } }); birthDayPickerView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showDobDialog(); } }); homeTownACView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { hasSelectedHometown = true; homeTownLayout.setError(null); } }); setCountry(); return rootView; }
From source file:com.openarc.nirmal.mytrack.AttendanceActivity.java
private void initialize() { attendanceView = new AttendanceView(); attendanceView.etFrom = (EditText) findViewById(R.id.etFrom); attendanceView.etFrom.setInputType(InputType.TYPE_NULL); attendanceView.etTo = (EditText) findViewById(R.id.etTo); attendanceView.etTo.setInputType(InputType.TYPE_NULL); attendanceView.tvNoPay = (TextView) findViewById(R.id.tvNoPay); attendanceView.tvMissingIn = (TextView) findViewById(R.id.tvMissingIn); attendanceView.tvMissingOut = (TextView) findViewById(R.id.tvMissingOut); attendanceView.bView = (Button) findViewById(R.id.bView); attendanceView.rvAttendance = (RecyclerView) findViewById(R.id.rvAttendance); attendanceView.rlLoadingLayout = (RelativeLayout) findViewById(R.id.rlLoadingLayout); attendanceView.etFrom.setOnTouchListener(fromOnTouch); attendanceView.etTo.setOnTouchListener(toOnTouch); attendanceView.bView.setOnClickListener(viewButtonOnClick); }
From source file:com.michael.feng.textlater.NewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Remove title bar // requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_new); getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setDisplayShowHomeEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setCustomView(R.layout.abs_layout_new); backButton = (ImageView) findViewById(R.id.back); backButton.setOnClickListener(new OnClickListener() { @Override//from w w w . j a va 2s. c om public void onClick(View arg0) { finish(); } }); backButton.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: // touch down code backButton.setBackgroundColor(Color.rgb(104, 156, 210)); break; case MotionEvent.ACTION_MOVE: // touch move code break; case MotionEvent.ACTION_UP: // touch up code backButton.setBackgroundColor(Color.TRANSPARENT); break; } return false; } }); // Init Add Contact Button and EditText textContact = (EditText) findViewById(R.id.textContact); textContact.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { validateMessage(); } }); textContact.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { textContact.setSelection(textContact.getText().length()); } }); addContactButton = (Button) findViewById(R.id.addContactButton); addContactButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Log.d("add button click", "hep"); Intent in = new Intent(getApplicationContext(), ContactsActivity.class); contactNames = textContact.getText().toString(); if (null != contactNames && !"".equals(contactNames)) { in.putExtra("contactNames", contactNames); in.putExtra("contactNumbers", contactNumbers); Log.d("addbutton contactNames", contactNames); Log.d("addbutton contactNumbers", contactNumbers); } int requestCode = 0; startActivityForResult(in, requestCode); } }); // Init TextDate EditText textDate = (EditText) findViewById(R.id.textDate); textDate.setInputType(InputType.TYPE_NULL); textDate.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { showDatePickerDialog(view); } } }); textDate.setOnClickListener(this); // Init TextDate Button setDateButton = (Button) findViewById(R.id.setDateButton); setDateButton.setOnClickListener(this); // Init TextTime EditText textTime = (EditText) findViewById(R.id.textTime); textTime.setInputType(InputType.TYPE_NULL); textTime.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { showTimePickerDialog(view); } } }); textTime.setOnClickListener(this); // Init TextTime Button setTimeButton = (Button) findViewById(R.id.setTimeButton); setTimeButton.setOnClickListener(this); // Init Active Button and Content EditText textContent = (EditText) findViewById(R.id.textContent); textContent.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable arg0) { validateMessage(); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO } }); sendButton = (Button) findViewById(R.id.sendButton); sendButton.setOnClickListener(this); }
From source file:org.alfresco.mobile.android.application.security.PassCodeDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getDialog() != null) { setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Dialog_MinWidth); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); // getDialog().setTitle(R.string.passcode_preference); }//from ww w.ja va2 s .c o m final View v = inflater.inflate(R.layout.app_passcode, (ViewGroup) this.getView()); title = (TextView) v.findViewById(R.id.passcode_hint); if (getArguments().containsKey(ARGUMENT_INFO)) { ((TextView) v.findViewById(R.id.passcode_admin)).setText(R.string.passcode_admin_title); v.findViewById(R.id.passcode_admin).setVisibility(View.VISIBLE); } else { } errorMessage = (TextView) v.findViewById(R.id.passcode_error); passwordEditText = (EditText) v.findViewById(R.id.passcode); passwordEditText.setInputType(InputType.TYPE_NULL); focusValue = passwordEditText; ImageView backButton = (ImageView) v.findViewById(R.id.delete_passcode); backButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { clearAll(); } }); int[] ids = new int[] { R.id.keyboard_0, R.id.keyboard_1, R.id.keyboard_2, R.id.keyboard_3, R.id.keyboard_4, R.id.keyboard_5, R.id.keyboard_6, R.id.keyboard_7, R.id.keyboard_8, R.id.keyboard_9, R.id.keyboard_back }; Button key = null; for (int i = 0; i < ids.length; i++) { key = (Button) v.findViewById(ids[i]); key.setOnClickListener(keyboardClickListener); } return v; }
From source file:org.mifos.androidclient.templates.OperationFormActivity.java
public EditText addDateFormField(String fieldLabel) { LinearLayout field = (LinearLayout) getLayoutInflater().inflate(R.layout.date_form_field, null); TextView label = (TextView) field.findViewById(R.id.dateFormField_label); label.setText(fieldLabel);//from w ww . j a va 2 s . c o m EditText input = (EditText) field.findViewById(R.id.dateFormField_input); input.setInputType(InputType.TYPE_NULL); input.setOnFocusChangeListener(this); mFormFields.addView(field, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); return input; }
From source file:info.hl.mediam.MyProfileActivity.java
private void Initialization() { if (MediamApp.hasNetworkConnection()) { getLoginUserData();/* w w w . ja v a2s . c o m*/ } mSvProfile = (ScrollView) findViewById(R.id.svProfile); mRlEditControls = (RelativeLayout) findViewById(R.id.rlEditControls); mRlBirthday = (RelativeLayout) findViewById(R.id.rlBirthday); mRlAbout = (RelativeLayout) findViewById(R.id.rlAbout); mRlGender = (RelativeLayout) findViewById(R.id.rlGender); mRlEmail = (RelativeLayout) findViewById(R.id.rlEmail); mRlOnlineStatus = (RelativeLayout) findViewById(R.id.rlOnlineStatus); mIvProfileImage = (ImageView) findViewById(R.id.ivProfileImage); mPbLoading = (ProgressBar) findViewById(R.id.pbLoadingForImage); mBtnEdit = (Button) findViewById(R.id.btnEdit); mBtnEdit.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); mBtnSave = (Button) findViewById(R.id.btnSave); mBtnSave.setTypeface(MediamApp.getTfMyriadProBold(), Typeface.BOLD); mTvUserName = (TextView) findViewById(R.id.tvUserName); mEtUserName = (EditText) findViewById(R.id.etUserName); mEtUserName.setTypeface(MediamApp.getTfMyriadPro()); mEtUserEmail = (EditText) findViewById(R.id.etUserEmail); mEtUserEmail.setTypeface(MediamApp.getTfMyriadPro()); mEtUserEmail.setInputType(InputType.TYPE_NULL); mSpinnerGender = (Spinner) findViewById(R.id.spinnerGender); final ArrayAdapter<String> genderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.gender)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.light_gray_subtext)); ((TextView) v).setText(getResources().getString(R.string.tap_to_add_gender)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_neutral)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } }; mSpinnerGender.setAdapter(genderAdapter); mSpinnerGender.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewGender = Const.MALE; break; case 1: mNewGender = Const.FEMALE; break; case 2: mNewGender = null; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mSpinnerStatus = (Spinner) findViewById(R.id.spinnerStatus); final ArrayAdapter<String> onlineStatusAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.online_status)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(MediamApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } }; mSpinnerStatus.setAdapter(onlineStatusAdapter); mSpinnerStatus.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewOnlineStatus = Const.ONLINE; break; case 1: mNewOnlineStatus = Const.AWAY; break; case 2: mNewOnlineStatus = Const.BUSY; break; case 3: mNewOnlineStatus = Const.OFFLINE; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mEtUserPassword = (EditText) findViewById(R.id.etUserPassword); mEtUserPassword.setTypeface(MediamApp.getTfMyriadPro()); mEtUserAbout = (EditText) findViewById(R.id.etUserAbout); mEtUserAbout.setTypeface(MediamApp.getTfMyriadPro()); mEtUserBirthday = (EditText) findViewById(R.id.etUserBirthday); mEtUserBirthday.setTypeface(MediamApp.getTfMyriadPro()); setProfileMode(ProfileMode.CANCEL); }
From source file:com.cloverstudio.spika.MyProfileActivity.java
private void Initialization() { if (SpikaApp.hasNetworkConnection()) { getLoginUserData();//w ww . j av a 2 s . co m } mSvProfile = (ScrollView) findViewById(R.id.svProfile); mRlEditControls = (RelativeLayout) findViewById(R.id.rlEditControls); mRlBirthday = (RelativeLayout) findViewById(R.id.rlBirthday); mRlAbout = (RelativeLayout) findViewById(R.id.rlAbout); mRlGender = (RelativeLayout) findViewById(R.id.rlGender); mRlEmail = (RelativeLayout) findViewById(R.id.rlEmail); mRlOnlineStatus = (RelativeLayout) findViewById(R.id.rlOnlineStatus); mIvProfileImage = (ImageView) findViewById(R.id.ivProfileImage); mPbLoading = (ProgressBar) findViewById(R.id.pbLoadingForImage); mBtnEdit = (Button) findViewById(R.id.btnEdit); mBtnEdit.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mBtnSave = (Button) findViewById(R.id.btnSave); mBtnSave.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mTvUserName = (TextView) findViewById(R.id.tvUserName); mEtUserName = (EditText) findViewById(R.id.etUserName); mEtUserName.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserEmail = (EditText) findViewById(R.id.etUserEmail); mEtUserEmail.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserEmail.setInputType(InputType.TYPE_NULL); mSpinnerGender = (Spinner) findViewById(R.id.spinnerGender); final ArrayAdapter<String> genderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.gender)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.light_gray_subtext)); ((TextView) v).setText(getResources().getString(R.string.tap_to_add_gender)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); if (position == 2) { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_neutral)); } else { ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); } return v; } }; mSpinnerGender.setAdapter(genderAdapter); mSpinnerGender.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewGender = Const.MALE; break; case 1: mNewGender = Const.FEMALE; break; case 2: mNewGender = null; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mSpinnerStatus = (Spinner) findViewById(R.id.spinnerStatus); final ArrayAdapter<String> onlineStatusAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.online_status)) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); ((TextView) v).setTextSize(16); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); ((TextView) v).setTextSize(20); ((TextView) v).setTypeface(SpikaApp.getTfMyriadPro()); ((TextView) v).setPadding(15, 15, 15, 15); Drawable statusIcon = null; switch (position) { case 0: statusIcon = getContext().getResources().getDrawable(R.drawable.user_online_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 1: statusIcon = getContext().getResources().getDrawable(R.drawable.user_away_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 2: statusIcon = getContext().getResources().getDrawable(R.drawable.user_busy_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; case 3: statusIcon = getContext().getResources().getDrawable(R.drawable.user_offline_icon); ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; default: ((TextView) v).setTextColor(getResources().getColor(R.color.hookup_positive)); break; } ((TextView) v).setCompoundDrawablePadding(10); ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(statusIcon, null, null, null); return v; } }; mSpinnerStatus.setAdapter(onlineStatusAdapter); mSpinnerStatus.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { switch (arg2) { case 0: mNewOnlineStatus = Const.ONLINE; break; case 1: mNewOnlineStatus = Const.AWAY; break; case 2: mNewOnlineStatus = Const.BUSY; break; case 3: mNewOnlineStatus = Const.OFFLINE; break; default: break; } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mEtUserPassword = (EditText) findViewById(R.id.etUserPassword); mEtUserPassword.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserAbout = (EditText) findViewById(R.id.etUserAbout); mEtUserAbout.setTypeface(SpikaApp.getTfMyriadPro()); mEtUserBirthday = (EditText) findViewById(R.id.etUserBirthday); mEtUserBirthday.setTypeface(SpikaApp.getTfMyriadPro()); setProfileMode(ProfileMode.CANCEL); }
From source file:com.cssweb.android.trade.stock.StockTrading.java
@Override public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); sc = new ServiceControl(this);//?? ///*from w ww .ja v a 2s .c o m*/ HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD"); mHandlerThread.start(); priceHandler = new PriceDataHandler(mHandlerThread.getLooper()); setContentView(com.cssweb.android.main.R.layout.zr_trade_stock_trade); Bundle bundle = getIntent().getExtras(); type = bundle.getInt("type"); bsname = bundle.getString("bsname"); String stockCode = bundle.getString("stkcode"); initTitle(R.drawable.njzq_title_left_back, 0, bsname); LinearLayout localLinearLayout = (LinearLayout) findViewById(R.id.zrtradelayout); localLinearLayout.setOnFocusChangeListener(setOnEditFocusListener); this.m_vklayout = localLinearLayout; View localView1 = this.m_vklayout; localView1.setOnFocusChangeListener(setOnEditFocusListener); View localView2 = this.m_vklayout; localView2.setOnClickListener(setOnEditClickListener); viewFlipper = (ViewFlipper) this.findViewById(R.id.ViewFlipper01); preView = (ImageView) findViewById(R.id.previous_screen); leftIn = AnimationUtils.loadAnimation(this, R.anim.push_left_in_layout); leftOut = AnimationUtils.loadAnimation(this, R.anim.push_left_out_layout); rightIn = AnimationUtils.loadAnimation(this, R.anim.push_right_in_layout); rightOut = AnimationUtils.loadAnimation(this, R.anim.push_right_out_layout); priceView = (PriceMini) findViewById(R.id.zrviewprice); trendView = (TrendView) findViewById(R.id.zrviewtrend); trendView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }); klineView = (KlineMini) findViewById(R.id.zrviewkline); klineView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }); financeView = (FinanceMini) findViewById(R.id.zrviewfinance); stockHolder = (Spinner) findViewById(R.id.zrtxtaccount); queryMethod = (Spinner) findViewById(R.id.zrtxtbsflag); // availableNum = (SeekBar) findViewById(R.id.zrcanbs); // lblMaxNumber = (TextView)findViewById(R.id.txtMaxNumber); stkcode = (EditText) findViewById(R.id.zredtstockcode); stkname = (TextView) findViewById(R.id.zrtxtstockname); price = (EditText) findViewById(R.id.zredtprice); number = (EditText) findViewById(R.id.zredtcount); lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit); btn0 = (ShadowButton) findViewById(R.id.zr_surebutton); btn0.setOnClickListener(myShowProgreeBar); layoutprice0 = (LinearLayout) findViewById(R.id.LinearLayout03); layoutprice = (LinearLayout) findViewById(R.id.LinearLayout11); //layoutAvaiNumber = (LinearLayout)findViewById(R.id.LinearLayout04); //layoutAvaiAsset = (LinearLayout)findViewById(R.id.LinearLayout06); lblAvaiAsset = (TextView) findViewById(R.id.lblAvaiAsset); AvaiAsset = (TextView) findViewById(R.id.AvaiAsset); lblPrice = (TextView) findViewById(R.id.lblPrice); lblPrice1 = (TextView) findViewById(R.id.lblPrice1); lblNumber = (TextView) findViewById(R.id.lblNumber); avaiAsset = (TextView) findViewById(R.id.AvaiAsset); lblNumberUnit = (TextView) findViewById(R.id.lblNumberUnit); setDynamic(); adjustDownPrice = (ImageView) findViewById(R.id.AdjustDownPrice); adjustDownPrice.setTag(0); adjustDownPrice.setOnClickListener(adjustIconListener); adjustUpPrice = (ImageView) findViewById(R.id.AdjustUpPrice); adjustUpPrice.setTag(1); adjustUpPrice.setOnClickListener(adjustIconListener); adjustDownNumber = (ImageView) findViewById(R.id.AdjustDownNumber); adjustDownNumber.setTag(2); adjustDownNumber.setOnClickListener(adjustIconListener); adjustUpNumber = (ImageView) findViewById(R.id.AdjustUpNumber); adjustUpNumber.setTag(3); adjustUpNumber.setOnClickListener(adjustIconListener); stkcode.setText(stockCode); if (stkcode.getText().length() == 6) { showProgress(); } stkcode.setInputType(InputType.TYPE_NULL); stkcode.setFocusable(true); stkcode.setTag("STOCK"); stkcode.setOnClickListener(setOnEditClickListener); stkcode.setOnFocusChangeListener(setOnEditFocusListener); price.setInputType(InputType.TYPE_NULL); price.setFocusable(true); price.setTag("NUMDOT"); price.setOnClickListener(setOnEditClickListener); price.setOnFocusChangeListener(setOnEditFocusListener); number.setInputType(InputType.TYPE_NULL); number.setFocusable(true); number.setTag(""); number.setOnClickListener(setOnEditClickListener); number.setOnFocusChangeListener(setOnEditFocusListener); stkcode.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable arg0) { //queryStock(queryCode.getText()); OnTextChanged(arg0); } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } }); holder = TradeUser.getInstance().getHolder(); stockHolderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, (String[]) holder.toArray(new String[holder.size()])); stockHolderAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); stockHolder.setAdapter(stockHolderAdapter); String[] arrayOfString = getResources().getStringArray(R.array.other_market_bs_methods); for (int i = 0; i < arrayOfString.length; i++) { Log.e("arrayOfString", arrayOfString[i]); } queryMethodAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, arrayOfString); queryMethodAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); queryMethod.setAdapter(queryMethodAdapter); queryMethod.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position != 0) { layoutprice0.setVisibility(View.GONE); layoutprice.setVisibility(View.VISIBLE); } else { layoutprice0.setVisibility(View.VISIBLE); layoutprice.setVisibility(View.GONE); } } public void onNothingSelected(AdapterView<?> arg0) { } }); int h = R.drawable.forminput; Resources localResources = getResources(); Drawable localDrawable = null; localDrawable = localResources.getDrawable(h); int spinnerheight = localDrawable.getIntrinsicHeight() - 4; // Log.e("<<<<<<<<<<<<<<<<<<<eeeeeeeeeeeeeeeeeeeeeeeeeee>>>>>>>>>>>>>>", String.valueOf(spinnerheight)); LinearLayout.LayoutParams linearParams1 = (LinearLayout.LayoutParams) stockHolder.getLayoutParams();//?stockHolder? linearParams1.height = spinnerheight;//?? stockHolder.setLayoutParams(linearParams1); LinearLayout.LayoutParams linearParams = (LinearLayout.LayoutParams) queryMethod.getLayoutParams();//?queryMethod? linearParams.height = spinnerheight;//?? queryMethod.setLayoutParams(linearParams); }
From source file:io.github.trulyfree.easyaspi.MainActivity.java
@Override public boolean setup() { downloadHandler = new DownloadHandler(this); fileHandler = new FileHandler(this); moduleHandler = new ModuleHandler(this); executorService = Executors.newCachedThreadPool(); setContentView(R.layout.activity_main); BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override/*from ww w . j av a2 s . c o m*/ public boolean onNavigationItemSelected(@NonNull MenuItem item) { ViewSwitcher viewGroup = (ViewSwitcher) findViewById(R.id.content); int id = item.getItemId(); if ((id == R.id.navigation_home || id == R.id.navigation_modules) && id != currentID) { currentID = item.getItemId(); viewGroup.showNext(); return true; } return false; } }); ViewSwitcher viewSwitcher = (ViewSwitcher) findViewById(R.id.content); Animation in = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); Animation out = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right); viewSwitcher.setInAnimation(in); viewSwitcher.setOutAnimation(out); resetConfigReturned(); Button getNewModule = (Button) findViewById(R.id.new_module_config_confirm); getNewModule.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText editText = (EditText) findViewById(R.id.new_module_config_configurl); final String url = editText.getText().toString(); Toast.makeText(MainActivity.this, "Requested config from: " + url, Toast.LENGTH_SHORT).show(); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { ModuleConfig config; try { config = moduleHandler.getModuleConfig(url); } catch (MalformedURLException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Invalid URL. :(", Toast.LENGTH_LONG).show(); } }); return false; } catch (IOException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Failed to get module config. :(", Toast.LENGTH_LONG).show(); } }); return false; } catch (JsonParseException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(MainActivity.this, "Config loaded was invalid. :(", Toast.LENGTH_LONG).show(); } }); return false; } final ModuleConfig finalConfig = config; final ImageView configResponseBlock = (ImageView) findViewById(R.id.block_module_returned); final int colorFrom = ContextCompat.getColor(MainActivity.this, R.color.colorFillingTint); final int colorTo = ContextCompat.getColor(MainActivity.this, R.color.colorClear); final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(ANIMATION_DURATION); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { configResponseBlock.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { LinearLayout layout = (LinearLayout) findViewById(R.id.module_returned_config); EditText moduleName = (EditText) findViewById(R.id.module_returned_configname); EditText moduleVersion = (EditText) findViewById( R.id.module_returned_configversion); EditText moduleConfigUrl = (EditText) findViewById(R.id.module_returned_configurl); EditText moduleJarUrl = (EditText) findViewById(R.id.module_returned_jarurl); LinearLayout moduleDependencies = (LinearLayout) findViewById( R.id.module_returned_dependencies); moduleDependencies.removeAllViewsInLayout(); try { configResponseBlock.setVisibility(View.GONE); moduleName.setText(finalConfig.getName()); moduleVersion.setText(finalConfig.getVersion()); moduleConfigUrl.setText(finalConfig.getConfUrl()); moduleJarUrl.setText(finalConfig.getJarUrl()); Config[] dependencies = finalConfig.getDependencies(); for (Config dependency : dependencies) { LinearLayout dependencyLayout = new LinearLayout(MainActivity.this); dependencyLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); dependencyLayout.setOrientation(LinearLayout.HORIZONTAL); EditText name = new EditText(MainActivity.this); EditText jarUrl = new EditText(MainActivity.this); EditText[] loopThrough = { name, jarUrl }; LayoutParams params = new LayoutParams(0, LayoutParams.WRAP_CONTENT, 1.0f); for (EditText item : loopThrough) { item.setLayoutParams(params); item.setClickable(false); item.setInputType(InputType.TYPE_NULL); item.setCursorVisible(false); item.setFocusable(false); item.setFocusableInTouchMode(false); } name.setText(dependency.getName()); jarUrl.setText(dependency.getJarUrl()); dependencyLayout.addView(name); dependencyLayout.addView(jarUrl); moduleDependencies.addView(dependencyLayout); } layout.setClickable(true); Button validate = (Button) findViewById(R.id.module_returned_validate); Button cancel = (Button) findViewById(R.id.module_returned_cancel); validate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Requesting jars...", Toast.LENGTH_SHORT).show(); executorService.submit(new Callable<Boolean>() { @Override public Boolean call() { try { boolean success = true, refreshAllModification = true; Button refreshAll = null, getNewModule = (Button) findViewById( R.id.new_module_config_confirm); try { refreshAll = (Button) findViewById(R.id.refresh_all); refreshAll.setClickable(false); } catch (Throwable e) { refreshAllModification = false; } getNewModule.setClickable(false); final TextView stager = (TextView) findViewById( R.id.new_module_config_downloadstage); final ProgressBar progressBar = (ProgressBar) findViewById( R.id.new_module_config_downloadprogress); try { runOnUiThread(new Runnable() { @Override public void run() { resetConfigReturned(); } }); moduleHandler.getNewModule( makeModuleCallback(stager, progressBar), finalConfig, null, true); } catch (IOException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { stager.setText(""); progressBar.setProgress(0); } }); success = false; } getNewModule.setClickable(true); if (refreshAllModification) { refreshAll.setClickable(true); } return success; } catch (Throwable throwable) { throwable.printStackTrace(); return false; } } }); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this, "Cancelling request...", Toast.LENGTH_SHORT).show(); resetConfigReturned(); } }); } catch (Exception e) { e.printStackTrace(); Toast.makeText(MainActivity.this, "Module config invalid. :(", Toast.LENGTH_LONG).show(); layout.setClickable(false); final int colorFrom = ContextCompat.getColor(MainActivity.this, R.color.colorClear); final int colorTo = ContextCompat.getColor(MainActivity.this, R.color.colorFillingTint); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); colorAnimation.setDuration(ANIMATION_DURATION); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { configResponseBlock .setBackgroundColor((Integer) animator.getAnimatedValue()); } }); } } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); runOnUiThread(new Runnable() { @Override public void run() { colorAnimation.start(); } }); return true; } }); } }); moduleHandler.setup(); refreshFilling(); return true; }