java实现收藏名言语句台词的app java实现收藏名言语句台词的app
人气:0想了解java实现收藏名言语句台词的app的相关内容吗,在本文为您仔细讲解java实现收藏名言语句台词的app的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:java,收藏名言语句台词,app,下面大家一起来学习吧。
让动漫中那些喜欢的人、喜欢的台词,让你难忘的话语,都保留在你的手机中吧
/** * 创建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有所帮助。
加载全部内容