Example #1
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			Button buttonNext = FindViewById<Button> (Resource.Id.ButtonNext);		
			buttonNext.Click += (object sender, EventArgs e) => {
				// Get all data & collect in an array
				Bundle data = new Bundle();

				EditText Name = FindViewById<EditText> (Resource.Id.editTextName);
				EditText Email = FindViewById<EditText> (Resource.Id.editTextEmail);
				EditText Street1 = FindViewById<EditText> (Resource.Id.editTextStreet1);
				EditText Street2 = FindViewById<EditText> (Resource.Id.editTextStreet2);
				EditText PostalCode = FindViewById<EditText> (Resource.Id.editTextPostalcode);
				EditText City = FindViewById<EditText> (Resource.Id.editTextCity);

				data.PutString("name", Name.Text);
				data.PutString("email", Email.Text);
				data.PutString("street1", Street1.Text);
				data.PutString("street2", Street2.Text);
				data.PutString("postalcode", PostalCode.Text);
				data.PutString("city", City.Text);

				var intent = new Intent (this, typeof(SecondActivity));
				// Send all data with intent
				intent.PutExtras (data);
				StartActivity (intent);
			};
		}
Example #2
0
		private void ButtonOnClick (object sender, EventArgs eventArgs)
		{
			// These are the values that we want to pass to the next activity
			Bundle valuesForActivity = new Bundle ();
			valuesForActivity.PutInt ("count", _count);

			// Create the PendingIntent with the back stack             
			// When the user clicks the notification, SecondActivity will start up.
			Intent resultIntent = new Intent (this, typeof(SecondActivity));
			resultIntent.PutExtras (valuesForActivity); // Pass some values to SecondActivity.

			TaskStackBuilder stackBuilder = TaskStackBuilder.Create (this);
			stackBuilder.AddParentStack (Class.FromType (typeof(SecondActivity)));
			stackBuilder.AddNextIntent (resultIntent);

			PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent (0, (int)PendingIntentFlags.UpdateCurrent);

			// Build the notification
			NotificationCompat.Builder builder = new NotificationCompat.Builder (this)
                .SetAutoCancel (true) // dismiss the notification from the notification area when the user clicks on it
                .SetContentIntent (resultPendingIntent) // start up this activity when the user clicks the intent.
                .SetContentTitle ("Button Clicked") // Set the title
                .SetNumber (_count) // Display the count in the Content Info
                .SetSmallIcon (Resource.Drawable.ic_stat_button_click) // This is the icon to display
                .SetContentText (String.Format ("The button has been clicked {0} times.", _count)); // the message to display.

			// Finally publish the notification
			NotificationManager notificationManager = (NotificationManager)GetSystemService (NotificationService);
			notificationManager.Notify (ButtonClickNotificationId, builder.Build ());

			_count++;
		}
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            Intent statusIntent = null;
            SystemStatus systemStatus = null;

            base.OnListItemClick(l, v, position, id);
            systemStatus = statusListAdapter.statii [position];
            statusIntent = new Intent(this, typeof(DisplayResourceActivity));
            statusIntent.PutExtras(Intent.Extras);
            switch (systemStatus.getSystemType()) {
            case SystemStatus.NETWORK_STATUS:
                statusIntent.PutExtra("RESOURCE_TYPE", GetString(Resource.String.network_status_text));
                break;
            case SystemStatus.MEMORY_STATUS:
                statusIntent.PutExtra("RESOURCE_TYPE", GetString(Resource.String.memory_status_text));
                break;
            case SystemStatus.DISK_STATUS:
                statusIntent.PutExtra("RESOURCE_TYPE", GetString(Resource.String.disk_status_text));
                break;
            case SystemStatus.CPU_STATUS:
                statusIntent.PutExtra("RESOURCE_TYPE", GetString(Resource.String.cpu_status_text));
                break;
            default:
                statusIntent = null;
                break;
            //case SystemStatus.SYSTEM_MSGS_STATUS:
                //statusIntent = new Intent(SystemStatusActivity.this, SystemMessagesActivity.class);
                //break;
            }
            if (statusIntent != null) {
                StartActivity(statusIntent);
            }
        }
