コード例 #1
0
        @Override
        public void callback(final MediaPlayer player, final String url) {
          Trace.e(tag, "callback:" + url);
          if (init) {
            init = false;
            if (!TextUtils.isEmpty(url)) {
              mUrl = url;
            }
            mHandler.removeCallbacks(runnable);
            mHandler.postDelayed(runnable, 800);
            return;
          }
          mHandler.removeCallbacks(runnable);
          if (!TextUtils.isEmpty(url) && player != null && (mUrl == null || !mUrl.equals(url))) {
            mUrl = url;
            player.reset();

            Intent intent = VideoActivity.getIntent(context, mUrl, title);
            intent.putExtra(IS_FROM_PLAYER_ON_LINE_VIDEO_ACTIVITY, true);
            startActivityForResult(intent, REQUEST_PLAYER_ONLINE_VIDEO_ACTIVITY);
            finish();
          } else {
            mHandler.postDelayed(runnable, 800);
          }
        }
コード例 #2
0
 @Override
 public void onLoadResource(WebView view, String url) {
   Trace.e(tag, "onLoadResource  =  " + url);
   if (!isFromVideoActivity) {
     playVideo(url);
   }
   super.onLoadResource(view, url);
 }
コード例 #3
0
ファイル: MainActivity.java プロジェクト: lpjhblpj/football
  @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)); }
     */

  }
コード例 #4
0
 @SuppressLint("Wakelock")
 @Override
 protected void onDestroy() {
   Trace.d(tag, "onDestroy");
   // 解决退出无法关闭声音
   mWebContent.loadUrl("about:blank");
   mHandler.removeCallbacks(runnable);
   super.onDestroy();
 }
コード例 #5
0
ファイル: FeedFragment.java プロジェクト: lpjhblpj/football
 @Override
 public void run() {
   Trace.d(tag, "refreshRunnable");
   mHandler.removeCallbacks(refreshRunnable);
   if (AppUtils.networkAvailable(getActivity())) {
     requestNewFeedRefresh();
   } else {
     mHandler.postDelayed(refreshRunnable, mRefreshRate);
   }
 }
コード例 #6
0
 private void playVideo(String url) {
   if ("youku".equalsIgnoreCase(type) && matchOnLiveVideoUrl(url)) {
     Intent intent = VideoActivity.getIntent(this, url, title);
     intent.putExtra(IS_FROM_PLAYER_ON_LINE_VIDEO_ACTIVITY, true);
     startActivityForResult(intent, REQUEST_PLAYER_ONLINE_VIDEO_ACTIVITY);
     this.finish();
   } else if (matchOnLiveVideoUrl(url)) {
     Trace.e("video", "startActivity...");
     Intent intent = VideoActivity.getIntent(this, url, title);
     intent.putExtra(IS_FROM_PLAYER_ON_LINE_VIDEO_ACTIVITY, true);
     startActivityForResult(intent, REQUEST_PLAYER_ONLINE_VIDEO_ACTIVITY);
     this.finish();
   }
 }
コード例 #7
0
 @TargetApi(Build.VERSION_CODES.HONEYCOMB)
 @Override
 public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
   Trace.e(tag, "shouldInterceptRequest:" + url);
   WebResourceResponse webResourceResponse = null;
   try {
     if (url.startsWith("http://mf.atm.youku.com/")
         || url.startsWith("https://mf.atm.youku.com/")) {
       String s = "{\"SKIP\":1,\"P\":7,\"BAK\":[{}],\"VAL\":[]}";
       webResourceResponse =
           new WebResourceResponse(
               "application/json", "UTF-8", new ByteArrayInputStream(s.getBytes()));
     } else if (url.startsWith("http://api.letv.com/mms/out/video/")) {
       String s = "{\"SKIP\":1,\"P\":7,\"BAK\":[{}],\"VAL\":[]}";
       webResourceResponse =
           new WebResourceResponse(
               "application/json", "UTF-8", new ByteArrayInputStream(s.getBytes()));
     }
   } catch (Exception e) {
     Trace.e(tag, e.getMessage().toString());
   }
   return webResourceResponse;
 }
