private void setMoreRing() { String[] menustring = new String[] {"设为来电铃声", "设为提示音", "设为闹铃声"}; ListView menulist = new ListView(context); menulist.setCacheColorHint(Color.TRANSPARENT); menulist.setDividerHeight(1); menulist.setAdapter( new ArrayAdapter<String>(context, R.layout.dialog_menu_item, R.id.text1, menustring)); menulist.setLayoutParams( new LayoutParams(MainActivity.getScreen(context)[0] / 2, LayoutParams.WRAP_CONTENT)); final CustomDialog xfdialog = new CustomDialog.Builder(context).setTitle("您要将文件处理为:").setView(menulist).create(); xfdialog.show(); menulist.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { xfdialog.cancel(); xfdialog.dismiss(); if (position == 0) { MainActivity.this.setMyRingtone(); } // 设为来电铃声 else if (position == 1) { MainActivity.this.setMyNotification(); } else if (position == 2) { MainActivity.this.setMyAlarm(); } } }); }
private void MenuChoice() { String[] menustring = new String[] {"刷新音乐列表", "分享当前歌曲", "软件详情", "退出应用"}; ListView menulist = new ListView(context); menulist.setCacheColorHint(Color.TRANSPARENT); menulist.setDividerHeight(1); menulist.setAdapter( new ArrayAdapter<String>( MainActivity.this, R.layout.dialog_menu_item, R.id.text1, menustring)); menulist.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT)); final CustomDialog xfdialog = new CustomDialog.Builder(context).setTitle("菜单选择").setView(menulist).create(); xfdialog.show(); menulist.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { xfdialog.cancel(); xfdialog.dismiss(); if (position == 0) { ScanSDCard(); } else if (position == 1) { ShareMusicFile(); } else if (position == 2) { openDialog(); } else if (position == 3) { MusicPlayerService.manager.cancelAll(); // 清除广播 SharedPreferences sp = getSharedPreferences("service", 0); sp.edit().putBoolean("isStart", false).commit(); sendBroadcast(new Intent(Constant.ACTION_STOP)); MyApplication.getInstance().exit(); } } }); }
@TargetApi(11) @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); playlistName = getIntent().getStringExtra("playlist"); if (null != playlistName && playlistName.length() > 0) { isPlayQueue = false; } MPDApplication app = (MPDApplication) getApplication(); setContentView(R.layout.playlist_editlist_activity); if (isPlayQueue) { this.setTitle(R.string.nowPlaying); } else { this.setTitle(playlistName); } update(); app.oMPDAsyncHelper.addStatusChangeListener(this); ListView trackList = getListView(); trackList.setOnCreateContextMenuListener(this); ((TouchInterceptor) trackList).setDropListener(mDropListener); ((TouchInterceptor) trackList).setRemoveListener(mRemoveListener); trackList.setCacheColorHint(0); Button button = (Button) findViewById(R.id.Remove); button.setOnClickListener(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
private void populateList() { ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setCacheColorHint(0); ((TouchInterceptor) lv).setDragListener(mDragListener); ((TouchInterceptor) lv).setDropListener(mDropListener); lv.setDivider(null); mArray = Page.getAllPages(getContext()); mAdapter = new PageAdapter(getContext(), mArray); setListAdapter(mAdapter); lv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> av, View v, int position, long id) { if (!"settings".equals(mArray.get(position).getKey())) { boolean isEnabled = CalculatorSettings.isPageEnabled(getContext(), mArray.get(position)); CalculatorSettings.setPageEnabled(getContext(), mArray.get(position), !isEnabled); mAdapter.notifyDataSetChanged(); } } }); }
/** * Assigns a value to the backgroundColor * * @param color an alpha-red-green-blue integer for a color */ public void setBackgroundColor(int color) { backgroundColor = color; view.setBackgroundColor(backgroundColor); listViewLayout.setBackgroundColor(backgroundColor); // Keeps background color behind list elements correct when scrolling through listView view.setCacheColorHint(backgroundColor); }
private View getPopupWindowLayout() { if (contentView == null) { if (lAdapter != null) { contentView = new ListView(context); contentView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); contentView.setCacheColorHint(Color.argb(0, 0, 0, 0)); if (backgroundId != 0) { contentView.setBackgroundResource(backgroundId); } else { contentView.setBackgroundColor(Color.argb(0, 0, 0, 0)); } contentView.setPadding( contentPadding[0], contentPadding[1], contentPadding[2], contentPadding[3]); contentView.setFadingEdgeLength(0); if (divider == null) { contentView.setDivider(null); contentView.setDividerHeight(0); } else { contentView.setDivider(divider); contentView.setDividerHeight(dividerHeight); } contentView.setAdapter(lAdapter); } } return contentView; }
/** Create menu drawer ListView and listeners */ private void initMenuDrawer() { mListView = new ListView(this); mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mListView.setDivider(null); mListView.setDividerHeight(0); mListView.setCacheColorHint(android.R.color.transparent); String[] blogNames = getBlogNames(); if (blogNames.length > 1) { addBlogSpinner(blogNames); } mListView.setOnItemClickListener(mItemClickListener); mListView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) {} @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { mMenuDrawer.invalidate(); } }); mMenuDrawer.setMenuView(mListView); updateMenuDrawer(); }
public static void setListViewStyle( ListView view, Drawable divider_drawable, int height_px, boolean show_bar) { view.setCacheColorHint(Color.TRANSPARENT); view.setSelector(new ColorDrawable(Color.TRANSPARENT)); view.setDivider(divider_drawable); view.setDividerHeight(height_px); view.setVerticalScrollBarEnabled(show_bar); }
public TiListView(TiViewProxy proxy, Activity activity) { super(proxy); // initializing variables sections = new ArrayList<ListSectionProxy>(); itemTypeCount = new AtomicInteger(2); templatesByBinding = new HashMap<String, TiListViewTemplate>(); defaultTemplateBinding = UIModule.LIST_ITEM_TEMPLATE_DEFAULT; caseInsensitive = true; // handling marker HashMap<String, Integer> preloadMarker = ((ListViewProxy) proxy).getPreloadMarker(); if (preloadMarker != null) { setMarker(preloadMarker); } else { resetMarker(); } // initializing listView and adapter ListViewWrapper wrapper = new ListViewWrapper(activity); wrapper.setFocusable(false); wrapper.setFocusableInTouchMode(false); listView = new ListView(activity); listView.setLayoutParams( new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); wrapper.addView(listView); adapter = new TiBaseAdapter(activity); // init inflater if (inflater == null) { inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } listView.setCacheColorHint(Color.TRANSPARENT); getLayoutParams().autoFillsHeight = true; getLayoutParams().autoFillsWidth = true; listView.setFocusable(true); listView.setFocusableInTouchMode(true); listView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); try { headerFooterId = TiRHelper.getResource("layout.titanium_ui_list_header_or_footer"); listItemId = TiRHelper.getResource("layout.titanium_ui_list_item"); titleId = TiRHelper.getResource("id.titanium_ui_list_header_or_footer_title"); listContentId = TiRHelper.getResource("id.titanium_ui_list_item_content"); isCheck = TiRHelper.getResource("drawable.btn_check_buttonless_on_64"); hasChild = TiRHelper.getResource("drawable.btn_more_64"); disclosure = TiRHelper.getResource("drawable.disclosure_64"); accessory = TiRHelper.getResource("id.titanium_ui_list_item_accessoryType"); } catch (ResourceNotFoundException e) { Log.e(TAG, "XML resources could not be found!!!", Log.DEBUG_MODE); } this.wrapper = wrapper; setNativeView(wrapper); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reward_history); SharedPreferences sharedprefs = getSharedPreferences(SignInActivity.PREFS_NAME, Context.MODE_PRIVATE); user_id = sharedprefs.getString("USER_ID", ""); ListView menuListView = (ListView) findViewById(R.id.ListView_reward_history); menuListView.setCacheColorHint(Color.BLUE); // TODO change this to get the redeemed rewards RewardImpl myrewardImpl = new RewardImpl(); myrewardsCollection = myrewardImpl.getRewardsCollection(); String[] items = new String[myrewardsCollection.size()]; int i = 0; boolean user_has_rewards = false; String usersID = null; for (Reward reward : myrewardsCollection) { usersID = ((RewardImpl) reward).getUsers(); if (usersID != null && usersID.contains(user_id)) { items[i] = reward.getName(); i++; user_has_rewards = true; } } if (!user_has_rewards) { ((TextView) (findViewById(R.id.txviewRewadrHistory))) .setText("No redeemed rewards for you!", TextView.BufferType.EDITABLE); menuListView.setVisibility(View.INVISIBLE); } else { String[] rewarditems = new String[i]; for (int j = 0; j < i; j++) rewarditems[j] = items[j]; ArrayAdapter<String> adapt = new ArrayAdapter<String>(this, R.layout.menu_item, rewarditems); menuListView.setAdapter(adapt); menuListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position >= 0) { Intent intent = new Intent(RewardHistoryActivity.this, RewardDetailsActivity.class); intent.putExtra("rewardID", myrewardsCollection.get(position).getId()); intent.putExtra("history", "history"); startActivity(intent); } } }); } }
public void initViews() { pbar = (LinearLayout) findViewById(R.id.root_pb); pbar.setVisibility(View.GONE); listview = (ListView) findViewById(R.id.listview); listview.setCacheColorHint(0); twEmpty = (TextView) findViewById(R.id.tw_empty); twEmpty.setTypeface(coust); twEmpty.setVisibility(View.GONE); registerForContextMenu(listview); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); // getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); // curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { lv.addHeaderView(mHeaderView, null, true); } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); // getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); // getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. // showDetails(curCheckPosition, curCheckWizard); } else { // getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
private void initView(LayoutInflater inflater) { mDialogView = inflater.inflate(R.layout.renren_dialog_layout, null); mContentView = mDialogView.findViewById(R.id.renren_dialog_content_layout); mButtonView = mDialogView.findViewById(R.id.button_view); mTitleView = (TextView) mDialogView.findViewById(R.id.renren_dialog_title_view); mMessageView = (TextView) mDialogView.findViewById(R.id.renren_dialog_message_view); mEditText = (SearchEditText) mDialogView.findViewById(R.id.renren_dialog_edit_text); mCheckView = mDialogView.findViewById(R.id.renren_dialog_check_layout); mCheckBox = (CheckBox) mDialogView.findViewById(R.id.renren_dialog_check_box); mCheckMessageView = (TextView) mDialogView.findViewById(R.id.renren_dialog_check_message_view); mCancelBtn = (Button) mDialogView.findViewById(R.id.renren_dialog_cancel_btn); mOkBtn = (Button) mDialogView.findViewById(R.id.renren_dialog_ok_btn); mBtnDivider = mDialogView.findViewById(R.id.renren_dialog_btn_divider); mDiliver = mDialogView.findViewById(R.id.renren_dialog_divider); mListView = (ListView) mDialogView.findViewById(R.id.renren_dialog_list_view); mListView.setVerticalFadingEdgeEnabled(false); mListView.setScrollingCacheEnabled(false); mListView.setCacheColorHint(0); mEditText.setIsShowLeftIcon(false); mCancelBtn.setOnClickListener( new android.view.View.OnClickListener() { @Override public void onClick(View v) { AppMethods.hideSoftInputMethods(mEditText); dismiss(); if (mNegativeBtnClickListener != null) { mNegativeBtnClickListener.onClick(v); } if (mNegativeBinderOnClickListener != null && mBinder != null) { mNegativeBinderOnClickListener.OnClick(v, mBinder); } } }); mOkBtn.setOnClickListener( new android.view.View.OnClickListener() { @Override public void onClick(View v) { AppMethods.hideSoftInputMethods(mEditText); dismiss(); if (mPositiveBtnClickListener != null) { mPositiveBtnClickListener.onClick(v); } if (mPositiveBinderOnClickListener != null && mBinder != null) { mPositiveBinderOnClickListener.OnClick(v, mBinder); } } }); }
@Override public void onResume() { super.onResume(); setContentView(R.layout.moreventsbybusiness); vctEmails = new ArrayList<String>(); userActBL = new UserAccountBusinessLayer(); friendBL = new FriendsBusinessLayer(); context = this; objDrawableManager = new DrawableManager(); strBusinessName = getIntent().getExtras().getString(BUSINESSNAME); businessId = getIntent().getExtras().getInt(BUSINESSID); objEventBL = new EventsBusinessLayer(); vctEventDetails = new ArrayList<EventsDetails>(); llMoreEvents = (LinearLayout) findViewById(R.id.llMoreEvents); lvMoreEvents = (ListView) findViewById(R.id.lvMoreEvents); lvMoreEvents.setCacheColorHint(0); lvMoreEvents.setScrollbarFadingEnabled(true); vctEventDetails = objEventBL.getEventsByBusiness(businessId); if (vctEventDetails != null) if (vctEventDetails.size() != 0) lvMoreEvents.setAdapter( objCustomMoreEventsAdapter = new CustomMoreEventsAdapter(vctEventDetails)); if (objCustomMoreEventsAdapter != null) objCustomMoreEventsAdapter.refresh(vctEventDetails); TabsActivity.btnBack.setVisibility(View.VISIBLE); TabsActivity.btnLogout.setVisibility(View.INVISIBLE); TabsActivity.tvTitle.setText(getResources().getString(R.string.events_by) + strBusinessName); TabsActivity.rlCommonTitleBar.setBackgroundResource(R.drawable.top_bar_empty); TabsActivity.btnLogout.setVisibility(View.VISIBLE); TabsActivity.rlCommonTitleBar.invalidate(); TabsActivity.btnBack.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { TabGroupActivity pActivity = (TabGroupActivity) MoreEventsByBusiness.this.getParent(); pActivity.finishFromChild(MoreEventsByBusiness.this); } }); TabsActivity.btnLogout.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MoreEventsByBusiness.this, Login.class); startActivity(intent); TabsActivity.tabActivity.finish(); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_xiaoer); List<Map<String, Object>> listItems = new ArrayList<Map<String, Object>>(); for (int i = 0; i < names.length; i++) { Map<String, Object> listItem = new HashMap<String, Object>(); listItem.put("header", imageIds[i]); listItem.put("personName", names[i]); listItems.add(listItem); } // 创建一个simpleAdapter SimpleAdapter simpleAdapter = new SimpleAdapter( this, listItems, R.layout.celan_item, new String[] {"personName", "header"}, // new String[] {"personName","header"}, new int[] {R.id.name, R.id.header}); // new int[] {R.id.name,R.id.header}); ListView list = (ListView) findViewById(R.id.listietem); // 为ListView设置Adapter list.setAdapter(simpleAdapter); list.setCacheColorHint(Color.TRANSPARENT); // 消除listview滑动缓存 list.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub if (position == 0) { Intent classfyIntent = new Intent(XiaoerActiviy.this, TunaiActivity.class); startActivity(classfyIntent); } else if (position == 1) { Intent classfyIntent = new Intent(XiaoerActiviy.this, GaoshaoActivity.class); startActivity(classfyIntent); } else if (position == 2) { Intent classfyIntent = new Intent(XiaoerActiviy.this, YeshiActivity.class); startActivity(classfyIntent); } else if (position == 3) { Intent classfyIntent = new Intent(XiaoerActiviy.this, MazhenActivity.class); startActivity(classfyIntent); } else if (position == 4) { Intent classfyIntent = new Intent(XiaoerActiviy.this, FeiyanActivity.class); startActivity(classfyIntent); } } }); }
public Leaderboard(Context context, String kind, String selectedContest) { super(context, R.style.ThemeBeintoo); setContentView(R.layout.leaderboardlist); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.current = this; this.currentContext = context; this.leader_kind = kind; this.codeID = selectedContest; // GETTING DENSITY PIXELS RATIO ratio = (context.getApplicationContext().getResources().getDisplayMetrics().densityDpi / 160d); // SET UP LAYOUTS double pixels = ratio * 40; RelativeLayout beintooBar = (RelativeLayout) findViewById(R.id.beintoobarsmall); beintooBar.setBackgroundDrawable( new BDrawableGradient(0, (int) pixels, BDrawableGradient.BAR_GRADIENT)); listView = (ListView) findViewById(R.id.listView); listView.setVisibility(LinearLayout.GONE); listView.setCacheColorHint(0); LinearLayout content = (LinearLayout) findViewById(R.id.goodcontent); content.addView(progressLoading()); LinearLayout tip = (LinearLayout) findViewById(R.id.tip); tip.setBackgroundDrawable( new BDrawableGradient(0, (int) (ratio * 27), BDrawableGradient.LIGHT_GRAY_GRADIENT)); if (!Beintoo.isLogged( context)) { // IF THE USER IS NOT LOGGED HIDE TIPS FOR CHALLENGE AND SHOW SIGNUP BUTTON tip.setVisibility(LinearLayout.GONE); LinearLayout signup = (LinearLayout) findViewById(R.id.signupPlayer); signup.addView(SignupLayouts.signupRow(context, Beintoo.FEATURE_LEADERBOARD)); signup.setVisibility(View.VISIBLE); } if (leader_kind != null && leader_kind.equals("ALLIANCES")) { findViewById(R.id.tip).setVisibility(View.GONE); findViewById(R.id.spacer).setVisibility(View.GONE); } imageManager = new ImageManager(currentContext); usersExts = new ArrayList<String>(); usersNicks = new ArrayList<String>(); listView.setOnItemClickListener(this); listView.setOnScrollListener(this); this.firstLoading(); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); ListView lv = new ListView(this); lv.setId(android.R.id.list); lv.setCacheColorHint(getResources().getColor(R.color.activity_background)); lv.setDivider(getResources().getDrawable(R.drawable.tab_text_separator)); setContentView(lv); settings = ((OsmandApplication) getApplication()).getSettings(); favouritesAdapter = new FavouritesAdapter( ((OsmandApplication) getApplication()).getFavorites().getFavouritePoints()); setListAdapter(favouritesAdapter); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.workstatistics); bundle = this.getIntent().getExtras(); listView = (ListView) findViewById(R.id.statList); listView.setCacheColorHint(0); listView.setAlwaysDrawnWithCacheEnabled(true); // webview=(WebView)findViewById(R.id.webview); id = Integer.parseInt(getIdByUsername()); queryDatebase(); fillItemList(); // drawChart(); }
private void initAttrs(Context context, AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BGASelectView); mListView = (ListView) View.inflate( getContext(), typedArray.getResourceId( R.styleable.BGASelectView_sv_listViewLayoutId, R.layout.selectview_popwindow), null); mListView.setCacheColorHint(context.getResources().getColor(android.R.color.transparent)); mListView.setOnItemClickListener(this); if (Build.VERSION.SDK_INT >= 9) { mListView.setOverScrollMode(View.OVER_SCROLL_NEVER); } typedArray.recycle(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Setup views & listener View v = inflater.inflate(R.layout.list_view_with_spinner, null); listView = (ListView) v.findViewById(R.id.list); ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.progress); // disable touch feedback (you can't click the elements here...) listView.setCacheColorHint(android.R.color.transparent); listView.setSelector(R.drawable.transparent); // Either reload data if returning from another fragment/activity // Or get data if viewing fragment for the first time. if (adapter != null) { listView.setAdapter(adapter); listView.onRestoreInstanceState(listState); progressBar.setVisibility(View.GONE); } return v; }
/** Change foreground/background color in a view. */ public static void overrideFonts(final View v) { if (v == null) return; final int bg = ColorTheme.instance().getColor(ColorTheme.GENERAL_BACKGROUND); final boolean excludedItems = v instanceof Button || v instanceof EditText || v instanceof ImageButton || "title".equals(v.getTag()); if (!excludedItems) v.setBackgroundColor(bg); if (v instanceof ListView) ((ListView) v).setCacheColorHint(bg); if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { View child = vg.getChildAt(i); overrideFonts(child); } } else if ((v instanceof TextView) && !excludedItems) { int fg = ColorTheme.instance().getColor(ColorTheme.FONT_FOREGROUND); ((TextView) v).setTextColor(fg); } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FlightOrderListActivity activity = (FlightOrderListActivity) getActivity(); footerView = LayoutInflater.from(activity).inflate(R.layout.list_loading_footer, null); footerContent = footerView.findViewById(R.id.content); mContentView = new ListView(getActivity()); mContentView.setDivider(null); mContentView.setDividerHeight(0); mContentView.setCacheColorHint(0xffe9e9e9); mContentView.setOnScrollListener(onScrollListener); mContentView.addFooterView(footerView, null, false); setContentView(mContentView); setEmptyText("暂无订单"); mContentView.setAdapter(activity.adapter); footerContent.setVisibility(View.GONE); activity.getOrderList(); setContentShown(false); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rod = inflater.inflate(R.layout.nav1_overfoersler_frag, container, false); aq = new AQuery(rod); listView = aq.id(R.id.listView).adapter(adapter).itemClicked(this).getListView(); View emptyView = aq.id(R.id.tom).getView(); listView.setEmptyView(emptyView); listView.setCacheColorHint(Color.WHITE); aq.id(R.id.overskrift); aq.id(R.id.supplerende_info).clicked(this); if (App.PRODUKTION) aq.gone(); // hentedeUdsendelser.observatører.add(this); run(); OploadService2.start(); return rod; }
public MVCHelper(IRefreshView refreshView, ILoadView loadView, ILoadMoreView loadMoreView) { super(); this.context = refreshView.getContentView().getContext().getApplicationContext(); this.autoLoadMore = true; this.refreshView = refreshView; contentView = refreshView.getContentView(); contentView.setOverScrollMode(View.OVER_SCROLL_NEVER); refreshView.setOnRefreshListener(onRefreshListener); if (loadMoreView != null) { if (contentView instanceof ListView) { final ListView listView = (ListView) contentView; listView.setCacheColorHint(Color.TRANSPARENT); listView.setOnScrollListener(new ListViewOnScrollListener()); listView.setOnItemSelectedListener(new ListViewOnItemSelectedListener()); mLoadMoreView = loadMoreView; mLoadMoreView.init( new FootViewAdder() { @Override public View addFootView(int layoutId) { View view = LayoutInflater.from(context).inflate(layoutId, listView, false); return addFootView(view); } @Override public View addFootView(View view) { listView.addFooterView(view); return view; } }, onClickLoadMoreListener); } else if (contentView instanceof RecyclerView) { RecyclerView recyclerView = (RecyclerView) contentView; recyclerView.setOnScrollListener(new RecyclerViewOnScrollListener()); mLoadMoreView = loadMoreView; } } mLoadView = loadView; mLoadView.init(refreshView.getSwitchView(), onClickRefresListener); }
public void showAllGa2ooFriendsPopup() { LayoutInflater inflater = getLayoutInflater(); RelativeLayout popup = (RelativeLayout) inflater.inflate(R.layout.all_friends_popup, null); ImageView ivClose = (ImageView) popup.findViewById(R.id.ivClose); Button btnDone = (Button) popup.findViewById(R.id.btnDone); lvFriendsList = (ListView) popup.findViewById(R.id.lvFriendsList); lvFriendsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); lvFriendsList.setCacheColorHint(0); lvFriendsList.setFadingEdgeLength(0); ivClose.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { customDialog.dismiss(); } }); vecFriends = new ArrayList<UserFriend>(); vecFriends.clear(); vecFriends = friendBL.getAllFriends(); if (vecFriends.size() != 0) { lvFriendsList.setAdapter(new CustomFriendAdapter(vecFriends)); } vctEmails.clear(); btnDone.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < vctEmails.size(); i++) { Log.i("Email", "" + vctEmails.get(i)); } customDialog.dismiss(); } }); customDialog = new PopUpDailog(getParent(), popup, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); customDialog.show(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity_frame); ((TextView) findViewById(R.id.list_activity_title)).setText("院系列表"); final List<School> schools = new FileManager(this).getSchoolInfo(); mList = this.getListView(); mList.setCacheColorHint(Color.TRANSPARENT); mList.setAdapter(new SchoolListAdapter(schools)); mList.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(SchoolListActivity.this, PublicCourseListActivity.class); intent.putExtra(Course.KEY_CODE, schools.get(position).mCode); startActivity(intent); } }); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.list_view_with_spinner, null); mListView = (ListView) v.findViewById(R.id.list); ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.progress); TextView nonDistrictWarning = (TextView) v.findViewById(R.id.info_container); if (mAdapter != null) { mListView.setAdapter(mAdapter); mListView.onRestoreInstanceState(mListState); progressBar.setVisibility(View.GONE); } mBinder.listView = mListView; mBinder.progressBar = progressBar; mBinder.nonDistrictWarning = nonDistrictWarning; mBinder.setNoDataView((NoDataView) v.findViewById(R.id.no_data)); // disable touch feedback (you can't click the elements here...) mListView.setCacheColorHint(getResources().getColor(android.R.color.transparent)); mListView.setSelector(R.drawable.transparent); return v; }
@SuppressWarnings("unchecked") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); appContext = this; Bundle bun = getIntent().getExtras(); bookList = (ArrayList<String>) bun.get("BookList"); bookImages = (ArrayList<Bitmap>) bun.get("BookImages"); bookDescriptions = (ArrayList<String>) bun.get("BookDescriptions"); authors = getAuthors(bookDescriptions); bookArray = (String[]) bookList.toArray(new String[0]); I = new IconicAdapter(); setListAdapter(I); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setBackgroundColor(Color.WHITE); lv.setCacheColorHint(Color.WHITE); fileNames = booksInDirectory.list(); lv.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { setPosition(position); Builder builder = new AlertDialog.Builder(appContext); builder.setTitle(bookArray[position]); Drawable d = new BitmapDrawable(bookImages.get(position)); builder.setIcon(d); builder.setMessage(bookDescriptions.get(position)); builder.setPositiveButton( "Download", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { new BookDownloader(showDialog(), bookArray[getPosition()], appContext) .execute(); } }); for (int i = 0; i < fileNames.length; i++) { if (fileNames[i].equals(bookArray[position])) { builder.setPositiveButton( "Delete", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { File deleteDirectory = new File(internalStorage + bookArray[getPosition()]); deleteDir(deleteDirectory); for (int b = 0; b < Global.books.size(); b++) { if (Global.books.get(b).getBookTitle().equals(bookArray[getPosition()])) { Global.books.remove(b); } } updateAdapter(); } }); } } builder.setNegativeButton("Cancel", null); builder.show(); } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(LT, "App created."); Events.intEnableDebug(1); // disable the titlebar requestWindowFeature(Window.FEATURE_NO_TITLE); // create a basic user interface LinearLayout panel = new LinearLayout(this); panel.setOrientation(LinearLayout.VERTICAL); setContentView(panel); // -- Button b = new Button(this); b.setText("Scan Input Devs"); b.setId(idButScan); b.setOnClickListener(this); panel.addView(b); // -- m_lvDevices = new ListView(this); m_lvDevices.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); m_lvDevices.setId(idLVDevices); m_lvDevices.setDividerHeight(0); m_lvDevices.setFadingEdgeLength(0); m_lvDevices.setCacheColorHint(0); m_lvDevices.setAdapter(null); panel.addView(m_lvDevices); // -- LinearLayout panelH = new LinearLayout(this); panelH.setOrientation(LinearLayout.HORIZONTAL); panel.addView(panelH); // -- m_selDevSpinner = new Spinner(this); m_selDevSpinner.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); m_selDevSpinner.setId(idSelSpin); m_selDevSpinner.setOnItemSelectedListener((OnItemSelectedListener) this); panelH.addView(m_selDevSpinner); // -- simulate key event b = new Button(this); b.setText(">Key"); b.setId(idButInjectKey); b.setOnClickListener(this); panelH.addView(b); // -- simulate touch event b = new Button(this); b.setText(">Tch"); b.setId(idButInjectTouch); b.setOnClickListener(this); panelH.addView(b); // -- m_tvMonitor = new TextView(this); m_tvMonitor.setText("Event Monitor stopped."); panel.addView(m_tvMonitor); // -- panelH = new LinearLayout(this); panelH.setOrientation(LinearLayout.HORIZONTAL); panel.addView(panelH); // -- b = new Button(this); b.setText("Monitor Start"); b.setId(idButMonitorStart); b.setOnClickListener(this); panelH.addView(b); // -- b = new Button(this); b.setText("Monitor Stop"); b.setId(idButMonitorStop); b.setOnClickListener(this); panelH.addView(b); // -- simulate test event b = new Button(this); b.setText(">Test"); b.setId(idButTest); b.setOnClickListener(this); panelH.addView(b); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Toast.makeText(this, "Asdf", Toast.LENGTH_SHORT).show(); Tabs.mTitleProgressBar.setVisibility(ProgressBar.VISIBLE); setContentView(R.layout.activity_inicio); mContext = this; listaDeBusquedas = (ListView) findViewById(R.id.list_last_seen); listaDeBusquedas.setCacheColorHint(Color.TRANSPARENT); String coordinates[] = {"-33.44", "-70.54"}; lat = Double.parseDouble(coordinates[0]); lng = Double.parseDouble(coordinates[1]); locMgr = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); locLstnr = new MyLocationListener(); lat = locMgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getLatitude(); lng = locMgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getLongitude(); locMgr.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locLstnr); mPrefs = getSharedPreferences("loginDrPastillo", 0); msgThread = new Thread() { public void run() { try { ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add( new BasicNameValuePair("idUsuario", "" + mPrefs.getInt("idUsuario", 0))); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(getString(R.string.getSearch)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { System.out.println("fail maximo: " + e.toString()); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); } catch (Exception e) { System.out.println("Error converting result " + e.toString()); } try { jArray = new JSONArray(result); } catch (JSONException e) { jArray = null; } try { System.out.println("y aca está la segunda"); ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("lat", "" + lat)); nameValuePairs.add(new BasicNameValuePair("lon", "" + lng)); System.out.println("Lat: " + lat + " Lng: " + lng); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://www.qwarety.com/probandoCosas/prueba/jko/config/getLatestEdited.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is2 = entity.getContent(); } catch (Exception e) { System.out.println("fail maximo: " + e.toString()); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is2, "ISO-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is2.close(); result2 = sb.toString(); System.out.println("result2: " + result2); } catch (Exception e) { System.out.println("Error converting result " + e.toString()); } try { jArray2 = new JSONArray(result2); } catch (JSONException e) { jArray2 = null; } adapter = new ListDataNoPic(mContext, listaDeRemedios); adapter.notifyDataSetChanged(); finishedHandler.sendEmptyMessage(0); } }; if (mPrefs.getInt("ultimosModificados", 0) == 1) { String[] listItems = new String[5]; remedios = new Remedio[5]; for (int i = 0; i < 5; i++) { listItems[i] = mPrefs.getString("nombreReal" + i, ""); remedios[i] = new Remedio( mPrefs.getString("nombreReal" + i, ""), mPrefs.getString("nombreGenerico" + i, ""), mPrefs.getString("cantidad" + i, ""), mPrefs.getString("presentacion" + i, ""), mPrefs.getString("nombreLaboratorio" + i, ""), mPrefs.getInt("idMedicamento" + i, 0)); } listaDeBusquedas.setAdapter( new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, listItems)); listaDeBusquedas.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent i = new Intent(mContext, ListaFarmacias.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra("idMedicamento", remedios[arg2].getId()); i.putExtra("nombreMedicamento", remedios[arg2].getNombreReal()); i.putExtra("laboratorio", remedios[arg2].getLaboratorio()); mContext.getApplicationContext().startActivity(i); } }); } }