Beispiel #1
0
        // TODO extract methods in here
        protected override void onCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Preferences.init(this, Tomdroid.CLEAR_PREFERENCES);

            SetContentView(Resource.Layout.note_edit);

            content = FindViewById<EditText>(Resource.Id.content);
            title = FindViewById<EditText>(Resource.Id.title);

            formatBar = FindViewById<SlidingDrawer>(Resource.Id.formatBar);

            //			content.setOnFocusChangeListener(new OnFocusChangeListener() {

            //			    public void onFocusChange(View v, bool hasFocus) {
            //			    	if(hasFocus && !xmlOn) {
            //			    		formatBar.setVisibility(View.VISIBLE);
            //			    	}
            //			    	else {
            //			    		formatBar.setVisibility(View.GONE);
            //			    	}
            //			    }
            //			});

            uri = Intent.getData();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.CreateAnimation);
            ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel(btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString(Resource.String.animationTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo(header.Context);
            header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack);
            ImageButton imgUndo = FindViewById<ImageButton>(Resource.Id.imgUndo);
            ImageButton imgStamp = FindViewById<ImageButton>(Resource.Id.imgStamp);
            ImageButton imgPaint = FindViewById<ImageButton>(Resource.Id.imgPaint);
            ImageButton imgColour = FindViewById<ImageButton>(Resource.Id.imgColour);
            ImageButton imgText = FindViewById<ImageButton>(Resource.Id.imgText);
            ImageButton imgComix = FindViewById<ImageButton>(Resource.Id.imgComix);
            ImageButton imgSound = FindViewById<ImageButton>(Resource.Id.imgSound);
            ImageButton imgPicture = FindViewById<ImageButton>(Resource.Id.imgPicture);
            ImageButton imgConfig = FindViewById<ImageButton>(Resource.Id.imgConfig);
            ImageButton imgPlayAnimation = FindViewById<ImageButton>(Resource.Id.imgPlayAnimation);
            ImageButton btnHome = FindViewById<ImageButton>(Resource.Id.btnHome);
            drawer = FindViewById<SlidingDrawer>(Resource.Id.slidingDrawer1);
            sliderToggle = FindViewById<Button>(Resource.Id.handle);
            context = header.Context;

            brushImage = null;

            relLay = FindViewById<RelativeLayout>(Resource.Id.relativeLayout2);
            relLay.LayoutParameters = new LinearLayout.LayoutParams((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth);

            if (AnimationUtil.imagesForCanvas == null)
                AnimationUtil.imagesForCanvas = new List<Bitmap>();

            if (currentColor == null)
            {

                currentColor = new WZColor(ImageHelper.convColToByteArray(Color.Black));
                inactiveColor = new WZColor(ImageHelper.convColToByteArray(Color.Gray));
                colorUtil.color = ImageHelper.convWZColorToColor(currentColor);
            }

            if (currentBrush == null)
            {
                using (Bitmap myBrush = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.HardBrush1))
                {
                    MemoryStream stream = new MemoryStream();
                    myBrush.Compress(Bitmap.CompressFormat.Png, 0, stream);
                    brushImage = stream.ToArray();
                    currentBrush = new BrushItem(4f, AnimationTypesBrushType.Normal, currentColor, inactiveColor, brushImage);
                }
            }

            myBitmap = Bitmap.CreateBitmap((int)wowZapp.LaffOutOut.Singleton.ScreenXWidth,
                                            (int)wowZapp.LaffOutOut.Singleton.ScreenYHeight / 2 /*- (int)ImageHelper.convertDpToPixel (320f, context)*/, Bitmap.Config.Argb8888);
            AnimationUtil.imagesForCanvas.Add(myBitmap);
            canvas = new Canvas(myBitmap);

            if (AnimationUtil.theImage == null)
                AnimationUtil.theImage = new Dictionary<int, List<ImageAttr>>();
            if (AnimationUtil.imgAttr == null)
                AnimationUtil.imgAttr = new List<ImageAttr>();
            AnimationUtil.imgAttr.Add(new ImageAttr());
            AnimationUtil.currentImage = 0;

            relLay.AddView(new CreateAnimationDrawer(context, currentBrush, canvas, myBitmap));

            if (AudioItems == null || AudioItems.Count == 0)
                AudioItems = new Dictionary<int, AnimationAudioInfo>();

            CurrentLayer = new FrameLayerPair(1, 1);

            dbm = LaffOutOut.Singleton.dbm;

            drawerState = false;

            btnBack.Click += delegate
            {
                SaveAnimation();
                Finish();
            };

            btnHome.Click += delegate
            {
                Intent i = new Intent(this, typeof(Main.HomeActivity));
                i.SetFlags(ActivityFlags.ClearTop);
                StartActivity(i);
            };

            imgUndo.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgStamp.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPaint.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgColour.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgText.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgComix.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgSound.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgPicture.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};
            imgConfig.Click += (object sender, EventArgs e) => {
                openDrawer(sender, e);};

            imgPlayAnimation.Click += delegate
            {
                Intent m = new Intent(this, typeof(PlayAnimation));
                StartActivity(m);
            };
            modalPicture = new ImageView(context);
            percents = new TextView[4];
            colours = new ImageView[2];
        }