public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { final View rootview = inflater.inflate(R.layout.function_layout, container, false); peop.clear(); spinner1 = (Spinner) rootview.findViewById(R.id.spinner); adapter = new ArrayAdapter<>(rootview.getContext(), android.R.layout.simple_list_item_1, func); adapter1 = new ArrayAdapter<>(rootview.getContext(), android.R.layout.simple_list_item_1, peop); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(adapter); spinner1.setOnItemSelectedListener(new FunctionSelector()); ListView listView = (ListView) rootview.findViewById(R.id.listView); AdapterView.OnItemClickListener mMessageClickedHandler = new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { Intent intent = new Intent(parent.getContext(), Profile.class); Person person = TabsFragment.changeListfunc.get(position); intent.putExtra("snails", person); intent.putExtra("json", TabsFragment.people); startActivity(intent); } }; adapter1.notifyDataSetChanged(); listView.setOnItemClickListener(mMessageClickedHandler); listView.setAdapter(adapter1); adapter1.notifyDataSetChanged(); return rootview; }
public void updateRow(View v, int i) { RelativeLayout rl = (RelativeLayout) v.getParent(); TextView tvQuantity = (TextView) rl.findViewById(R.id.salesitemrowquantity); int q = (Integer.valueOf(tvQuantity.getText().toString())) + i; tvQuantity.setText("" + q); TextView tvPrice = (TextView) rl.findViewById(R.id.salesitemrowprice); BigDecimal p = new BigDecimal(tvPrice.getText().toString()); TextView tvTotal = (TextView) rl.findViewById(R.id.salesitemrowtotalcost); tvTotal.setText(p.multiply(new BigDecimal(q)).setScale(2).toString()); UpdateSalesItemLocator ucl = (UpdateSalesItemLocator) tvQuantity.getTag(); ArrayList<SalesItemsSold> list = FundraiserCounterActivity.readGsFilex(v.getContext()); SalesItemsSold gscs = list.get(ucl.personRow); SalesItem row = gscs.getItemsSoldList().get(ucl.getSalesItemRow()); row.setQuantity(q); FundraiserCounterActivity.saveGsFilex(v.getContext(), list); LinearLayout ll = (LinearLayout) v.getParent().getParent(); RelativeLayout rlTotalRow = (RelativeLayout) ll.findViewById(R.id.rlsalesitemtotalrow); TextView tvTotalQuantity = (TextView) rlTotalRow.findViewById(R.id.salesitemrowquantity); TextView tvTotalTotal = (TextView) rlTotalRow.findViewById(R.id.salesitemrowtotalcost); tvTotalQuantity.setText("" + (Integer.parseInt(tvTotalQuantity.getText().toString()) + i)); BigDecimal bd = new BigDecimal(tvTotalTotal.getText().toString()); if (i == 1) bd = bd.add(row.getCost()); if (i == -1) bd = bd.subtract(row.getCost()); tvTotalTotal.setText(bd.toString()); }
/** * apply compound property in textView position 0:left, 1:top, 2:right, 3:bottom - REF : drawable * to load as compoundDrawable - BASE64 : decode as base64 and set as CompoundDrawable */ public static void applyCompoundDrawable(View view, DynamicProperty property, int position) { if (view instanceof TextView) { TextView textView = (TextView) view; Drawable[] d = textView.getCompoundDrawables(); switch (property.type) { case REF: { try { d[position] = view.getContext() .getResources() .getDrawable(getDrawableId(view.getContext(), property.getValueString())); } catch (Exception e) { } } break; case BASE64: { d[position] = property.getValueBitmapDrawable(); } break; case DRAWABLE: { d[position] = property.getValueGradientDrawable(); } break; } textView.setCompoundDrawablesWithIntrinsicBounds(d[0], d[1], d[2], d[3]); } }
public void Update(View rootView) { final Typeface custom_font_regular = Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Regular.otf"); final Typeface custom_font_bold = Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Bold.otf"); final Typeface custom_font_italic = Typeface.createFromAsset(rootView.getContext().getAssets(), "fonts/Quicksand-Italic.otf"); TextView vText = ((TextView) rootView.findViewById(R.id.sprintDetTitle)); ((TextView) rootView.findViewById(R.id.sprintDetTitle)).setText(sprint.id); ((TextView) rootView.findViewById(R.id.sprintDetEstHours)) .setText("Estimated Hours : " + Float.toString(sprint.estHours)); ((TextView) rootView.findViewById(R.id.sprintDetEstWeeks)) .setText("Estimated Weeks : " + Float.toString(sprint.estWeeks)); ((TextView) rootView.findViewById(R.id.sprintDetCompletedHours)) .setText("Completed Hours : " + Float.toString(sprint.completedHours)); ((TextView) rootView.findViewById(R.id.sprintDetCompletedWeeks)) .setText("Completed Weeks : " + Float.toString(sprint.completedWeeks)); ((TextView) rootView.findViewById(R.id.sprintDetTitle)).setTypeface(custom_font_regular); ((TextView) rootView.findViewById(R.id.sprintDetEstHours)).setTypeface(custom_font_regular); ((TextView) rootView.findViewById(R.id.sprintDetEstWeeks)).setTypeface(custom_font_regular); ((TextView) rootView.findViewById(R.id.sprintDetCompletedHours)) .setTypeface(custom_font_regular); ((TextView) rootView.findViewById(R.id.sprintDetCompletedWeeks)) .setTypeface(custom_font_regular); while (mProgressStatus < 100) { mProgressStatus = (int) ((sprint.completedHours / sprint.estHours) * 100f); break; } mProgress.setProgress(mProgressStatus); }
public void loadImage(View view, MusicDirectory.Entry entry, boolean large, boolean crossfade) { if (largeUnknownImage != null && ((BitmapDrawable) largeUnknownImage).getBitmap().isRecycled()) { createLargeUnknownImage(view.getContext()); } if (entry == null || entry.getCoverArt() == null) { setUnknownImage(view, large); return; } int size = large ? imageSizeLarge : imageSizeDefault; Bitmap bitmap = cache.get(getKey(entry.getCoverArt(), size)); if (bitmap != null && !bitmap.isRecycled()) { final Drawable drawable = Util.createDrawableFromBitmap(this.context, bitmap); setImage(view, drawable, large); if (large) { nowPlaying = bitmap; } return; } if (!large) { setUnknownImage(view, large); } queue.offer( new Task( view.getContext(), entry, size, imageSizeLarge, large, new ViewTaskHandler(view, crossfade))); }
@Override public void onClick(View v) { if (entry == null) { return; } switch (entry.getState()) { case ThemeEntry.STATE_UNINSTALLED: Uri uri = Uri.parse("market://search?q=pname:" + entry.getPackageName()); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { v.getContext().startActivity(intent); } catch (ActivityNotFoundException e) { uri = Uri.parse(entry.getFileUrl()); intent.setData(uri); v.getContext().startActivity(intent); } break; case ThemeEntry.STATE_INSTALLED: useTheme(v.getContext()); break; case ThemeEntry.STATE_USING: break; } }
@SuppressWarnings("deprecation") public void setCircleButtonStateListDrawable( View circleButton, int radius, int pressedColor, int normalColor) { WeakReference<Bitmap> imagePressed = new WeakReference<>(Bitmap.createBitmap(2 * radius, 2 * radius, Bitmap.Config.ARGB_8888)); Canvas canvasPressed = new Canvas(imagePressed.get()); Paint paintPressed = new Paint(); paintPressed.setAntiAlias(true); paintPressed.setColor(pressedColor); canvasPressed.drawCircle(radius, radius, radius, paintPressed); WeakReference<Bitmap> imageNormal = new WeakReference<>(Bitmap.createBitmap(2 * radius, 2 * radius, Bitmap.Config.ARGB_8888)); Canvas canvasNormal = new Canvas(imageNormal.get()); Paint paintNormal = new Paint(); paintNormal.setAntiAlias(true); paintNormal.setColor(normalColor); canvasNormal.drawCircle(radius, radius, radius, paintNormal); StateListDrawable stateListDrawable = new StateListDrawable(); stateListDrawable.addState( new int[] {android.R.attr.state_pressed}, new BitmapDrawable(circleButton.getContext().getResources(), imagePressed.get())); stateListDrawable.addState( StateSet.WILD_CARD, new BitmapDrawable(circleButton.getContext().getResources(), imageNormal.get())); if (android.os.Build.VERSION.SDK_INT >= 16) { circleButton.setBackground(stateListDrawable); } else { circleButton.setBackgroundDrawable(stateListDrawable); } }
public ActiveItem bind(RunningState state, RunningState.BaseItem item, StringBuilder builder) { synchronized (state.mLock) { PackageManager pm = rootView.getContext().getPackageManager(); if (item.mPackageInfo == null && item instanceof RunningState.MergedItem) { // Items for background processes don't normally load // their labels for performance reasons. Do it now. RunningState.MergedItem mergedItem = (RunningState.MergedItem) item; if (mergedItem.mProcess != null) { ((RunningState.MergedItem) item).mProcess.ensureLabel(pm); item.mPackageInfo = ((RunningState.MergedItem) item).mProcess.mPackageInfo; item.mDisplayLabel = ((RunningState.MergedItem) item).mProcess.mDisplayLabel; } } name.setText(item.mDisplayLabel); ActiveItem ai = new ActiveItem(); ai.mRootView = rootView; ai.mItem = item; ai.mHolder = this; ai.mFirstRunTime = item.mActiveSince; if (item.mBackground) { description.setText(rootView.getContext().getText(R.string.cached)); } else { description.setText(item.mDescription); } item.mCurSizeStr = null; icon.setImageDrawable(item.loadIcon(rootView.getContext(), state)); icon.setVisibility(View.VISIBLE); ai.updateTime(rootView.getContext(), builder); return ai; } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_browse, container, false); latestWallpaperIDs = new ArrayList<>(); randomWallpapers = new ArrayList<>(); mSfwSwitch = (Switch) view.findViewById(R.id.sfwSwitch); mSketchySwitch = (Switch) view.findViewById(R.id.sketchySwitch); mSfwSwitch.setChecked(true); //Latest mLatestRecyclerView = (RecyclerView) view.findViewById(R.id.latestRecycler); mLatestRecyclerView.setHasFixedSize(true); mLatestLayoutManager = new LinearLayoutManager(view.getContext(), LinearLayoutManager.HORIZONTAL, false); mLatestRecyclerView.setLayoutManager(mLatestLayoutManager); mLatestAdapter = new ImageRecyclerAdapter(latestWallpaperIDs); mLatestRecyclerView.setAdapter(mLatestAdapter); SharedPreferences mSharedPref = WallhavenBrowser.getContext().getSharedPreferences("com.sirkitboard.wallhavenbrowser", WallhavenBrowser.getContext().MODE_PRIVATE); String purity = mSharedPref.getString("purity","100"); mSfwSwitch.setChecked(purity.charAt(0) == '1'); mSketchySwitch.setChecked(purity.charAt(1) == '1'); //Random mRandomRecyclerView = (RecyclerView) view.findViewById(R.id.randomRecycler); mRandomRecyclerView.setHasFixedSize(true); mRandomLayoutManager = new LinearLayoutManager(view.getContext(), LinearLayoutManager.HORIZONTAL, false); mRandomRecyclerView.setLayoutManager(mRandomLayoutManager); mRandomAdapter = new ImageRecyclerAdapter(randomWallpapers); mRandomRecyclerView.setAdapter(mRandomAdapter); refresh(); return view; }
@Override public void onClick(View v) { int id = v.getId(); Log.v(TAG, "Clicked " + id); if (id == R.id.findBusId) { if (this.fromLocationId == 0) { Toast.makeText(v.getContext(), "Please choose a starting point", Toast.LENGTH_SHORT).show(); } else if (this.toLocationId == 0) { Toast.makeText(v.getContext(), "Please choose your final stop", Toast.LENGTH_SHORT).show(); } else if (travelDate == null) { Toast.makeText(v.getContext(), "When do you want to travel ?", Toast.LENGTH_SHORT).show(); } else { if (this.mHomeListener != null) { Log.v(TAG, "Data being passed is " + this.fromLocationId + " and " + this.toLocationId); this.mHomeListener.displayBuses( String.valueOf(this.fromLocationId), String.valueOf(this.toLocationId), travelDate.getText().toString()); } } } else if (id == R.id.travelDateId) { Log.v(TAG, "In Date Picker"); DatePickerFragment dialogFragment = new DatePickerFragment(); dialogFragment.setTravelDateIdText(travelDate); dialogFragment.show(getFragmentManager(), "datePicker"); } }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.quick_keys_popup_close: mKeyboardActionListener.onCancel(); break; case R.id.quick_keys_popup_backspace: mKeyboardActionListener.onKey(KeyCodes.DELETE, null, 0, null, true); break; case R.id.quick_keys_popup_quick_keys_settings: Intent startSettings = FragmentChauffeurActivity.createStartActivityIntentForAddingFragmentToUi( v.getContext(), MainSettingsActivity.class, new QuickTextSettingsFragment(), TransitionExperiences.ROOT_FRAGMENT_EXPERIENCE_TRANSITION); startSettings.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); v.getContext().startActivity(startSettings); mKeyboardActionListener.onCancel(); break; } }
/** * @see android.widget.SimpleCursorAdapter.ViewBinder#setViewValue(android.view.View, * android.database.Cursor, int) */ public boolean setViewValue(View view, Cursor cursor, int columnIndex) { int colIndex = -1; switch (view.getId()) { case R.id.tweet_sent: String time = RelativeTime.getDifference(view.getContext(), cursor.getLong(columnIndex)); colIndex = cursor.getColumnIndex(Tweets.IN_REPLY_TO_AUTHOR_ID); if (colIndex > -1) { String inReplyTo = cursor.getString(colIndex); if (inReplyTo != null && "null".equals(inReplyTo) == false) { time += " " + String.format( Locale.getDefault(), view.getContext().getText(R.string.tweet_source_in_reply_to).toString(), inReplyTo); } } ((TextView) view).setText(time); return true; case R.id.tweet_avatar_image: return true; case R.id.tweet_favorite: colIndex = cursor.getColumnIndex(Tweets.FAVORITED); if (colIndex > -1) { if (cursor.getInt(colIndex) == 1) { ((ImageView) view).setImageResource(android.R.drawable.star_on); } else { ((ImageView) view).setImageResource(android.R.drawable.star_off); } } return true; } return false; }
@Override public void onClick(View arg0) { // TODO Auto-generated method stub if (arg0.equals(btnSure)) { if (etPasswd.getText().toString().trim().equals("666666")) { ly.removeAllViews(); ly.addView(view); bPasswdOk = true; } else { AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); b.setMessage(R.string.passwd_error); b.setPositiveButton(R.string.btn_sure, null); b.show(); } } else if (arg0.equals(btnSaveIP)) { editor.putString(CONTROLLER_10_IP, etController10IP.getText().toString().trim()); editor.putString(CONTROLLER_9_IP, etController9IP.getText().toString().trim()); editor.putString(CONTROLLER_8_IP, etController8IP.getText().toString().trim()); editor.putString(CONTROLLER_7_IP, etController7IP.getText().toString().trim()); editor.putString(CONTROLLER_6_IP, etController6IP.getText().toString().trim()); editor.putString(CONTROLLER_5_IP, etController5IP.getText().toString().trim()); editor.putString(CONTROLLER_4_IP, etController4IP.getText().toString().trim()); editor.putString(CONTROLLER_3_IP, etController3IP.getText().toString().trim()); editor.putString(CONTROLLER_2_IP, etController2IP.getText().toString().trim()); editor.putString(CONTROLLER_1_IP, etController1IP.getText().toString().trim()); editor.commit(); AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); b.setMessage(R.string.save_ok); b.setPositiveButton(R.string.btn_sure, null); b.show(); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; if (convertView == null) { vi = inflater.inflate(R.layout.article_view, null); holder = new ViewHolder(); holder.tvBranch = (TextView) vi.findViewById(R.id.article); // city name holder.tvBranchImage = (ImageView) vi.findViewById(R.id.list_image); // thumb image vi.setTag(holder); } else { holder = (ViewHolder) vi.getTag(); } // Setting all values in listview holder.tvBranch.setText(branchDataCollection.get(position).get(KEY_NAME)); holder.tvBranch.setTextColor(Color.GRAY); // holder.tvBranch.setTextColor(Color.WHITE); // Setting an image String uri = "drawable/" + branchDataCollection.get(position).get(KEY_ICON); int imageResource = vi.getContext() .getApplicationContext() .getResources() .getIdentifier(uri, null, vi.getContext().getApplicationContext().getPackageName()); Drawable image = vi.getContext().getResources().getDrawable(imageResource); holder.tvBranchImage.setImageDrawable(image); return vi; }
/** * Constructor * * @param anchor {@link View} on where the popup should be displayed */ public QuickAction(View anchor) { super(anchor); actionList = new ArrayList<ActionItem>(); context = anchor.getContext(); inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); root = (ViewGroup) inflater.inflate(R.layout.quickaction, null); mArrowDown = (ImageView) root.findViewById(R.id.arrow_down); mArrowUp = (ImageView) root.findViewById(R.id.arrow_up); setContentView(root); mTrackAnim = AnimationUtils.loadAnimation(anchor.getContext(), R.anim.rail); mTrackAnim.setInterpolator( new Interpolator() { public float getInterpolation(float t) { // Pushes past the target area, then snaps back into place. // Equation for graphing: 1.2-((x*1.6)-1.1)^2 final float inner = (t * 1.55f) - 1.1f; return 1.2f - inner * inner; } }); mTrack = (ViewGroup) root.findViewById(R.id.tracks); animStyle = ANIM_AUTO; animateTrack = true; }
public final boolean a(ContextMenu paramContextMenu, View paramView, ai paramai) { if (ah.tE().isSDCardAvailable()) { int i = getTagposition; Object localObject = null; if (field_msgId > 0L) { localObject = n.Ay().ae(field_msgId); } if (((localObject == null) || (bJz <= 0L)) && (field_msgSvrId > 0L)) { n.Ay().ad(field_msgSvrId); } paramContextMenu.add(i, 110, 0, paramView.getContext().getString(2131234525)); if ((com.tencent.mm.v.o.xl()) && (!ltl.bln())) { paramContextMenu.add(i, 114, 0, paramView.getContext().getString(2131231696)); } if (com.tencent.mm.av.c.zM("favorite")) { paramContextMenu.add(i, 116, 0, paramView.getContext().getString(2131234160)); } localObject = new bz(); ahe.agU = field_msgId; com.tencent.mm.sdk.c.a.kug.y((b) localObject); if ((ahf.agF) || (g.u(ltl.kNN.kOg, field_type))) { paramContextMenu.add(i, 128, 0, paramView.getContext().getString(2131231704)); } if (!ltl.bln()) { paramContextMenu.add(i, 100, 0, paramView.getContext().getString(2131231699)); } } return true; }
/** * Constructor. Notar que no se necesita el cursor cuando se crea el adaptador. En cambio, los * cursores son creados a medida que completaciones son necesitadas por el campo. */ public AutocompleteEmpresaCursorAdapter(View mView) { // llamamos a super con cursor en null super(mView.getContext(), null, 0); this.contexto = mView.getContext(); this.etIdEmpresa = (EditText) mView.findViewById(R.id.textEditHiddenIdEmpresa); this.acNombreEmpresa = (AutoCompleteTextView) mView.findViewById(R.id.autocompleteEmpresa); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { // View-IDs fuer die Textfelder einer Bestellung des aktuellen Kunden final TextView kundeTxt = (TextView) view.findViewById(R.id.bestellungen_kunde_id); kundeTxt.setText(getString(R.string.k_bestellungen_kunde_id, kunde.id)); Log.v(LOG_TAG, "!!! KundeTxt Text zugewiesen !!!"); txtBestellungId = (TextView) view.findViewById(R.id.bestellung_id); txtBestellungDatum = (TextView) view.findViewById(R.id.datum); final Activity activity = getActivity(); if (Main.class.equals(activity.getClass())) { Log.v(LOG_TAG, "!!! Main.class equals activity Class !!!"); Main main = (Main) activity; kundeServiceBinder = main.getKundeServiceBinder(); bestellungServiceBinder = main.getBestellungServiceBinder(); } else if (KundenListe.class.equals(activity.getClass())) { KundenListe kundenListe = (KundenListe) activity; kundeServiceBinder = kundenListe.getKundeServiceBinder(); bestellungServiceBinder = kundenListe.getBestellungServiceBinder(); } else { Log.e(LOG_TAG, "Activity " + activity.getClass().getSimpleName() + " nicht beruecksichtigt."); return; } Log.v(LOG_TAG, "!!! 1 !!!"); bestellungenIds = kundeServiceBinder.sucheBestellungenIdsByKundeId(kunde.id, view.getContext()); if (bestellungenIds == null || bestellungenIds.isEmpty()) { kundeTxt.setText(getString(R.string.k_keine_bestellungen, kunde.id)); } else { // ListView mit den IDs der Bestellungen aufbauen Log.v(LOG_TAG, "!!! List View: bestellungen-liste !!!"); final ListView listView = (ListView) view.findViewById(R.id.bestellungen_liste); int anzahl = bestellungenIds.size(); bestellungen = new ArrayList<Bestellung>(anzahl); final String[] values = new String[anzahl]; for (int i = 0; i < anzahl; i++) { bestellungen.add(null); values[i] = getString(R.string.k_kunde_bestellung_id, bestellungenIds.get(anzahl - i - 1)); Log.d(LOG_TAG, values[i]); } final ArrayAdapter<String> adapter = new ArrayAdapter<String>( view.getContext(), android.R.layout.simple_list_item_1, android.R.id.text1, values); // Items in der Liste duerfen angeklickt werden listView.setAdapter(adapter); listView.setOnItemClickListener(this); // Die neueste Bestellung visualisieren Log.v(LOG_TAG, " !!! Vor activateBestellung !!!"); Log.v(LOG_TAG, "bestellungenIds: " + bestellungenIds.toString()); activateBestellung(0, view); } final OnGestureListener onGestureListener = new WischenListener(activity); gestureDetector = new GestureDetector( activity, onGestureListener); // Context und OnGestureListener als Argumente view.setOnTouchListener(this); }
public final boolean a(ContextMenu paramContextMenu, View paramView, ak paramak) { int i = ((kk) paramView.getTag()).position; paramContextMenu.add(i, 118, 0, paramView.getContext().getString(2131165626)); if (p.xQ()) paramContextMenu.add(i, 114, 0, paramView.getContext().getString(2131165798)); if (!this.gMB.aJJ()) paramContextMenu.add(i, 100, 0, paramView.getContext().getString(2131165658)); return true; }
public void onClick(View v) { UserAllData user = AccountManager.sharedInstance().getUserAllData(); if (user.user.coins < coinNum) { ((ZXBBaseActivity) v.getContext()).showToast("金币不足"); return; } ZXActivityJumpHelper.startActivity(v.getContext(), CoinAddressActivity.class, this); }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = inflater.inflate(R.layout.view_lesson, parent, false); setViewHolder(convertView); } final ViewHolder vh = (ViewHolder) convertView.getTag(); Lesson lesson = mValues[position]; String subject = lesson.fields.get("subject"); String timePeriod = lesson.fields.get("timePeriod"); String auditorium = lesson.fields.get("auditorium"); String teacher = lesson.fields.get("teacher"); String subjectType = lesson.fields.get("subjectType"); if (!subjectType.equals("кч")) { boolean isShowSubjectTypes = PreferenceManager.getDefaultSharedPreferences(convertView.getContext()) .getBoolean(ActivitySettings.KEY_SHOW_SUBJECTS_TYPE, false); if (isShowSubjectTypes && !subjectType.equals("")) { vh.lessonName.setText(subject); vh.lessonSubject.setVisibility(View.VISIBLE); vh.lessonSubject.setText(" (" + subjectType + ")"); } else { vh.lessonName.setText(subject); vh.lessonSubject.setVisibility(View.GONE); } } else { vh.lessonName.setText("КЧ"); } vh.lessonTime.setText(timePeriod); vh.lessonTeacher.setText(teacher); Note note = NoteDatabase.getInstance(convertView.getContext()).fetchNoteByLessonId(lesson.id); if (note != null) { vh.ivNote.setVisibility(View.VISIBLE); } else { vh.ivNote.setVisibility(View.INVISIBLE); } vh.lessonAuditorium.setText(auditorium); if (subjectType.equals("лр")) { vh.lView.setBackgroundColor(mContext.getResources().getColor(R.color.red)); } else if (subjectType.equals("пз")) { vh.lView.setBackgroundColor(mContext.getResources().getColor(R.color.orange)); } else if (subjectType.equals("лк")) { vh.lView.setBackgroundColor(mContext.getResources().getColor(R.color.green)); } else { vh.lView.setBackgroundColor(Color.WHITE); } View verticalLine = convertView.findViewById(R.id.customview); verticalLine.setBackgroundColor(Color.WHITE); return convertView; }
@Override public void onClick(View v) { radioGroup = (RadioGroup) findViewById(R.id.radGroup); if (v.getId() == R.id.btnOk) { if (radioGroup.getCheckedRadioButtonId() == R.id.radListView) Toast.makeText(v.getContext(), "OK - List View", Toast.LENGTH_SHORT).show(); else Toast.makeText(v.getContext(), "OK - Grid View", Toast.LENGTH_SHORT).show(); } else finish(); }
/** * run on ui thread * * @param view * @param runnable */ public static void runOnUiThread(final View view, final Runnable runnable) { if (view != null) { if (view.getContext() instanceof Activity) { ((Activity) view.getContext()).runOnUiThread(runnable); } else { view.post(runnable); } } }
public void onResume() { super.onResume(); updateOutput(); TextView v = (TextView) rootView.findViewById(R.id.deviceAttached); if (v == null) return; if (RoboCatActivity.deviceConnected) v.setText(rootView.getContext().getString(R.string.errorMessage)); else v.setText(rootView.getContext().getString(R.string.errorMessage)); }
public ChaptersHolder(View view, ChaptersAdapter adapter, OnListItemClickListener listener) { super(view, adapter, listener); this.adapter = adapter; ButterKnife.bind(this, view); readColor = ContextCompat.getColor(view.getContext(), R.color.hint_text); unreadColor = ContextCompat.getColor(view.getContext(), R.color.primary_text); chapterMenu.setOnClickListener(v -> v.post(() -> showPopupMenu(v))); }
@Override public void onClick(View widget) { if (hideUrlStyle) { // Do nothing } else { // super.onClick(widget); int id = Integer.parseInt(getURL().split("://")[1]); widget.getContext().startActivity(Intents.openProfile(id, widget.getContext())); } }
public static void showKeyboard(View view) { if (view == null) { return; } InputMethodManager inputManager = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); ((InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) .showSoftInput(view, 0); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mineLayout = inflater.inflate(R.layout.mine_layout, container, false); editor = new SharePreferencesEditor(mineLayout.getContext()); mQueue = Volley.newRequestQueue(mineLayout.getContext()); mImageLoader = new ImageLoader(mQueue, new BitmapCache()); initLayout(); initDate(); return mineLayout; }
/* * (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*| * "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f]) * * * ")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9] * ) * ?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0- * 9 * ]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21- * \x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]) */ public void btnValidateEmailAddress(View v) { strEmailAddress = editTextEmail.getText().toString().trim(); Matcher matcherObj = Pattern.compile(regEx).matcher(strEmailAddress); if (matcherObj.matches()) { Toast.makeText(v.getContext(), strEmailAddress + " is valid", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(v.getContext(), strEmailAddress + " is InValid", Toast.LENGTH_SHORT).show(); } }
/** * Creates view for Regional Rail Alerts * * @param inflater inflates the view and formats the data * @param container holds the view * @param savedInstanceState saved state on close * @return view */ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_alerts, container, false); alertsRecyclerView = (RecyclerView) view.findViewById(R.id.alertsRecyclerView); alertsRecyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); alertsAdapter = new AlertsAdapter(rrList, view.getContext()); alertsRecyclerView.setAdapter(alertsAdapter); return view; }