private void SwitchingBackgrounds() { for (int i = 1; i < 5; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LB/img" + i.ToString() + ".jpg", this)); } for (int i = 1; i < 8; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img" + i.ToString() + ".jpg", this)); } SwitchingBackgroundsThread = new Thread(new ThreadStart(() => { while (true) { int randId = new Random().Next(0, DrawableList.Count); while (randId == 3) { randId = new Random().Next(0, DrawableList.Count); } RunOnUiThread(() => Backgroud.Background = DrawableList [randId]); Thread.Sleep(1000); } })); SwitchingBackgroundsThread.Start(); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { RequestWindowFeature(Android.Views.WindowFeatures.NoTitle); Window.SetFlags(Android.Views.WindowManagerFlags.Fullscreen, Android.Views.WindowManagerFlags.Fullscreen); Bundle Extras = Intent.Extras; string[] DateUtilizatorNou = Extras.GetStringArray("FacebookUserData"); BackID = Extras.GetInt("BackgroundLoginByteArray"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); LoginText = FindViewById <EditText> (Resource.Id.editText1); ParolaText = FindViewById <EditText> (Resource.Id.editText2); LoginBtn = FindViewById <Button> (Resource.Id.button1); SignUpBtn = FindViewById <Button> (Resource.Id.button2); RememberMe = FindViewById <CheckBox> (Resource.Id.checkBox1); Backgroud = FindViewById <RelativeLayout> (Resource.Id.relativeLayout1); LoginWithFacebook = FindViewById <ImageView>(Resource.Id.imageView3); SetTypeface.Italic.SetTypeFace(this, LoginText); SetTypeface.Italic.SetTypeFace(this, ParolaText); SetTypeface.Italic.SetTypeFace(this, LoginBtn); SetTypeface.Italic.SetTypeFace(this, SignUpBtn); SetTypeface.Italic.SetTypeFace(this, RememberMe); if (DateUtilizatorNou != null) { CreateNewFacebookUser(DateUtilizatorNou); } List <Drawable> DrawableList = new List <Drawable>(); for (int i = 1; i < 5; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LB/img" + i.ToString() + ".jpg", this)); } for (int i = 1; i < 8; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img" + i.ToString() + ".jpg", this)); } Backgroud.Background = DrawableList[BackID]; SignUpBtn.Click += SignUpBtn_Click; LoginBtn.Click += LoginBtn_Click; LoginWithFacebook.Click += LoginWithFacebook_Click; if (new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username) != string.Empty) { Intent StartSignUp = new Intent(this, typeof(Utilizator_Main)); StartSignUp.PutExtra("BackgroundUtilizatorMainByteArray", DrawableConverter.DrawableToByteArray(Backgroud.Background)); StartActivity(StartSignUp); } }
private void RenderGif() { AnimationDrawable test = new AnimationDrawable(); test.OneShot = false; for (int i = 1; i < 90; i++) { Drawable d = DrawableConverter.GetDrawableFromAssets("gif/i" + i.ToString() + ".png", this); test.AddFrame(d, 1); } iView.SetImageDrawable(test); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { RequestWindowFeature(Android.Views.WindowFeatures.NoTitle); Window.SetFlags(Android.Views.WindowManagerFlags.Fullscreen, Android.Views.WindowManagerFlags.Fullscreen); Bundle Extras = Intent.Extras; int BackgroundByteArray = Extras.GetInt("BackgroundSignUpByteArray"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SignUp); Pager = FindViewById <ViewPager> (Resource.Id.viewPager1); Titlu = FindViewById <TextView> (Resource.Id.textView1); Background = FindViewById <RelativeLayout> (Resource.Id.relativeLayout1); string[] Titluri = new string[] { "Informatii Personale", "Informatii Virtuale", "Finalizare", }; int[] Layouturi = new int[] { Resource.Layout.SignUp_Page1, Resource.Layout.SIgnUp_Page2, Resource.Layout.SignUp_Page3, }; SetTypeface.Bold.SetTypeFace(this, Titlu); List <Drawable> DrawableList = new List <Drawable>(); for (int i = 1; i < 5; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LB/img" + i.ToString() + ".jpg", this)); } for (int i = 1; i < 8; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img" + i.ToString() + ".jpg", this)); } Background.Background = DrawableList[BackgroundByteArray]; Pager.Adapter = new ViewPagerAdapter(SupportFragmentManager, Layouturi, this, Pager); Pager.OffscreenPageLimit = 3; Pager.PageSelected += (object sender, ViewPager.PageSelectedEventArgs e) => { Titlu.Text = Titluri[e.Position]; }; }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); Bundle Extras = Intent.Extras; byte[] BackgroundByteArray = Extras.GetByteArray("BackgroundUtilizatorMainByteArray"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Organizator_Main); CreareExcursieBtn = FindViewById <Button> (Resource.Id.button1); CreareExcursieTView = FindViewById <TextView> (Resource.Id.textView2); LeftDrawer = FindViewById <ListView> (Resource.Id.left_drawer_listview); UserProfilePic = FindViewById <ImageView> (Resource.Id.imageView1); UserNume = FindViewById <TextView> (Resource.Id.textView1); Background = FindViewById <RelativeLayout> (Resource.Id.relativeLayout1); Background.Background = DrawableConverter.ByteArrayToDrawable(BackgroundByteArray, this); Drawable RoundedUserProfile = DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img1.jpg", this); RoundedUserProfile = new BitmapDrawable(Resources, RoundedBitmap.MakeRound(((BitmapDrawable)RoundedUserProfile).Bitmap, ((BitmapDrawable)RoundedUserProfile).Bitmap.Width)); UserProfilePic.SetImageDrawable(RoundedUserProfile); UserNume.Text = "Dragos Mihaitza"; SetTypeface.Normal.SetTypeFace(this, UserNume); Drawable d = Resources.GetDrawable(Resource.Drawable.SettingsIcon); LeftDrawer.Adapter = new Organizator_Main_LeftDrawerAdapter(this, new string[] { "test 1", "test 2", "test 3", }, new Drawable[] { d, d, d }); SetTypeface.Normal.SetTypeFace(this, CreareExcursieTView); SetTypeface.Normal.SetTypeFace(this, CreareExcursieBtn); CreareExcursieBtn.Click += (object sender, EventArgs e) => { Intent StartCreareExcursie = new Intent(this, typeof(Organizator_CreareExcursie)); StartCreareExcursie.PutExtra("BackgroundUtilizatorMainByteArray", DrawableConverter.DrawableToByteArray(Background.Background)); StartActivity(StartCreareExcursie); }; }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); Bundle Extras = Intent.Extras; int BackgroundByteArray = Extras.GetInt("BackgroundUtilizatorMainByteArray"); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Utilizator_Main); Background = FindViewById <RelativeLayout> (Resource.Id.relativeLayout1); LeftDrawer = FindViewById <ListView> (Resource.Id.left_drawer_listview); Next = FindViewById <Button> (Resource.Id.button1); Container = FindViewById <RelativeLayout> (Resource.Id.relativeLayout3); Cod = FindViewById <EditText> (Resource.Id.editText1); IntroducetiCodul = FindViewById <TextView> (Resource.Id.textView2); UserProfilePic = FindViewById <ImageView> (Resource.Id.imageView1); UserNume = FindViewById <TextView> (Resource.Id.textView1); List <Drawable> DrawableList = new List <Drawable>(); for (int i = 1; i < 5; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LB/img" + i.ToString() + ".jpg", this)); } for (int i = 1; i < 8; i++) { DrawableList.Add(DrawableConverter.GetDrawableFromAssets("LoadingBackgrounds/img" + i.ToString() + ".jpg", this)); } Background.Background = DrawableList[BackgroundByteArray]; Cod.Text = new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Trip.TipId); //Cod.Text = "c41z1zb6xc"; SetTypeface.Normal.SetTypeFace(this, IntroducetiCodul); SetTypeface.Normal.SetTypeFace(this, Next); SetTypeface.Normal.SetTypeFace(this, Cod); TcpClient Client = new TcpClient(_Details.ServerIP, _Details.LargeFilesPort); NetworkStream ns = Client.GetStream(); _TcpDataExchange.WriteStreamString(ns, CryptDecryptData.CryptData(new string[] { _Details.GetProfilePic, new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username) })); int ReadedBytes; byte[] Buffer = new byte[1000]; MemoryStream ms = new MemoryStream(); while ((ReadedBytes = ns.Read(Buffer, 0, Buffer.Length)) > 0) { ms.Write(Buffer, 0, ReadedBytes); } Client.Close(); ns.Dispose(); Bitmap bitMap = ((BitmapDrawable)DrawableConverter.ByteArrayToDrawable(ms.ToArray(), this)).Bitmap; UserProfilePic.SetImageDrawable(new BitmapDrawable(Resources, RoundedBitmap.MakeRound(bitMap, bitMap.Height / 2))); TcpClient client = new TcpClient(_Details.ServerIP, _Details.LargeFilesPort); NetworkStream Ns = client.GetStream(); _TcpDataExchange.WriteStreamString(Ns, CryptDecryptData.CryptData(new string[] { _Details.GetUserName, new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username) })); string NumeUtilizator = CryptDecryptData.DecryptData(_TcpDataExchange.ReadStreamString(Ns))[0]; UserNume.Text = NumeUtilizator; client.Close(); Ns.Dispose(); SetTypeface.Normal.SetTypeFace(this, UserNume); LeftDrawer.Adapter = new Utilizator_Main_LeftDrawerAdapter(this, new string[] { "Logout" }, Background.Background); Next.Click += (object sender, EventArgs e) => { TcpClient OUTPUT_Client = new TcpClient(_Details.ServerIP, _Details.TripPort_INPUT); NetworkStream OUTPUT_ns = OUTPUT_Client.GetStream(); OUTPUT = new Client(OUTPUT_Client, OUTPUT_ns); string NumePrenume = "nume Prenume"; string NumarTelefon = new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username); string TripId = Cod.Text; _TcpDataExchange.WriteStreamString(OUTPUT_ns, CryptDecryptData.CryptData(new String [] { "TRIPENTER", NumePrenume, NumarTelefon, TripId })); List <string> Messages = new List <string>(); Messages.AddRange(CryptDecryptData.DecryptData(_TcpDataExchange.ReadStreamString(OUTPUT_ns))); Messages.Add(TripId); TcpClient INPUT_Client = new TcpClient(_Details.ServerIP, _Details.TripPort_OUTPUT); NetworkStream INPUT_ns = INPUT_Client.GetStream(); INPUT = new Client(INPUT_Client, INPUT_ns); _TcpDataExchange.WriteStreamString(INPUT_ns, CryptDecryptData.CryptData(new String [] { NumePrenume, NumarTelefon, TripId })); new SaveUsingSharedPreferences(this).Save(SaveUsingSharedPreferences.Tags.Trip.TipId, TripId); Intent StartUtilizatorTrip = new Intent(this, typeof(Utilizator_Trip)); StartUtilizatorTrip.PutExtra("BackgroundByteArray", DrawableConverter.DrawableToByteArray(Background.Background)); StartUtilizatorTrip.PutStringArrayListExtra("TripData", Messages); StartActivity(StartUtilizatorTrip); }; }