js面向对象开发互联网机顶盒应用头端之二

 


/**
* Dare Movie Object.
* @constructor
*/

//声明构造函数 构造函数初始化变量
Dare.Movie = function() {
  this.parent = new Dare.Util();
  this.className = "Dare.Movie";

  //----类Dare.Movie全局属性变量-----//
  this.stylePath = dareStyle.getStylePath();
  this.pageIndex = 0; //当前页索引
  this.pageTotal = 0; //总页数;
  this.pageSize = 8; //每页显示记录数
  this.recordCount = 0; //总记录数
  this.dataSource = null; //数据源
  this.tempdataSource; //数据源

  this.orderBy = 'sortdate'; //默认排序字段
  this.sortDirection = 'asc'; //默认升序方式
  this.searchValue = '';
  this.currentFocus = 'searchvalue'; //初始化焦点
  this.bookMovies = { movies: [] };
  //----类Dare.Movie全局属性变量-----//

  this.selectImages = { "normal": this.stylePath + "selectall.gif", "focus": this.stylePath + "selectallover.gif", "on": this.stylePath + "selectallon.gif" };
  this.unselectImages = { "normal": this.stylePath + "unselectall.gif", "focus": this.stylePath + "unselectallover.gif", "on": this.stylePath + "unselectallon.gif" };
  this.Allselected = false; //全选状态,按下后变为true ,在按为false
  this.hasGetChspell = false; //获取拼音的状态,第一次查询后获取
};
Dare.Movie.prototype = new Dare.Util(); //继承父类 Dare.Util是系统架构工具类
Dare.Movie.prototype.constructor = Dare.Movie; //引用构造函数
/**
* @function movieInit
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.movieInit = function() {
  sortimg.innerText = DareLang.DATETIME;
  searchimg.innerText = DareLang.SEARCH;
  sortdate.innerText = DareLang.DATETIME;
  sortname.innerText = DareLang.NAME;
  sorttype.innerText = DareLang.TYPE;
  sortsize.innerText = DareLang.SIZE;
  this.$('title').src = this.stylePath + DareLang.IMAGE.MY_MOVIE_TITLE; //'movie_title.gif';
  this.$('imgtop').src = this.stylePath + 'movie_no.png';
  this.$('selectAllimg').src = this.unselectImages.normal;
  this.$('freshimg').src = this.stylePath + 'no.gif';
  var json = new Dare.JSObject.JSON();
  var cmd = new Dare.Business.Command();
  this.dataSource = cmd.getFiles('movie', 'date', '');

  var request = new Dare.Request();
  var index = request.QueryString('pageIndex');
  this.pageIndex = index == null ? 0 : parseInt(index);
 
  this.tempdataSource = this.dataSource;
  this.recordCount = this.dataSource.length;
  this.pageTotal = this.recordCount % this.pageSize == 0 ? this.recordCount / this.pageSize : parseInt(this.recordCount / this.pageSize + 1);
  this.movieDataBind();

};
Dare.Movie.prototype.sort = function() {
  var sortname = 'date';

  switch (this.orderBy) {
    case 'sortname':
      sortname = 'name';
      if (this.hasGetChspell == false) {
        for (var j in this.tempdataSource) {
          this.tempdataSource[j].chname = chineseSpell.getpy(dareUtil.getFileName(this.tempdataSource[j]["name"]), 4).toString().toLowerCase();
        }
        this.dataSource = this.tempdataSource;
        this.hasGetChspell = true;
      }
      break;
    case 'sorttype':
      sortname = 'type';
      break;
    case 'sortsize':
      sortname = 'size';
      break;
    case 'sortdate':
      sortname = 'date';
      break;
    default:
      sortname = 'date';
      break;
  }
  dareUtil.sortBy(this.dataSource, sortname, this.sortDirection);
  this.movieDataBind();
}
Dare.Movie.prototype.loading = function() {
  this.$('freshimg').src = this.stylePath + 'loading.gif';
};
Dare.Movie.prototype.closeLoading = function() {
  this.$('freshimg').src = this.stylePath + 'no.gif';
};
/**
* @function movieDataBind
* @author
* @return this.$('maincontent').innerHTML
*/
Dare.Movie.prototype.movieDataBind = function() {
  this.loading();
  var start = parseInt(this.pageIndex * this.pageSize);
  var end = parseInt(this.pageIndex * this.pageSize + this.pageSize);
  if (end > this.recordCount) end = this.recordCount;

  var item = '';
  var i = 0;

  for (var j = start; j < end; j++) {
    if (this.dataSource[j] == null) break;
    var itemId = 'item' + i;
    var selectId = 'select' + i;
    var movieId = 'movie' + i;
    var name = dareUtil.getFileName(this.dataSource[j]['name']);
    var subName = dareUtil.trimstr(name, 20);
    var movieObj = '{name:"' + this.dataSource[j]['name'] + '",type:"' + this.dataSource[j]['type'] + '",size:"' + this.dataSource[j]['size'] + '",time:"' + this.secondsToMMSS(this.dataSource[j]['time']) + '",scale:"' + this.dataSource[j]['scale'] + '",date:"' + this.dataSource[j]['date'] + '"}';
    item += '<div  class="itemnone" id="' + itemId + '"><div id="' + movieId + '" style="display:none;">' + movieObj + '</div><div class="selectnone" id="' + selectId + '" ></div>' +
      '<div class="menufont">' + subName + '</div>' +
      '<div class="menusize">' + this.secondsToMMSS(this.dataSource[j]['time']) + '</div>'
    '</div>';

    i++;

  }

  this.$('movies').innerHTML = item;
  if (this.$('item0')) {
    this.$('item0').className = 'item';
    this.currentFocus = 'item0';
    this.movieDetail('movie0');
    this.$('pagetext').innerHTML = this.pageTotal == 0 ? '' : (this.pageIndex + 1) + "/" + this.pageTotal;
  }
  this.bookMovieBind();
  this.closeLoading();
};
/**
* @function movieDetail
* @author
* @return this.$('detail').innerHTML
*/
Dare.Movie.prototype.movieDetail = function(id) {
  var movie = this.$(id).innerText;
  var json = new Dare.JSObject.JSON();
  var movieArray = json.toObject(movie);
  var detailContent = '';

  detailContent += DareLang.NAME + ': ' + dareUtil.getFileName(movieArray["name"]) + '<br>';
  detailContent += DareLang.TYPE + ': ' + movieArray["type"] + '<br>';
  detailContent += DareLang.SIZE + ': ' + dareUtil.fileSizeInt2Str(movieArray["size"]) + '<br>';
  detailContent += DareLang.DURATION + ': ' + movieArray["time"] + '<br>';
  detailContent += DareLang.RESOLUTION + ': ' + movieArray["scale"] + '<br>';
  detailContent += DareLang.DATETIME + ': ' + movieArray["date"];

  this.$('detail').innerHTML = detailContent;
};
/**
* @function previousPage
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.previousPage = function() {
  this.pageIndex--;
  if (this.pageIndex < 0) { this.pageIndex = 0; return; }
  if (this.pageIndex <= this.pageTotal - 1 && this.pageIndex >= 0) {
    this.movieDataBind();
    this.$('item0').className = 'item';
  }
};
/**
* @function nextPage
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.nextPage = function() {
  this.pageIndex++;
  if (this.pageIndex >= this.pageTotal) { this.pageIndex = this.pageTotal - 1; return; }
  if (this.pageIndex <= this.pageTotal - 1) {
    this.movieDataBind();
  }
};
Dare.Movie.prototype.searchLostFocus = function() {
  document.getElementById('searchvalue').blur();
  document.getElementById('fresh').focus();
}
/**
* @function keypressHandler
* @author
* @param event
* @return null
*/
Dare.Movie.prototype.keypressHandler = function(event) {
  var keyValue = Dare.isiPanel ? event.which : window.event.keyCode;
  //document.getElementById("divDebug").innerText += "keyValue:" + keyValue+"</br>";
  showUSBInfo(keyValue);
  this.searchLostFocus();
  switch (keyValue) {
    case KeyMap.STB_KEY_DOWN: //向下
      this.keydownHandler();
      break;
    case KeyMap.STB_KEY_UP: //向上
      this.keyupHandler();
      break;
    case KeyMap.STB_KEY_ENTER: //确定
      this.keyenterHandler();
      break;
    case KeyMap.STB_KEY_LEFT: //向左
      this.keyleftHandler();
      break;
    case KeyMap.STB_KEY_RIGHT: //向右
      this.keyrightHandler();
      break;
    case KeyMap.STB_KEY_PAGEUP: //上一页
      this.keypageupHandler();
      break;
    case KeyMap.STB_KEY_PAGEDOWN: //下一页
      this.keypagedownHandler();
      break;
    case KeyMap.STB_KEY_HOME:
      break;
    case KeyMap.STB_KEY_STOP:
      window.location.href = '../main/index.html?focus=1';
      break;
    case KeyMap.STB_KEY_FULLSCREEN:
      this.focusToolbar();
      break;
    default:
      break;
  }
};
/**
* 回到菜单
*/
Dare.Movie.prototype.focusToolbar = function () {
  document.getElementById('searchvalue').focus();
  this.currentFocus = 'searchvalue';
  for (var i = 0; i < 8; i++) {
    document.getElementById("item" + i).className = "itemnone";
  }
}
/**
* @function keyupHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keyupHandler = function() {
  if (this.currentFocus == "searchvalue") {
    this.$('searchvalue').focus();
    return;
  }
  switch (this.currentFocus) {
    case 'item0':
      if (this.pageIndex == 0) {
        this.currentFocus = 'searchvalue';
        this.$('item0').className = 'itemnone';
        searchvalue.focus();
      }
      break;
    case 'sortsize': //大小
      this.$('sortsize').className = 'sortnone';
      this.$('sorttype').className = 'sortselected';
      this.currentFocus = 'sorttype';
      break;
    case 'sorttype': //类型
      this.$('sorttype').className = 'sortnone';
      this.$('sortname').className = 'sortselected';
      this.currentFocus = 'sortname';
      break;
    case 'sortname': //名称
      this.$('sortname').className = 'sortnone';
      this.$('sortdate').className = 'sortselected';
      this.currentFocus = 'sortdate';
    default:
      break;
  }

  this.pageEvent = false;
  var foucusId = this.currentFocus.substr(4, 1);
  if ('0' == foucusId) {
    this.previousPage();
    this.pageEvent = true;
  }
  if (parseInt(foucusId) <= 7 && this.pageEvent == false) {
    this.listUpFocus(foucusId);
  }
};
/**
* @function listDownFocus
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.listDownFocus = function(i) {
  this.pageEvent = false;
  var id = parseInt(i) + 1;
  if (this.$('item' + (id))) {
    this.$('item' + i).className = 'itemnone';
    this.$('item' + (id)).className = 'item';
    this.currentFocus = 'item' + (id);
    this.rightPressCount = 0;
    this.movieDetail('movie' + (id));
  }
};
/**
* @function listUpFocus
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.listUpFocus = function(i) {
  this.pageEvent = false;
  this.$('item' + i).className = 'itemnone';
  var id = parseInt(i) - 1;
  this.$('item' + (id)).className = 'item';
  this.currentFocus = 'item' + (id);
  this.rightPressCount = 0;
  this.movieDetail('movie' + (id));
};
/**
* @function keydownHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keydownHandler = function() {
  if (this.currentFocus.indexOf('item') < 0
   && this.currentFocus.indexOf('sort') < 0
   && this.$('item0')
   && this.$('sortlist').style.display == 'none') {
    this.$('searchimg').className = 'search';
    this.$('sortimg').className = 'search';
    if (this.sortDirection == 'asc') this.$('arrowimg').className = 'arrowup';
    else this.$('arrowimg').className = 'arrowdown';
    this.currentFocus = 'item0';
    this.$('item0').className = 'item';
    return;
  }
  if (sortlist.style.display != "none") {
    switch (this.currentFocus) {
      case 'sortimg':
        this.$('sortdate').className = 'sortselected';
        this.currentFocus = 'sortdate';
        break;
      case 'sortdate': //日期
        this.$('sortdate').className = 'sortnone';
        this.$('sortname').className = 'sortselected';
        this.currentFocus = 'sortname';
        break;
      case 'sortname': //名称
        this.$('sortname').className = 'sortnone';
        this.$('sorttype').className = 'sortselected';
        this.currentFocus = 'sorttype';
        break;
      case 'sorttype': //类型
        this.$('sorttype').className = 'sortnone';
        this.$('sortsize').className = 'sortselected';
        this.currentFocus = 'sortsize';
      default:
        break;
    }
  }
  this.pageEvent = false;
  var foucusId = this.currentFocus.substr(4, 1);
  if ('7' == foucusId) {
    this.nextPage();
    this.pageEvent = true;
    return;
  }
  if (parseInt(foucusId) < 7 && this.pageEvent == false) {
    this.listDownFocus(foucusId);
  }
};
/**
* @function keyenterHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keyenterHandler = function() {
  if (this.currentFocus == 'sortimg') {
    this.$('sortlist').style.display = 'block';
    return;
  }

  if (this.orderBy != this.currentFocus && (this.currentFocus == 'sortdate' || this.currentFocus == 'sortname' || this.currentFocus == 'sorttype' || this.currentFocus == 'sortsize')) {
    this.$('sortlist').style.display = "none";
    this.$('sortimg').innerText = this.$(this.currentFocus).innerText;
    this.orderBy = this.currentFocus;

    this.$(this.currentFocus).className = 'sortnone';
    this.$('sortimg').className = 'search';
    this.currentFocus = 'arrowimg';

  }

  switch (this.currentFocus) {
    case 'arrowimg':
      if (this.sortDirection == 'asc') {
        this.sortDirection = 'desc';
        this.$('arrowimg').className = 'arrowdownon';
      }
      else {
        this.sortDirection = 'asc';
        this.$('arrowimg').className = 'arrowupon';
      }
      this.sort();
      return; case 'searchimg':
      this.$('searchimg').className = 'searchon';
      this.movieSeacher();
      return; case 'sortimg':
      this.$('sortimg').className = 'searchon';
      break;
    default:
      break;
  }
  if (this.currentFocus == 'selectAllimg') {
    this.Allselected = !this.Allselected; //取反
    if (this.Allselected) {
      this.selectAll();
    }
    else {
      this.unSelectAll();
    }
  }
  var hasMovie = false;
  if (this.currentFocus.indexOf('item') >= 0) {
    var movies = this.bookMovies.movies;
    var json = new Dare.JSObject.JSON();
    if (movies.length != 0) {
      var movieList = json.parse(movies);
      new Dare.Business.Command().setGlobalVar("movieBookList", movieList);
      hasMovie = true;
    }
    else {
      var focusId = this.currentFocus.substr(4, 1);
      var moviestr = this.$('movie' + focusId).innerText;
      var json = new Dare.JSObject.JSON();
      var movie = json.toObject(moviestr);
      movies.push(movie);
      var movieList = json.parse(movies);
      new Dare.Business.Command().setGlobalVar('movieBookList', movieList);
      //选片对象有实例 按确定转向播放页面
      hasMovie = true;
    }
    if (hasMovie) {
      var currentMedia = new Dare.Business.Command().getGlobalVar('currentPlayMedia');
      var json = new Dare.JSObject.JSON();
      var mp = json.toObject(currentMedia);
      var currentPlayMovieInPlayList = false;
      for (var k in movies) {
        if (movies[k].name == mp.playPath) {
          currentPlayMovieInPlayList = true;
          break;
        }
      }
      window.location.href = '../movie/movieplay.html?appendback=true&currentPlayMovieInPlayList=' + currentPlayMovieInPlayList + '&pageIndex=' + this.pageIndex;
    }
  }
};
Dare.Movie.prototype.selectAll = function() {
  var movies = dareMovie.bookMovies.movies;
  for (var f in dareMovie.dataSource) {
    var movie = dareMovie.dataSource[f];
    movies.push(movie);
  }
  for (var i = 0; i < 8; i++) {
    if (this.$('item' + i)) {
      this.$('select' + i).className = 'select';
    }
  }
  this.$('selectAllimg').src = this.selectImages.on;
};
/**
* 全不选
*/
Dare.Movie.prototype.unSelectAll = function() {
  this.$('selectAllimg').src = this.unselectImages.on;
  this.bookMovies.movies = [];
  for (var i = 0; i < 8; i++) {
    if (this.$('item' + i)) {
      this.$('select' + i).className = 'selectnone';
    }
  }
};
Dare.Movie.prototype.arrowImageFocus = function() {
  if (this.sortDirection == "asc") {
    document.getElementById('arrowimg').className = 'arrowupover';
  } else {
    document.getElementById('arrowimg').className = 'arrowdownover';
  }
};
Dare.Movie.prototype.arrowImageLostFocus = function() {
  if (this.sortDirection == "asc") {
    document.getElementById('arrowimg').className = 'arrowup';
  }
  else {
    document.getElementById('arrowimg').className = 'arrowdown';
  }
};
/**
* @function keyleftHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keyleftHandler = function() {
  this.$('sortlist').style.display = 'none';
  if (this.currentFocus.indexOf('sort') == 0) {
    this.currentFocus = 'searchimg';
    this.$('searchimg').className = 'searchover';
    this.$('sortimg').className = 'search';
    return;
  }
  switch (this.currentFocus) {
    case 'arrowimg':
      if (this.sortDirection == 'asc') {
        this.$('arrowimg').className = 'arrowup';
      } else {
        this.$('arrowimg').className = 'arrowdown';
      }
      this.$('sortimg').className = 'searchover';
      this.currentFocus = 'sortimg';
      break;
    case 'sortimg':
      this.$('sortimg').className = 'search';
      this.$('searchimg').className = 'searchover';
      this.currentFocus = 'searchimg';
      break;
    case 'searchimg':
      this.currentFocus = 'searchvalue';
      document.getElementById('searchimg').className = 'search';
      searchvalue.focus();
      break;
    case 'selectAllimg':
      if (this.Allselected) { this.$('selectAllimg').src = this.selectImages.normal; }
      else this.$('selectAllimg').src = this.unselectImages.normal;
      this.arrowImageFocus();
      this.currentFocus = 'arrowimg';
      break;
    default:
      break;
  }
};
/**
* @function keyrightHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keyrightHandler = function() {
  this.$('sortlist').style.display = 'none';
  if (this.currentFocus.indexOf('sort') == 0) {
    this.currentFocus = 'arrowimg';
    this.$('sortimg').className = 'search';
    if (this.sortDirection == "asc") {
      this.$('arrowimg').className = 'arrowupover';
    } else {
      this.$('arrowimg').className = 'arrowdownover';
    }
    return;
  }
  switch (this.currentFocus) {
    case 'searchvalue':
      this.$('searchimg').className = 'searchover';
      this.currentFocus = 'searchimg';
      break;
    case 'searchimg':
      this.$('searchimg').className = 'search';
      this.$('sortimg').className = 'searchover';
      this.currentFocus = 'sortimg';
      break;
    case 'sortimg':
      this.$('sortimg').className = 'search';
      if (this.sortDirection == "asc") {
        this.$('arrowimg').className = 'arrowupover';
      } else {
        this.$('arrowimg').className = 'arrowdownover';
      }
      this.currentFocus = 'arrowimg';
      break;
    case "arrowimg":
      if (this.Allselected) { this.$('selectAllimg').src = this.selectImages.focus; }
      else this.$('selectAllimg').src = this.unselectImages.focus;
      this.arrowImageLostFocus();
      this.currentFocus = 'selectAllimg';
      break;
    default:
      break;
  }

  if (this.currentFocus.indexOf('item') >= 0) {
    var focusId = this.currentFocus.substr(4, 1);
    var selectObj = this.$('select' + focusId);
    var movieString = this.$('movie' + focusId).innerText;
    var json = new Dare.JSObject.JSON();
    var movie = json.toObject(movieString);

    if (selectObj.className == 'selectnone') {
      selectObj.className = 'select';
      this.selectMovie(movie, 0);
    }
    else {
      selectObj.className = 'selectnone';
      this.selectMovie(movie, 1);
    }

  }
};
/**
* @function keypageupHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keypageupHandler = function() {
  this.previousPage();
};
/**
* @function keypagedownHandler
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.keypagedownHandler = function() {
  this.nextPage();
};

/**
* @function selectMovie 选择
* @author
* @param movie type
* @return null
*/
Dare.Movie.prototype.selectMovie = function(movie, type) {
  var movies = this.bookMovies.movies;
  switch (type) {
    //添加对象                                                                          
    case 0:
      movies.push(movie);
      break;
    //移除对象                                                                 
    case 1:
      for (var i in movies) {
        if (movies[i].name == movie.name) {
          movies.splice(i, 1);
          break;
        }
      }
      break;
    default:
      break;
  }
};
/**
* @function bookMovieBind
* @author
* @return null
*/
Dare.Movie.prototype.bookMovieBind = function() {
  var start = parseInt(this.pageIndex * this.pageSize);
  var end = parseInt(this.pageIndex * this.pageSize + this.pageSize);
  if (end > this.dataSource.length) end = this.dataSource.length;

  var movies = this.bookMovies.movies;
  var json = new Dare.JSObject.JSON();
  var movieBookList = new Dare.Business.Command().getGlobalVar("movieBookList");
  if (movieBookList.length != 0) {
    var movieBooks = json.toObject(movieBookList);
    for (var key in movieBooks) {
      movies.push(movieBooks[key]);
    }
    new Dare.Business.Command().setGlobalVar('movieBookList', '');
  }

  var i = 0;
  for (var j = start; j < end; j++) {
    var selectObj = this.$('select' + i);
    var movieString = this.$('movie' + i).innerText;
    var json = new Dare.JSObject.JSON();
    var movie = json.toObject(movieString);
    for (var key in movies) {
      if (movies[key].name == movie.name) {
        selectObj.className = 'select';
        break;
      }
    }
    i++;
  }

};
/**
* @function styleInt
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.styleInt = function() {
  this.$('searchimg').className = 'search';
  this.$('sortimg').className = 'search';
  this.$('arrowimg').className = 'arrowup';
};
/**
* @function movieSeacher 查询
* @author
* @param null
* @return null
*/
Dare.Movie.prototype.movieSeacher = function() {
  if (this.hasGetChspell == false) {
    for (var j in this.tempdataSource) {
      this.tempdataSource[j].chname = chineseSpell.getpy(dareUtil.getFileName(this.tempdataSource[j]["name"]), 4).toString().toLowerCase();
    }
    this.dataSource = this.tempdataSource;

    this.hasGetChspell = true;
  }
  var keyWord = this.$('searchvalue').value;
  var resultData = []; //交换数组
  var i = 0;
  for (var key in this.tempdataSource) {
    if (dareUtil.getFileName(this.tempdataSource[key].name).indexOf(keyWord) != -1 || this.tempdataSource[key].chname.indexOf(keyWord) == 0) {

      resultData.push(this.tempdataSource[key]); //从缓存数据库原读取,便于二次查询
    }
  }
  this.dataSource = resultData;
  this.recordCount = this.dataSource.length;

  this.pageTotal = this.recordCount % this.pageSize == 0 ? this.recordCount / this.pageSize : parseInt(this.recordCount / this.pageSize + 1);
  this.movieDataBind();
};
var dareMovie = new Dare.Movie();
document.onkeypress = function(event) {
  dareMovie.keypressHandler(event);
};

 

