// private static class NavigationCallback extends CustomTabsCallback // { // @Override // public void onNavigationEvent(int navigationEvent, Bundle extras) // { // Log.w(TAG, "onNavigationEvent: Code = " + navigationEvent); // } //} protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.main); mEditText = (EditText)FindViewById(Resource.Id.edit); mConnectButton = (Button)FindViewById(Resource.Id.connect_button); mWarmupButton = (Button)FindViewById(Resource.Id.warmup_button); mMayLaunchButton = (Button)FindViewById(Resource.Id.may_launch_button); mLaunchButton = (Button)FindViewById(Resource.Id.launch_button); var spinner = (Spinner)FindViewById(Resource.Id.spinner); mEditText.RequestFocus(); mConnectButton.SetOnClickListener(this); mWarmupButton.SetOnClickListener(this); mMayLaunchButton.SetOnClickListener(this); mLaunchButton.SetOnClickListener(this); mMediaPlayer = MediaPlayer.Create(this, Resource.Raw.amazing_grace); var activityIntent = new Intent(Intent.ActionView, Uri.Parse("http://www.example.com")); var pm = PackageManager; var resolvedActivityList = pm.QueryIntentActivities(activityIntent, PackageInfoFlags.MatchAll); var packagesSupportingCustomTabs = new List <Pair>(); foreach (var info in resolvedActivityList) { var serviceIntent = new Intent(); serviceIntent.SetAction("android.support.customtabs.action.CustomTabsService"); serviceIntent.SetPackage(info.ActivityInfo.PackageName); if (pm.ResolveService(serviceIntent, 0) != null) { packagesSupportingCustomTabs.Add(Pair.Create(info.LoadLabel(pm), info.ActivityInfo.PackageName)); } } var arrayAdapter = new SpinnerArrayAdapter <Pair>(ApplicationContext, 0, packagesSupportingCustomTabs); spinner.Adapter = arrayAdapter; spinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { var item = arrayAdapter.GetItem(e.Position); if (TextUtils.IsEmpty(item.Second.ToString())) { mPackageNameToBind = null; return; } mPackageNameToBind = item.Second.ToString(); }; mLogImportance = new LogImportance(); mLogImportance.Run(); }
/** * Handles a {@link MotionEvent#ACTION_DOWN} event. * * @param x the x-coordinate of the down action * @param y the y-coordinate of the down action */ private void OnActionDown(float x, float y) { float left = EdgeManager.LEFT.coordinate; float top = EdgeManager.TOP.coordinate; float right = EdgeManager.RIGHT.coordinate; float bottom = EdgeManager.BOTTOM.coordinate; mPressedHandle = HandleUtil.getPressedHandle(x, y, left, top, right, bottom, mHandleRadius); if (mPressedHandle == null) { return; } // Calculate the offset of the touch point from the precise location // of the handle. Save these values in a member variable since we want // to maintain this offset as we drag the handle. mTouchOffset = HandleUtil.getOffset(mPressedHandle, x, y, left, top, right, bottom); Invalidate(); }