/** Set views data from app item */
 public void setViews() {
   if (appItem != null) {
     /** **** TITLE ****** */
     textViewTitle.setText(appItem.getAppname());
     /** **** STRORAGE ****** */
     try {
       appDetails =
           MainActivity.service
               .getSystemControl()
               .getApplicationControl()
               .getApplicationDeatails(appItem.getAppPackage());
     } catch (Exception e) {
       e.printStackTrace();
     }
     if (appDetails != null) {
       try {
         appDetails.getAppSizeInfo();
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }
 private void fillPermisions() {
   layoutForInflating.removeAllViews();
   List<AppPermission> permissions = null;
   try {
     permissions = appDetails.getAppPermissions();
   } catch (Exception e) {
     e.printStackTrace();
   }
   if (permissions != null) {
     // list permissions and create views for each
     for (int i = 0; i < permissions.size(); i++) {
       final LinearLayout smallLayoutHorizontal = new LinearLayout(ctx);
       smallLayoutHorizontal.setOrientation(LinearLayout.HORIZONTAL);
       smallLayoutHorizontal.setLayoutParams(
           new LinearLayout.LayoutParams(
               LayoutParams.MATCH_PARENT, MainActivity.dialogListElementHeight));
       smallLayoutHorizontal.setWeightSum(DialogCreatorClass.SMALL_LAYOUT_WEIGHT_SUM);
       smallLayoutHorizontal.setPadding(15, 4, 15, 4);
       /** ***** TEXT VIEW ****** */
       A4TVTextView textView = new A4TVTextView(ctx, null);
       textView.setLayoutParams(
           new LinearLayout.LayoutParams(
               0, LayoutParams.WRAP_CONTENT, DialogCreatorClass.ELEMENTS_WEIGHT_BIG));
       textView.setGravity(Gravity.CENTER_VERTICAL);
       // auto scroll text in text view
       textView.setEllipsize(TruncateAt.MARQUEE);
       textView.setSingleLine(true);
       textView.setTextSize(ctx.getResources().getDimension(R.dimen.a4tvdialog_textview_size));
       // set text to text view
       textView.setText(permissions.get(i).getPermissionGroup());
       // add text view to small layout
       smallLayoutHorizontal.addView(textView);
       /** ********* BUTTON *********** */
       A4TVButton button = new A4TVButton(ctx);
       button.setLayoutParams(
           new LinearLayout.LayoutParams(
               0, LayoutParams.MATCH_PARENT, DialogCreatorClass.ELEMENTS_WEIGHT_SMALL));
       // set text to button
       button.setText(permissions.get(i).getDescription());
       button.setTextSize(ctx.getResources().getDimension(R.dimen.a4tvdialog_button_text_size));
       button.setEllipsize(TruncateAt.MARQUEE);
       button.setSingleLine(true);
       button.setBackgroundColor(Color.TRANSPARENT);
       // add focus listener for button
       button.setOnFocusChangeListener(
           new OnFocusChangeListener() {
             @Override
             public void onFocusChange(View v, boolean hasFocus) {
               // get drawable from theme for small layout
               // background
               TypedArray atts =
                   ctx.getTheme().obtainStyledAttributes(new int[] {R.attr.LayoutFocusDrawable});
               int backgroundID = atts.getResourceId(0, 0);
               if (hasFocus) {
                 smallLayoutHorizontal.getChildAt(0).setSelected(true);
                 smallLayoutHorizontal.setBackgroundResource(backgroundID);
               } else {
                 smallLayoutHorizontal.getChildAt(0).setSelected(false);
                 smallLayoutHorizontal.setBackgroundColor(Color.TRANSPARENT);
               }
               atts.recycle();
             }
           });
       // add button to small layout
       smallLayoutHorizontal.addView(button);
       /** Add view to dialog */
       layoutForInflating.addView(smallLayoutHorizontal);
       if (i < permissions.size() - 1) {
         // create horizontal line
         ImageView horizLin = new ImageView(ctx);
         horizLin.setLayoutParams(
             new LinearLayout.LayoutParams(
                 android.widget.LinearLayout.LayoutParams.MATCH_PARENT,
                 android.widget.LinearLayout.LayoutParams.WRAP_CONTENT));
         // get drawable from theme for image source
         TypedArray att =
             ctx.getTheme().obtainStyledAttributes(new int[] {R.attr.DialogSmallDividerLine});
         int src = att.getResourceId(0, 0);
         horizLin.setBackgroundResource(src);
         att.recycle();
         // add horiz line to main layout
         layoutForInflating.addView(horizLin);
       }
     }
   }
 }