@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item_icon, parent, false); TextView textView = (TextView) rowView.findViewById(R.id.label); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); textView.setText(mValues[position]); // Set icons String s = mValues[position]; if (s.equals("CPU")) { imageView.setImageResource(R.drawable.ic_drawer_cpu); } else if (s.equals("System")) { imageView.setImageResource(R.drawable.ic_drawer_system); } else if (s.equals("Disks")) { imageView.setImageResource(R.drawable.ic_drawer_disks); } else if (s.equals("Processes")) { imageView.setImageResource(R.drawable.ic_drawer_processes); } else if (s.equals("GPU")) { imageView.setImageResource(R.drawable.ic_drawer_gpu); } else if (s.equals("Overview")) { imageView.setImageResource(R.drawable.ic_drawer_overview); } else if (s.equals("History")) { imageView.setImageResource(R.drawable.ic_drawer_history); } else if (s.equals("Notifications")) { imageView.setImageResource(R.drawable.ic_drawer_notifications); } imageView.setContentDescription(s + " icon"); return rowView; }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); textView = new TextView(this); textView.setText("Toca y arrastra (solo un dedo)"); textView.setOnTouchListener(this); setContentView(textView); }
/*Type :Function name:checkvalidate return type:void date:29-6-11 purpose:To get the image path from phone contact and set that image*/ public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View v; LayoutInflater li = getLayoutInflater(); v = li.inflate(R.layout.iconlist, null); TextView tv = (TextView) v.findViewById(R.id.icon_text); tv.setText( "" + results.get(position) + " ," + results2.get(position) + "\n " + results4.get(position)); System.out.println("name==" + results.get(position)); tv.setOnClickListener( new TextView.OnClickListener() { public void onClick(View v) { int pos = position; String id = results3.get(pos); tid = Integer.parseInt(id); System.out.println("Position... nameeeeeeee" + position + " iddd" + id); Intent i = new Intent(ViewTaskByDate.this, Taskdetails.class); Bundle bun = new Bundle(); bun.putInt("tid", tid); i.putExtras(bun); startActivity(i); } }); return v; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.type_row, null); } Type type = items.get(position); if (type != null) { ImageView iv = (ImageView) v.findViewById(R.id.icon); TextView tt = (TextView) v.findViewById(R.id.toptext); if (tt != null) { tt.setText(type.getTitle()); } if (iv != null) { int resId = R.drawable.type; if (type.getId() == OrdersDataSource.TYPE_INCOME) { resId = R.drawable.plus; } else if (type.getId() == OrdersDataSource.TYPE_OUTGO) { resId = R.drawable.minus; } iv.setImageResource(resId); } } return v; }
@Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) { mConnected = true; updateConnectionState(R.string.connected); invalidateOptionsMenu(); } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) { mConnected = false; updateConnectionState(R.string.disconnected); invalidateOptionsMenu(); } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) { BluetoothGattService gattService = mBluetoothLeService.getSoftSerialService(); characteristicTX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX); // characteristicRX = gattService.getCharacteristic(BluetoothLeService.UUID_HM_RX_TX); characteristicRX = characteristicTX; if ((gattService != null) && (characteristicTX != null)) { mBluetoothLeService.setCharacteristicNotification(characteristicTX, true); isSerial.setText("Serial ready"); updateReadyState(R.string.ready); } else { isSerial.setText("Serial can't be found"); } } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) { displayData(intent.getStringExtra(mBluetoothLeService.EXTRA_DATA)); } }
@Nonnull public PropertyView setValue(@Nullable CharSequence value) { final TextView valueView = getValueTextView(); valueView.setText(value); valueView.setVisibility(Strings.isEmpty(value) ? GONE : VISIBLE); return this; }
/** * Sets the indicator colors, when QuickScroll.TYPE_INDICATOR is selected as type. * * <p> * * @param background the background color of the square * @param tip the background color of the tip triangle * @param text the color of the text */ public void setIndicatorColor(final int background, final int tip, final int text) { if (mType == TYPE_INDICATOR || mType == TYPE_INDICATOR_WITH_HANDLE) { ((Pin) mScrollIndicator.findViewById(ID_PIN)).setColor(tip); mScrollIndicatorText.setTextColor(text); mScrollIndicatorText.setBackgroundColor(background); } }
// platform logos private LinearLayout getPlatformList() { LinearLayout llToolBar = new LinearLayout(getContext()); LayoutParams lpTb = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llToolBar.setLayoutParams(lpTb); TextView tvShareTo = new TextView(getContext()); int resId = getStringRes(activity, "ssdk_oks_share_to"); if (resId > 0) { tvShareTo.setText(resId); } tvShareTo.setTextColor(0xffcfcfcf); tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); int dp_9 = dipToPx(getContext(), 9); LayoutParams lpShareTo = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpShareTo.gravity = Gravity.CENTER_VERTICAL; lpShareTo.setMargins(dp_9, 0, 0, 0); tvShareTo.setLayoutParams(lpShareTo); llToolBar.addView(tvShareTo); HorizontalScrollView sv = new HorizontalScrollView(getContext()); sv.setHorizontalScrollBarEnabled(false); sv.setHorizontalFadingEdgeEnabled(false); LayoutParams lpSv = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpSv.setMargins(dp_9, dp_9, dp_9, dp_9); sv.setLayoutParams(lpSv); llToolBar.addView(sv); llPlat = new LinearLayout(getContext()); llPlat.setLayoutParams( new HorizontalScrollView.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); sv.addView(llPlat); return llToolBar; }
private void setState(State state) { this.state = state; switch (state) { case PULL_TO_REFRESH: spinner.setVisibility(View.INVISIBLE); image.setVisibility(View.VISIBLE); text.setText(pullToRefreshText); if (showLastUpdatedText && lastUpdated != -1) { lastUpdatedTextView.setVisibility(View.VISIBLE); lastUpdatedTextView.setText( String.format(lastUpdatedText, lastUpdatedDateFormat.format(new Date(lastUpdated)))); } break; case RELEASE_TO_REFRESH: spinner.setVisibility(View.INVISIBLE); image.setVisibility(View.VISIBLE); text.setText(releaseToRefreshText); break; case REFRESHING: setUiRefreshing(); lastUpdated = System.currentTimeMillis(); if (onRefreshListener == null) { setState(State.PULL_TO_REFRESH); } else { onRefreshListener.onRefresh(); } break; } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_loyalty); this.loyaltyCard = (LoyaltyCardVo) this.getIntent().getSerializableExtra("loyaltyCard"); mSlideHolder = (SlideHolder) findViewById(R.id.slideHolder); View toggleView = findViewById(R.id.menuButton); toggleView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mSlideHolder.toggle(); } }); SharedPreferences settings = getSharedPreferences("VostoPreferences", 0); if (!settings.getString("userToken", "").equals("") && settings.getString("userName", "user") != "user") { // User logged in: TextView nameOfUser = (TextView) findViewById(R.id.nameOfUser); nameOfUser.setText(settings.getString("userName", "user")); } else { // User not logged in: } GetLoyaltyCardByIdService service = new GetLoyaltyCardByIdService(this, this, this.loyaltyCard.getId()); service.execute(); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView = (ListView) mView.findViewById(R.id.lv); mListView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { PullRightLayout.collapseAll(); } } @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {} }); mStartScanView = (TextView) mView.findViewById(R.id.tv_start_scan); mStartScanView.setBackgroundColor(ThemeManager.with(getActivity()).getCurrentColor()); mStartScanView.setOnClickListener(this); mPullLayout = (PullLayout) mView.findViewById(R.id.pull_layout); mPullLayout.addOnPullListener(this); if (mListener != null) { mPullLayout.addOnPullListener(mListener); mListener = null; } mIvScan = (ImageView) mView.findViewById(R.id.iv_scan); IntentFilter filter = new IntentFilter(ScanService.ACTION_SCAN_FINISH); LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, filter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); earIcon = (ImageView) findViewById(R.id.earIcon); flatDisplay = (TextView) findViewById(R.id.flatText); sharpDisplay = (TextView) findViewById(R.id.sharpText); prevNote = (TextView) findViewById(R.id.nextLower); nextNote = (TextView) findViewById(R.id.nextHigher); noteDisplay = (TextView) findViewById(R.id.noteDisplay); noteDisplay.setKeepScreenOn(true); noteDisplay.setText(""); instruction = (TextView) findViewById(R.id.tunerInsruction); instruction.setText(""); offsetCentView = (CenterOffsetView) findViewById(R.id.centView); offsetCentView.setRange(25); offsetCentView.setQuantization(2.5f); offsetCentView.setMarkAt(kCentThreshold); int techVisibility = kShowTechInfo ? View.VISIBLE : View.INVISIBLE; frequencyDisplay = (TextView) findViewById(R.id.frequencyDisplay); frequencyDisplay.setVisibility(techVisibility); decibelView = (TextView) findViewById(R.id.decibelView); decibelView.setVisibility(techVisibility); addAccidentalListener(); }
private boolean PopupTouchEvent(final MotionEvent event) { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) // mScrollIndicatorText.setVisibility(View.VISIBLE); toggleVisibilityCompat(false); else mScrollIndicatorText.startAnimation(mFadeIn); mScrolling = true; scroll(event.getY()); return true; case MotionEvent.ACTION_MOVE: scroll(event.getY()); return true; case MotionEvent.ACTION_UP: if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE) mHandlebar.setSelected(false); if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { mScrolling = false; toggleVisibilityCompat(true); } else mScrollIndicatorText.startAnimation(mFadeOut); return true; default: break; } return false; }
private void parseGameSetupAndStart() { switch (mCurrentGameType) { case GAMETYPE_ALL_QUESTIONS: break; case GAMETYPE_CATEGORIES: break; case GAMETYPE_LEVELS: mCurrentGame = new ClassGameLevels( mCurrentGameType, 3, 10, 10, mRestartLivesEachLevel, mTriviaDb, mTimeToAnswerQuestion); break; default: break; } mCurrentGame.setGameListener(this); // TODO: change this to start from certain level mCurrentGame.setupNewGame(0); textViewLivesLeftValue.setText(mCurrentGame.getCurrentLivesAsString()); textViewGameScoreText.setText(mCurrentGame.getGameScoreAsString()); showStartLevel(); }
protected void applyTheme(int theme) { Resources res = getResources(); mRootView.setBackgroundColor( res.getColor(MODE_NIGHT == theme ? R.color.background_night : R.color.background)); if (!mHideTitle) { final RelativeLayout titleView = (RelativeLayout) findViewById(R.id.title_bar); final TextView titleText = (TextView) findViewById(R.id.title_text); final View divider = findViewById(R.id.split_h); final ImageView backBtn = (ImageView) findViewById(R.id.ic_arrow); final View leftView = findViewById(R.id.back_view); if (MODE_NIGHT == theme) { titleView.setBackgroundColor(0xFF1C1C1C); titleText.setTextColor(0xFF666666); divider.setBackgroundColor(0xFF303030); if (null != backBtn) { backBtn.setImageResource(R.drawable.ic_back_night); } if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg_night); } else { titleView.setBackgroundColor(res.getColor(R.color.action_bar_color)); titleText.setTextColor(res.getColor(R.color.white)); divider.setBackgroundColor(0xFFCACACA); if (null != backBtn) { backBtn.setImageResource(R.drawable.ic_back); } if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg); } } }
public void rollDice() { int rollResult; int[] rolls; switch (m_rollMode) { case SINGLE: m_rollResultTv.setText(Integer.toString(m_diceSet.singleRoll(getDieType()))); break; case XDY: rolls = m_diceSet.multiRollWithResults(getDieQuantity(), getDieType()); rollResult = sumIntArray(rolls); m_rollResultTv.setText(Integer.toString(rollResult)); refreshRollsListView(rolls); break; case CUMULATIVE: rolls = m_diceSet.multiRollWithResults(getDieQuantity(), getDieType()); rollResult = sumIntArray(rolls); m_rollSum += rollResult; if (m_rollSum > MAX_ROLL_SUM) m_rollSum = MAX_ROLL_SUM; m_rollSumTv.setText(getString(R.string.roller_sum_label) + " " + m_rollSum); m_rollResultTv.setText(Integer.toString(rollResult)); refreshRollsListView(rolls); break; default: throw new IllegalStateException("Invalid roll mode: " + m_rollMode); } }
// Use this method to read sms, when sms text is already know (already found // by another method) public void readMessages( String message, Calendar calendar, TextView tempr, TextView dateV, ToggleButton toggleButton) { // Making toggle button visible toggleButton.setVisibility(View.VISIBLE); // Taking required information from message String messageTemp = message.substring(message.indexOf("T=") + 2, message.indexOf("T=") + 6); tempr.setText(messageTemp); // Taking calendar object and getting date and time of incoming // message, the feeding information to view int smsDay = calendar.get(Calendar.DATE); int smsTime = calendar.get(Calendar.HOUR_OF_DAY); String smsReceived = smsDay + " - " + smsTime; dateV.setText(smsReceived); // If yes, check security status and change Toggle button information // Accordingly if (message.indexOf("Apsauga isjungta") > -1) { toggleButton.setChecked(false); } else { toggleButton.setChecked(true); } }
@Override public View getView(int i, View view, ViewGroup viewGroup) { TextView textView = new TextView(getApplicationContext()); textView.setText(itemList.get(i)); return textView; // To change body of implemented methods use File | Settings | File // Templates. }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view); setTitle("ListView"); final ListView listView = (ListView) findViewById(R.id.list_view); LayoutInflater layoutInflater = getLayoutInflater(); View header = layoutInflater.inflate(R.layout.list_item_header_footer, null); View footer = layoutInflater.inflate(R.layout.list_item_header_footer, null); TextView txtHeaderTitle = (TextView) header.findViewById(R.id.txt_title); TextView txtFooterTitle = (TextView) footer.findViewById(R.id.txt_title); txtHeaderTitle.setText("THE HEADER!"); txtFooterTitle.setText("THE FOOTER!"); listView.addHeaderView(header); listView.addFooterView(footer); final SampleAdapter adapter = new SampleAdapter(this, R.id.txt_line1); listView.setAdapter(adapter); final List<String> sampleData = SampleData.generateSampleData(); for (String data : sampleData) { adapter.add(data); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false); int idEstadistica = this.mPageNumber; // Titulo y descripcion de estadistica TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica); TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica); tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo()); descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion()); rootView.addView( new EstadisticaViewLayout(Utilidades.getAppContext()) .getView(RelacionEstadisticas.getRelacion().get(idEstadistica))); // } // catch (Exception e) // { // Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(), // Toast.LENGTH_LONG).show(); // Log.e("ERROR", e.getLocalizedMessage()); // } // Set the title view to show the page number. /*((TextView) rootView.findViewById(android.R.id.text1)).setText( getString(R.string.title_template_step, mPageNumber + 1));*/ return rootView; }
public void AddCursorData(Cursor outCursor) { sp_adapter.clear(); if (outCursor.getCount() == 0) { s_result.setText(" 검색 결과가 없습니다 ! "); return; } s_result.setText(""); int musicNumberCol = outCursor.getColumnIndex("music_num"); int titleCol = outCursor.getColumnIndex("m_title"); int artistCol = outCursor.getColumnIndex("m_artist"); int imageCol = outCursor.getColumnIndex("m_image"); int urlCol = outCursor.getColumnIndex("m_url"); int lyricsCol = outCursor.getColumnIndex("lyrics"); int scoreCol = outCursor.getColumnIndex("score"); Resources res = getResources(); while (outCursor.moveToNext()) { int music_num = outCursor.getInt(musicNumberCol); String m_title = outCursor.getString(titleCol); String m_artist = outCursor.getString(artistCol); byte[] m_image = outCursor.getBlob(imageCol); String m_url = outCursor.getString(urlCol); String lyrics = outCursor.getString(lyricsCol); int score = outCursor.getInt(scoreCol); sp_adapter.addItem(new IconTextItem(m_image, m_title, m_artist, m_url, lyrics, score)); } outCursor.close(); }
private void initView(String cont) { if (CommUtil.isBlank(cont)) { return; } String[] conts = cont.split(" *, *"); if (conts.length != 5) { Log.e(Constants.TAG, "指令长度不为10节,长度不对,指令内容:" + cont); return; } String[] time1 = formatTimeStr(conts[1].replaceAll(CmdType.CL.getType() + "=", "")); String[] time2 = formatTimeStr(conts[3]); startTimeTV.setText(time1[0]); endTimeTV.setText(time1[1]); startTimeTV1.setText(time2[0]); endTimeTV1.setText(time2[1]); int j = 2; checkTVOne1.setChecked(!"0".equals(conts[j].charAt(0) + "")); checkTVOne2.setChecked(!"0".equals(conts[j].charAt(1) + "")); checkTVOne3.setChecked(!"0".equals(conts[j].charAt(2) + "")); checkTVOne4.setChecked(!"0".equals(conts[j].charAt(3) + "")); checkTVOne5.setChecked(!"0".equals(conts[j].charAt(4) + "")); checkTVOne6.setChecked(!"0".equals(conts[j].charAt(5) + "")); checkTVOne7.setChecked(!"0".equals(conts[j].charAt(6) + "")); int i = 4; checkTV1.setChecked(!"0".equals(conts[i].charAt(0) + "")); checkTV2.setChecked(!"0".equals(conts[i].charAt(1) + "")); checkTV3.setChecked(!"0".equals(conts[i].charAt(2) + "")); checkTV4.setChecked(!"0".equals(conts[i].charAt(3) + "")); checkTV5.setChecked(!"0".equals(conts[i].charAt(4) + "")); checkTV6.setChecked(!"0".equals(conts[i].charAt(5) + "")); checkTV7.setChecked(!"0".equals(conts[i].charAt(6) + "")); }
public void RefreshTweetList(final Activity act, final View v, final TweetListType mode) { LinearLayout ll = (LinearLayout) v; ListView lv = (ListView) ll.findViewById(android.R.id.list); final List<Tweet> tmpTweets = new ArrayList<Tweet>(); final TweetListAdapter aa = new TweetListAdapter(act, R.layout.tweetlist_item, tmpTweets); getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS); lv.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) {} @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (visibleItemCount != 0) { final int GUESS_WANT_MORE = 1; if (firstVisibleItem + visibleItemCount + 1 + GUESS_WANT_MORE > totalItemCount) { getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS); } } } }); TextView tv = (TextView) ll.findViewById(android.R.id.empty); if (aa.getCount() > 0) { tv.setVisibility(View.GONE); } else { tv.setVisibility(View.VISIBLE); } lv.setAdapter(aa); }
private void initViewAndAction() { btNext = (Button) findViewById(R.id.book_service_btNext); btPrevious = (Button) findViewById(R.id.book_service_btPrevious); btback = (Button) findViewById(R.id.book_service_btBack); btSend = (Button) findViewById(R.id.book_service_btSend); btRightRegoDate = (Button) findViewById(R.id.book_service_btRegoDateRight); btRightOtherWork = (Button) findViewById(R.id.book_service_btOtherWork); btAddNewVehicle = (Button) findViewById(R.id.book_service_btAddNewVehicle); tvDistance = (TextView) findViewById(R.id.book_service_tvKilometer); tvBookDate = (TextView) findViewById(R.id.book_service_tvBookDate); etName = (EditText) findViewById(R.id.book_service_edtName); edtRego = (EditText) findViewById(R.id.book_service_edtRego); edtMake = (EditText) findViewById(R.id.book_service_edtMake); edtModel = (EditText) findViewById(R.id.book_service_edtModel); edtPhone = (EditText) findViewById(R.id.book_service_edtYourPhone); edtAddress = (EditText) findViewById(R.id.book_service_edtYourAddress); edtRegoDate = (EditText) findViewById(R.id.book_service_edtRegoDate); tvOtherWork = (TextView) findViewById(R.id.book_service_tvOtherWork); tvDistance.setOnClickListener(this); tvBookDate.setOnClickListener(this); btback.setOnClickListener(this); btSend.setOnClickListener(this); btPrevious.setOnClickListener(this); btNext.setOnClickListener(this); btRightRegoDate.setOnClickListener(this); btRightOtherWork.setOnClickListener(this); btAddNewVehicle.setOnClickListener(this); }
public void callAppForSentEmail() { String to[] = {"*****@*****.**"}; String subject = "ATA App: Servicing Booking"; String message = "Service Type: %s\n" + "Other Work: %s\n" + "Booking Date: %s\n" + "Name: %s\n" + "Rego: %s\n" + "Make: %s\n" + "Model: %s\n" + "Phone: %s\n" + "Address: %s\n" + "Rego Date: %s\n"; message = String.format( message, tvDistance.getText().toString(), tvOtherWork.getText().toString(), tvBookDate.getText().toString(), etName.getText().toString(), edtRego.getText().toString(), edtMake.getText().toString(), edtModel.getText().toString(), edtPhone.getText().toString(), edtAddress.getText().toString(), edtRegoDate.getText().toString()); Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_EMAIL, to); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); startActivity(Intent.createChooser(emailIntent, "email")); }
private void updateAlgorithmSpinner(int keyIndex) { int selection = 0; ArrayAdapter newAdapter = null; if (keyIndex < ZipSigner.SUPPORTED_KEY_MODES.length) { if (algorithmSpinnerAdapter != sha1WithRsaSpinnerAdapter) { newAdapter = sha1WithRsaSpinnerAdapter; selection = 0; TextView tv = (TextView) findViewById(R.id.SignatureAlgorithmTextView); tv.setVisibility(View.INVISIBLE); algorithmSpinner.setVisibility(View.INVISIBLE); } } else { if (algorithmSpinnerAdapter != allAlgorithmsSpinnerAdapter) { newAdapter = allAlgorithmsSpinnerAdapter; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); selection = prefs.getInt(PREFERENCE_ALG_INDEX, 0); TextView tv = (TextView) findViewById(R.id.SignatureAlgorithmTextView); tv.setVisibility(View.VISIBLE); algorithmSpinner.setVisibility(View.VISIBLE); } } if (newAdapter != null) { algorithmSpinnerAdapter = newAdapter; algorithmSpinner.setAdapter(algorithmSpinnerAdapter); algorithmSpinner.setSelection(selection); } }
/** 初始化Column栏目项 */ private void initTabColumn() { mRadioGroup_content.removeAllViews(); if (mUserChannelList != null) { int count = mUserChannelList.size(); mColumnHorizontalScrollView.setParam( getActivity(), mScreenWidth, mRadioGroup_content, mShadeleft, mShaderight, ll_more_columns, rl_column); for (int i = 0; i < count; i++) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.leftMargin = 5; params.rightMargin = 5; // TextView localTextView = (TextView) mInflater.inflate(R.layout.column_radio_item, // null); TextView columnTextView = new TextView(getActivity()); columnTextView.setTextAppearance(getActivity(), R.style.top_category_scroll_view_item_text); // // localTextView.setBackground(getResources().getDrawable(R.drawable.top_category_scroll_text_view_bg)); columnTextView.setBackgroundResource(R.drawable.radio_buttong_bg); columnTextView.setGravity(Gravity.CENTER); columnTextView.setPadding(5, 5, 5, 5); columnTextView.setId(i); columnTextView.setText(mUserChannelList.get(i).getName()); columnTextView.setTextColor( getResources().getColorStateList(R.color.top_category_scroll_text_color_day)); if (columnSelectIndex == i) { columnTextView.setSelected(true); } columnTextView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < mRadioGroup_content.getChildCount(); i++) { View localView = mRadioGroup_content.getChildAt(i); if (localView != v) localView.setSelected(false); else { localView.setSelected(true); mViewPager.setCurrentItem(i); } } Toast.makeText( getActivity().getApplicationContext(), mUserChannelList.get(v.getId()).getName(), Toast.LENGTH_SHORT) .show(); } }); mRadioGroup_content.addView(columnTextView, i, params); } } }
private void setTextAppearance(int value) { if (null != mHeaderText) { mHeaderText.setTextAppearance(getContext(), value); } if (null != mSubHeaderText) { mSubHeaderText.setTextAppearance(getContext(), value); } }
/** * 展示一个粉色的Toast * * @param message */ public void toast(String message) { View toastRoot = LayoutInflater.from(context).inflate(R.layout.toast, null); Toast toast = new Toast(context); toast.setView(toastRoot); TextView tv = (TextView) toastRoot.findViewById(R.id.pink_toast_notice); tv.setText(message); toast.show(); }
private void setTextColor(ColorStateList color) { if (null != mHeaderText) { mHeaderText.setTextColor(color); } if (null != mSubHeaderText) { mSubHeaderText.setTextColor(color); } }