private void showMinorPopupWindow() { if (mMinors.Count() > 0 && minorAdapter != null) { if (mListPopupWindow == null) { mListPopupWindow = new ListPopupWindow(this); mListPopupWindow.SetAdapter(minorAdapter); mListPopupWindow.Width = (ViewGroup.LayoutParams.MatchParent); mListPopupWindow.Height = (ViewGroup.LayoutParams.WrapContent); mListPopupWindow.AnchorView = (mCommonToolbar); mListPopupWindow.Modal = (true); mListPopupWindow.ItemClick += (sender, e) => { var position = e.Position; minorAdapter.setChecked(position); if (position > 0) { currentMinor = mMinors[position]; } else { currentMinor = ""; } int current = mViewPager.CurrentItem; EventManager.refreshSubCategory(currentMinor, types[current]); mListPopupWindow.Dismiss(); mCommonToolbar.Title = (mMinors[position]); }; } mListPopupWindow.Show(); } }
protected override void OnCreate (Android.OS.Bundle savedInstanceState) { base.OnCreate (savedInstanceState); var mActionBar = ActionBar; mActionBar.SetDisplayHomeAsUpEnabled(true); mActionBar.SetDisplayShowCustomEnabled(true); mActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent))); mActionBar.SetDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.From(this); View mCustomView = mInflater.Inflate(Resource.Layout.samplelist_layout, null); selectedGroup= (Group)MainActivity.SelectedIntent.GetSerializableExtra("sample"); SampleLayout sampleLayouts= new SampleLayout(MainActivity.context,selectedGroup.samples); mActionBar.CustomView = mCustomView; Sample selectedSample=(Sample)selectedGroup.samples[selectedIndex]; SetContentView(Resource.Layout.SamplePage); ImageView imageButton = (ImageView) mCustomView .FindViewById(Resource.Id.imageButton); Context wrapper = new ContextThemeWrapper(this, Android.Resource.Style.Theme); ListPopupWindow popupWindow = new ListPopupWindow(wrapper); popupWindow.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.listpopup)); imageButton.Click += (object sender, EventArgs e) => { popupWindow.Show(); }; popupWindow.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { Sample subSamples = (Sample) selectedGroup.samples[e.Position]; selectedIndex = e.Position; RefreshSample(subSamples); popupWindow.Dismiss(); }; RelativeLayout settingButton = (RelativeLayout) mCustomView .FindViewById(Resource.Id.settingsParent); settingButton.Click += (object sender, EventArgs e) => { onProperyWindowClick(); }; if(selectedGroup.samples.Count<=1) { imageButton.Visibility = ViewStates.Invisible; } popupWindow.AnchorView = imageButton; popupWindow.Width = measureContentWidth(sampleLayouts); popupWindow.SetAdapter(sampleLayouts); RefreshSample (selectedSample); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var mActionBar = ActionBar; mActionBar.SetDisplayHomeAsUpEnabled(true); mActionBar.SetDisplayShowCustomEnabled(true); mActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent))); mActionBar.SetDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.From(this); View mCustomView = mInflater.Inflate(Resource.Layout.samplelist_layout, null); selectedGroup = (Group)MainActivity.SelectedIntent.GetSerializableExtra("sample"); SampleLayout sampleLayouts = new SampleLayout(MainActivity.context, selectedGroup.samples); mActionBar.CustomView = mCustomView; Sample selectedSample = (Sample)selectedGroup.samples[selectedIndex]; SetContentView(Resource.Layout.SamplePage); ImageView imageButton = (ImageView)mCustomView .FindViewById(Resource.Id.imageButton); Context wrapper = new ContextThemeWrapper(this, Android.Resource.Style.Theme); ListPopupWindow popupWindow = new ListPopupWindow(wrapper); popupWindow.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.listpopup)); imageButton.Click += (object sender, EventArgs e) => { popupWindow.Show(); }; popupWindow.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { Sample subSamples = (Sample)selectedGroup.samples[e.Position]; selectedIndex = e.Position; RefreshSample(subSamples); popupWindow.Dismiss(); }; RelativeLayout settingButton = (RelativeLayout)mCustomView .FindViewById(Resource.Id.settingsParent); settingButton.Click += (object sender, EventArgs e) => { onProperyWindowClick(); }; if (selectedGroup.samples.Count <= 1) { imageButton.Visibility = ViewStates.Invisible; } popupWindow.AnchorView = imageButton; popupWindow.Width = measureContentWidth(sampleLayouts); popupWindow.SetAdapter(sampleLayouts); RefreshSample(selectedSample); }
private void initAutoList() { mAutoAdapter = new AutoCompleteAdapter(this, mAutoList); mListPopupWindow = new ListPopupWindow(this); mListPopupWindow.SetAdapter(mAutoAdapter); mListPopupWindow.Width = (ViewGroup.LayoutParams.MatchParent); mListPopupWindow.Height = (ViewGroup.LayoutParams.WrapContent); mListPopupWindow.AnchorView = (mCommonToolbar); mListPopupWindow.ItemClick += (sender, e) => { mListPopupWindow.Dismiss(); TextView tv = e.View.FindViewById <TextView>(Resource.Id.tvAutoCompleteItem); String str = tv.Text.ToString(); search(str); }; }
public void ReloadFromArguments(Bundle arguments) { // Teardown from previous arguments if (mListPopupWindow != null) { mListPopupWindow.SetAdapter(null); } if (mCursor != null) { Activity.StopManagingCursor(mCursor); mCursor = null; } mHandler.CancelOperation(TracksAdapter.TracksQuery._TOKEN); // Load new arguments Intent intent = BaseActivity.FragmentArgumentsToIntent(arguments); Uri tracksUri = intent.Data; if (tracksUri == null) { return; } mNextType = intent.GetStringExtra(EXTRA_NEXT_TYPE); // Filter our tracks query to only include those with valid results String[] projection = TracksAdapter.TracksQuery.PROJECTION; String selection = null; if (TracksFragment.NEXT_TYPE_SESSIONS.Equals(mNextType)) { // Only show tracks with at least one session projection = TracksAdapter.TracksQuery.PROJECTION_WITH_SESSIONS_COUNT; selection = ScheduleContract.Tracks.SESSIONS_COUNT + ">0"; } else if (TracksFragment.NEXT_TYPE_VENDORS.Equals(mNextType)) { // Only show tracks with at least one vendor projection = TracksAdapter.TracksQuery.PROJECTION_WITH_VENDORS_COUNT; selection = ScheduleContract.Tracks.VENDORS_COUNT + ">0"; } // Start background query to load tracks mHandler.StartQuery(TracksAdapter.TracksQuery._TOKEN, null, tracksUri, projection, selection, null, ScheduleContract.Tracks.DEFAULT_SORT); }
public override Android.Views.View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_tracks_dropdown, null); mTitle = (TextView)mRootView.FindViewById(Resource.Id.track_title); mAbstract = (TextView)mRootView.FindViewById(Resource.Id.track_abstract); mRootView.Click += (sender, e) => { mListPopupWindow = new ListPopupWindow(Activity); mListPopupWindow.SetAdapter(mAdapter); mListPopupWindow.Modal = true; mListPopupWindow.SetContentWidth(400); mListPopupWindow.AnchorView = mRootView; mListPopupWindow.SetOnItemClickListener(this); mListPopupWindow.Show(); mListPopupWindow.SetOnDismissListener(this); }; return(mRootView); }
private void initTocList() { mTocListAdapter = new TocListAdapter(this, mChapterList, bookId, currentChapter); mTocListPopupWindow = new ListPopupWindow(this); mTocListPopupWindow.SetAdapter(mTocListAdapter); mTocListPopupWindow.Width = (ViewGroup.LayoutParams.MatchParent); mTocListPopupWindow.Height = (ViewGroup.LayoutParams.WrapContent); mTocListPopupWindow.AnchorView = (mLlBookReadTop); mTocListPopupWindow.ItemClick += (sender, e) => { mTocListPopupWindow.Dismiss(); currentChapter = e.Position + 1; mTocListAdapter.setCurrentChapter(currentChapter); startRead = false; showDialog(); readCurrentChapter(); hideReadBar(); }; mTocListPopupWindow.DismissEvent += (sender, e) => { gone(mTvBookReadTocTitle); visible(mTvBookReadReading, mTvBookReadCommunity, mTvBookReadChangeSource); }; }
public override Android.Views.View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup)inflater.Inflate (Resource.Layout.fragment_tracks_dropdown, null); mTitle = (TextView)mRootView.FindViewById (Resource.Id.track_title); mAbstract = (TextView)mRootView.FindViewById (Resource.Id.track_abstract); mRootView.Click += (sender, e) => { mListPopupWindow = new ListPopupWindow (Activity); mListPopupWindow.SetAdapter (mAdapter); mListPopupWindow.Modal = true; mListPopupWindow.SetContentWidth (400); mListPopupWindow.AnchorView = mRootView; mListPopupWindow.SetOnItemClickListener (this); mListPopupWindow.Show (); mListPopupWindow.SetOnDismissListener (this); }; return mRootView; }