/** @param context */ public AppPermssionView(Context context, AppItem appItem) { super(context); setBackgroundColor(getResources().getColor(R.color.content_bg_color)); this.appItem = appItem; // ���Ȩ���б� taskMark = marketContext.getTaskMarkPool().createAppPermissionTaskMark(appItem.getId()); if (appItem.getPermissionList().size() == 0) { addView(R.layout.progressbar_view_l_r); marketContext.getServiceWraper().getAppPermissionList(this, taskMark, null, appItem.getId()); } else { handleInitShowPermissionList(); } }
// ��ʼ��Ȩ���б� private void handleInitShowPermissionList() { // �б���ͼ removeAllViews(); addView(R.layout.app_permission); // ��ʼ��Ȩ���б� LinearLayout showPermissionList = (LinearLayout) findViewById(R.id.showPermissionList); LinearLayout hidePermissionList = (LinearLayout) findViewById(R.id.hidePermissionList); List<AppPermission> permList = appItem.getPermissionList(); View permissionView = null; LayoutInflater layoutInflater = LayoutInflater.from(getContext()); for (AppPermission appPermission : permList) { if (appPermission.isHide()) { permissionView = layoutInflater.inflate(R.layout.permision_less_item, null); hidePermissionList.addView(permissionView); } else { permissionView = layoutInflater.inflate(R.layout.permision_item, null); showPermissionList.addView(permissionView); } ((TextView) permissionView.findViewById(R.id.permissionTitleLabel)) .setText(appPermission.getTitle()); ((TextView) permissionView.findViewById(R.id.permissionDesLabel)) .setText(appPermission.getDes()); } // ��ʾ���ص�Ȩ�� View view = findViewById(R.id.showHidePermissionView); if (hidePermissionList.getChildCount() == 0) { view.setVisibility(View.GONE); hidePermissionList.setVisibility(View.GONE); } else { view.setOnClickListener(this); // ��ʼʱ�۵��� view.setTag(false); } }