public StreamManager(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; StreamStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long); app = ((GlobalApp)context.ApplicationContext); }
public TextToSpeechManager(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; app = ((GlobalApp)context.ApplicationContext); if (mTts == null) mTts = new TextToSpeech(context, this); lockObject = new object(); }
private TapjoyManager(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; TapjoyToast = Toast.MakeText(context, string.Empty, ToastLength.Short); app = ((GlobalApp)context.ApplicationContext); StreamPrice = context.Resources.GetInteger(Resource.Integer.tapjoy_stream_price); connectListener = new ConnectListener(); streamSpentListener = new CurrencySpentListener(); streamPlacementListener = new PlacementListener(); earnedListener = new CurrencyEarnedListener(); videoListener = new VideoListener(); }
public MainEventHandlers(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; app = ((GlobalApp)context.ApplicationContext); ConnectStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long); TapjoyManager.Initialize(context); TapjoyManager.Connect(delegate { if (SetMenuVisibility != null) SetMenuVisibility.Invoke(); }); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.about_activity); mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolbar); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.Title = GetString(Resource.String.AboutTitle); layoutAbout = FindViewById<LinearLayout>(Resource.Id.layoutAboutSecondary); app = (GlobalApp)ApplicationContext; lbVersion = FindViewById<TextView>(Resource.Id.lbVersion); lbRelaseName = FindViewById<TextView>(Resource.Id.lbRelaseName); lbAndroidSerial = FindViewById<TextView>(Resource.Id.lbAndroidSerial); lbAndroidId = FindViewById<TextView>(Resource.Id.lbAndroidId); lbAndroidVersion = FindViewById<TextView>(Resource.Id.lbAndroidVersion); lbManufacturer = FindViewById<TextView>(Resource.Id.lbManufacturer); lbDeviceModel = FindViewById<TextView>(Resource.Id.lbDeviceModel); //lbMac = FindViewById<TextView>(Resource.Id.lbMac); lbAdvertisingId = FindViewById<TextView>(Resource.Id.lbAdvertisingId); btnCoins = FindViewById<Button>(Resource.Id.btnCoins); btnCoins.Click += (sender, e) => Dialogs.BuildDialog(this, "Info", GetString(Resource.String.coins_explanation), (args, ed) => { }, null, null, Android.Resource.String.Ok, 0, 0).Show(); lbRelaseName.Text += ": " + app.ReleaseName; try { PackageManager manager = this.PackageManager; PackageInfo info = manager.GetPackageInfo(this.PackageName, 0); lbVersion.Text += ": " + info.VersionName; } catch (Exception) { Log.Debug(TAG, "Failed to obtain current application version name and version code"); } DeviceInfo.ObtainInfo(this); lbAndroidSerial.Text += ": " + DeviceInfo.AndroidSerial; lbAndroidId.Text += ": " + DeviceInfo.AndroidID; lbAndroidVersion.Text += ": " + DeviceInfo.AndroidVersion; lbManufacturer.Text += ": " + DeviceInfo.Manufacturer; lbDeviceModel.Text += ": " + DeviceInfo.DeviceModel; //lbMac.Text += ": " + DeviceInfo.MacAddress; var id = await GetAdvertisingId(); lbAdvertisingId.Text += ": " + id; }
public JsonGestureIntentStore(string jsonPath, string fileVersion) { FileVersion = fileVersion; this.jsonPath = jsonPath; SetupSerializer(); if (File.Exists(jsonPath)) { Deserialize(); } else { Apps = new Dictionary<string, ExeApp>(); GlobalApp = new GlobalApp(); } }
private void Deserialize(Stream stream, bool closeStream) { if(stream == null || !stream.CanRead) throw new ArgumentException("stream"); try { using (var txtReader = new StreamReader(stream)) using (var jsonReader = new JsonTextReader(txtReader)) { var ser = new JsonSerializer(); ser.Formatting = Formatting.None; ser.TypeNameHandling = TypeNameHandling.Auto; if (FileVersion.Equals("1")) { ser.Converters.Add(new GestureIntentConverter_V1()); } else if (FileVersion.Equals("2")) { ser.Converters.Add(new GestureIntentConverter()); } var result = ser.Deserialize<SerializeWrapper>(jsonReader); FileVersion = result.FileVersion; GlobalApp = result.Global; //Apps = result.Apps; Apps = new Dictionary<string, ExeApp>(); //to lower foreach(var a in result.Apps.Values) { a.ExecutablePath = a.ExecutablePath.ToLower(); Apps.Add(a.ExecutablePath, a); } } } finally { if (closeStream) stream.Dispose(); } //todo: 完全在独立domain中加载json.net? /*var deserializeDomain = AppDomain.CreateDomain("jsonDeserialize"); deserializeDomain.UnhandledException += (sender, args) => { throw new IOException(args.ExceptionObject.ToString()); }; deserializeDomain.DomainUnload += (sender, args) => { Console.WriteLine("deserializeDomain Unloaded"); }; var wrapperRef = (ISerializeWrapper)deserializeDomain.CreateInstanceAndUnwrap("SerializeWrapper", "SerializeWrapper.SerializeWrapper"); wrapperRef.DeserializeFromStream(stream, FileVersion, closeStream); GlobalApp = wrapperRef.Global; Apps = wrapperRef.Apps; wrapperRef = null; GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); AppDomain.Unload(deserializeDomain); deserializeDomain = null; GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers();*/ }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); InitializeInsights(); //Read application wide values app = ((GlobalApp)this.ApplicationContext); app.Settings = ((PreferenceManager)app.PreferenceManager).LoadSettings(this); savedInstanceState = false; if (bundle != null) { selectedView = (MainEventHandlers.ViewsEnum)bundle.GetInt(selectedViewKey); } var tapjoyPayload = Intent.GetStringExtra(Tapjoy.Tapjoy.IntentExtraPushPayload); if (tapjoyPayload != null) { TapjoyManager.HandlePushPayload(tapjoyPayload); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.main_material); mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(mToolbar); SupportActionBar.SetDisplayShowHomeEnabled(true); IsTabletLandscapeLayout = (FindViewById<LinearLayout>(Resource.Id.tablet_layout) != null); ResetFragmentPositions(); if (!IsTabletLandscapeLayout && drawerFragment == null) { drawerFragment = (FragmentDrawer)SupportFragmentManager.FindFragmentById(Resource.Id.fragment_navigation_drawer); drawerFragment.SetUpDrawer(Resource.Id.fragment_navigation_drawer, FindViewById<DrawerLayout>(Resource.Id.drawer_layout), mToolbar); drawerFragment.ListItemClicked += (sender, e) => { if (ConnectionManager.Connected) DisplayView((MainEventHandlers.ViewsEnum)e.Position); }; } ReadSatellitesXml(); }