@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.offline_media); setTitle(getString(R.string.offline)); mLoadingBar = findViewById(R.id.offline_loading_bar); mLoadingBar.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { if (mLoadingCount > 0) { Intent intent = new Intent(OfflineMediaActivity.this, OfflineActivity.class); startActivity(intent); } } }); mLoadingCountTextView = (TextView) mLoadingBar.findViewById(R.id.offline_media_bar_title); mLoadingProgressTextView = (TextView) mLoadingBar.findViewById(R.id.offline_media_bar_subtitle); setLoadingCount(0); setLoadingProgress(0, 0); adapter = new RelativeAdapter(getBaseContext(), null, true); mListView = (GridView) findViewById(R.id.offline_media_block_grids); // update UI mListView.setAdapter(adapter); mLoadingView = makeEmptyLoadingView(getBaseContext(), (RelativeLayout) findViewById(R.id.tabs_content)); findViewById(R.id.offline_media_block).setVisibility(View.GONE); // after check then load getSupportLoaderManager().initLoader(cursorFinishedLoaderID, null, this); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.carbon_cycle_view, container, false); TextView diagramTxt = (TextView) view.findViewById(R.id.txt_diagram); TextView savedScoreTxt = (TextView) view.findViewById(R.id.score_saved); Button startBtn = (Button) view.findViewById(R.id.go_diagram_btn); diagramTxt.setTypeface(tfThin); startBtn.setTypeface(tfThin); savedScoreTxt.setText((int) ((score / GAME_SCORE) * 100) + "% Sucess"); startBtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent carbonIntent = new Intent(getActivity(), DiagramPlayCarbonCycle.class); carbonIntent.putExtra("SOURCE", "Fragment"); carbonIntent.putExtra("TRY_CYCLE", 0); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); carbonIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(carbonIntent); } }); return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.inflater = inflater; if (diseaseview != null) container.removeAllViews(); diseaseview = inflater.inflate(R.layout.fragment_symptomdisease, container, false); InitWidth(diseaseview); lcontent = (LinearLayout) diseaseview.findViewById(R.id.lcontainer); btjianjie = (Button) diseaseview.findViewById(R.id.jianjie); btdescription = (Button) diseaseview.findViewById(R.id.description); btjianjie.setEnabled(true); btdescription.setEnabled(true); btjianjie.setOnClickListener(this); btdescription.setOnClickListener(this); if (data.getType() == Constants.ZHENGZHUANG) { btdescription.setText("¿ÉÄܼ²²¡"); } else { btdescription.setText("°éËæÖ¢×´"); } onjianjie(); return diseaseview; }
private void setupHistoryRow(View view, History history, User user) { final AsyncImageView pictureView = (AsyncImageView) view.findViewById(R.id.picture); { if (user.containsNonNullValue(USER_PICTURE)) { String pictureUrl = user.getPictureUrl(USER_PICTURE, RemoteModel.PICTURE_THUMB); pictureView.setUrl(pictureUrl); } else { pictureView.setUrl(null); } pictureView.setVisibility(View.VISIBLE); } final AsyncImageView commentPictureView = (AsyncImageView) view.findViewById(R.id.comment_picture); commentPictureView.setVisibility(View.GONE); final TextView nameView = (TextView) view.findViewById(R.id.title); { nameView.setText( getHistoryComment( (AstridActivity) fragment.getActivity(), history, user, linkColor, fromView)); nameView.setTextColor(grayColor); } final TextView date = (TextView) view.findViewById(R.id.date); { CharSequence dateString = DateUtils.getRelativeTimeSpanString( history.getValue(History.CREATED_AT), DateUtilities.now(), DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE); date.setText(dateString); } }
/** 显示下载对话框 */ private void showDownloadDialog() { Builder builder = new Builder(mContext); builder.setTitle("正在下载新版本"); final LayoutInflater inflater = LayoutInflater.from(mContext); View v = inflater.inflate(R.layout.update_progress, null); mProgress = (ProgressBar) v.findViewById(R.id.update_progress); mProgressText = (TextView) v.findViewById(R.id.update_progress_text); builder.setView(v); builder.setNegativeButton( "取消", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); interceptFlag = true; } }); builder.setOnCancelListener( new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { dialog.dismiss(); interceptFlag = true; } }); downloadDialog = builder.create(); downloadDialog.setCanceledOnTouchOutside(false); downloadDialog.show(); downloadApk(); }
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.purchaselistrow, null); } PurchaseHistoryEntity watchListAllEntity = items.get(position); if (watchListAllEntity != null) { // TextView nt = (TextView) // v.findViewById(R.id.fileNameTextView); TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1); TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2); TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3); TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4); TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5); /*STATUS 注文日 (order date) 納品日 (delivery date) 依頼枚数(no. of request) 納品枚数(no. of delivery)*/ tv1.setText("STATUS: " + watchListAllEntity.get_status_ja()); tv2.setText("注文日: " + watchListAllEntity.get_order_created_at()); tv3.setText("納品日: " + watchListAllEntity.get_order_created_at()); tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount()); tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount()); } return v; }
public void displayPopup(View view) { LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View popView = (View) inflater.inflate(R.layout.add_popup, null, false); Button okButton = (Button) popView.findViewById(R.id.okButton); okButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { addRow(v); } }); Button cancelButton = (Button) popView.findViewById(R.id.cancelButton); cancelButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { _popPopupWindow.dismiss(); _popPopupWindow = null; } }); _popPopupWindow = new PopupWindow(popView, 400, 300, true); _popPopupWindow.setBackgroundDrawable(new BitmapDrawable()); _popPopupWindow.setOutsideTouchable(false); _popPopupWindow.setFocusable(true); _popPopupWindow.showAtLocation(this.findViewById(R.id.LinearLayout1), Gravity.CENTER, 0, 0); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { fragment = inflater.inflate(R.layout.fragment_definition, container, false); prefs = getActivity().getSharedPreferences("Taminations", Context.MODE_PRIVATE); defview = (WebView) fragment.findViewById(R.id.definitionView); // Turn on pinch-to-zoom, which is off(!) by default defview.getSettings().setBuiltInZoomControls(true); defview.getSettings().setJavaScriptEnabled(true); abbrevRadioButton = (RadioButton) fragment.findViewById(R.id.definitionAbbrevRadioButton); abbrevRadioButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { evaluateJavascript("setAbbrev(true)"); prefs.edit().putBoolean("isabbrev", true).commit(); } } }); fullRadioButton = (RadioButton) fragment.findViewById(R.id.definitionFullRadioButton); fullRadioButton.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { evaluateJavascript("setAbbrev(false)"); prefs.edit().putBoolean("isabbrev", false).commit(); } } }); setDefinition(intentString("link")); return fragment; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Changed to ViewHolder and Picasso error load as per feedback received ViewHolder holder = new ViewHolder(); // Inflate view if it is null if (convertView == null) { convertView = inflater.inflate(R.layout.grid_item, null); holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster); MovieDetailDO movie = movieList.get(position); convertView.setTag(holder); Picasso.with(context) .load(movie.getPoster_path()) // .placeholder(R.drawable.def_pos) .error(R.drawable.def_pos) .into(holder.imageView); } else { holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster); MovieDetailDO movie = movieList.get(position); convertView.setTag(holder); Picasso.with(context) .load(movie.getPoster_path()) // .placeholder(R.drawable.def_pos) .error(R.drawable.def_pos) .into(holder.imageView); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.sales_ware_summer_list_item, null); holder.textView1 = (TextView) convertView.findViewById(R.id.waresummer_kuanhao); holder.textView2 = (TextView) convertView.findViewById(R.id.waresummer_count); holder.textView3 = (TextView) convertView.findViewById(R.id.waresummer_money); holder.textView4 = (TextView) convertView.findViewById(R.id.waresummer_mincheng); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Order order = list.get(position); holder.textView1.setText(order.getOrderDate()); holder.textView2.setText(order.getCardNum()); holder.textView3.setText(order.getKuanHao()); holder.textView4.setText(order.getKuanHao()); int[] colors = {Color.WHITE, Color.rgb(219, 238, 244)}; // RGB颜色 convertView.setBackgroundColor(colors[position % 2]); // 每隔item之间颜色不同 return convertView; }
public void addTrailerView() { LayoutInflater vi = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); Log.d("vi", "Null " + Boolean.toString(vi == null)); for (int i = 0; i < trailerVideo.size(); i++) { View trailerView = vi.inflate(R.layout.trailer_view, null); final TextView trailerTitleView = (TextView) trailerView.findViewById(R.id.trailer_title); trailerTitleView.setText(trailerVideo.get(i).getName()); ImageButton imageButton = (ImageButton) trailerView.findViewById(R.id.trailer_play_button); final String source = trailerVideo.get(i).getSource(); imageButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + source)); startActivity(intent); } }); insertTrailerPoint.addView( trailerView, 0, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } }
public ViewHolder(View v) { super(v); recordingName = (TextView) v.findViewById(R.id.recording_name); recordingLength = (TextView) v.findViewById(R.id.duration); myImageButton = (ImageButton) v.findViewById(R.id.play); relLay = (RelativeLayout) v.findViewById(R.id.item_layout); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_restaurant, container, false); RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.restaurant_fragment_recycler); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(mStaggeredGridLayoutManager); final RuAdapter ruAdapter = new RuAdapter(getActivity()); recyclerView.setAdapter(ruAdapter); final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.restaurant_fragment_swipe_layout); swipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Log.d(AppTags.UFRGS_MOBILE, "RU Refresh"); ruAdapter.updateAdapter(); swipeRefreshLayout.setRefreshing(false); } }); return view; }
private static void AddTab( Activity_Tab activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo, String label, int drawable) { tabSpec.setContent(activity.new TabFactory(activity)); View tabIndicator = LayoutInflater.from(activity) .inflate(R.layout.tab_indicator, tabHost.getTabWidget(), false); TextView txtTitle = (TextView) tabIndicator.findViewById(R.id.title); ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon); txtTitle.setText(label); txtTitle.setTextSize( Float.parseFloat(activity.getResources().getString(R.string.size_pointer))); txtTitle.setTypeface(StaticUtils.getTypeface(activity, Font.THSarabanNew)); icon.setImageResource(drawable); tabSpec.setIndicator(tabIndicator); tabHost.addTab(tabSpec); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = inflater.inflate(R.layout.fragment_protocol, container, false); ProtocolDataBaseHelper db = new ProtocolDataBaseHelper(this.getActivity(), DB_NAME, null, DB_VERSION); question = (TextView) mRootView.findViewById(R.id.exerciseQuestion); mCardView = (RelativeLayout) mRootView.findViewById(R.id.card); rg = new RadioGroup(getActivity()); addAnswerRadioButtons(); seeSolution = (Button) mRootView.findViewById(R.id.seesolution); check = (Button) mRootView.findViewById(R.id.checkbutton); // Manejador del evento de mostrar solución (solo en modo entrenamiento). seeSolution.setOnClickListener( new OnClickListener() { private Object TAG; @Override public void onClick(View arg0) { flag = false; int i = 0; while (i < NUMBER_OF_ANSWERS) { if ((respRadioButton[i].getText().equals(test.getResponse())) && (!flag)) { respRadioButton[i].setChecked(true); flag = true; } i++; } } }); // Manejador del botón de comprobación de respuesta. check.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { flag = false; int index = 0; while ((index < NUMBER_OF_ANSWERS) && (!flag)) { if (respRadioButton[index].isChecked()) { checkIfButtonClickedIsCorrectAnswer(index); flag = true; } index++; } if (!gameMode) newQuestion(); } }); try { db.createDataBase(); db.openDataBase(); } catch (IOException e) { // TODO: extraer cadenas a recursos Toast.makeText(this.getActivity(), "Error al abrir la base de datos", Toast.LENGTH_LONG) .show(); } testList = db.loadData(); newQuestion(); return mRootView; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_stories_view, container, false); getActivity().setTitle(getResources().getString(R.string.title_activity_news_home_screen)); swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout); swipeLayout.setOnRefreshListener(this); TextView noTopicsText = (TextView) rootView.findViewById(R.id.no_topics_textview); user = ValuesAndUtil.getInstance().loadUserData(getActivity().getApplicationContext()); boolean hasTopics = false; try { hasTopics = user.has("topics") && user.getJSONArray("topics").length() > 0; } catch (JSONException e) { e.printStackTrace(); } Log.d("SVF", "Has topics = " + hasTopics); if (!hasTopics) { noTopicsText.setText(getString(R.string.no_topics_available)); swipeLayout.setVisibility(View.INVISIBLE); } else { Log.d("SVF", "Topics were not null"); swipeLayout.setVisibility(View.VISIBLE); try { topics = user.getJSONArray("topics"); setUpList(rootView, topics); } catch (JSONException e) { e.printStackTrace(); } } return rootView; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.video_grid, container, false); // init the information for the scan (1/2) mLayoutFlipperLoading = (LinearLayout) v.findViewById(R.id.layout_flipper_loading); mTextViewNomedia = (TextView) v.findViewById(R.id.textview_nomedia); mViewNomedia = v.findViewById(android.R.id.empty); mGridView = (GridView) v.findViewById(android.R.id.list); mSwipeRefreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeLayout); mSwipeRefreshLayout.setColorSchemeResources(R.color.orange700); mSwipeRefreshLayout.setOnRefreshListener(this); mGridView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) {} @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { mSwipeRefreshLayout.setEnabled(firstVisibleItem == 0); } }); mGridView.setAdapter(mVideoAdapter); mGridView.setOnItemClickListener(this); return v; }
@Override protected void initView() { super.initView(); View headerView = LayoutInflater.from(getActivity()) .inflate(com.xuhai.telescopes.R.layout.em_contacts_header, null); HeaderItemClickListener clickListener = new HeaderItemClickListener(); applicationItem = (ContactItemView) headerView.findViewById(com.xuhai.telescopes.R.id.application_item); applicationItem.setOnClickListener(clickListener); headerView.findViewById(com.xuhai.telescopes.R.id.group_item).setOnClickListener(clickListener); headerView .findViewById(com.xuhai.telescopes.R.id.chat_room_item) .setOnClickListener(clickListener); // // headerView.findViewById(com.xuhai.telescopes.R.id.robot_item).setOnClickListener(clickListener); // 添加headerview // listView.addHeaderView(headerView); // 添加正在加载数据提示的loading view loadingView = LayoutInflater.from(getActivity()) .inflate(com.xuhai.telescopes.R.layout.em_layout_loading_data, null); contentContainer.addView(loadingView); // 注册上下文菜单 registerForContextMenu(listView); }
@Override public View getView(int position, View convertView, ViewGroup parent) { TaskViewHolder holder; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(row, null); holder = new TaskViewHolder(); convertView.setTag(holder); } else { holder = (TaskViewHolder) convertView.getTag(); } if ((tours == null) || ((position + 1) > tours.size())) return convertView; // Can't extract item Tour obj = tours.get(position); holder.image = (ImageView) convertView.findViewById(R.id.tourImage); Drawable img = mContext .getResources() .getDrawable( mContext .getResources() .getIdentifier(obj.getImage(), "drawable", mContext.getPackageName())); holder.image.setImageDrawable(img); holder.name = (TextView) convertView.findViewById(R.id.tourNameLbl); holder.name.setText(obj.getName()); holder.totalHours = (TextView) convertView.findViewById(R.id.totalHoursLbl); holder.totalHours.setText(obj.getTotalHours() + "h"); holder.totalKms = (TextView) convertView.findViewById(R.id.totalKmsLbl); holder.totalKms.setText(obj.getTotalKms() + "Km"); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; LayoutInflater vi; vi = LayoutInflater.from(mContext); v = vi.inflate(R.layout.categories_listview_items, null); Category c = getItem(position); if (c != null) { TextView name = (TextView) v.findViewById(R.id.categories_listview_items_name); ImageView icon = (ImageView) v.findViewById(R.id.categories_listview_items_icon); if (name != null) { name.setTypeface(typeface); name.setText(c.getName()); } if (icon != null) icon.setImageResource( mContext .getResources() .getIdentifier(c.getIconFileName(), "drawable", mContext.getPackageName())); } return v; }
@Override public View getView(int position, View bankView, ViewGroup parent) { // set the rowview View rowView = bankView; // reuse views if (rowView == null) { // if the row view is not null then inflate for display LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.password_bank_item, null); } // get the text views and set the values to the values in the list TextView username = (TextView) rowView.findViewById(R.id.value_username); TextView website = (TextView) rowView.findViewById(R.id.value_website); TextView password = (TextView) rowView.findViewById(R.id.value_password); TextView expiration = (TextView) rowView.findViewById(R.id.value_expires); username.setText(PasswordInfoArrayList.get(position).getUsername()); website.setText(PasswordInfoArrayList.get(position).getWebsite()); password.setText(PasswordInfoArrayList.get(position).getPassword()); DateHelper expires = PasswordInfoArrayList.get(position).getExpiration(); boolean expired = expires.isLaterThan(DateHelper.getCurrentDate()); if (expired) { expiration.setTextColor(Color.RED); } String expStr = PasswordInfoArrayList.get(position).getExpiration().toString(); expiration.setText(expStr); return rowView; }
public SimpleItemViewHolder(final View view) { super(view); wall = (ImageView) view.findViewById(R.id.wall_grid_art); name = (TextView) view.findViewById(R.id.wall_grid_name); author = (TextView) view.findViewById(R.id.wall_grid_desc); pb = (ProgressBar) view.findViewById(R.id.progressBar_wall_grid); realBackground = (RelativeLayout) view.findViewById(R.id.wall_real_background); mainView = view; target = new Target() { @Override public void onBitmapLoaded(final Bitmap bitmap, Picasso.LoadedFrom from) { pb.setVisibility(View.GONE); wall.setImageBitmap(bitmap); realBackground.setBackgroundColor( view.getContext().getResources().getColor(android.R.color.white)); new ColorGridTask(view.getContext(), bitmap, SimpleItemViewHolder.this).execute(); } @Override public void onBitmapFailed(Drawable errorDrawable) {} @Override public void onPrepareLoad(Drawable placeHolderDrawable) {} }; }
/** Inflate the layout for this fragment */ @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encrypt_asymmetric_fragment, container, false); mSelectKeysButton = (BootstrapButton) view.findViewById(R.id.btn_selectEncryptKeys); mSign = (CheckBox) view.findViewById(R.id.sign); mMainUserId = (TextView) view.findViewById(R.id.mainUserId); mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); mSelectKeysButton.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { selectPublicKeys(); } }); mSign.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { CheckBox checkBox = (CheckBox) v; if (checkBox.isChecked()) { selectSecretKey(); } else { setSignatureKeyId(Constants.key.none); } } }); return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_about_aokp, container, false); root.findViewById(R.id.aokp_mgerrit_changelog) .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // open mGerrit if we can. otherwise launch gerrit url. try { launchActivity(MGERRIT, MGERRIT_MAIN_ENTRY); } catch (ActivityNotFoundException failToMarket) { launchUrl(MGERRIT_PLAYSTORE); } } }); root.findViewById(R.id.aokp_review) .setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // open mGerrit if we can. otherwise launch gerrit url. try { launchActivity(MGERRIT, MGERRIT_AOKP_CHANGELOG); } catch (ActivityNotFoundException failToMarket) { launchUrl(getString(R.string.url_aokp_gerrit)); } } }); return root; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_authentication, container, false); usernameEditText = (EditText) view.findViewById(R.id.username_edit_text); passwordEditText = (EditText) view.findViewById(R.id.password_edit_text); loginButton = (Button) view.findViewById(R.id.login_button); loginButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String username = usernameEditText.getText().toString(); String password = passwordEditText.getText().toString(); Authenticator authenticator = new Authenticator((Activity) mListener, "", username, password); authenticator.authenticate(); } }); return view; }
private void init() { Log.d(TAG, "call TwitterSelectUserItemView init"); LayoutInflater factory = LayoutInflater.from(mContext); removeAllViews(); // container FrameLayout view = (FrameLayout) FrameLayout.inflate(getContext(), R.layout.sns_container_normal, null); FrameLayout.LayoutParams paras = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); view.setLayoutParams(paras); view.setVerticalScrollBarEnabled(true); addView(view); // child 1 View v = factory.inflate(R.layout.sns_user_select_item, null); v.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); view.addView(v); chekbox = (CheckBox) v.findViewById(R.id.sns_user_select_checkbox); username = (TextView) v.findViewById(R.id.sns_user_name_item); chekbox.setOnClickListener(stOnClik); setUI(); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left_fragment, null); LinearLayout userLayout = (LinearLayout) view.findViewById(R.id.userLayout); userLayout.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { // 创建用户信息界面 UserFragment user = UserFragment.newInstance(((MainActivity) getActivity()).getToken()); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.replace(R.id.center_frame, user); ft.commit(); ((MainActivity) getActivity()).showLeft(); } }); LinearLayout mainPage = (LinearLayout) view.findViewById(R.id.mainPage); // 添加主页按钮响应 mainPage.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ((MainActivity) getActivity()).showCenter(); ((MainActivity) getActivity()).showLeft(); } }); return view; }
public void showIssue(final String issue) { LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(R.layout.touzhu_succe, null); final AlertDialog dialog = new AlertDialog.Builder(context).create(); TextView textContent = (TextView) view.findViewById(R.id.touzhu_succe_text); Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure); Button cancel = (Button) view.findViewById(R.id.touzhu_succe_button_share); ok.setBackgroundResource(R.drawable.loginselecter); cancel.setBackgroundResource(R.drawable.loginselecter); ok.setText(context.getString(R.string.dialog_issue_text_ok)); cancel.setText(context.getString(R.string.dialog_issue_text_cancel)); textContent.setText(context.getString(R.string.dialog_issue_text_content) + issue + "期。"); ok.setOnClickListener( new OnClickListener() { public void onClick(View v) { dialog.cancel(); touzhuIssue(issue); } }); cancel.setOnClickListener( new OnClickListener() { public void onClick(View v) { dialog.cancel(); finish(); } }); dialog.show(); dialog.getWindow().setContentView(view); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; ViewHolder holder; if (convertView == null) { view = inflater.inflate(R.layout.grid_list_layout, null); holder = new ViewHolder(); holder.adIcon = (ImageView) view.findViewById(R.id.adIcon); holder.adType = (TextView) view.findViewById(R.id.adType); holder.adSize = (TextView) view.findViewById(R.id.adSize); holder.adClientId = (TextView) view.findViewById(R.id.adClientId); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } ListItem listItem = this.getItem(position); holder.adIcon.setImageResource(listItem.getAdIcon()); holder.adType.setText(listItem.getAdType()); holder.adSize.setText(listItem.getAdSize()); holder.adClientId.setText(listItem.getAdClientId()); return view; }
/** * Method for registering the user based on credentials placed into EditText views. * * @param view The view housing the EditTexts for simplicity. */ private void registerUser(View view) { // ensure view isnt null if (view != null) { // retrieve the values within the edit texts // final TextView errorText = (TextView) view.findViewById(R.id.register_error_label); final EditText usernameField = (EditText) view.findViewById(R.id.register_username); final EditText password = (EditText) view.findViewById(R.id.register_password); final EditText passwordCheck = (EditText) view.findViewById(R.id.register_password_redo); String username = usernameField.getText().toString(); String pwd = password.getText().toString(); String pwdCheck = passwordCheck.getText().toString(); // Ensure the fields are not empty and the passwords match if (username.length() != 0 && pwd.length() != 0 && pwd.equals(pwdCheck)) { // hash the password to increase security a bit String pwdHash = String.valueOf(password.getText().toString().hashCode()); String regUrl = url; regUrl += "?username="******"&password="******"Attempting to Register Account!"); new AddUserWebTask().execute(regUrl); } // a field is empty if (username.length() == 0 || pwd.length() == 0 || pwdCheck.length() == 0) { errorText.setText("Error: Cannot leave a field blank!"); } // passwords do not match if (!pwd.equals(pwdCheck)) { errorText.setText("Error: Passwords do not match!"); } } }