Example #4
0
		internal void StartChat (string channelUrl)
		{
			var intent = new Intent (this, typeof(SendBirdChatActivity));
			Bundle args = SendBirdChatActivity.MakeSendBirdArgs (appId, userId, userName, channelUrl);
			intent.PutExtras (args);
			StartActivityForResult (intent, REQUEST_SENDBIRD_CHAT_ACTIVITY);
		}
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.HomeScreen);

			Button profile = FindViewById<Button> (Resource.Id.ProfileButton);


			var user= Intent.GetStringExtra("user");
			var key = Intent.GetStringExtra("key");
			Console.WriteLine (user + " @@@@@ " + key);

			LoginResponse data = new LoginResponse (user, key);
				
			profile.Click += async (sender, e) => {

				var Pgetter = new ProfileUtility();
				ProfileResponse result = await Pgetter.ProfileAsync(data);

				Intent intent = new Intent(this, typeof(StudentProfile));
				var b = new Bundle();
				b.PutString("fname",result.fname);
				b.PutString("lname",result.lname);
				b.PutString("major",result.major);
				b.PutString("email",result.email);
				b.PutString("gender",result.gender);
				b.PutString("year",result.year);
				b.PutString("age",result.age.ToString());
				intent.PutExtras(b);
				StartActivity(intent);
			};

			// Create your application here
		}
Example #6
0
        public override void Present(GlassService service)
        {
            base.Present(service);

            if (service.GetType() == typeof (StopwatchService))
            {
                if (_card == null)
                {
                    _card = new LiveCard(service, service.GetType().FullName);
                    _renderer = new ChronometerRenderer(service);
                    _card.SetDirectRenderingEnabled(true).SurfaceHolder.AddCallback(_renderer);

                    var mi = new Intent(service, typeof(MenuActivity));
                    var b = new Bundle();
                    b.PutInt("ResourceID", Resource.Menu.stopwatch);
                    mi.PutExtras(b);
                    mi.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);

                    _card.SetAction(PendingIntent.GetActivity(service, 0, mi, 0));
                    _card.Attach(service);

                    _card.Publish(LiveCard.PublishMode.Reveal);
                }
                else
                {
                    _card.Navigate();
                }
            }
        }
Example #7
0
        private void LaunchFile(int index)
        {
            Bundle bundle;

            if (AppConstant.IsQPOffline(SystemPath.GetFileName(semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString())))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", SystemPath.Combine(AppConstant.QPFolderPath, SystemPath.GetFileName(semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString())));
            }
            else
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", false);

                bundle.PutString("URL", semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString());
                bundle.PutBoolean("IsFileNotice", false);
            }

            if (Looper.MyLooper() == null)
            {
                Looper.Prepare();
            }

            Android.Content.Intent i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
            i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
            i.PutExtras(bundle);
            StartActivity(i);
        }
Example #8
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			SetContentView (Resource.Layout.Second);

			Bundle b = Intent.Extras;

			Button buttonPrev = FindViewById<Button> (Resource.Id.ButtonPrev);		
			buttonPrev.Click += (object sender, EventArgs e) => {
				var intent = new Intent (this, typeof(MainActivity));
//				intent.PutExtras(b);
				StartActivity (intent);
			};

			Button buttonNext = FindViewById<Button> (Resource.Id.ButtonNext);		
			buttonNext.Click += (object sender, EventArgs e) => {
				var intent = new Intent (this, typeof(ThirdActivity));
				// Add current views' data to bundle
				CheckBox chb1 = FindViewById<CheckBox> (Resource.Id.checkBox1);
				CheckBox chb2 = FindViewById<CheckBox> (Resource.Id.checkBox2);
				EditText iban = FindViewById<EditText> (Resource.Id.editTextIban);
				EditText bic = FindViewById<EditText> (Resource.Id.editTextBic);
				EditText euro = FindViewById<EditText> (Resource.Id.editTextEuro);

				b.PutBoolean("chb1", chb1.Checked);
				b.PutBoolean("chb2", chb2.Checked);
				b.PutString("iban", iban.Text);
				b.PutString("bic", bic.Text);
				b.PutString("euro", euro.Text);

				intent.PutExtras(b);
				StartActivity (intent);
			};
		}
Example #9
0
		internal void StartMemberList ()
		{
			var intent = new Intent (this, typeof(SendBirdMemberListActivity));
			Bundle args = SendBirdMemberListActivity.MakeSendBirdArgs (appId, userId, userName, channelUrl);
			intent.PutExtras (args);
			StartActivityForResult (intent, REQUEST_SENDBIRD_MEMBER_LIST_ACTIVITY);
		}
