java openfile busy_Java OpenGlHelper.openFile方法代码示例

import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类

/**

* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)

*/

protected void actionPerformed(GuiButton button) throws IOException

{

if (button.enabled)

{

if (button.id == 2)

{

File file1 = this.mc.getResourcePackRepository().getDirResourcepacks();

OpenGlHelper.openFile(file1);

}

else if (button.id == 1)

{

if (this.changed)

{

List list = Lists.newArrayList();

for (ResourcePackListEntry resourcepacklistentry : this.selectedResourcePacks)

{

if (resourcepacklistentry instanceof ResourcePackListEntryFound)

{

list.add(((ResourcePackListEntryFound)resourcepacklistentry).getResourcePackEntry());

}

}

Collections.reverse(list);

this.mc.getResourcePackRepository().setRepositories(list);

this.mc.gameSettings.resourcePacks.clear();

this.mc.gameSettings.incompatibleResourcePacks.clear();

for (ResourcePackRepository.Entry resourcepackrepository$entry : list)

{

this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName());

if (resourcepackrepository$entry.getPackFormat() != 3)

{

this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName());

}

}

this.mc.gameSettings.saveOptions();

this.mc.refreshResources();

}

this.mc.displayGuiScreen(this.parentScreen);

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
优化这个方法:private View getPopupWindowContentView(LayoutElementParcelable file) { // 一个自定义的布局,作为显示的内容 int layoutId = R.layout.popup_open_file_layout; // 布局ID View contentView = LayoutInflater.from(this).inflate(layoutId, null); // 点击重命名 contentView.findViewById(R.id.open_file_menu_rename).setOnClickListener(v -> { if (mPopupWindow != null) { mPopupWindow.dismiss(); } XLog.tag(TAG).i("popup click:rename"); checkDir(file, 0); }); // 点击删除 contentView.findViewById(R.id.open_file_menu_delete).setOnClickListener(v -> { if (mPopupWindow != null) { mPopupWindow.dismiss(); } XLog.tag(TAG).i("popup click:delete"); checkDir(file, 1); }); // 设置收藏按钮文字 收藏||取消收藏 String collectPath = ""; if (mCollects != null) { collectPath = mCollects.get(file.desc); } if (TextUtils.isEmpty(collectPath)) { collectPath = ""; } // 点击 收藏||取消收藏 TextView open_file_menu_collect = contentView.findViewById(R.id.open_file_menu_collect); String finalCollectPath = collectPath; open_file_menu_collect.setOnClickListener(v -> { if (mPopupWindow != null) { mPopupWindow.dismiss(); } if (finalCollectPath.equals(file.desc)) { XLog.tag(TAG).i("popup click:unCollect"); } else { XLog.tag(TAG).i("popup click:collect"); saveFileBrowseRecord(file); } }); if (collectPath.equals(file.desc)) { open_file_menu_collect.setText(getString(R.string.file_browser_un_collect)); } else { open_file_menu_collect.setText(getString(R.string.file_browser_collect)); } if (mTransferType == U_FTP_TO_FAB_FTP || mTransferType == FTP_U) { open_file_menu_collect.setVisibility(View.VISIBLE); } else { open_file_menu_collect.setVisibility(View.GONE); } return contentView; }
最新发布
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值