@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); rl = (RelativeLayout) findViewById(R.id.rl); setBackground(); startService(new Intent(this, PhoneService.class)); preferences = getSharedPreferences("config", MODE_PRIVATE); copyDataBase("address.db"); // copy the database of phone tracking copyDataBase("antivirus.db"); System.out.println("start to update"); // update the virus database updataVirus(); if (preferences.getBoolean("auto_update", true)) { checkVersion(); } else { // if user doesn't check the new version, delay for 2s, then go to homepage handler.sendEmptyMessageDelayed(ENTER_HOME_DIRECTLY, 1000); } // graduate change splashpage AlphaAnimation anim = new AlphaAnimation(0.3f, 1f); anim.setDuration(1000); rl.startAnimation(anim); AdManager.getInstance(this).init("879ed71bbc111e86", "e20e455762cc5ef5", true); OffersManager.getInstance(this).onAppLaunch(); }
@Override public void onClick(View arg0) { if (!"-1".equals(t.id)) { Intent intent = new Intent(mActivity, ResourcesActivity.class); intent.putExtra("category", t); mActivity.startActivity(intent); mActivity.int4Right(); } else { // 调用方式二:直接打开全屏积分墙,并且监听积分墙退出的事件onDestory OffersManager.getInstance(mActivity) .showOffersWall( new Interface_ActivityListener() { /** 但积分墙销毁的时候,即积分墙的Activity调用了onDestory的时候回调 */ @Override public void onActivityDestroy(Context context) {} }); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); AdManager.getInstance(this).init("b8d1742f93ff5bca", "604765a32396a7fc", true); OffersManager.getInstance(this).onAppLaunch(); new Thread() { public void run() { while (true) { SpotManager.getInstance(MainActivity.this).loadSpotAds(); SpotManager.getInstance(MainActivity.this).setSpotTimeout(5000); try { sleep(160000); } catch (InterruptedException e) { e.printStackTrace(); } } }; }.start(); handler = new Handler() { public void handleMessage(android.os.Message msg) { if (msg.what == 123) { SpotManager.getInstance(MainActivity.this).showSpotAds(MainActivity.this); } }; }; FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; DiyBanner banner = new DiyBanner(this, DiyAdSize.SIZE_MATCH_SCREENx32); this.addContentView(banner, layoutParams); ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); for (int i = 0; i < 16; i++) { HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("text", view[i]); list.add(hashMap); } SimpleAdapter adapter = new SimpleAdapter( MainActivity.this, list, R.layout.bt, new String[] {"text"}, new int[] {R.id.bt1}); gridView = (GridView) this.findViewById(R.id.gridView1); gridView.setAdapter(adapter); tView1 = (TextView) this.findViewById(R.id.textView1); tView2 = (TextView) this.findViewById(R.id.textView2); button = (Button) this.findViewById(R.id.button1); button2 = (Button) this.findViewById(R.id.button2); compute = new Compute(tView1, tView2, view); button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { compute.c(); } }); button2.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { compute.del(); } }); gridView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { compute.cli(arg2); } }); gridView.setOnItemSelectedListener( new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { compute.cli(arg2); } @Override public void onNothingSelected(AdapterView<?> arg0) {} }); }
@Override public View intView(LayoutInflater inflater) { View view = inflater.inflate(R.layout.home_center_frame, null); ViewUtils.inject(this, view); // 有米android 积分墙sdk 5.0.0之后支持定制浏览器顶部标题栏的部分UI // setOfferBrowserConfig(); // (可选)关闭有米log输出,建议开发者在嵌入有米过程中不要关闭,以方便随时捕捉输出信息,出问题时可以快速定位问题 // AdManager.getInstance(Context context).setEnableDebugLog(false); // 初始化接口,应用启动的时候调用,参数:appId, appSecret AdManager.getInstance(ct).init("8a676b5774c1679d", "06f65e7e565c19e8"); // (可选)开启用户数据统计服务,(sdk v4.08之后新增功能)默认不开启,传入false值也不开启,只有传入true才会调用 AdManager.getInstance(ct).setUserDataCollect(true); // 如果使用积分广告,请务必调用积分广告的初始化接口: OffersManager.getInstance(ct).onAppLaunch(); // (可选)注册积分监听-随时随地获得积分的变动情况 PointsManager.getInstance(ct).registerNotify(this); // (可选)注册积分订单赚取监听(sdk v4.10版本新增功能) PointsManager.getInstance(ct).registerPointsEarnNotify(this); // (可选)设置是否在通知栏显示下载相关提示。默认为true,标识开启;设置为false则关闭。(sdk v4.10版本新增功能) // AdManager.setIsDownloadTipsDisplayOnNotification(false); // (可选)设置安装完成后是否在通知栏显示已安装成功的通知。默认为true,标识开启;设置为false则关闭。(sdk v4.10版本新增功能) // AdManager.setIsInstallationSuccessTipsDisplayOnNotification(false); // (可选)设置是否在通知栏显示积分赚取提示。默认为true,标识开启;设置为false则关闭。 // PointsManager.setEnableEarnPointsNotification(false); // (可选)设置是否开启积分赚取的Toast提示。默认为true,标识开启;设置为false这关闭。 // PointsManager.setEnableEarnPointsToastTips(false); myOptionTitles = ct.getResources().getStringArray(R.array.home_option_name); myOptionIcons = ct.getResources().obtainTypedArray(R.array.home_option_icon); myAdatper = new HomePageAdapter(ct, myOptionTitles, myOptionIcons); gridView.setAdapter(myAdatper); gridView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: dialog = ProgressDialog.createDialog(ct); dialog.setCancelable(true); dialog.setMessage("寻找数据中。。。"); dialog.show(); startLocation(mCityNameStatus); sm.toggle(); break; case 1: Intent intent = new Intent(ct, BaiDuMapActivity.class); ct.startActivity(intent); break; case 2: Intent intent2 = new Intent(ct, CaptureActivity.class); ct.startActivity(intent2); break; case 3: Intent intent3 = new Intent(ct, BaiDuFanYIActivity.class); ct.startActivity(intent3); break; case 4: refreshCamera(); break; case 5: Intent intent5 = new Intent(ct, PhoneMessageActivity.class); ct.startActivity(intent5); break; case 6: Intent intent4 = new Intent(ct, IpSearchActivity.class); ct.startActivity(intent4); break; case 7: Intent intent6 = new Intent(ct, CalendarActivity.class); ct.startActivity(intent6); break; case 8: // 展示插播广告,可以不调用loadSpot独立使用 SpotManager.getInstance(ct) .showSpotAds( ct, new SpotDialogListener() { @Override public void onShowSuccess() { Log.i("YoumiAdDemo", "展示成功"); } @Override public void onShowFailed() { Log.i("YoumiAdDemo", "展示失败"); } @Override public void onSpotClosed() { Log.i("YoumiAdDemo", "展示关闭"); } }); // // break; default: break; } } }); imageview.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // 调用方式一:直接打开全屏积分墙 // OffersManager.getInstance(this).showOffersWall(); // 调用方式二:直接打开全屏积分墙,并且监听积分墙退出的事件onDestory OffersManager.getInstance(ct) .showOffersWall( new Interface_ActivityListener() { /** 但积分墙销毁的时候,即积分墙的Activity调用了onDestory的时候回调 */ @Override public void onActivityDestroy(Context context) {} }); } }); // myOptionIcons.recycle(); return view; }
@Override public void onDestroy() { super.onDestroy(); OffersManager.getInstance(mParentActivity).onAppExit(); }