void getLayoutCache() { final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent); View view1 = (View) parent.findViewById(R.id.view1); View view2 = (View) parent.findViewById(R.id.view2); View view3 = (View) parent.findViewById(R.id.view3); View view4 = (View) parent.findViewById(R.id.view4); View view5 = (View) parent.findViewById(R.id.view5); View view12 = (View) parent.findViewById(R.id.view12); String firstColumn = view2.getLeft() + "," + view2.getRight(); layoutCache.put(firstColumn, new HashMap<String, Integer>()); String secondColumn = view1.getLeft() + "," + view1.getRight(); layoutCache.put(secondColumn, new HashMap<String, Integer>()); String thirdColumn = view4.getLeft() + "," + view4.getRight(); layoutCache.put(thirdColumn, new HashMap<String, Integer>()); String firstRow = view3.getTop() + "," + view3.getBottom(); layoutCache.get(firstColumn).put(firstRow, 1); layoutCache.get(secondColumn).put(firstRow, 2); layoutCache.get(thirdColumn).put(firstRow, 3); String secondRow = view5.getTop() + "," + view5.getBottom(); layoutCache.get(firstColumn).put(secondRow, 4); layoutCache.get(secondColumn).put(secondRow, 5); layoutCache.get(thirdColumn).put(secondRow, 6); String thirdRow = view12.getTop() + "," + view12.getBottom(); layoutCache.get(firstColumn).put(thirdRow, 7); layoutCache.get(secondColumn).put(thirdRow, 8); layoutCache.get(thirdColumn).put(thirdRow, 9); }
/** {@inheritDoc} */ @Override public View getView(int position, View convertView, ViewGroup parent) { RelativeLayout artistView; Artist artist = getItem(position); // Inflate the view if (convertView == null) { artistView = new RelativeLayout(getContext()); String inflater = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater vi; vi = (LayoutInflater) getContext().getSystemService(inflater); vi.inflate(mResource, artistView, true); } else { artistView = (RelativeLayout) convertView; } TextView textView = ((TextView) artistView.findViewById(R.id.artistViewName)); textView.setText(artist.name); ImageView imageView = ((ImageView) artistView.findViewById(R.id.artistViewImage)); Image optimalImage = getOptimalImage(artist.images); if (optimalImage != null) { Picasso.with(super.getContext()).load(optimalImage.url).into(imageView); } else { Picasso.with(super.getContext()).load(R.drawable.placeholder_small_thumbnail).into(imageView); } return artistView; }
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()); }
private void setupHeaderView() { RelativeLayout headerRL = (RelativeLayout) this.findViewById(R.id.headerLayout); headerRL.setBackgroundResource( mEditMode ? R.drawable.alerts_header_background : R.drawable.location_header_background); TextView headerTitleTV = (TextView) headerRL.findViewById(R.id.title_header_TV); Button headerBtn = (Button) headerRL.findViewById(R.id.action_btn); headerBtn.setVisibility(mEditMode ? View.GONE : View.VISIBLE); headerBtn.setText(getResources().getString(mEditMode ? R.string.done : R.string.add_to_alerts)); headerBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new GoogleAnalyticsUtil() .trackEvents( IndriveApplication.getInstance(), getResources().getString(R.string.category_location), "LocationAddAlerts"); if (validateTime()) { save(); } else { Toast.makeText( LocationAlertsActivity.this, getResources().getString(R.string.time_validate_error), Toast.LENGTH_LONG) .show(); } } }); headerTitleTV.setText( this.getResources() .getString(mEditMode ? R.string.edit_location_alert : R.string.location_alert)); }
@Override public void getViews() { RelativeLayout titlebar = (RelativeLayout) findViewById(R.id.detail_titlebar); titleBack = (Button) titlebar.findViewById(R.id.titlebar_back); titleName = (TextView) titlebar.findViewById(R.id.titlebar_name); titleHome = (Button) titlebar.findViewById(R.id.titlebar_home); userinfo = (LinearLayout) findViewById(R.id.detail_userinfo); icon = (ImageView) findViewById(R.id.detail_icon); v = (ImageView) findViewById(R.id.detail_v); name = (TextView) findViewById(R.id.detail_name); content = (TextView) findViewById(R.id.detail_content); pic = (ImageView) findViewById(R.id.detail_pic); sub = (LinearLayout) findViewById(R.id.detail_sub); subContent = (TextView) findViewById(R.id.detail_subContent); subPic = (ImageView) findViewById(R.id.detail_subPic); subRedirect = (LinearLayout) findViewById(R.id.detail_subRedirect); subRedirectNum = (TextView) findViewById(R.id.detail_sub_redirectNum); subComment = (LinearLayout) findViewById(R.id.detail_subComent); subCommentNum = (TextView) findViewById(R.id.detail_sub_commentNum); redirect_bt = (Button) findViewById(R.id.detail_redirect_bt); comment_bt = (Button) findViewById(R.id.detail_comment_bt); time = (TextView) findViewById(R.id.detail_time); source = (TextView) findViewById(R.id.detail_from); refresh = (Button) findViewById(R.id.detail_refresh); comment = (Button) findViewById(R.id.detail_comment); redirect = (Button) findViewById(R.id.detail_redirect); favorite = (Button) findViewById(R.id.detail_favorite); weibodel = (Button) findViewById(R.id.detail_del); }
/** 初始化提醒事件时间选择按钮 */ private void initAlertsButton() { LinearLayout llAlert = (LinearLayout) findViewById(R.id.llAddEventAlert); // btnsDay = new ArrayList<Button>(); // btnsHours = new ArrayList<Button>(); // btnsMinute = new ArrayList<Button>(); int[] alertsValues = getResources().getIntArray(R.array.alert_events); RelativeLayout rlAlertLinePictures = (RelativeLayout) getLayoutInflater().inflate(R.layout.view_add_event_alert_row, null); llAlert.addView(rlAlertLinePictures); if (alertsValues == null || alertsValues.length < 10) { return; } alertsValueButtons = new ArrayList<Button>(); for (int i = 0; i < 3; i++) { RelativeLayout rlAlertLine = (RelativeLayout) getLayoutInflater().inflate(R.layout.view_add_event_alert_row, null); llAlert.addView(rlAlertLine); Button btn1 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow1); Button btn2 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow2); Button btn3 = (Button) rlAlertLine.findViewById(R.id.btnAddEventAlertRow3); createAlertsValuesButton(alertsValues[7 + i], btn1); createAlertsValuesButton(alertsValues[4 + i], btn2); createAlertsValuesButton(alertsValues[1 + i], btn3); alertsValueButtons.add(btn1); alertsValueButtons.add(btn2); alertsValueButtons.add(btn3); } showAlertsInView(); setAlertsvalueToEventReminder(); }
private void init(Context context) { mContext = context; initResources(); LayoutInflater.from(mContext).inflate(R.layout.wootric_survey_layout, this); initNpsViewElements(); initFeedbackViewElements(); mBtnSubmit = (TextView) mLayoutBody.findViewById(R.id.wootric_btn_submit); mBtnDismiss = (TextView) mLayoutBody.findViewById(R.id.wootric_btn_dismiss); mBtnSubmit.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { submitSurvey(); } }); mBtnDismiss.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dismissSurvey(); } }); mTvSurveyHeader = (TextView) findViewById(R.id.wootric_survey_layout_tv_header); mCommonSurveyViews = new View[] {mLayoutBody, mTvSurveyHeader}; mThankYouLayout = (ThankYouLayout) findViewById(R.id.wootric_thank_you_layout); mThankYouLayout.setThankYouLayoutListener(this); }
private void dialog() { LayoutInflater inflater = LayoutInflater.from(activity); RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.exit_dialog, null); dialog = new AlertDialog.Builder(activity).create(); dialog.setCancelable(false); dialog.show(); dialog.getWindow().setContentView(layout); Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel); Button drop_out = (Button) layout.findViewById(R.id.drop_out); drop_out.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); activity.finish(); } }); exit_cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ToDoItem toDoItem = mItems.get(position); LayoutInflater inflater = LayoutInflater.from(mContext); RelativeLayout itemLayout = (RelativeLayout) inflater.inflate(R.layout.todo_item, null); final TextView titleView = (TextView) itemLayout.findViewById(R.id.titleView); titleView.setText(toDoItem.getTitle()); final CheckBox statusView = (CheckBox) itemLayout.findViewById(R.id.statusCheckBox); statusView.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { log("Entered onCheckedChanged()"); ToDoItem.Status status = isChecked ? ToDoItem.Status.DONE : ToDoItem.Status.NOTDONE; toDoItem.setStatus(status); } }); final TextView priorityView = (TextView) itemLayout.findViewById(R.id.priorityView); priorityView.setText(toDoItem.getPriority().toString()); final TextView dateView = (TextView) itemLayout.findViewById(R.id.dateView); dateView.setText(ToDoItem.FORMAT.format(toDoItem.getDate())); // Return the View you just created return itemLayout; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); RelativeLayout root = (RelativeLayout) inflater.inflate(R.layout.fragment_networks_list, container, false); listview = (ListView) root.findViewById(R.id.networks_list); wifiListAdapter = new WifiListAdapter(getActivity()); listview.setAdapter(wifiListAdapter); noNetworksMessage = root.findViewById(R.id.message_group); if (savedInstanceState != null) { if (savedInstanceState.containsKey(NETWORKS_FOUND)) { Parcelable[] storedNetworksFound = savedInstanceState.getParcelableArray(NETWORKS_FOUND); networksFound = new WiFiNetwork[storedNetworksFound.length]; for (int i = 0; i < storedNetworksFound.length; ++i) networksFound[i] = (WiFiNetwork) storedNetworksFound[i]; onScanFinished(networksFound); } if (savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) { setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION)); } } registerForContextMenu(listview); listview.setOnItemClickListener(this); return root; }
/** 删除好友对话框(中部) */ private void showDeleteFriendDialog2() { LayoutInflater inflater = LayoutInflater.from(this); RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.dialog_invite, null); // 对话框 final Dialog dialog = new AlertDialog.Builder(UserInfoActivity.this).create(); dialog.show(); dialog.getWindow().setContentView(layout); TextView dialog_info = (TextView) layout.findViewById(R.id.dialog_info); TextView invite_cancel = (TextView) layout.findViewById(R.id.invite_cancel); TextView invite_sure = (TextView) layout.findViewById(R.id.invite_sure); dialog_info.setText("你真的要狠心删除Ta吗?"); invite_cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); invite_sure.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); deleteFriend(); } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { RelativeLayout root = (RelativeLayout) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); ImageButton xda = (ImageButton) root.findViewById(R.id.xda); xda.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse("http://forum.xda-developers.com/showthread.php?t=2334554"))); } }); ImageButton github = (ImageButton) root.findViewById(R.id.github); github.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/dslnexus/rashr"))); } }); mDrawerListView = (ListView) root.findViewById(R.id.lvNavigation); mDrawerListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); return root; }
/** Called when the activity is first created. */ @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { toDelete = new ArrayList<Item>(); RelativeLayout layout = (RelativeLayout) inflater.inflate(getLayout(), container, false); ListView listView = (ListView) layout.findViewById(android.R.id.list); ImageButton addButton = (ImageButton) layout.findViewById(R.id.editAddButton); ImageButton removeButton = (ImageButton) layout.findViewById(R.id.editRemoveButton); addButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), com.iaco.testapp.EditActivity.class); startActivityForResult(intent, 1001); } }); removeButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { for (Item item : toDelete) { m_dao.delete(item); } refreshList(); } }); return layout; }
/** init drop down style, only init once */ private void initDropDownStyle() { if (headerLayout != null) { if (isDropDownStyle) { addHeaderView(headerLayout); } else { removeHeaderView(headerLayout); } return; } if (!isDropDownStyle) { return; } headerReleaseMinDistance = context .getResources() .getDimensionPixelSize(R.dimen.drop_down_list_header_release_min_distance); flipAnimation = new RotateAnimation( 0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); flipAnimation.setInterpolator(new LinearInterpolator()); flipAnimation.setDuration(250); flipAnimation.setFillAfter(true); reverseFlipAnimation = new RotateAnimation( -180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); reverseFlipAnimation.setInterpolator(new LinearInterpolator()); reverseFlipAnimation.setDuration(250); reverseFlipAnimation.setFillAfter(true); headerDefaultText = context.getString(R.string.drop_down_list_header_default_text); headerPullText = context.getString(R.string.drop_down_list_header_pull_text); headerReleaseText = context.getString(R.string.drop_down_list_header_release_text); headerLoadingText = context.getString(R.string.drop_down_list_header_loading_text); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); headerLayout = (RelativeLayout) inflater.inflate(R.layout.drop_down_list_header, this, false); headerText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_default_text); headerImage = (ImageView) headerLayout.findViewById(R.id.drop_down_list_header_image); headerProgressBar = (ProgressBar) headerLayout.findViewById(R.id.drop_down_list_header_progress_bar); headerSecondText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_second_text); headerLayout.setClickable(true); headerLayout.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { onDropDown(); } }); headerText.setText(headerDefaultText); addHeaderView(headerLayout); measureHeaderLayout(headerLayout); headerOriginalHeight = headerLayout.getMeasuredHeight(); headerOriginalTopPadding = headerLayout.getPaddingTop(); currentHeaderStatus = HEADER_STATUS_CLICK_TO_LOAD; }
/** init on bottom style, only init once */ private void initOnBottomStyle() { if (footerLayout != null) { if (isOnBottomStyle) { addFooterView(footerLayout); } else { removeFooterView(footerLayout); } return; } if (!isOnBottomStyle) { return; } footerDefaultText = context.getString(R.string.drop_down_list_footer_default_text); footerLoadingText = context.getString(R.string.drop_down_list_footer_loading_text); footerNoMoreText = context.getString(R.string.drop_down_list_footer_no_more_text); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); footerLayout = (RelativeLayout) inflater.inflate(R.layout.drop_down_list_footer, this, false); footerButton = (Button) footerLayout.findViewById(R.id.drop_down_list_footer_button); footerButton.setDrawingCacheBackgroundColor(0); footerButton.setEnabled(true); footerProgressBar = (ProgressBar) footerLayout.findViewById(R.id.drop_down_list_footer_progress_bar); addFooterView(footerLayout); }
public AnimateRssItem(Context context, final AnimateRss rss, Intent callOutIntent) { super(context); app = (App) context.getApplicationContext(); this.rss = rss; RelativeLayout rl = (RelativeLayout) ((Activity) context).getLayoutInflater().inflate(R.layout.item_rss_animate, null); ivThumb = (ImageView) rl.findViewById(R.id.imageView_rss_animate_thumb); tvTitle = (TextView) rl.findViewById(R.id.textView_rss_animate_title); tvLength = (TextView) rl.findViewById(R.id.textView_rss_animate_length); tvTotal = (TextView) rl.findViewById(R.id.textView_rss_animate_total); if (rss.getRanking() == 0) { tvTitle.setText(rss.getTitle()); } else { tvTitle.setText("第" + rss.getRanking() + "位:" + rss.getTitle()); } tvLength.setText(rss.getNicoInfoLength()); String total = "Play:<font color='#0000a0'>" + rss.getNicoInfoTotalView() + "</font>" + " Res:<font color='#0000a0'>" + rss.getNicoInfoTotalRes() + "</font>" + " My:<font color='#0000a0'>" + rss.getNicoInfoTotalMylist() + "</font>"; tvTotal.setText(Html.fromHtml(total)); this.addView(rl); }
private void init() { ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); mArrayShowView = new ArrayList<View>(); for (int i = 0; i < mArrayShowImageId.length; i++) { RelativeLayout relative = null; relative = (RelativeLayout) getLayoutInflater().inflate(R.layout.viewpager_guide, null); ImageView image = (ImageView) relative.findViewById(R.id.viewpager_image); image.setBackgroundResource(mArrayShowImageId[i]); if (i == mArrayShowImageId.length - 1) { Button button = (Button) relative.findViewById(R.id.btn_viewpager); button.setVisibility(View.VISIBLE); button.setOnClickListener( new OnClickListener() { public void onClick(View arg0) { // 屏蔽掉引导界面 BaseApplication.getInstance().getShared().putBoolean(Config.IS_NEED_GUIDE, true); // startActivity(new Intent(GuideActivity.this, // MainActivity.class)); startActivity(new Intent(GuideActivity.this, MainFragmentActivity.class)); finish(); getActivityInFromRight(); } }); } mArrayShowView.add(relative); } viewPager.setAdapter(mypager); }
public ViewHolder(RelativeLayout v) { super(v); mFirstLine = (TextView) v.findViewById(R.id.firstLine); mSecondLine = (TextView) v.findViewById(R.id.secondLine); mProfileImage = (ImageView) v.findViewById(R.id.icon); mGroupId = (TextView) v.findViewById(R.id.groupId); }
void clearImageViews() { final RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent); try { for (int i = 1; i < 10; i++) { String action1 = zero + i; String action2 = X + i; final ImageView view1 = (ImageView) parent.findViewById((R.id.class.getField(action1).getInt(null))); view1.setVisibility(View.INVISIBLE); final ImageView view2 = (ImageView) parent.findViewById((R.id.class.getField(action2).getInt(null))); view2.setVisibility(View.INVISIBLE); } /* * final View winner = (View) * parent.findViewById(R.id.class.getField( "winner").getInt(null)); * winner.setVisibility(View.INVISIBLE); final View tie = (View) * parent.findViewById(R.id.class.getField( "tie").getInt(null)); * tie.setVisibility(View.INVISIBLE); */ } catch (Exception e) { e.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getIntent().getExtras(); ID = bundle.getString("ID"); mText = (EditText) findViewById(R.id.text); RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.btnSend); TextView title = (TextView) relativeLayout.findViewById(R.id.text); title.setTypeface( Typeface.createFromAsset( SendWrongInfoActivity.this.getAssets(), "fonts/ProximaNova-Bold.otf")); ImageButton imageButton = (ImageButton) relativeLayout.findViewById(R.id.button); imageButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { String text = mText.getText().toString(); if ((text != null) && (text.length() > 0)) { Intent intent = new Intent(); intent.putExtra("text", text); setResult(RESULT_OK, intent); } finish(); } }); }
public void closeCurrentTab(View v) { int pos = (Integer) v.getTag(); ProgressBar PB = (ProgressBar) MainActivity.webLayout.findViewById(R.id.webpgbar); ImageButton BookmarkButton = (ImageButton) MainActivity.bar.findViewById(R.id.browser_bookmark); ImageButton refreshButton = (ImageButton) MainActivity.bar.findViewById(R.id.browser_refresh); if ((pos) <= (webWindows.size() - 1)) { webWindows.get(pos).loadUrl("about:blank"); if (webLayout.findViewById(R.id.browser_page) == webWindows.get(pos)) { if ((pos - 1) >= 0) { ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).removeAllViews(); ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).addView(webWindows.get(pos - 1)); if (((TextView) bar.findViewById(R.id.browser_searchbar)) != null && webWindows.get(pos - 1).getUrl() != null) { webWindows.get(pos - 1).setUrlBarText(webWindows.get(pos - 1).getUrl()); } if (webWindows.get(pos - 1).getProgress() < 100) { PB.setVisibility(View.VISIBLE); refreshButton.setImageResource(R.drawable.btn_toolbar_stop_loading_normal); } else { PB.setVisibility(View.INVISIBLE); refreshButton.setImageResource(R.drawable.btn_toolbar_reload_normal); } System.out.println("CLOSED" + webWindows.get(pos - 1).getProgress()); // Find out if already a bookmark String bookmarkName = null; if (webWindows.get(pos - 1) != null && webWindows.get(pos - 1).getUrl() != null) { bookmarkName = BookmarksActivity.bookmarksMgr.root.containsBookmarkDeep( webWindows.get(pos - 1).getUrl()); } if (bookmarkName != null) { BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_selected_normal); } else { BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_normal); } } else { ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).removeAllViews(); if (((TextView) bar.findViewById(R.id.browser_searchbar)) != null) ((TextView) bar.findViewById(R.id.browser_searchbar)).setText(""); ImageView IV = new ImageView(ctxt); IV.setLayoutParams( new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); IV.setScaleType(ImageView.ScaleType.CENTER); IV.setImageResource(R.drawable.web_logo); ((ViewGroup) webLayout.findViewById(R.id.webviewholder)).addView(IV); PB.setVisibility(View.INVISIBLE); BookmarkButton.setImageResource(R.drawable.btn_omnibox_bookmark_normal); refreshButton.setImageResource(R.drawable.btn_toolbar_reload_normal); } } webWindows.remove(pos); } browserListViewAdapter.notifyDataSetChanged(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO - Get the current ToDoItem final ToDoItem toDoItem = (ToDoItem) getItem(position); // TODO - Inflate the View for this ToDoItem // from todo_item.xml. LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); RelativeLayout itemLayout = (RelativeLayout) inflater.inflate(R.layout.todo_item, null); // TODO - Fill in specific ToDoItem data // Remember that the data that goes in this View // corresponds to the user interface elements defined // in the layout file // TODO - Display Title in TextView final TextView titleView = (TextView) itemLayout.findViewById(R.id.titleView); titleView.setText(toDoItem.getTitle()); // TODO - Set up Status CheckBox final CheckBox statusView = (CheckBox) itemLayout.findViewById(R.id.statusCheckBox); statusView.setChecked(toDoItem.getStatus().equals(Status.DONE)); statusView.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { log("Entered onCheckedChanged()"); // TODO - Set up and implement an OnCheckedChangeListener, which // is called when the user toggles the status checkbox if (isChecked) { toDoItem.setStatus(Status.DONE); statusView.setChecked(true); } else { toDoItem.setStatus(Status.NOTDONE); statusView.setChecked(false); } } }); // TODO - Display Priority in a TextView final TextView priorityView = (TextView) itemLayout.findViewById(R.id.priorityView); priorityView.setText(toDoItem.getPriority().toString()); // TODO - Display Time and Date. // Hint - use ToDoItem.FORMAT.format(toDoItem.getDate()) to get date and time String final TextView dateView = (TextView) itemLayout.findViewById(R.id.dateView); dateView.setText(ToDoItem.FORMAT.format(toDoItem.getDate())); // Return the View you just created return itemLayout; }
@Override public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { String name = handleString( (String) dataList.get(position).get(ImageSelectedActivity.KEY_SRC_DATA_PATH)); boolean hasFile = hasFile(Config.SDCARD_MOFA + name); if (!hasFile || !isFile(Config.SDCARD_MOFA + name)) { if (!hasFile(Config.SDCARD_MOFA)) { File f = new File(Config.SDCARD_MOFA); f.mkdirs(); } if (ImageSelectedActivity.isNetworkConnected(getActivity())) { if (ImageSelectedActivity.isWifi(getActivity())) { DownLoadImageFilesWithIon( (String) dataList.get(position).get(ImageSelectedActivity.KEY_SRC_DATA_PATH)); } else { LayoutInflater inflater = LayoutInflater.from(getActivity()); RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.layout_dialog, null); DefaultFontInflator.applyRecursive(getActivity(), layout); final Dialog dialog = new AlertDialog.Builder(getActivity()).create(); dialog.show(); dialog.getWindow().setContentView(layout); ((TextView) layout.findViewById(R.id.dialog_text)).setText("现在不是WiFi状态,真下载吗?"); // 取消按钮 Button btnCancel = (Button) layout.findViewById(R.id.dialog_cancel); btnCancel.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); // 确定按钮 Button btnOK = (Button) layout.findViewById(R.id.dialog_ok); btnOK.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { DownLoadImageFilesWithIon( (String) dataList.get(position).get(ImageSelectedActivity.KEY_SRC_DATA_PATH)); dialog.dismiss(); } }); } } else { Toast.makeText(getActivity(), "美美的图片联网就可以下载哦~亲~~", Toast.LENGTH_SHORT).show(); } } else { Intent intent = new Intent(getActivity(), HandleImageActivity.class); intent.putExtra(ImageSelectedActivity.INTENT_EXTRA_NAME_IMAGE_SELECTED, name); intent.putExtra("network", true); startActivity(intent); getActivity().finish(); getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.ani_static); } }
private void init(Context context) { // Load all of the animations we need in code rather than through XML // rotate relatively to center to 180 degrees mFlipAnimation = new RotateAnimation( 0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mFlipAnimation.setInterpolator(new LinearInterpolator()); mFlipAnimation.setDuration(250); mFlipAnimation.setFillAfter(true); // rotate relatively to center to 180 degrees back mReverseFlipAnimation = new RotateAnimation( -180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); mReverseFlipAnimation.setInterpolator(new LinearInterpolator()); mReverseFlipAnimation.setDuration(250); mReverseFlipAnimation.setFillAfter(true); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // get root relative layout of additional top view mRefreshView = (RelativeLayout) mInflater.inflate(R.layout.romanblack_coupon_pull_to_refresh_header, this, false); mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.romanblack_coupon_pull_to_refresh_text); mRefreshViewImage = (ImageView) mRefreshView.findViewById(R.id.romanblack_coupon_pull_to_refresh_image); mRefreshViewProgress = (ProgressBar) mRefreshView.findViewById(R.id.romanblack_coupon_pull_to_refresh_progress); mRefreshViewLastUpdated = (TextView) mRefreshView.findViewById(R.id.romanblack_coupon_pull_to_refresh_updated_at); mRefreshViewImage.setMinimumHeight(50); mRefreshView.setOnClickListener(new OnClickRefreshListener()); mRefreshOriginalTopPadding = mRefreshView.getPaddingTop(); mRefreshState = TAP_TO_REFRESH; addHeaderView(mRefreshView); super.setOnScrollListener(this); measureView(mRefreshView); mRefreshViewHeight = mRefreshView.getMeasuredHeight(); }
public EventController( Activity activity, RelativeLayout titleLayout, LinearLayout commentLayout) { this.activity = activity; engine = NewBornApplication.getDbEngine(); prefEditor = NewBornApplication.getPrefEditor(); this.comment = (EditText) commentLayout.findViewById(R.id.comment_edit_text); this.title = (TextView) titleLayout.findViewById(R.id.title); titleImage = (ImageView) titleLayout.findViewById(R.id.dialog_icon); }
// Metodo que despliega un DatePicker para seleccionar la fecha del filtro. public void abrirDialogoFecha() { // Se crea una ventana de dialogo tomando en cuenta un layout que contiene un DatePicker y tres // botones (Aceptar, Reset y Cancelar). final Dialog dialogoFecha = new Dialog(this); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); final RelativeLayout vistaDialogoFecha = (RelativeLayout) inflater.inflate(R.layout.fecha, null); final Button boton1 = (Button) vistaDialogoFecha.findViewById(R.id.Aceptar); final Button boton2 = (Button) vistaDialogoFecha.findViewById(R.id.Reset); final Button boton3 = (Button) vistaDialogoFecha.findViewById(R.id.Cancelar); final DatePicker datePicker = (DatePicker) vistaDialogoFecha.findViewById(R.id.DatePicker); // Para el boton "Aceptar", se toma la fecha establecida por el usuario a partir del DatePicker // y // Se guarda el valor de la fecha en la variable fecha. boton1.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { datePicker.clearFocus(); annio = datePicker.getYear(); mes = datePicker.getMonth() + 1; dia = datePicker.getDayOfMonth(); dialogoFecha.dismiss(); Toast.makeText( getBaseContext(), "Fecha: " + reacomodar(annio) + "-" + reacomodar(mes) + "-" + reacomodar(dia), Toast.LENGTH_SHORT) .show(); fecha = reacomodar(annio) + "-" + reacomodar(mes) + "-" + reacomodar(dia); } }); // Para el boton "Reset", se reestablecen los valores del DatePicker. boton2.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { final Calendar c = Calendar.getInstance(); datePicker.updateDate( c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)); } }); // Para el boton "Cancelar", se desaparece la ventana de Dialogo. boton3.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { dialogoFecha.cancel(); } }); // Se establece la vista para la ventana y se muestra. dialogoFecha.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogoFecha.setContentView(vistaDialogoFecha); dialogoFecha.show(); }
// private String formContent; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); inflater = LayoutInflater.from(this); Intent intent = this.getIntent(); // position = intent.getIntExtra("position", 0); setContentView(R.layout.form_survey_ask_record_other_info); init(); bottomBarLayout = (RelativeLayout) this.findViewById(R.id.form_bottom); if (bottomBarLayout == null) { return; } reportCase = (TextView) bottomBarLayout.findViewById(R.id.report_case); posPrint = (TextView) bottomBarLayout.findViewById(R.id.pos_print); reportCase.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Dialog.showDialog( Dialog.OKCANCEL, ActivityFormWitnessRecoredOtherInfo.this, myHandler, Msg.PROMPT_PRINT, "提示", "如需打印先打印,上报后将无法打印,是否继续上报?", 0, ""); // // reportCaseProcess(); // Toast.makeText(ActivityForm.this, "hhhhhh", Toast.LENGTH_SHORT); } }); if (Config.currentFormList.get(Config.bdPositionId).getState() != null) { if (!Config.currentFormList.get(Config.bdPositionId).getState().equals("")) { reportCase.setVisibility(View.GONE); setEditTextLock(); } } posPrint.setVisibility(View.GONE); // 暂时隐藏 posPrint.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { posPrintProcess(); } }); if (Config.threadGetCaseInfo == null) { Config.threadGetCaseInfo = new ThreadGetCaseInfo(); Config.threadGetCaseInfo.showProcess(this, myHandler, 0, Config.caseId); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.specs); if (movieUrl != null && movieName != null && movieURL != null && movieID != 0) { System.out.println("Ths is test"); RelativeLayout layout = (RelativeLayout) findViewById(R.id.specsLayout); ImageView image = (ImageView) layout.findViewById(R.id.movieImage2); TextView txtview = (TextView) layout.findViewById(R.id.movieName1); TextView txtoverview = (TextView) layout.findViewById(R.id.movieOverview); // aff ListView listView = (ListView) findViewById(R.id.listOfComments); TextView txtrating = (TextView) layout.findViewById(R.id.movieRating1); // TextView casting = (TextView) layout.findViewById(R.id.casting1); // VideoView video=(VideoView) layout.findViewById(R.id.movieTrailer1); // Drawable drawable = LoadImageFromWeb(posterurl); String movieImageUrl = getMovieUrl(); // MediaController mc = new MediaController(this); // mc.setAnchorView(video); // mc.setMediaPlayer(video); // Uri uri=Uri.parse(movieURL); System.out.println("movie ID" + movieID); Bitmap mBitmap; try { if (movieImageUrl == null || movieImageUrl.isEmpty()) { mBitmap = ImageSizerUtility.decodeSampledBitmapFromResource( getResources(), R.drawable.nophoto, 50, 60); } else { // mBitmap = BitmapFactory.decodeStream((InputStream) new // URL(movieImageUrl.toString()).getContent()); mBitmap = ImageSizerUtility.decodeSampledBitmapFromUrl(movieImageUrl, 60, 319); } } catch (Exception e) { Log.e(TAG, "while decoding bitmap", e); throw new RuntimeException(e); } image.setImageBitmap(mBitmap); txtview.setText(movieName); txtoverview.setText(movieOverview + cast); txtrating.setText("Rating : " + Double.toString(rating)); // If trailer url is empty then donot show the play trailer button if (movieURL.isEmpty()) { Button btn = (Button) findViewById(R.id.button1); btn.setVisibility(View.GONE); } } }
/** 初始化控件 */ private void initView() { RelativeLayout headView = (RelativeLayout) this.findViewById(R.id.head); RelativeLayout leftBack = (RelativeLayout) headView.findViewById(R.id.back_left); TextView title = (TextView) headView.findViewById(R.id.head_title); leftBack.setOnClickListener(this); title.setText("意见反馈"); problemText = (EditText) this.findViewById(R.id.problem_text); TextView submit = (TextView) this.findViewById(R.id.sumbit); submit.setOnClickListener(this); }
public static Map<Integer, Button> getAllColorButton(RelativeLayout colorPanelLayout) { Map<Integer, Button> buttonMap = new HashMap<Integer, Button>(); buttonMap.put( Color.rgb(230, 0, 18), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_red_button)); buttonMap.put( Color.rgb(248, 182, 45), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_croci_button)); buttonMap.put( Color.rgb(250, 230, 0), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_yellow_button)); buttonMap.put( Color.rgb(0, 154, 62), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_green_button)); buttonMap.put( Color.rgb(46, 167, 224), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_blue_button)); buttonMap.put( Color.rgb(126, 49, 142), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_purple_button)); buttonMap.put( Color.rgb(181, 181, 182), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_gray_button)); buttonMap.put( Color.rgb(255, 255, 255), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_white_button)); buttonMap.put( Color.rgb(0, 0, 0), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_black_button)); return buttonMap; }