转载于:https://www.cnblogs.com/fx2008/archive/2011/08/20/2147239.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/267648.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

nginx内置变量 大全

nginx内置变量 内置变量存放在 ngx_http_core_module 模块中&#xff0c;变量的命名方式和apache 服务器变量是一致的。总而言之&#xff0c;这些变量代表着客户端请求头的内容&#xff0c;例如$http_user_agent, $http_cookie, 等等。 下面是nginx支持的所有内置变量&#xf…

android抽奖动画,Android App中实现简单的刮刮卡抽奖效果的实例详解

主要思想&#xff1a;将一个view设计成多层&#xff1a;背景层&#xff0c;含中奖信息等&#xff1b;遮盖层&#xff0c;用于刮奖&#xff0c;使用关联一个Bitmap的Canvas在该Bitmap上&#xff0c;使用它的canvas.drawPath的api来处理 手势滑动(类似刮奖的动作)使用paint.setXf…

忙了一上午终于把形状特征搞定了啊

就是光滑度和紧致度&#xff0c;这个实现起来还是比较简单的&#xff0c;不过不知道这两个特征作用到底有多大啊&#xff01;

如何提高英语听力(内容摘自NECCS)+ 乘法表

乘法表 print(\n.join([ .join([%s*%s%-2s%(y,x,x*y) for y in range(1,x1)]) for x in range(1,10)])) 如何提高英语听力 很喜欢这篇关于提高英语听力的文章&#xff0c;所以收藏下来和大家一同分享一下 人走路时要用两条腿&#xff0c;没有任何人会觉得走路费劲。可如果让人…

