<commit_before>package de.fau.cs.mad.fablab.android.view.fragments.news;

import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import butterknife.ButterKnife;
import butterknife.InjectView;

import de.fau.cs.mad.fablab.android.R;
import de.fau.cs.mad.fablab.android.view.common.binding.ViewCommandBinding;
import de.fau.cs.mad.fablab.android.view.common.fragments.BaseDialogFragment;

public class NewsDetailsDialogFragment extends BaseDialogFragment implements NewsDetailsDialogViewModel.Listener{

    @InjectView(R.id.title_news_dialog)
    TextView tv_title;
    @InjectView(R.id.news_text_news_dialog)
    TextView tv_content;
    @InjectView(R.id.image_news_dialog)
    ImageView iv_image;
    @InjectView(R.id.ok_button_news_dialog)
    Button dimissButton;

    NewsDetailsDialogViewModel viewModel;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void setViewModel(NewsDetailsDialogViewModel viewModel){
        this.viewModel = viewModel;
        this.viewModel.setListener(this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_news_dialog, container, false);
        ButterKnife.inject(this, v);

        new ViewCommandBinding().bind(iv_image, viewModel.getImageClickCommand());
        new ViewCommandBinding().bind(dimissButton, viewModel.getDismissCommand());

        tv_content.setLinksClickable(true);
        tv_content.setMovementMethod(LinkMovementMethod.getInstance());
        tv_content.setText(Html.fromHtml(viewModel.getText()));
        tv_title.setText(viewModel.getTitle());

        Picasso.with(iv_image.getContext()).load(viewModel.getImageLink()).into(iv_image);

        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

        return v;
    }

    @Override
    public void onImageLayoutChanged() {
        if(!viewModel.isImageZoom()){
            iv_image.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
        }
        else{
            iv_image.setLayoutParams(new LinearLayout.LayoutParams((int)getResources().getDimension(R.dimen.news_dialog_icon_size), (int)getResources().getDimension(R.dimen.news_dialog_icon_size)));
        }
    }
}<commit_msg>fixed if-condition for image click in NewsDetailsDialog<commit_after>package de.fau.cs.mad.fablab.android.view.fragments.news;

import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import butterknife.ButterKnife;
import butterknife.InjectView;

import de.fau.cs.mad.fablab.android.R;
import de.fau.cs.mad.fablab.android.view.common.binding.ViewCommandBinding;
import de.fau.cs.mad.fablab.android.view.common.fragments.BaseDialogFragment;

public class NewsDetailsDialogFragment extends BaseDialogFragment implements NewsDetailsDialogViewModel.Listener {

    @InjectView(R.id.title_news_dialog)
    TextView tv_title;
    @InjectView(R.id.news_text_news_dialog)
    TextView tv_content;
    @InjectView(R.id.image_news_dialog)
    ImageView iv_image;
    @InjectView(R.id.ok_button_news_dialog)
    Button dimissButton;

    NewsDetailsDialogViewModel viewModel;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void setViewModel(NewsDetailsDialogViewModel viewModel) {
        this.viewModel = viewModel;
        this.viewModel.setListener(this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_news_dialog, container, false);
        ButterKnife.inject(this, v);

        new ViewCommandBinding().bind(iv_image, viewModel.getImageClickCommand());
        new ViewCommandBinding().bind(dimissButton, viewModel.getDismissCommand());

        tv_content.setLinksClickable(true);
        tv_content.setMovementMethod(LinkMovementMethod.getInstance());
        tv_content.setText(Html.fromHtml(viewModel.getText()));
        tv_title.setText(viewModel.getTitle());

        Picasso.with(iv_image.getContext()).load(viewModel.getImageLink()).into(iv_image);

        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

        return v;
    }

    @Override
    public void onImageLayoutChanged() {
        if (viewModel.isImageZoom()) {
            iv_image.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
        } else {
            iv_image.setLayoutParams(new LinearLayout.LayoutParams((int) getResources().getDimension(R.dimen.news_dialog_icon_size), (int) getResources().getDimension(R.dimen.news_dialog_icon_size)));
        }
    }
}
{'fraction_non_alphanumeric': 0.10003585514521333, 'fraction_numerical': 0.0, 'mean_word_length': 4.248353715898401, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6102030', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1612, 'n_words': 233}