protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); var tv = new TextView(this); tv.SetText("Hello Dot42"); SetContentView(tv); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_cheat); if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) { ActionBar.SetSubtitle(Resource.String.test_subject); } // Create your application here mAnswerIsTrue = Intent.GetBooleanExtra(EXTRA_ANSWER_IS_TRUE, false); mAnswerTextView = (TextView)FindViewById(Resource.Id.answerTextView); mVersionTextView = (TextView)FindViewById(Resource.Id.apiVersion); mVersionTextView.SetText(String.Format("API Level {0} {1}", Build.VERSION.Sdk, Build.VERSION.SdkInt.ToString()), TextView.BufferType.Normal); // Answer will not be shown until the user presses the button mWasAnswerShown = false; SetAnswerShownResult(mWasAnswerShown); mShowAnswer = (Button)FindViewById(Resource.Id.showAnswerButton); mShowAnswer.Click += (object sender, EventArgs e) => { ShowAnswer(); }; if (savedInstanceState != null) { mWasAnswerShown = savedInstanceState.GetBoolean(KEY_ANSWER_SHOWN, false); ShowAnswer(); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView(Resource.Layout.Log); logView = FindViewById<TextView> (Resource.Id.log); scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView); scrollView.FullScroll(FocusSearchDirection.Down); logView.SetText(savedText,TextView.BufferType.Editable); scrollView.ScrollTo(0,logView.Height); scrollView.FullScroll(FocusSearchDirection.Down); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder dialog = new AlertDialog.Builder(Activity) .SetTitle(title) .SetPositiveButton("Got it", (sender, args) => { }); LayoutInflater inflater = Activity.LayoutInflater; View view = inflater.Inflate(Resource.Layout.VideoHelpPopup, null); video = view.FindViewById<VideoView>(Resource.Id.helper_video); descriptionView = view.FindViewById<TextView>(Resource.Id.helper_explanation); descriptionView.SetText(description.ToCharArray(),0, description.Length); if (!string.IsNullOrEmpty(videoAdd)) { video.Prepared += VideoPrepared; video.SetVideoURI(Uri.Parse(videoAdd)); video.Touch += VideoTouched; video.SetZOrderOnTop(true); // Removes dimming } else { LinearLayout holder = view.FindViewById<LinearLayout>(Resource.Id.helper_videoHolder); holder.Visibility = ViewStates.Gone; } dialog.SetView(view); return dialog.Create(); }
private void Initialize() { var text = new TextView(Context); text.SetHeight(500); text.SetWidth(200); text.SetText(Resource.String.FooWidgetText); AddView(text); }
protected override void OnCreate(Android.Os.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ScrollView scroll = new ScrollView(this); TextView license = new TextView(this); license.SetText(GooglePlayServicesUtil.GetOpenSourceSoftwareLicenseInfo(this)); scroll.AddView(license); SetContentView(scroll); }
protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layout.MainLayout); var actionBar = GetActionBar(); actionBar.SetNavigationMode(ActionBar.NAVIGATION_MODE_LIST); //actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, R.Layout.TextView), // this); //actionBar.SetListNavigationCallbacks(ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item), // this); var adapter = ArrayAdapter<string>.CreateFromResource(this, R.Arrays.gameType_array, Android.R.Layout.Simple_spinner_item); adapter.SetDropDownViewResource(Android.R.Layout.Simple_spinner_dropdown_item); actionBar.SetListNavigationCallbacks(adapter, this); tvAnswer = (TextView)FindViewById(R.Id.answer); tvQuestion = (TextView)FindViewById(R.Id.question); tvResult = (TextView)FindViewById(R.Id.result); var btn = (Button)FindViewById(R.Id.cmd0); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd1); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd2); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd3); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd4); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd5); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd6); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd7); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd8); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.cmd9); btn.Click += new EventHandler(btn_Click); btn = (Button)FindViewById(R.Id.Ok); btn.Click += new EventHandler(btnOk_Click); btn = (Button)FindViewById(R.Id.Erase); btn.Click += new EventHandler(btnErase_Click); var gamePreferences = new Preferences(); gamePreferences.RetrievePreferences(GetSharedPreferences("GamePreferences", 0)); gameParameterFactory.Preferences = gamePreferences; game = GameFactory.GetGame(gameType, gameParameterFactory); tvQuestion.SetText(game.GetNextAssignment()); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.activity_new_document); documentCount = Intent.GetIntExtra (DocumentCentricActivity.KEY_EXTRA_NEW_DOCUMENT_COUNTER, 0); documentCounterTextView = (TextView)FindViewById (Resource.Id.hello_new_document_text_view); removeFromOverview = FindViewById<Button> (Resource.Id.remove_task_button); removeFromOverview.Click+=delegate { OnRemoveFromOverview(); }; documentCounterTextView.SetText (string.Format ("Hello Document {0}!", documentCount),TextView.BufferType.Normal); }
protected override void OnCreate (Bundle bundle) { /*base.OnCreate (bundle); SetContentView(Resource.Layout.CameraView); camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview); camera.Holder.SetType(SurfaceType.PushBuffers); holder = camera.Holder; Session.setSurfaceHolder(holder);*/ base.OnCreate (bundle); base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; SetContentView (Resource.Layout.Main); startButton = FindViewById<ImageButton> (Resource.Id.startButton); connectButton = FindViewById<ImageButton> (Resource.Id.connectToClientButton); settingsButton = FindViewById<ImageButton> (Resource.Id.settingsButton); connectLight = FindViewById<ImageView> (Resource.Id.connectLight); streamingLight = FindViewById<ImageView> (Resource.Id.streamingLight); connectText = FindViewById<TextView> (Resource.Id.connectStatus); streamText = FindViewById<TextView> (Resource.Id.streamingStatus); logView = FindViewById<TextView> (Resource.Id.log); scrollView = FindViewById<ScrollView> (Resource.Id.logScrollView); scrollView.FullScroll(FocusSearchDirection.Down); logView.SetText(savedText,TextView.BufferType.Editable); scrollView.ScrollTo(0,logView.Height); scrollView.FullScroll(FocusSearchDirection.Down); camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview); camera.Holder.SetType(SurfaceType.PushBuffers); //holder = camera.Holder; Session.SetSurfaceHolder(camera.Holder); startButton.Click += OnStartClicked; connectButton.Click += OnConnectToClientClicked; settingsButton.Click += OnStettingsClicked; //this should be set based on something DisableButton(connectButton); EnableButton(settingsButton); SetStartICon(); SetDisableLight(connectLight); SetDisableLight(streamingLight); connectText.Text = "Client is not connected"; streamText.Text = "Not streaming"; PreferenceManager.SetDefaultValues(this, Resource.Layout.Settings,false); }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layout.labeled_text_edit, container, false); View tv = v.FindViewById(R.Id.msg); ((TextView)tv).SetText("The fragment saves and restores this text."); // Retrieve the text editor, and restore the last saved state if needed. mTextView = (TextView)v.FindViewById(R.Id.saved); if (savedInstanceState != null) { mTextView.SetText(savedInstanceState.GetCharSequence("text")); } return v; }
public override View GetView (Context context, View convertView, ViewGroup parent) { TextView tv = new TextView (context); tv.TextSize = 20f; tv.SetText (Android.Text.Html.FromHtml (Caption), TextView.BufferType.Spannable); var parms = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); parms.AddRule (LayoutRules.CenterHorizontal); RelativeLayout view = new RelativeLayout (context, null, Android.Resource.Attribute.ListSeparatorTextViewStyle); view.AddView (tv, parms); return view; }
public double MeasureTextSize(string text, double width, double fontSize, string fontName = null) { var textView = new TextView(global::Android.App.Application.Context); textView.Typeface = GetTypeface(fontName); textView.SetText(text, TextView.BufferType.Normal); textView.SetTextSize(ComplexUnitType.Px, (float)fontSize); int widthMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec( (int)width, AViews.MeasureSpecMode.AtMost); int heightMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec( 0, AViews.MeasureSpecMode.Unspecified); textView.Measure(widthMeasureSpec, heightMeasureSpec); return (double)textView.MeasuredHeight; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.ChoosePlayer); SetHomeButtonEnabled (false); var list = this.FindViewById<ListView>(Resource.Id.playerList); _adapter = new PlayerListAdapter(this); list.Adapter = _adapter; _readyButton = (TextView)CreateActionButton(Resource.Drawable.table_button); SetTextButtonEnabled (false); _readyButton.SetText (Resource.String.ConfirmString); _readyButton.SetTextColor (Resources.GetColorStateList(Resource.Drawable.ready_label_enable)); RegisterSubscribes(); }
void AppendRow (TableLayout table) { TableRow row = new TableRow (this); TextView label = new TextView (this); label.SetText (Resource.String.table_layout_8_quit); label.SetPadding (3, 3, 3, 3); TextView shortcut = new TextView (this); shortcut.SetText (Resource.String.table_layout_8_ctrlq); shortcut.SetPadding (3, 3, 3, 3); shortcut.Gravity = GravityFlags.Right | GravityFlags.Top; row.AddView (label, new TableRow.LayoutParams (1)); row.AddView (shortcut, new TableRow.LayoutParams ()); table.AddView (row, new TableLayout.LayoutParams ()); }
public override View GetView(int position, View convertView, ViewGroup parent) { TextView button = new TextView(context); button.SetText(chapters[position], TextView.BufferType.Normal); button.TextSize = 32; button.SetTypeface(ThisApp.Font(context, "ionbold"), Android.Graphics.TypefaceStyle.Normal); button.SetHeight(84); button.SetBackgroundResource(Resource.Drawable.metro_button_style); button.Gravity = GravityFlags.Center; //button.SetPadding(0, 0, 0, 0); //button.SetTextColor(Resources.System.GetColorStateList(Resource.Color.metro_button_text_style)); //button.SetTextColor(Resources.System.GetColor(Resource.Color.metro_button_text_style)); button.Id = position; button.Click += button_Click; return button; }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.ChoosePlayer); SetHomeButtonEnabled (false); var list = this.FindViewById<ListView>(Resource.Id.playerList); _adapter = new PlayerListAdapter(this); list.Adapter = _adapter; _readyButton = (TextView)CreateActionButton(Resource.Drawable.table_button); SetTextButtonEnabled (false); _readyButton.SetText (Resource.String.ConfirmString); _readyButton.SetTextColor (Resources.GetColorStateList(Resource.Drawable.ready_label_enable)); _readyButton.Click+= delegate { SetResult(Result.Ok, new Intent().PutExtra("player_id",_adapter.SelectedPosition)); base.OnBackPressed(); }; }
/// <summary> /// Rebuild the all span in and set it into the label /// </summary> private void SetText() { var computedString = BuildRawTextString(); _iconSpan = BuildSpannableString(computedString); if (_iconLabel.TextAlignement == Xamarin.Forms.TextAlignment.Center) { _nativeLabel.Gravity = Android.Views.GravityFlags.Center; } else if (_iconLabel.TextAlignement == Xamarin.Forms.TextAlignment.End) { _nativeLabel.Gravity = Android.Views.GravityFlags.Right; } else if (_iconLabel.TextAlignement == Xamarin.Forms.TextAlignment.Start) { _nativeLabel.Gravity = Android.Views.GravityFlags.Left; } _nativeLabel.SetText(_iconSpan, TextView.BufferType.Spannable); }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { View v = Inflater.Inflate(R.Layout.receive_result, container, false); // Retrieve the TextView widget that will display results. mResults = (TextView)v.FindViewById(R.Id.results); // This allows us to later extend the text buffer. mResults.SetText(mResults.GetText(), TextView.BufferType.EDITABLE); // Watch for button clicks. Button getButton = (Button)v.FindViewById(R.Id.get); getButton.Click += (o, a) => { // Start the activity whose result we want to retrieve. The // result will come back with request code GET_CODE. Intent intent = new Intent(GetActivity(), typeof(SendResult)); StartActivityForResult(intent, GET_CODE); }; return v; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); Dialog.Window.RequestFeature(WindowFeatures.NoTitle); Dialog.Window.Attributes.WindowAnimations = Resource.Style.Animation_AppCompat_DropDownUp; var view = inflater.Inflate(Resource.Layout.createMemBox, container, false); memBoxName = view.FindViewById<EditText>(Resource.Id.inputMemBoxName); createMemBox = view.FindViewById<Button>(Resource.Id.submitNewMemBox); profilePic = view.FindViewById<ProfilePictureView>(Resource.Id.profilepic1); profilePic.ProfileId = Profile.CurrentProfile.Id; loggedInAs = view.FindViewById<TextView>(Resource.Id.loggedInAs); loggedInAs.SetText("Logged In As: "+Profile.CurrentProfile.Name, TextView.BufferType.Normal); createMemBox.Click += delegate { CreateMemBox.Invoke(this, new CreateNewMemBoxArgs(memBoxName.Text)); }; return view; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); // If you want to understand the life cycle more, you can use below command to turn on // verbose logging for this Activity on your testing device: // adb shell setprop log.tag.SignInActivity VERBOSE mIsLogVerbose = Android.Util.Log.IsLoggable (TAG, Android.Util.LogPriority.Verbose); SetContentView (Resource.Layout.sign_in_activity); restoreState (savedInstanceState); logVerbose ("Activity onCreate, creating new GoogleApiClient"); mGoogleApiClient = buildGoogleApiClient (false); mSignInStatus = FindViewById<TextView> (Resource.Id.sign_in_status); mSignInButton = FindViewById<SignInButton> (Resource.Id.sign_in_button); mSignInButton.Click += (sender, e) => { if (!mGoogleApiClient.IsConnecting) { int available = GooglePlayServicesUtil.IsGooglePlayServicesAvailable (this); if (available != ConnectionResult.Success) { ShowDialog (DIALOG_GET_GOOGLE_PLAY_SERVICES); return; } mSignInClicked = true; mSignInStatus.Text = GetString (Resource.String.signing_in_status); resolveSignInError (); } }; mServerAuthCodeDisabledLabel = FindViewById<TextView> (Resource.Id.server_auth_code_disabled); mServerAuthCodeResetButton = FindViewById<View> (Resource.Id.server_auth_code_reset_button); mServerAuthCodeResetButton.Click += (sender, e) => { mServerAuthCodeRequired.Set (true); }; if (!isUsingOfflineAccess ()) { mServerAuthCodeDisabledLabel.Visibility = ViewStates.Visible; mServerAuthCodeResetButton.Visibility = ViewStates.Gone; } else { mServerAuthCodeDisabledLabel.Visibility = ViewStates.Gone; mServerAuthCodeResetButton.Visibility = ViewStates.Visible; } mSignOutButton = FindViewById<View> (Resource.Id.sign_out_button); mSignOutButton.Click += (sender, e) => { if (mGoogleApiClient.IsConnected) mGoogleApiClient.ClearDefaultAccountAndReconnect (); }; mRevokeAccessButton = FindViewById (Resource.Id.revoke_access_button); mRevokeAccessButton.Click += async delegate { mServerAuthCodeRequired.Set (true); if (mGoogleApiClient.IsConnected) { var result = await PlusClass.AccountApi.RevokeAccessAndDisconnectAsync (mGoogleApiClient); if (result.IsSuccess) { mSignInStatus.SetText (Resource.String.revoke_access_status); } else { mSignInStatus.SetText (Resource.String.revoke_access_error_status); } mGoogleApiClient.Reconnect (); updateButtons (false /* isSignedIn */); } }; mScopeSelector = FindViewById<ToggleButton> (Resource.Id.scope_selection_toggle); mScopeSelector.CheckedChange += (sender, e) => { mGoogleApiClient.Disconnect (); // Since we changed the configuration, the cached connection result is no longer // valid. mConnectionResult = null; mGoogleApiClient = buildGoogleApiClient (e.IsChecked); mGoogleApiClient.Connect (); }; if (Build.VERSION.SdkInt >= BuildVersionCodes.Honeycomb) { ActionBar.SetDisplayHomeAsUpEnabled (true); } }
public void SetTVText(TextView tv, object value) { try { if (value != null) { tv.SetText (value.ToString (), TextView.BufferType.Normal); } } catch (Exception e) { throw e; } }
protected void SetContent (TextView view) { view.SetText (Resource.String.action_items_content); }
/// <summary> /// Gets the day suffix. /// </summary> /// <param name="day">The day.</param> /// <param name="txtSuffix">The text suffix.</param> private void SetDaySuffix(int day, TextView txtSuffix) { switch (day) { case 1: case 21: case 31: txtSuffix.SetText(Resource.String.St); break; case 2: case 22: txtSuffix.SetText(Resource.String.Nd); break; case 3: case 23: txtSuffix.SetText(Resource.String.Rd); break; default: txtSuffix.SetText(Resource.String.Th); break; } }
/** * Sets up the compatibility action bar with the given title. */ private void setupActionBar() { ViewGroup actionBarCompat = getActionBarCompat(); if (actionBarCompat == null) { return; } LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams( 0, ViewGroup.LayoutParams.FillParent); springLayoutParams.Weight = 1; // Add Home button SimpleMenu tempMenu = new SimpleMenu(mActivity); SimpleMenuItem homeItem = new SimpleMenuItem( tempMenu, Resource.Id.home, 0, mActivity.GetString(Resource.String.app_name)); homeItem.setIcon(Resource.Drawable.Icon); addActionItemCompatFromMenuItem(homeItem); // Add title text TextView titleText = new TextView(mActivity, null, Resource.attr.actionbarCompatTitleStyle); titleText.LayoutParameters = springLayoutParams; titleText.SetText(mActivity.Title); actionBarCompat.AddView(titleText); }
public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Android.Content.Res.Resources res = this.Resources; // Android 3.x+ still wants to show title: disable Dialog.Window.RequestFeature (WindowFeatures.NoTitle); // Create our view view = inflater.Inflate (Resource.Layout.AuthKey, container, true); if (cds == CommonDialogStates.Auth) { //auth lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.auth); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.authkey); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; //end auth } else if ((cds == CommonDialogStates.AuditPresence) || (cds == CommonDialogStates.AuditSubscribe) || (cds == CommonDialogStates.RevokePresence) || (cds == CommonDialogStates.RevokeSubscribe)) { //auth lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.auth); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.authopt); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; //end auth } else if (cds == CommonDialogStates.ChangeUuid) { lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.btnChangeUuid); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterUuid); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnChangeUuid); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.PresenceHeartbeat) { lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.enterHeartbeatTime); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterHeartbeatTime); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnset); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.PresenceHeartbeatInterval) { lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.enterHeartbeatInterval); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterHeartbeatInterval); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnset); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.DeleteUserState) { tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.deleteUserState); lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterUserStateKey); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnDelUserStateAndExit); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.SetText (Resource.String.btnDelUserStateAndMore); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.GetUserState) { tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.btnGetUserState); lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.Text = string.Format ("{0} ({1})", res.GetString (Resource.String.uuid), res.GetString (Resource.String.optional)); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnGetUserState); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.WhereNow) { lblInput0 = view.FindViewById<TextView> (Resource.Id.lblinput0); lblInput0.Visibility = ViewStates.Invisible; txtChannel = view.FindViewById<TextView> (Resource.Id.txtChannel); txtChannel.Visibility = ViewStates.Invisible; lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.Visibility = ViewStates.Invisible; tvinput2 = view.FindViewById<TextView> (Resource.Id.txtinput2); tvinput2.Visibility = ViewStates.Invisible; tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.btnWhereNow); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.Text = string.Format ("{0} ({1})", res.GetString (Resource.String.uuid), res.GetString (Resource.String.optional)); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnWhereNow); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.AddUserStateKeyValue) { tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.addUserState); lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.SetText (Resource.String.enterUserStateValue); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterUserStateKey); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnSaveUserStateAndExit); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.SetText (Resource.String.btnDelUserStateAndMore); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } else if (cds == CommonDialogStates.SetUserStateJson) { tvAuthLabel = view.FindViewById<TextView> (Resource.Id.tvAuthLabel); tvAuthLabel.SetText (Resource.String.btnSetUserState); lblInput2 = view.FindViewById<TextView> (Resource.Id.lblinput2); lblInput2.SetText (Resource.String.btnUserStateInst); lblInput2.SetHeight (100); tvinput1 = view.FindViewById<TextView> (Resource.Id.lblinput1); tvinput1.SetText (Resource.String.enterUserStateKey); tvinput1.Text = string.Format ("{0} ({1})", res.GetString (Resource.String.uuid), res.GetString (Resource.String.optional)); // Handle dismiss button click btnSet = view.FindViewById<Button> (Resource.Id.btnSet); btnSet.SetText (Resource.String.btnSetUserState); btnSet.Click += ButtonSetClick; btnSet2 = view.FindViewById<Button> (Resource.Id.btnSet2); btnSet2.Visibility = ViewStates.Invisible; btnDismiss = view.FindViewById<Button> (Resource.Id.btnCancel); btnDismiss.Click += ButtonDismissClick; } return view; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the interpolator_fragment layout var v = inflater.Inflate (Resource.Layout.interpolator_fragment, container, false); // Set up the "animate" button // When it is clicked, the view is animatied with the options selected var button = v.FindViewById<Button> (Resource.Id.animateButton); button.Click += delegate { // Interpolator selected in the spinner var interpolator = interpolators [interpolatorSpinner.SelectedItemPosition]; // Duration selected in SeekBar long duration = (long)durationSeekbar.Progress; // Animation path is based on whether animating in or out var path = isOut ? pathIn : pathOut; // Log animation details Log.Info (TAG, string.Format ("Starting animation: [{0} ms, {1}, {2}", duration, interpolatorSpinner.SelectedItem.ToString (), ((isOut) ? "Out (growing)" : "In (shrinking)"))); // Start the animation with the selected options StartAnimation(interpolator,duration,path); // Toggle direction of the animation isOut = !isOut; }; durationLabel = v.FindViewById<TextView> (Resource.Id.durationLabel); // Initialize the Interpolators programmatically by loading them from their XML definitions // provided by the framework. interpolators = new IInterpolator[] { AnimationUtils.LoadInterpolator(Activity,Android.Resource.Interpolator.Linear), AnimationUtils.LoadInterpolator(Activity,Android.Resource.Interpolator.FastOutLinearIn), AnimationUtils.LoadInterpolator(Activity,Android.Resource.Interpolator.FastOutSlowIn), AnimationUtils.LoadInterpolator(Activity,Android.Resource.Interpolator.LinearOutSlowIn) }; // Load names of interpolators var interpolatorNames = Resources.GetStringArray (Resource.Array.interpolator_names); // Set up the Spinner with the names of interpolators interpolatorSpinner = v.FindViewById<Spinner> (Resource.Id.interpolatorSpinner); var spinnerAdapter = new ArrayAdapter<string> (Activity, Android.Resource.Layout.SimpleSpinnerDropDownItem, interpolatorNames); interpolatorSpinner.Adapter = spinnerAdapter; // Set up SeekBar that defines the duration of the animation durationSeekbar = v.FindViewById<SeekBar> (Resource.Id.durationSeek); durationSeekbar.ProgressChanged+=delegate { durationLabel.SetText(Resources.GetString(Resource.String.animation_duration,durationSeekbar.Progress),TextView.BufferType.Normal); }; // Set default duration durationSeekbar.Progress = INITIAL_DURATION_MS; // Get the view that will be animated view = v.FindViewById (Resource.Id.square); // Path for the "in" animation pathIn = new Path (); pathIn.MoveTo (0.2f, 0.2f); pathIn.LineTo (1f, 1f); // Path for the "out" animation pathOut = new Path (); pathOut.MoveTo (1f, 1f); pathOut.LineTo (0.2f, 0.2f); return v; }
public void ShowPopUpMessage(int text) { AlertDialog alert = new AlertDialog.Builder(this).SetNegativeButton(Resource.String.btnClose, (object s, DialogClickEventArgs eventClick) => { }).Create(); LinearLayout dialogLayout = new LinearLayout(this); dialogLayout.Orientation = Orientation.Vertical; TextView txtHelp = new TextView(this); ; Button btnCancel = new Button(this); ImageView imgHelpView = null; btnCancel.SetText(Resource.String.btnCancel); imgHelpView = new ImageView(this); switch (text) { case 0: txtHelp.SetText(Resource.String.txtHelpVariables); imgHelpView.SetImageResource(Resource.Drawable.HelpVariable); break; case 500: txtHelp.SetText(Resource.String.txtHelpPython); imgHelpView.SetImageResource(Resource.Drawable.HelpPython); break; case 501: txtHelp.SetText(Resource.String.txtHelpPascal); imgHelpView.SetImageResource(Resource.Drawable.HelpPascal); break; case 800: txtHelp.SetText(Resource.String.txtHelpMap); imgHelpView.SetImageResource(Resource.Drawable.HelpMap); break; case 801: txtHelp.SetText(Resource.String.txtHelpRoad); imgHelpView.SetImageResource(Resource.Drawable.HelpRoad); break; case 802: txtHelp.SetText(Resource.String.txtHelpShop); imgHelpView.SetImageResource(Resource.Drawable.HelpShop); break; case 803: txtHelp.SetText(Resource.String.txtHelpFunctions); imgHelpView.SetImageResource(Resource.Drawable.blue); break; } if (imgHelpView != null) { dialogLayout.AddView(imgHelpView); } dialogLayout.AddView(txtHelp); ScrollView scrollPane = new ScrollView(this); scrollPane.AddView(dialogLayout); alert.SetView(scrollPane); alert.Show(); }
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container, Bundle savedInstanceState) { if (container == null) { // We have different layouts, and in one of them this // fragment's containing frame doesn't exist. The fragment // may still be created from its saved state, but there is // no reason to try to create its view hierarchy because it // won't be displayed. Note this is not needed -- we could // just run the code below, where we would create and return // the view hierarchy; it would just never be used. return null; } ScrollView scroller = new ScrollView(GetActivity()); TextView text = new TextView(GetActivity()); int pAdding = (int)TypedValue.ApplyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, GetActivity().GetResources().GetDisplayMetrics()); text.SetPadding(pAdding, pAdding, pAdding, pAdding); scroller.AddView(text); text.SetText(Shakespeare.DIALOGUE[GetShownIndex()]); return scroller; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); RequestWindowFeature (WindowFeatures.ActionBar); SetContentView (Resource.Layout.book_a_time_schedule); ActionBar.NavigationMode = ActionBarNavigationMode.Standard; ActionBar.SetTitle (Resource.String.book_time); ActionBar.SetDisplayShowTitleEnabled (false); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetDisplayShowHomeEnabled (true); setHeadingTitle (Resource.String.book_time); if (this.Intent.Extras != null) { isStandardHour = this.Intent.Extras.GetBoolean (constants.pIsStandard); strEnquiry = this.Intent.Extras.GetString (constants.pEnquiry); } dialog = new BookPreTimeUI(this, isStandardHour); dialog.actionDelegate = this; llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar); llProgress.Visibility = ViewStates.Gone; tvDatetimeStart = FindViewById<TextView> (Resource.Id.tv_book_time_start); tvDatetimeEnd = FindViewById<TextView> (Resource.Id.tv_book_time_end); tvTimeError = FindViewById<TextView> (Resource.Id.tv_time_booking_error); var btnBookTime = FindViewById<Button> (Resource.Id.btn_book_request); var tvDay = FindViewById<TextView> (Resource.Id.tv_day_standardhours_select); var tvStartTime = FindViewById<TextView> (Resource.Id.tv_start_standardhours_select); var tvEndTime = FindViewById<TextView> (Resource.Id.tv_end_standardhours_select); var llStartTime = FindViewById<LinearLayout> (Resource.Id.llStartTimeBooking); var llEndTime = FindViewById<LinearLayout> (Resource.Id.llEndTimeBooking); tvDay.Text = ""; tvStartTime.Text = ""; tvEndTime.Text = ""; // foreach (var standarHour in constants.specialistInfo.SpecialistDetail.ListStandardHour) { // if (standarHour.Day != null) { // tvDay.Text += standarHour.Day.Trim ()+ ":" + "\n"; // tvStartTime.Text += standarHour.Start.Trim () + " -" + "\n"; // tvEndTime.Text += standarHour.End.Trim ()+"\n"; // } // } // datetimeStart = new DateTime (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); // datetimeEnd = new DateTime (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); llStartTime.Click += (sender, e) => { tvTimeError.Visibility = ViewStates.Gone; isStartDatepicker = true; dialog.showSelectPreTime(isStartDatepicker, datetimeStart); }; llEndTime.Click += (sender, e) => { tvTimeError.Visibility = ViewStates.Gone; isStartDatepicker = false; dialog.showSelectPreTime(isStartDatepicker, datetimeEnd); }; btnBookTime.Click += (sender, e) => { if (utilsAndroid.checkValidateTimeBooking (this, Utils.getDateTimeNow(MApplication.getInstance().timezoneName), datetimeStart, datetimeEnd, tvTimeError)) { if (isStandardHour) { if (Utils.checkIsStandarHour (datetimeStart, datetimeEnd, constants.specialistInfo.SpecialistDetail.ListStandardHour)) { dialog.showPreTimeConfirm(strEnquiry, datetimeStart, datetimeEnd); } else { tvTimeError.Visibility = ViewStates.Visible; tvTimeError.SetText(Resource.String.standard_time_error); } } else { if (!Utils.checkIsStandarHour (datetimeStart, datetimeEnd, constants.specialistInfo.SpecialistDetail.ListStandardHour)) { dialog.showPreTimeConfirm(strEnquiry, datetimeStart, datetimeEnd); } else { tvTimeError.Visibility = ViewStates.Visible; tvTimeError.SetText(Resource.String.out_of_time_error); } } } else { tvTimeError.Visibility = ViewStates.Visible; } }; datetimeStart = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName);// DateTime.Now; tvDatetimeStart.Text = datetimeStart.ToString (constants.sDateFormat) + " " + datetimeStart.ToString(constants.sTimeFormat, new CultureInfo("en-us")).ToUpper(); datetimeEnd = Utils.getDateTimeNow (MApplication.getInstance ().timezoneName); //DateTime.Now; tvDatetimeEnd.Text = datetimeEnd.ToString (constants.sDateFormat) + " " + datetimeEnd.ToString(constants.sTimeFormat, new CultureInfo("en-us")).ToUpper(); GetSystemConfig getSysConfig = new GetSystemConfig (this); getSysConfig.actionGetConfigDelegate = this; getSysConfig.getSysConfig (); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); if (Debug) Log.Error (TAG, "+++ ON CREATE +++"); // Set up the window layout RequestWindowFeature (WindowFeatures.CustomTitle); SetContentView (Resource.Layout.main); Window.SetFeatureInt (WindowFeatures.CustomTitle, Resource.Layout.custom_title); // Set up the custom title title = FindViewById<TextView> (Resource.Id.title_left_text); title.SetText (Resource.String.app_name); title = FindViewById<TextView> (Resource.Id.title_right_text); // Get local Bluetooth adapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter; // If the adapter is null, then Bluetooth is not supported if (bluetoothAdapter == null) { Toast.MakeText (this, "Bluetooth is not available", ToastLength.Long).Show (); Finish (); return; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle p2) { var v = inflater.Inflate(Resource.Layout.receive_result, container, false); // Retrieve the TextView widget that will display results. results = v.FindViewById<TextView>(Resource.Id.results); // This allows us to later extend the text buffer. results.SetText(results.Text, TextView.BufferType.Editable); // Watch for button clicks. var getButton = v.FindViewById<Button>(Resource.Id.get); getButton.Click += (sender, e) => { // Start the activity whose result we want to retrieve. The // result will come back with request code GET_CODE. var intent = new Intent(Activity, typeof(SendResult)); StartActivityForResult(intent, GET_CODE); }; return v; }