Android MindWorks库,如何从数据类调用片段方法

Android MindWorks库,如何从数据类调用片段方法,android,android-layout,android-fragments,Android,Android Layout,Android Fragments,我是一个android开发新手,我被这个问题困住了。对于任何使用过MindWorks库的人,也许你可以提供一些建议 下面使用的代码: @Layout(R.layout.tinder_card_view) public class TinderCard { @View(R.id.profileImageView) private ImageView profileImageView; @View(R.id.nameAgeTxt) private TextView nameAgeTxt; @V

我是一个android开发新手,我被这个问题困住了。对于任何使用过MindWorks库的人,也许你可以提供一些建议

下面使用的代码:

@Layout(R.layout.tinder_card_view)
public class TinderCard {

@View(R.id.profileImageView)
private ImageView profileImageView;

@View(R.id.nameAgeTxt)
private TextView nameAgeTxt;

@View(R.id.locationNameTxt)
private TextView locationNameTxt;

@View(R.id.profileInfo)
private ImageButton info;

@Click(R.id.profileInfo)
void openProfile()
{
  //Call the fragment method 
}


private Profile mProfile;
private Context mContext;
private SwipePlaceHolderView mSwipeView;

public TinderCard(Context context, Profile profile, SwipePlaceHolderView swipeView) {
    mContext = context;
    mProfile = profile;
    mSwipeView = swipeView;
}

@Resolve
private void onResolved(){
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    Bitmap bitmap = mProfile.getImage();
    bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
    byte[] byteArray = stream.toByteArray();
    Glide.with(mContext).load(byteArray).asBitmap().into(profileImageView);
    //profileImageView.setImageBitmap(mProfile.getImage());
    nameAgeTxt.setText(mProfile.getName() + ", " + mProfile.getAge());
    locationNameTxt.setText(mProfile.getLocation());

}
我对MindWorks图书馆的了解有限。我的目标是让tinder_card_view布局有一个按钮,打开一个对话框片段,显示用户的配置文件

我怎样才能做到这一点?TinderCard是一个简单的数据类,既不是片段也不是活动,但它使用的布局不在ParentFragment的范围内,因此从该类调用ParentFragment中的onClickListener看起来是不可能的

我正在调用mSwipeView.addView(新的TinderCard(mContext,profile,mSwipeView));在我的父片段中创建一个TinderCard,并将其放置在我的SwipePlaceHolderView(MindWorks类)上,该视图将保存Tinder卡

源教程在这里:


注意:@Click是一个注释,它将onClickListener设置为在圆括号中定义的元素。(我想)

我最终直接从TinderCard类中的onClick方法调用了该对话框。有人可以关闭该对话框吗?您可以添加自己的答案并接受它。