/***************Title Bar*****************/ public void onClickBack(object sender, EventArgs e) { if (mTocListPopupWindow.IsShowing) { mTocListPopupWindow.Dismiss(); } else { Finish(); } }
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 OnItemClick(AdapterView parent, Android.Views.View view, int position, long id) { ICursor cursor = (ICursor)mAdapter.GetItem(position); LoadTrack(cursor, true); if (cursor != null) { UIUtils.SetLastUsedTrackID(Activity, cursor.GetString(TracksAdapter.TracksQuery.TRACK_ID)); } else { UIUtils.SetLastUsedTrackID(Activity, ScheduleContract.Tracks.ALL_TRACK_ID); } if (mListPopupWindow != null) { mListPopupWindow.Dismiss(); } }
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); }; }