Example #10
0
        void ModuleListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            // Set selected level as current
            DataHolder.Current.CurrentModule = DataHolder.Current.CurrentLevel.Modules.ElementAt(e.Position);
            if (!DataHolder.Current.CurrentModule.Lessons.Any())
            {
                Toast.MakeText(this, "This module has not been implemented yet.", ToastLength.Short).Show();
                return;
            }

            DataHolder.Current.CurrentLesson = DataHolder.Current.CurrentModule.Lessons.First();
            DataHolder.Current.CurrentIteration = DataHolder.Current.CurrentLesson.Iterations.First();

            if (String.IsNullOrEmpty(DataHolder.Current.CurrentModule.VideoPath))
            {
                // Navigate to lesson view
                var intent = new Intent(this, typeof(LessonFameActivity));
                StartActivity(intent);
            }
            else
            {
                // Navigate to video player
                var intent = new Intent(this, typeof(VideoActivity));
                var bundle = new Bundle();
                bundle.PutString("nextView", "LessonFrameActivity");
                intent.PutExtras(bundle);
                StartActivity(intent);
            }
        }
Example #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Department);

            var listView = FindViewById<ListView>(Resource.Id.listViewDepartment);

            var personList = SQLiteHelper.GetPersonData();
            listView.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1,
                personList.GroupBy(p => p.DEPARTMENT).Select(p => p.Key).ToArray());

            listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                Activity act = this as Activity;
                Intent intent = new Intent();
                intent.SetClass(act, typeof(ContactList));

                Bundle b = new Bundle();
                b.PutString("department", (e.View as TextView).Text);
                intent.PutExtras(b);

                act.StartActivity(intent);
            };
        }
Example #12
0
        protected override void OnMessage (Context context, Intent intent)
        {
            //Push Notification arrived - print out the keys/values
            Intent received = new Intent (context, typeof(RecievedPush));
            string pushMessage = intent.GetStringExtra ("message");
            received.AddFlags (ActivityFlags.ReorderToFront);
            received.AddFlags (ActivityFlags.NewTask);
            received.PutExtra ("pushedMessage", pushMessage);
            if (intent == null || intent.Extras == null) {
                received.PutExtras (intent.Extras);
                foreach (var key in intent.Extras.KeySet()) {
                    Console.WriteLine ("Key: {0}, Value: {1}");
                }
            }
            PendingIntent notificationLaunch = PendingIntent.GetActivity (context, 1000, received, PendingIntentFlags.CancelCurrent );
            NotificationManager manager = (NotificationManager)GetSystemService (Context.NotificationService);
            NotificationCompat.Builder builder = new NotificationCompat.Builder (context);
            builder.SetContentText (pushMessage);
            builder.SetContentIntent ( notificationLaunch);
            builder.SetContentTitle ("New Message");
            builder.SetSmallIcon (Resource.Drawable.ic_action_chat);
            builder.SetStyle ( new NotificationCompat.InboxStyle());
            builder.SetSound (RingtoneManager.GetDefaultUri (RingtoneType.Notification));
            builder.SetVibrate (new long[] { 500, 300, 100, 1000, 300, 300, 300 ,300 });
            manager.Notify (1000, builder.Build ());

            Buddy.RecordNotificationReceived(intent);
         
        }
