PostFragment.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:SmileEssence 作者:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Logger.debug("PostFragment CreateView");
    MainActivity activity = (MainActivity) getActivity();
    PostState.getState().setListener(this);
    UserPreferenceHelper preferenceHelper = new UserPreferenceHelper(activity);
    View v = inflater.inflate(R.layout.fragment_post, null);
    buttonTweet = getTweetButton(v);
    buttonTweet.setOnClickListener(this);
    editText = getEditText(v);
    textViewCount = getCountTextView(v);
    int textSize = preferenceHelper.getValue(R.string.key_setting_text_size, 10);
    editText.addTextChangedListener(this);
    editText.setOnFocusChangeListener(this);
    editText.setTextSize(textSize + 4);
    editText.setMovementMethod(new ArrowKeyMovementMethod() {
        @Override
        protected boolean right(TextView widget, Spannable buffer) {
            //Don't back to Home
            return widget.getSelectionEnd() == widget.length() || super.right(widget, buffer);
        }
    });
    ImageButton imageButtonDeleteText = (ImageButton) v.findViewById(R.id.button_post_delete);
    imageButtonDeleteText.setOnClickListener(this);
    ImageButton imageButtonMedia = (ImageButton) v.findViewById(R.id.button_post_media);
    imageButtonMedia.setOnClickListener(this);
    ImageButton imageButtonMenu = (ImageButton) v.findViewById(R.id.button_post_menu);
    imageButtonMenu.setOnClickListener(this);
    //Reply view
    viewGroupReply = getReplyViewGroup(v);
    ImageButton imageButtonDeleteReply = (ImageButton) viewGroupReply.findViewById(R.id.button_post_reply_delete);
    imageButtonDeleteReply.setOnClickListener(this);
    //Media view
    viewGroupMedia = getMediaViewGroup(v);
    ImageView imageViewMedia = (ImageView) viewGroupMedia.findViewById(R.id.image_post_media);
    ImageButton imageButtonDeleteMedia = (ImageButton) viewGroupMedia.findViewById(R.id.button_post_media_delete);
    imageViewMedia.setOnClickListener(this);
    imageButtonDeleteMedia.setOnClickListener(this);
    editText.requestFocus();
    return v;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号