欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

java实现收藏名言语句台词的app

程序员文章站 2024-03-04 09:11:47
让动漫中那些喜欢的人、喜欢的台词,让你难忘的话语,都保留在你的手机中吧 /** * 创建dialoguefragment视图 * */ @...

让动漫中那些喜欢的人、喜欢的台词,让你难忘的话语,都保留在你的手机中吧

/**
  * 创建dialoguefragment视图
  * 
  */
 @targetapi(build.version_codes.honeycomb)
 @override
 public view oncreateview(layoutinflater inflater, viewgroup container,
   bundle savedinstancestate) {
  // todo auto-generated method stub
  view v = inflater.inflate(r.layout.fragment_acg_dialogue, container,
    false);
 
  int id = (integer) getarguments().getserializable(extra_acg_id);
  macg = acglab.get(getactivity()).getacg(id);
 
  mdialoguetextview = (textview) v.findviewbyid(r.id.dialogue_tv);
  // 从以下标点符号处换行
  string dialogue = macg.getdialogue().replace(",", "\n");
  dialogue = dialogue.replace("。", "\n");
  dialogue = dialogue.replace("?", "\n");
  dialogue = dialogue.replace("!", "\n");
  mdialoguetextview.settext(dialogue);
 
  mpersonagetextview = (textview) v.findviewbyid(r.id.personage_tv);
  if (!macg.getpersonage().isempty()) {
   mpersonagetextview.settext("--" + macg.getpersonage());
  } else {
   mpersonagetextview.settext("");
  }
 
  mheadimageview = (imageview) v.findviewbyid(r.id.avatar_iv);
  mrippleimageview = (imageview) v.findviewbyid(r.id.ripple_iv);
  // 将该应用程序自带的句子和用户添加的句子分开处理
  if (macg.getid() < acglistfragment.system_dialodue_lenght) {
   mheadimageview.setimageresource(integer.parseint(macg.gethead()));
   mheadimageview.setonclicklistener(new view.onclicklistener() {
 
    @override
    public void onclick(view v) {
     // todo auto-generated method stub
     // 设置水波动画
     animation anim = animationutils.loadanimation(
       getactivity(), r.anim.anim_ripple);
     mrippleimageview.startanimation(anim);
 
     acgdialoguefragment.getplayer().play(getactivity(),
       integer.parseint(macg.getsound()));
    }
   });
  } else {
   // 图片路径不存在或者未设置
   file file = new file(macg.gethead());
   if (macg.gethead().isempty() || (!file.exists())) {
    // 设置默认图片
    mheadimageview.setimageresource(r.drawable.saber);
   } else {
    bitmap bmp = pictureutils.getscaledbitmapfrompath(
      getactivity(), macg.gethead());
    bmp = pictureutils.getroundbitmap(bmp);
    mheadimageview.setimagebitmap(bmp);
   }
   mheadimageview.setonclicklistener(new view.onclicklistener() {
 
    @override
    public void onclick(view v) {
     // todo auto-generated method stub
     // 设置水波动画
     animation anim = animationutils.loadanimation(
       getactivity(), r.anim.anim_ripple);
     mrippleimageview.startanimation(anim);
 
     if (macg.getid() < acglistfragment.system_dialodue_lenght) {
      acgdialoguefragment.getplayer().play(getactivity(),
        integer.parseint(macg.getsound()));
     } else {
      if (macg.getsound().isempty()) {
       toast.maketext(getactivity(),
         r.string.tip_not_sound, toast.length_short)
         .show();
      } else {
       acgdialoguefragment.getplayer().play(getactivity(),
         macg.getsound());
      }
     }
    }
   });
  }
 
  return v;
 }

演示图:

java实现收藏名言语句台词的app

java实现收藏名言语句台词的app

java实现收藏名言语句台词的app

以上所述就是本文的全部内容了,希望能够对大家熟练掌握java开发app有所帮助。