Example #13
0
        public override void Start()
        {
            Bundle hints = new Bundle();
            foreach (Symbology symbology in _enabled)
            {
                switch (symbology)
                {
                    case Symbology.UPCE: hints.PutBoolean(DO_UPCE, true); break;
                    case Symbology.EAN8: hints.PutBoolean(DO_EAN8, true); break;
                    case Symbology.EAN13: hints.PutBoolean(DO_EAN13, true); break;
                    case Symbology.Code39: hints.PutBoolean(DO_CODE93, true); break;
                    case Symbology.Code93: hints.PutBoolean(DO_CODE39, true); break;
                    case Symbology.Code128: hints.PutBoolean(DO_CODE128, true); break;
                    case Symbology.Sticky: hints.PutBoolean(DO_STICKY, true); break;

                    case Symbology.UPCA: break;
                    default: break;
                }
            }
            hints.PutString(DO_BROADCAST_TO, RedLaserScanReceiver.BROADCAST_ACTION);

            Intent i = new Intent();
            i.SetAction("com.target.redlasercontainer.SCAN");
            i.PutExtras(hints);

            Log.Info("BarcodeScanning", "broadcast intent with action com.target.redlasercontainter.SCAN sent");
            try
            {
                _context.SendBroadcast(i);
            }
            catch (Exception ex)
            {
                Log.Error("BarcodeScanning", ex.Message);
            }
        }
		private void InitView()
		{
			//设置标题栏
			var btn_header_back = FindViewById<Button> (Resource.Id.btn_header_back);
			btn_header_back.Click += (sender, e) => 
			{
				this.Finish();
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			var tv_header_title = FindViewById<TextView> (Resource.Id.tv_header_title);
			tv_header_title.Text = "账户安全";



			//登录密码
			var rl_person_loginPwd = FindViewById<RelativeLayout>(Resource.Id.rl_person_loginPwd);
			rl_person_loginPwd.Click += (sender, e) => 
			{
				var intent = new Intent(this,typeof(SendSecurityCodeActivity));
				var sendbundle = new Bundle();
				sendbundle.PutString("SendType","ModifyPwd");//修改密码
				sendbundle.PutString("PhoneNumber",Global.MyInfo.PhoneNumberOne);
				intent.PutExtras(sendbundle);
				StartActivity(intent);
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);

			};
			//修改支付密码
			var rl_person_payPwd = FindViewById<RelativeLayout>(Resource.Id.rl_person_payPwd);
			rl_person_payPwd.Click += (sender, e) => 
			{
				var intent = new Intent(this,typeof(SendSecurityCodeActivity));
				var sendbundle = new Bundle();
				sendbundle.PutString("SendType","ModifyPayPwd");//设置支付密码
				sendbundle.PutString("PhoneNumber",Global.MyInfo.PhoneNumberOne);
				intent.PutExtras(sendbundle);
				StartActivity(intent);
				OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
			};
			tv_payPwd = FindViewById<TextView> (Resource.Id.tv_payPwd);

			//手机绑定
			var rl_person_phoneBind = FindViewById<RelativeLayout>(Resource.Id.rl_person_phoneBind);
			rl_person_phoneBind.Click += (sender, e) => 
			{

			};
			tv_phoneBind = FindViewById<TextView> (Resource.Id.tv_phoneBind);

			//身份认证
			var rl_person_identity = FindViewById<RelativeLayout>(Resource.Id.rl_person_identity);
			rl_person_identity.Click += (sender, e) => 
			{

			};
			tv_identity = FindViewById<TextView> (Resource.Id.tv_identity);


		}
Example #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //Log.Info(tag, "STUFF WILL HAPPEN");
            base.OnCreate (savedInstanceState);
            string username = "";
            string password = "";
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Login);

            // Get our button from the layout resource,
            // and attach an event to it
            Button login = FindViewById<Button> (Resource.Id.LoginButton);
            TextView userName = FindViewById<TextView> (Resource.Id.UserName);
            TextView passWord = FindViewById<TextView> (Resource.Id.Password);
            userName.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                username = e.Text.ToString();
            };

            passWord.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
                password = e.Text.ToString();
            };

            login.Click += async (sender, e) =>  {

                try{
                    var login_er =new LoginUtility();
                    Task<LoginResponse> asdfg = login_er.LoginAsync(username, password);

                    LoginResponse result = await asdfg;
                    if(result.validate){
                        Intent intent = new Intent(this, typeof(HomeScreenActivity));
                        var b = new Bundle();
                        b.PutString("user",result.username);
                        b.PutString("key",result.KEY);
                        intent.PutExtras(b);

                        StartActivity(intent);

                        LoginInfo.username = result.username;
                        LoginInfo.KEY = result.KEY;
                    }else{
                        Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(this);
                        AlertDialog alertDialog = builder.Create();
                        alertDialog.SetTitle("Login Failed");
                        alertDialog.SetMessage("Login Failed, Please Try Again");
                        alertDialog.Show();

                        //Log.Info(tag, "STUFF WILL HAPPEN"+ result.ToString());
                    }
                }
                catch (AndroidException){

                }

            };
        }
Example #16
0
 void NavigateToNextScreen()
 {
     // Navigate to video player
     var extras = new Bundle();
     extras.PutString("nextView", "LevelSelectActivity");
     extras.PutString("videoPath", DataHolder.Current.Common.IntroVideoPath);
     var intent = new Intent(this, typeof(VideoActivity));
     intent.PutExtras(extras);
     StartActivity(intent);
 }
		void OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
		{
			var bundle = new Bundle ();
			bundle.PutInt ("ItemPosition", e.Position);

			var intent = new Intent(this, typeof(DetailsActivity));
			intent.PutExtras (bundle);

			StartActivity(intent);
		}