android新拟态实现方法,Android 新拟态UI (Neumorphism)

前言本文转自github&#xff0c;只是进行了图片的处理和部分翻译&#xff0c;已获作者授权截至首次发文前找到的原作者的文章地址-May,17,2020若找到本文章更新的时间节点&#xff0c;请私信我更新。原作者github地址文末附源码下载地址&#xff0c;免费。Android上的拟态化UIT…

codeforces 919E Congruence Equation

E. Congruence Equationtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfy where a, b, p are all known co…

抽象工厂模块在开发中的应用

抽象工厂是设计模块中创建型模式的一种&#xff0c;它比起工厂方法模式来说&#xff0c;更加具有一般性&#xff0c;在本模式中会引入一个产品族的概念&#xff0c;就是说,在本模式中抽象产品会有多个&#xff0c;然后用抽象工厂去调用它们&#xff0c;具体怎么去调用由具体工厂…

android 过滤数组中的重复元素,Flutter List数组避免插入重复数据的实现

List具有一定长度存在索引的对象集合(长度为0不存在索引,长度>0存在索引)常见列表1、定长列表默认值null例如:List fixedLengthList new List(2)、List fixedLengthList new List(8)List fixedLengthList new List(2);for(int i0;i<2;i){print("索引为${i}的值${…

[js]jquery里的jsonp实现ajax异源请求

同源请求-jquery <script type"text/javascript" src"http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script><script type"text/javascript">$.ajax({url: "data.txt",type: "get",dataType…

android listview remove 动画,给Android ListView添加删除item动画

给Android ListView添加删除item动画给listview删除一个item的时候加上一个折叠动画&#xff0c;感觉效果会好一点。步骤是当删除一个view&#xff0c;先用动画把view的高度改变&#xff0c;看上去就是折叠的效果。当动画完成的时候&#xff0c;再真正把item移除。private void…

Css 选择器 算法 规则

首先上图 css 命令在读取时是按照其优先级的高低的先后顺序来解读的&#xff0c;当优先级相同时是按照其css命令写的先后顺序来读取的&#xff0c;即后面的css覆盖&#xff08;前后css属性设置 不同时&#xff09;或继承&#xff08;前后css属性设置相同或后面未设置该css属性时…

鸡尾酒排序算法c语言,[golang] 数据结构-鸡尾酒排序

吐个槽又是一个不正经取名的排序算法。真要说和鸡尾酒间的关系&#xff0c;大概就是想喝到鸡尾酒(得到排序好的队列)就要摇晃酒杯让不同的成分混合均匀(向两个方向冒泡排序)原理鸡尾酒排序(Cocktail Sort)是冒泡排序的一种优化算法。原本的冒泡排序只能在一轮中挑出一个值移动到…

ie6 div height bug css注意点(转)

所有浏览器的定位都大同小异&#xff0c;在各个浏览器兼容性问题&#xff0c;要了解各个浏览器的定位区别就可以了。 比如&#xff0c;当用float浮动时&#xff0c;同时设置margin或padding在IE6中会是双倍的值。即你设置为margin:10px;那么在IE6里就相当于margin:20px; 出现这…

Python算法——二叉树

一、二叉树 from collections import dequeclass BiTreeNode:def __init__(self, data):self.data dataself.lchild Noneself.rchild Nonea BiTreeNode(A) b BiTreeNode(B) c BiTreeNode(C) d BiTreeNode(D) e BiTreeNode(E) f BiTreeNode(F) g BiTreeNode(G)e.lchil…

艾伟_转载:.NET 4.0新特性-- Corrupted State Exceptions

作为程序员&#xff0c;我想很多人应该都有过跟异常打交道的经历。而且相信也有很多人也都写过catch(Exception e){//blabla}这种把所有未知异常一股脑儿捕获并处理掉的代码吧。不管是为敷衍客户也好&#xff0c;让程序继续运行以避免糟糕的用户体验也罢&#xff0c;在微软眼中…

android sdk 2.9.5.0,如何找到问题Android SDK 3.0错误:(9,5)错误:资源android:attr/colorError未找到...

当我做一个make时如何找到此错误的问题我收到此错误消息&#xff1a;错误&#xff1a;(9,5)错误&#xff1a;找不到资源android&#xff1a;attr / colorError奇怪的是我有2个build.gradle文件&#xff1a;这里是我的build.gradle(Project&#xff1a;Projectname)文件&#xf…

c# 读取 txt 文件中数据(int)

今天在学图的算法做测试是&#xff0c;需要读取文本文件中的点坐标&#xff0c;本来很简单的事情&#xff0c;折腾了半天&#xff0c;记录一下找到的一种简单粗暴的解决方法&#xff0c;以便以后查看。 第一种方法 &#xff1a; StringReader string line "";using …

艾伟_转载:使用Lambda表达式编写递归函数

前言 著名的牛顿同学曾经说过&#xff1a;如果说我比别人看得更远些,那是因为我站在了巨人的肩上. 原文&#xff1a;If I have been able to see further, it was only because I stood on the shoulders of giants. Whats Lambda表达式? 请参考msdn&#xff1a;Lambda 表达式…

android 模拟器read-only file system,WAC启动Android模拟器 transfer error: Read-only file system错误解决方法...

这两天在用WAC SDK开发Widget时&#xff0c;在启动Android模拟器时Eclipse的Consle出现如下错误&#xff1a;[2011-11-27 22:08:49 - ddms]transfer error: Read-only file system然后Widget无法安装和执行&#xff01;在参考了官方论坛上的相同问题的一个帖子后&#xff0c;也…

spring5.0.2中文官网文档pdf

下载地址&#xff1a;网盘下载Spring是一个开放源代码的设计层面框架&#xff0c;他解决的是业务逻辑层和其他各层的松耦合问题&#xff0c;因此它将面向接口的编程思想贯穿整个系统应用。本参考指南提供了有关spring5.0.2的详细信息。它全面的介绍了Spring的所有的功能&#x…