Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash_layout);
    final int currentVersionCode = getVersionCode();
    boolean isFirst = currentVersionCode != MoccaPreferences.ISFIRSTSTART.get() ? true : false;

    if (isFirst) {
      viewPager = (ViewPager) findViewById(R.id.viewpager_splash);
      circlePageIndicator = (CirclePageIndicator) findViewById(R.id.pager_indicator2);
      int[] drawables = {
        R.drawable.start_1, R.drawable.start_2, R.drawable.start_3, R.drawable.start_4
      };
      for (int i = 0; i <= 3; i++) {
        ImageView iv = new ImageView(this);
        iv.setLayoutParams(
            new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
        iv.setScaleType(ScaleType.FIT_XY);
        iv.setImageResource(drawables[i]);
        views.add(iv);
      }
      View iv = new View(this);
      iv.setLayoutParams(
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT));
      views.add(iv);

      viewPager.setAdapter(new SplashAdapter());
      circlePageIndicator.setViewPager(viewPager);
      circlePageIndicator.setOnPageChangeListener(
          new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageSelected(int arg0) {
              if (arg0 == views.size() - 1) {
                MoccaPreferences.ISFIRSTSTART.put(currentVersionCode);
                viewPager.setCurrentItem(views.size() - 2);
                Intent intent = new Intent(SplashActivity.this, NineShowMainActivity.class);
                startActivity(intent);
                finish();
              }
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {}

            @Override
            public void onPageScrollStateChanged(int arg0) {}
          });
    } else {
      ivSplash = (ImageView) findViewById(R.id.iv_splash);
      ivSplash.setVisibility(View.VISIBLE);
      drawable = (AnimationDrawable) ivSplash.getBackground();
      uiHandler.sendEmptyMessageDelayed(100, 2 * 1000);
    }
    FeedbackAgent agent = new FeedbackAgent(this);
    agent.sync();
    autoLogin();
  }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppUtils.switchLanguage(getApplicationContext());
    exitWithUserOption = false;
    EventBus.getDefault().register(this);
    initSlidingMenu();
    setContentView(R.layout.activity_main);
    Trace.e(tag, getString(R.string.lang));
    fMgr = getSupportFragmentManager();
    imageLoader = BaseApplication.getImageLoader(this);
    options =
        new DisplayImageOptions.Builder()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .showStubImage(R.drawable.tab_center_normal)
            .showImageForEmptyUri(R.drawable.tab_center_normal)
            .showImageOnFail(R.drawable.tab_center_normal)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();
    if (AppUtils.isLogin(this)) majorTeamGsonModel = AppSharePreferences.getMajorTeam(this);
    mTitleView = (TitleView) findViewById(R.id.titlebar_layout);
    mTitleView.initTitleBar(null, 0, 0);
    mTitleView.setRightMenuButton();
    mTitleView.setTitleViewListener(mTitleViewListener);
    dealBottomButtonsClickEvent();
    initFragment(savedInstanceState);
    if (majorTeamGsonModel != null && !TextUtils.isEmpty(majorTeamGsonModel.avatar)) {
      File file = DiskCacheUtils.findInCache(majorTeamGsonModel.avatar, imageLoader.getDiskCache());
      if (file == null || !file.exists()) {
        imageLoader.displayImage(majorTeamGsonModel.avatar, majorImageView, options);
      } else {
        majorImageView.setImageBitmap(BitmapFactory.decodeFile(file.getAbsolutePath()));
      }
    } else {
      if (AppSharePreferences.getFollowFlag(getApplicationContext())) {
        majorImageView.setImageResource(R.drawable.tab_center_notset_normal);
      } else {
        majorImageView.setImageResource(R.drawable.tab_center_normal);
      }
    }

    mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

    AppService.startCheckVersion(this, false);
    mDownloadReceiver = new DownloadCompleteReceiver();
    registerReceiver(mDownloadReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
    FeedbackAgent agent = new FeedbackAgent(this);
    agent.sync();

    /*
     * if
     * (AppSharePreferences.getDefault().getBoolean("MAIN_TOURNAMENT_GUIDE",
     * true)) { startActivity(new Intent(MainActivity.this,
     * GuideActivity.class)); }
     */

  }
Exemplo n.º 3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    overridePendingTransition(R.anim.fade_in, 0);

    // 初始化控件
    initWidget();
    // adapter绑定list
    noteList = noteDetailDao.getAllNoteForListView(currentGroupIndex, orderString);

    // 初始化用户反馈
    agent = new FeedbackAgent(this);
    // 刷新回复
    agent.sync();

    // 设置新浪SSO handler
    umSocialService =
        UMServiceFactory.getUMSocialService(MainActivity.class.getName(), RequestType.SOCIAL);
    umSocialService.getConfig().setSinaSsoHandler(new SinaSsoHandler());

    // 检查更新
    UmengUpdateAgent.update(this);

    // 读取系统设置
    sharedPreferences = getSharedPreferences("setting", MODE_PRIVATE);

    // 当typeGroup中改变按钮时
    typeGroup.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            // 改变radiobutton字体颜色
            changeRadioButoonColor();

            RadioButton radioButton = (RadioButton) findViewById(checkedId);
            String typeName = radioButton.getText().toString();
            showTypeView.setText(typeName);

            // 获取分组的全部记事本
            if (typeName.equals("全部")) {
              // 如果是“全部”则显示全部记事本
              currentGroupIndex = 1;
            } else {
              // 否则根据分组名获取tid找出全部记事本
              currentGroupIndex = noteTypeDao.getTid(typeName);
            }
            // 刷新listview
            showListView();
          }
        });

    // 默认选中"全部"分组
    SelectOneType(0);
  }
Exemplo n.º 4
0
  private void setUpUmengFeedback() {
    fb = new FeedbackAgent(this);
    // check if the app developer has replied to the feedback or not.
    fb.sync();
    fb.openAudioFeedback();
    fb.openFeedbackPush();

    // fb.setWelcomeInfo();
    fb.setWelcomeInfo("请输入您的意见和建议,您的支持是作者最大的动力,谢谢。");
    FeedbackPush.getInstance(this).init(true);
    PushAgent.getInstance(this).setPushIntentServiceClass(MyPushIntentService.class);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                boolean result = fb.updateUserInfo();
              }
            })
        .start();
  }