Example #18
0
        public override View OnCreateView(LayoutInflater inflater,
        ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(
                Resource.Layout.activity_category, container, false);

            GridView gridView = (GridView)view.FindViewById(Resource.Id.grid_view);
            // Instance of ImageAdapter Class

            var categories = DataHandler.LoadCategoriesFromLocalDatabase(new LocalDB());

            gridView.SetAdapter(new CategoryAdapter(view.Context, categories));

            gridView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {

                List<string> choiceList = new List<string>();
                List<string> detailList = new List<string>();

                var category = categories[args.Position];
                var choices = categories[args.Position].Choices;

                // Add each choice from selected category to list
                // Add each detail from selected choice to list
                foreach (var choice in choices)
                {
                    choiceList.Add(choice.Name);
 
                    detailList.AddRange(choice.Details.Select(detail => detail.Name));
                }

                if (choices == null || choices.Count == 0 || String.IsNullOrEmpty(choices[0].Name))
                // String.IsNullOrEmpty(choices[0].Name) = Dummy, hvis der er en tom Choice liste uden et navn
                {
                    CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category);
                    Call.MakeCall(callEntity, Activity);
                }
                else
                {
                    Bundle bundle = new Bundle();

                    bundle.PutStringArray("choices", choiceList.ToArray());
                    bundle.PutStringArray("details", detailList.ToArray());
                    bundle.PutString("category", categories[args.Position].Name);

                    Intent intent = new Intent(Application.Context, typeof(ChoiceActivity));
                    intent.PutExtras(bundle);

                    StartActivity(intent);
                }
            };
            return view;
        }
		public override void OnListItemClick (ListView l, View v, int position, long id)
		{
			var intent = new Intent (this.Activity, typeof(CodeProjectMemberProfileActivity));

			Bundle bundle = new Bundle ();
			bundle.PutInt (CodeProjectMemberProfileActivity.MemberIdKey, members[position].Id);

			intent.PutExtras(bundle);

			StartActivity (intent);
		}
Example #20
0
 /// <summary>
 /// 检查更新(自动)
 /// </summary>
 /// <param name="a"></param>
 private void of_update(object a)
 {
     Activity activity;
     activity = a as Activity;
     if (!stopUpdate)
     {
         System.Threading.Thread.Sleep(4000);
         string ver = Update.of_update(true);
         string memo = Update.as_UpdateMemo;
         string ls_isall = Update.as_All;
         bool lb_MustUpdate = Update.ab_MustUpdate;
         int enddate = Update.ai_MustUpdateEnddate;
         if (ver.Substring(0, 2) != "ER")
         {
             AlertDialog.Builder builder = new AlertDialog.Builder(activity);
             if (ls_isall == "Y")
                 builder.SetTitle("软件更新提示:(本次更新需重新下载所有数据)");
             else
                 builder.SetTitle("软件更新提示:");
             if (!lb_MustUpdate)
                 builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " ,确定下载更新吗?\n" + memo);
             else
                 builder.SetMessage("当前版本为" + Core._publicfuns.of_GetMySysSet("app", "vercode") + "服务器上最新版本为 " + ver + " \n在" + enddate + "日前未更新软件将不能使用,下载完成后请按提示安装\n" + memo);
             builder.SetPositiveButton("确定", delegate
             {
                 if (ls_isall == "Y")
                 {
                     string filename = AccessDB.dbFile;
                     System.IO.File.Delete(filename);
                 }
                 Intent intent = new Intent();
                 Bundle bu = new Bundle();
                 bu.PutString("name", "download");
                 intent.PutExtras(bu);
                 intent.SetClass(activity, typeof(Loading));
                 activity.StartActivity(intent);
             });
             builder.SetCancelable(false);
             //过期未更新(不显示取消按钮)
             if (lb_MustUpdate)
             {
                 if (int.Parse(DateTime.Now.ToString("yyyyMMdd")) < enddate)
                     builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; });
             }
             else
                 builder.SetNegativeButton("取消", delegate { stopUpdate = true; return; });
             activity.RunOnUiThread(() =>
             {
                 builder.Show();
             });
         }
     }
 }