コード例 #8
0
 @TargetApi(Build.VERSION_CODES.HONEYCOMB)
 @Override
 protected void onPause() {
   super.onPause();
   MobclickAgent.onPause(this);
   mWebContent.onPause();
   if (mWakeLock != null) {
     try {
       if (mWakeLock.isHeld()) mWakeLock.release();
     } catch (Exception e) {
       Trace.d(tag, e.getMessage());
     }
   }
 }
コード例 #9
0
ファイル: MainActivity.java プロジェクト: lpjhblpj/football
  @Override
  protected void onDestroy() {
    Trace.e("MainActivity", "onDestroy");
    EventBus.getDefault().unregister(this);
    BaseApplication.setMainActivityState(BaseApplication.FLAG_MAIN_STATE_NOMAL);

    unregisterReceiver(mDownloadReceiver);
    if (exitWithUserOption) {
      MobclickAgent.onKillProcess(this);
      WebviewService.exit(this);
      System.exit(0);
    }
    super.onDestroy();
  }
コード例 #10
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onResume() {
    super.onResume();
    MobclickAgent.onResume(this);
    AppService.onNewsResume();

    if (mWakeLock == null)
      mWakeLock =
          ((PowerManager) getSystemService(Context.POWER_SERVICE))
              .newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getSimpleName());
    try {
      if (!mWakeLock.isHeld()) mWakeLock.acquire();
    } catch (Exception e) {
      Trace.d(tag, e.getMessage());
    }
  }
コード例 #11
0
ファイル: MainActivity.java プロジェクト: lpjhblpj/football
 private void initFragment(Bundle savedInstanceState) {
   if (savedInstanceState == null) {
     FragmentTransaction ft = fMgr.beginTransaction();
     mFragment = mBaseNewsFragment = new BaseNewsFragment();
     // mFragment = new BaseTournamentFragment();
     // index = 1;
     initBottomButton();
     ft.replace(R.id.fragmentRoot, mFragment);
     ft.commitAllowingStateLoss();
   } else {
     List<Fragment> fragments = fMgr.getFragments();
     if (fragments == null || fragments.isEmpty()) {
       FragmentTransaction ft = fMgr.beginTransaction();
       mFragment = mBaseNewsFragment = new BaseNewsFragment();
       ft.replace(R.id.fragmentRoot, mFragment);
       ft.commitAllowingStateLoss();
     } else {
       index = savedInstanceState.getInt("INDEX");
       initBottomButton();
       FragmentTransaction ft = fMgr.beginTransaction();
       for (Fragment fragment : fragments) {
         if (fragment == null) {
           continue;
         } else if (fragment instanceof BaseNewsFragment && index == 0) {
           mFragment = mBaseNewsFragment = (BaseNewsFragment) fragment;
         } else if (fragment instanceof BaseTournamentFragment && index == 1) {
           mFragment = fragment;
         } else if (fragment instanceof FeedFragment && index == 2) {
           mFragment = mFeedFragment = (FeedFragment) fragment;
         } else if (fragment instanceof BaseGroupFragment && index == 3) {
           mFragment = fragment;
         } else if (fragment instanceof BaseStandingsFragment && index == 4) {
           mFragment = fragment;
         } else if (!(fragment instanceof LeftSlidingMenuFragment)) {
           ft.remove(fragment);
         }
       }
       if (mFragment != null) {
         ft.show(mFragment);
       }
       Trace.d(tag, "mFragment:" + mFragment);
       ft.commitAllowingStateLoss();
     }
   }
 }
コード例 #12
0
 @Override
 public void onProgressChanged(WebView view, int newProgress) {
   Trace.e(tag, "onProgressChanged:" + newProgress);
   if (progressDrawable != null) progressDrawable.setProgress((newProgress * 1.0f) / 100f);
   super.onProgressChanged(view, newProgress);
 }