Android Open Source - youku_api_android_framework Moive Detail Avctivity






From Project

Back to project page youku_api_android_framework.

License

The source code is released under:

Apache License

If you think the Android project youku_api_android_framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android.intro.moiveslist;
// www.ja va  2 s  .co  m
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;

import com.android.intro.moiveslist.models.HttpCallBackHandler;
import com.android.intro.moiveslist.models.MoiveModel;
import com.android.intro.movieslist.adpater.MovieDetailAdapter;
import com.aphidmobile.flip.FlipViewController;
import com.aphidmobile.utils.AphidLog;
import com.aphidmobile.utils.IO;
import com.aphidmobile.utils.UI;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import android.support.v4.app.FragmentActivity;

public class MoiveDetailAvctivity extends FragmentActivity {

  private FlipViewController flipView;
  VideoView mVideoView;
  Context context;
  private Integer pg = 1;
  private Integer pz = 30;
  private Integer max_pg = 30;
  private int visibleThreshold = 4;
  MoiveModel moives;
  String cid;
  private Integer intent_position;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

    super.onCreate(savedInstanceState);

    moives = new MoiveModel(this);
    Intent intent = getIntent();
    cid = intent.getStringExtra("cid");
    intent_position = intent.getIntExtra("position", 0);
    
    /* calcultor */
    if(intent_position>=pz){
      Log.d("PAGE:init:intent_position",intent_position.toString());
      pg = (Integer)(intent_position / pz) + 1; //ceil
      intent_position = intent_position % pz;
      Log.d("PAGE:pg",pg.toString());
      Log.d("PAGE:intent_position",intent_position.toString());
    }
    
    flipView = new FlipViewController(this);
    flipView.setAnimationBitmapFormat(Bitmap.Config.RGB_565);
    flipView.setOnViewFlipListener(new FlipViewController.ViewFlipListener() {
      @Override
      public void onViewFlipped(View view, int position) {
        
        if (position == flipView.getAdapter().getCount() - visibleThreshold) {
          //expand the data size on the last page
          pg++;
          moives.get_channel_list(cid, pg, pz, new HttpCallBackHandler() {
            @SuppressWarnings("unchecked")
            @Override
            public void onSuccess(HashMap<String, Object> result) {
              onUpdateHttpResponseCallback((ArrayList<String>) result
                  .get("datas"));
            }
          });
        }
      }
      
    });

    context = this;

    moives.get_channel_list(cid, pg, pz, new HttpCallBackHandler() {
      @Override
      public void onSuccess(HashMap<String, Object> result) {
        onHttpResponseCallback((ArrayList<?>) result.get("datas"));
      }
    });

  }
  
  public void onUpdateHttpResponseCallback(ArrayList datas) {
    MovieDetailAdapter adapter =(MovieDetailAdapter) flipView.getAdapter();
    adapter.appendToDataSet(datas);
        adapter.notifyDataSetChanged();
  }

  public void onHttpResponseCallback(ArrayList datas) {
    flipView.setAdapter(new MovieDetailAdapter(this, flipView, datas));
    flipView.setSelection(intent_position);
    setContentView(flipView);
  }

  @Override
  protected void onResume() {
    super.onResume();
    flipView.onResume();
  }

  @Override
  protected void onPause() {
    super.onPause();
    flipView.onPause();
  }
  
  @Override
  public void onBackPressed() {
    finish();
    if(intent_position %2 ==0){
        overridePendingTransition(R.anim.anim_slide_in_right, R.anim.anim_slide_out_left);
    }else{
        overridePendingTransition(R.anim.anim_slide_in_left,R.anim.anim_slide_out_right);
    }
  }

}




Java Source Code List

com.android.intro.custorm.imageview.NetworkedCacheableImageView.java
com.android.intro.custorm.imageview.SDK11.java
com.android.intro.custorm.imageview.SampleApplication.java
com.android.intro.moiveslist.MainActivity.java
com.android.intro.moiveslist.MoiveChannelFragment.java
com.android.intro.moiveslist.MoiveDetailAvctivity.java
com.android.intro.moiveslist.MovieHome.java
com.android.intro.moiveslist.SearchActivity.java
com.android.intro.moiveslist.SplashActivity.java
com.android.intro.moiveslist.YoukuVideoView.java
com.android.intro.moiveslist.models.BaseModel.java
com.android.intro.moiveslist.models.HttpCallBackHandler.java
com.android.intro.moiveslist.models.MoiveModel.java
com.android.intro.moiveslist.models.PlayModel.java
com.android.intro.moiveslist.models.SearchSuggestModel.java
com.android.intro.moviceslist.base.BaseActivity.java
com.android.intro.moviceslist.base.MenuFragment.java
com.android.intro.movieslist.adpater.MovieAdapter.java
com.android.intro.movieslist.adpater.MovieDetailAdapter.java
com.makeramen.RoundedDrawable.java
com.makeramen.RoundedImageView.java
uk.co.senab.bitmapcache.BitmapLruCache.java
uk.co.senab.bitmapcache.BitmapMemoryLruCache.java
uk.co.senab.bitmapcache.CacheableBitmapDrawable.java
uk.co.senab.bitmapcache.CacheableImageView.java
uk.co.senab.bitmapcache.Constants.java
uk.co.senab.bitmapcache.IoUtils.java
uk.co.senab.bitmapcache.Md5.java
uk.co.senab.bitmapcache.SDK11.java
uk.co.senab.bitmapcache.WeakReferenceRunnable.java