Example #21
0
        // Обработка текста письма и передача его в Activity1
        private void response_Clicked(object sender, EventArgs e)
        {
            count = 0;
            Intent intent = new Intent(this, typeof(Activity1));
            Bundle extras = new Bundle();

            extras.PutString("answer", letter.Text);
            extras.PutString("id", count.ToString());
            intent.PutExtras(extras);
            count++;
            StartActivity(intent);
        }
        public static Intent GetNewMessageIntent(Context context, Intent intent)
        {
            // Create the PendingIntent with the back stack
            // When the user clicks the notification, ConversationActivity will start up.
            var notificationIntent = new Intent(context, typeof(ConversationActivity));
            notificationIntent.PutExtras( intent.Extras); // Pass some values to SecondActivity.

            Android.App.TaskStackBuilder stackBuilder = Android.App.TaskStackBuilder.Create(context);
            stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(ConversationActivity)));
            stackBuilder.AddNextIntent(notificationIntent);

            return notificationIntent;
        }
Example #23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.PassFrom);

            // using Bundles
            Bundle thisBundle = new Bundle();
            thisBundle.PutString("MyData", "A string of data.");
            thisBundle.PutString("MyData2", "Another string of data.");
            var intent = new Intent(this, typeof(PassBundleToActivity));
            intent.PutExtras(thisBundle);
            StartActivity(intent);
        }
Example #24
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            // TODO Auto-generated method stub  
            LayoutInflater mInflater = LayoutInflater.From(context);
            //产生一个View  
            View view = null;
            //根据type不同的数据类型构造不同的View,也可以根据1,2,3天数构造不同的样式  
            if (type[position] == 0)
            {
                //view = mInflater.inflate(R.layout.city_item, null);  
                view = mInflater.Inflate(Resource.Layout.city_item, null);
                //获取城市名称  
                string cityName = list[position]["data"];

                ImageView image = view.FindViewById<ImageView>(Resource.Id.weather_image);
                Button viewBtn = view.FindViewById<Button>(Resource.Id.btn_click);
                viewBtn.Text = "详细";
                viewBtn.Tag = viewBtn.Id.ToString() + "/" + position.ToString();
                view.SetTag(viewBtn.Id, position.ToString());
                viewBtn.Click += delegate
                {
                    Intent intent = new Intent(context, typeof(layout1));
                    Android.OS.Bundle bundle = new Android.OS.Bundle();
                    intent.PutExtra("LayoutName", position.ToString() + cityName);
                    intent.PutExtras(bundle);
                    ((Activity1)context).StartActivityForResult(intent, 10);
                    // ((Activity1)context).SetContentView(Resource.Layout.layout1);  
                    // SetContentView(Resource.Layout.Main);  
                };

                TextView city = view.FindViewById<TextView>(Resource.Id.city);
                //city.setText(cityName);  
                city.Text = cityName;
            }
            else
            {
                view = mInflater.Inflate(Resource.Layout.content_item, null);
                //获取数据  
                string content = list[position]["data"];
                //分离数据  
                string[] items = content.Split(',');

                TextView weather = view.FindViewById<TextView>(Resource.Id.content);
                weather.Text = items[0] + "天气: " + items[1] + ";温度:  " + items[2];
                TextView date = view.FindViewById<TextView>(Resource.Id.date);
                date.Text = items[3];

            }

            return view;
        }
Example #25
0
        private void LaunchPlacements(int position)
        {
            Bundle         bundle = new Bundle();
            Intent         i      = new Android.Content.Intent(this, typeof(NewsEventViewer));
            IList <string> images = ConvertToStringList(placementList[position].Images);

            bundle.PutString("CONTENT", placementList[position].Content);
            bundle.PutStringArrayList("IMAGES", images);

            i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
            i.PutExtras(bundle);

            StartActivity(i);
        }
Example #26
0
 void ListView_ItemClick(object sender, ExpandableListView.ChildClickEventArgs e)
 {
     View view = e.ClickedView;
     view.Click += delegate
     {
         var text_msg = view.FindViewById<TextView>(Resource.Id.Buddylist_textChild);
         Intent intent = new Intent();
         Bundle bu = new Bundle();
         bu.PutString("name", text_msg.Text);
         intent.PutExtras(bu);
         intent.SetClass(this, typeof(ChatMian));
         StartActivity(intent);
     };
 }
		/// <summary>
		/// Loads the activity.
		/// </summary>
		public void LoadActivity()
		{
			//如果启动app的Intent中带有额外的参数,表明app是从点击通知栏的动作中启动的
			//将参数取出,传递到login activity 或MainActivity中
			var sharedPreferencelaunch =  this.GetSharedPreferences(Global.SHAREDPREFERENCES_LAUNCHNAME,FileCreationMode.Private);
			var isFirstLaunch = sharedPreferencelaunch.GetBoolean (Global.IsFirstIn, true);
			var sharedPreferenceuserinfo = this.GetSharedPreferences(Global.SHAREDPREFERENCES_USERINFO,FileCreationMode.Private);
			if (isFirstLaunch) {
				//软件第一次使用,进入功能引导页				
				StartActivity(typeof(GuiderActivity));
			} else {
				//软件不是第一次使用,判断是否自动登录和是否曾经登录成功过,
				if(sharedPreferenceuserinfo.GetBoolean(Global.login_AutoLogin_Check,false))
				{
					//勾选自动登录,且本地用户名存在,进入主界面,否则进入登录界面
					if (!string.IsNullOrEmpty (sharedPreferenceuserinfo.GetString (Global.login_UserName, string.Empty))) {
						Intent mainIntent = new Intent (this, typeof(MainFragActivity));
						var bundle = Intent.Extras;
						if (bundle != null)
							mainIntent.PutExtras (bundle);
						StartActivity (mainIntent);
						//StartActivity(typeof(MainFragActivity));
					} else {
						Intent loginIntent = new Intent(this,typeof(LoginActivity));
						loginIntent.SetFlags (ActivityFlags.ClearTop);
						var bundle = Intent.Extras;
						if (bundle != null)
							loginIntent.PutExtras (bundle);
						StartActivity(loginIntent);
						//StartActivity (typeof(LoginActivity));
					}
				}
				else
				{
					//未勾选自动登录
					Intent loginIntent = new Intent(this,typeof(LoginActivity));
					loginIntent.SetFlags (ActivityFlags.ClearTop);
					var bundle = Intent.Extras;
					if (bundle != null)
						loginIntent.PutExtras (bundle);
					StartActivity(loginIntent);
				}


			}

			this.Finish();
			OverridePendingTransition(Android.Resource.Animation.FadeIn,Android.Resource.Animation.FadeOut);

		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            SetContentView (Resource.Layout.Result);

            TextView paymentResultView = FindViewById<TextView> (Resource.Id.payment_result);

            Intent i = new Intent();
            if (this.Intent.HasExtra("result")) {
                i.PutExtras(this.Intent.Extras.GetBundle("result"));
            }
            int requestCode = this.Intent.GetIntExtra("request_code", 0);

            PaylevenApi.HandleIntent (requestCode, i, new PaylevenCallback (paymentResultView));
        }
Example #29
0
 public static void clearAndExit(Context ctx)
 {
     if (ctx != new MainActivity())
     {
         Intent intent = new Intent(ctx, typeof(MainActivity));
         intent.SetFlags(ActivityFlags.ClearTop);
         Bundle bundle = new Bundle();
         bundle.PutBoolean("exit", true);
         intent.PutExtras(bundle);
         ctx.StartActivity(intent);
     }
     else
     {
         ((Activity)ctx).Finish();
     }
 }
Example #30
0
        void PasswordsListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            if (e.Position != null)
            {
                var selectedItem = passwords[e.Position];
                var intent       = new Android.Content.Intent(this, typeof(DetailActivity));

                Bundle bundle = new Bundle();
                bundle.PutString("password_name", selectedItem.Name);
                bundle.PutString("password_value", selectedItem.PasswordValue);

                intent.PutExtras(bundle);

                StartActivity(intent);
            }
        }
Example #31
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate 
            { 
                button.Text = string.Format("{0} clicks!", ++dto.Count); 
                var serializer = new JsonSerializer();

                var intent = new Intent(this, typeof(SerializationSampleActivity));

                var b = new Bundle();
                b.PutString("object", serializer.Serialize(dto));
                intent.PutExtras(b);

                this.StartActivity(intent);

            };

            Drawable blankDrawable = Resources.GetDrawable (Resource.Drawable.Icon);
            var blankBitmap = ((BitmapDrawable)blankDrawable).Bitmap;
            var pixel1 = blankBitmap.GetPixel (100, 100);

            var colorOfPixel = new Color (pixel1);
            System.Diagnostics.Debug.WriteLine (pixel1);
            System.Diagnostics.Debug.WriteLine (colorOfPixel);

            var alpha = (byte)(pixel1 >> 3 * 8);
            var red = (byte)(pixel1 >> 2 * 8);
            var green = (byte)(pixel1 >> 8);
            var blue = (byte)pixel1;

            System.Diagnostics.Debug.WriteLine (alpha);
            System.Diagnostics.Debug.WriteLine (red);
            System.Diagnostics.Debug.WriteLine (green);
            System.Diagnostics.Debug.WriteLine (blue);

            button.Click += HandleClick;
        }
Example #32
0
        private void LaunchOfflineQP(int index)
        {
            Bundle bundle = new Bundle();

            bundle.PutBoolean("IsFileOffline", true);
            bundle.PutString("PATH", listOffline[index].FilePath);

            if (Looper.MyLooper() == null)
            {
                Looper.Prepare();
            }

            Android.Content.Intent i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
            i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
            i.PutExtras(bundle);
            this.StartActivity(i);
        }
 void NavigateToNextScreen()
 {
     if (String.IsNullOrEmpty(DataHolder.Current.CurrentLevel.VideoPath))
     {
         StartActivity(new Intent(this, typeof(ModuleSelectActivity)));
     }
     else
     {
         // Navigate to video player
         var extras = new Bundle();
         extras.PutString("nextView", "ModuleSelectActivity");
         extras.PutString("videoPath", DataHolder.Current.CurrentLevel.VideoPath);
         var intent = new Intent(this, typeof(VideoActivity));
         intent.PutExtras(extras);
         StartActivity(intent);
     }
 }
Example #34
0
        protected void proOpt(string strCommand, string strKeyID)
        {
            #region AREA
            if (strCommand == "AREA")
            {
                Intent intent = new Intent();
                intent.SetClass(this, typeof(CHE9000WAP.Login.LoginRegArea));
                Bundle bundle = new Bundle();
                bundle.PutString("ISCHANGE", "1");
                intent.PutExtras(bundle);
                StartActivity(intent);
            }
            #endregion

            #region CARTYPE
            if (strCommand == "CARTYPE")
            {
                Intent intent = new Intent();
                intent.SetClass(this, typeof(CHE9000WAP.Login.LoginRegCarType));
                Bundle bundle = new Bundle();
                bundle.PutString("ISCHANGE", "1");
                intent.PutExtras(bundle);
                StartActivity(intent);
            }
            #endregion

            #region BANK
            if (strCommand == "BANK")
            {
                Intent intent = new Intent();
                intent.SetClass(this, typeof(CHE9000WAP.Login.LoginRegBank));
                Bundle bundle = new Bundle();
                bundle.PutString("ISCHANGE", "1");
                intent.PutExtras(bundle);
                StartActivity(intent);
            }
            #endregion

            #region FINISH
            if (strCommand == "FINISH")
            {
                Finish();
            }
            #endregion
        }
Example #35
0
        private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            if (e != null)
            {
                var selectedBook = bookList[e.Position];
                var intent       = new Android.Content.Intent(this, typeof(BookDetailsActivity));

                Bundle bundle = new Bundle();
                bundle.PutString("selected_book", selectedBook.name);
                bundle.PutInt("selected_image_id", selectedBook.imageId);

                intent.PutExtras(bundle);

                StartActivity(intent);
            }
            else
            {
                return;
            }
        }
Example #36
0
        private void LaunchOfflineNotice(int index)
        {
            Bundle bundle;

            Android.Content.Intent i;

            if (listOffline[index].FileExtension.ToLower().Contains("jpg") || listOffline[index].FileExtension.ToLower().Contains("png") || listOffline[index].FileExtension.ToLower().Contains("jpeg"))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", listOffline[index].FilePath);

                if (Looper.MyLooper() == null)
                {
                    Looper.Prepare();
                }

                i = new Android.Content.Intent(this, typeof(ImageViewerActivity));
                i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
                i.PutExtras(bundle);
                this.StartActivity(i);
            }
            else if (listOffline[index].FileExtension.ToLower().Contains("pdf"))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", listOffline[index].FilePath);

                if (Looper.MyLooper() == null)
                {
                    Looper.Prepare();
                }

                i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
                i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
                i.PutExtras(bundle);
                this.StartActivity(i);
            }
        }