Example usage for android.widget LinearLayout.LayoutParams LinearLayout.LayoutParams

List of usage examples for android.widget LinearLayout.LayoutParams LinearLayout.LayoutParams

Introduction

In this page you can find the example usage for android.widget LinearLayout.LayoutParams LinearLayout.LayoutParams.

Prototype

public LayoutParams(int width, int height) 

Source Link

Usage

From source file:com.github.capone.controller.favorites.FavoritesFragment.java

@Override
public void onClick(View v) {
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    final EditText name = new EditText(getActivity());
    name.setHint(R.string.server_name);//  ww  w  .  j  av  a  2 s  .  c  o m
    final EditText address = new EditText(getActivity());
    address.setHint(R.string.server_address);
    final EditText publicKey = new EditText(getActivity());
    publicKey.setHint(R.string.public_key);

    LinearLayout layout = new LinearLayout(getActivity());
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(name, params);
    layout.addView(address, params);
    layout.addView(publicKey, params);

    new AlertDialog.Builder(getActivity()).setTitle(R.string.title_add_favorite)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    addServer(name.getText().toString(), address.getText().toString(),
                            publicKey.getText().toString());
                }
            }).setView(layout).show();
}

From source file:ru.orangesoftware.financisto.widget.AmountInput.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    requestId = EDIT_AMOUNT_REQUEST.incrementAndGet();

    LinearLayout v = new LinearLayout(getActivity());
    v.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams lpWrapWrap = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);//from w ww . j a  v a  2  s  . c o  m
    lpWrapWrap.weight = 1;

    inflater.inflate(R.layout.amount_input, v, true);
    c = new Controls(v);

    c.AmountInput.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), QuickAmountInput.class);
            intent.putExtra(EXTRA_AMOUNT, getAbsAmountString());
            startActivityForResult(intent, requestId);
        }
    });

    c.CalculatorInput.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), CalculatorInput.class);
            intent.putExtra(EXTRA_AMOUNT, getAbsAmountString());
            startActivityForResult(intent, requestId);
        }
    });

    c.primary.setKeyListener(keyListener);
    c.primary.addTextChangedListener(textWatcher);
    c.primary.setOnFocusChangeListener(selectAllOnFocusListener);

    c.secondary.setKeyListener(new DigitsKeyListener(false, false) {

        @Override
        public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_DEL) {
                if (content.length() == 0) {
                    c.primary.requestFocus();
                    int pos = c.primary.getText().length();
                    c.primary.setSelection(pos, pos);
                    return true;
                }
            }
            return super.onKeyDown(view, content, keyCode, event);
        }

        @Override
        public int getInputType() {
            return InputType.TYPE_CLASS_PHONE;
        }

    });
    c.secondary.addTextChangedListener(textWatcher);
    c.secondary.setOnFocusChangeListener(selectAllOnFocusListener);

    return v;
}

From source file:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);/*from   w w w. j av  a 2  s.c  om*/
    @SuppressLint("InflateParams")
    View v = inflater.inflate(R.layout.fragment_ordersbook, container, false);
    mAsksList = (ListView) v.findViewById(R.id.asks);
    mBidsList = (ListView) v.findViewById(R.id.bids);
    mChartArea = (FrameLayout) v.findViewById(R.id.OrdersBookChart);
    mLoadingViewAsks = new ProgressBar(getActivity());
    mLoadingViewBids = new ProgressBar(getActivity());
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    lp.gravity = Gravity.CENTER;
    mLoadingViewAsks.setLayoutParams(lp);

    mLoadingViewBids.setLayoutParams(lp);
    ((LinearLayout) mAsksList.getParent()).addView(mLoadingViewAsks);
    mAsksList.setEmptyView(mLoadingViewAsks);
    ((LinearLayout) mBidsList.getParent()).addView(mLoadingViewBids);
    mBidsList.setEmptyView(mLoadingViewBids);

    ActionBarActivity hostActivity = (ActionBarActivity) getActivity();
    hostActivity.getSupportActionBar().setCustomView(mPairsSpinner, new ActionBar.LayoutParams(Gravity.END));
    hostActivity.getSupportActionBar().setDisplayShowCustomEnabled(true);
    return v;
}

From source file:com.geoffreybuttercrumbs.arewethereyet.DrawerFragment.java

private void recent() {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    SharedPreferences prefs = getActivity().getSharedPreferences("AreWeThereYet", Context.MODE_WORLD_WRITEABLE);

    for (int i = 1; i <= 5; i++) {
        Location location = new Location("POINT_LOCATION");
        String address = prefs.getString(POINT_ADDRESS_KEY + i, "");
        location.setLatitude(0);/*  w w  w .j ava2  s .  com*/
        location.setLongitude(0);
        if (prefs.contains(POINT_LATITUDE_KEY + i)) {
            location.setLatitude(prefs.getFloat(POINT_LATITUDE_KEY + i, 0));
        }
        if (prefs.contains(POINT_LONGITUDE_KEY + i)) {
            location.setLongitude(prefs.getFloat(POINT_LONGITUDE_KEY + i, 0));
        }

        LinearLayout RecentParent = (LinearLayout) V.findViewById(R.id.group_recent);
        View Recent = inflater.inflate(R.layout.saved_item, null);
        Recent.setOnClickListener(this);

        CharSequence name;
        if (!address.equals("")) {
            name = address;
            ((TextView) Recent.findViewById(R.id.savedLabel)).setTextColor(0xDDFFFFFF);
            ((CompoundButton) Recent.findViewById(R.id.saveCB)).setOnCheckedChangeListener(this);
        } else {
            name = "No Recent Alarms";
            ((TextView) Recent.findViewById(R.id.savedLabel)).setTextColor(0xDD999999);
            Recent.findViewById(R.id.saveCB).setEnabled(false);
        }

        ((TextView) Recent.findViewById(R.id.savedLabel)).setText(name);
        ((TextView) Recent.findViewById(R.id.savedLabel)).setTextSize(14);
        Recent.findViewById(R.id.saveCB).setTag(i);
        Recent.setId(i);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        RecentParent.setLayoutParams(params);
        RecentParent.addView(Recent);
    }
}

From source file:com.egoclean.testpregnancy.util.ActivityHelper.java

/**
 * Sets up the action bar with the given title and accent color. If title is null, then
 * the app logo will be shown instead of a title. Otherwise, a home button and title are
 * visible. If color is null, then the default colorstrip is visible.
 *///from ww  w.j  a v  a 2 s .  co  m
public void setupActionBar(CharSequence title, int color) {
    final ViewGroup actionBarCompat = getActionBarCompat();
    if (actionBarCompat == null) {
        return;
    }

    LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams(0,
            ViewGroup.LayoutParams.FILL_PARENT);
    springLayoutParams.weight = 1;

    View.OnClickListener homeClickListener = new View.OnClickListener() {
        public void onClick(View view) {
            goHome();
        }
    };

    if (title != null) {
        // Add Home button
        addActionButtonCompat(R.drawable.ic_title_home, R.string.description_home, homeClickListener, true);
    } else {
        // Add logo
        ImageButton logo = new ImageButton(mActivity, null, R.attr.actionbarCompatLogoStyle);
        logo.setOnClickListener(homeClickListener);
        actionBarCompat.addView(logo);
    }

    // Add title text
    TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTextStyle);
    titleText.setLayoutParams(springLayoutParams);
    titleText.setText(title);
    actionBarCompat.addView(titleText);

    setActionBarColor(color);
}

From source file:fr.eoit.activity.fragment.blueprint.RequiredSkillInventionFragment.java

@Override
public void onLoadFinished(Cursor cursor) {
    if (DbUtil.hasAtLeastOneRow(cursor)) {
        short encryptionSkillLevel = -1;
        int encryptionSkillId = -1;
        short datacore1SkillLevel = -1;
        short datacore2SkillLevel = -1;

        List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();

        boolean datacore1SkillSet = false;

        while (!cursor.isAfterLast()) {
            Map<String, Object> dataLine = new HashMap<String, Object>();

            int skillId = cursor.getInt(cursor.getColumnIndexOrThrow(InventionMapping.COLUMN_NAME_SKILL_ID));
            String skillName = cursor.getString(cursor.getColumnIndexOrThrow(Item.COLUMN_NAME_NAME));
            int skillLevel = 1;

            short userSkillLevel = Skills.getSkill(skillId);
            if (Skills.isEncryptionSkill(skillId)) {
                encryptionSkillLevel = userSkillLevel;
                encryptionSkillId = skillId;
            } else {
                if (datacore1SkillSet) {
                    datacore2SkillLevel = userSkillLevel;
                } else {
                    datacore1SkillLevel = userSkillLevel;
                    datacore1SkillSet = true;
                }/*from w ww  .java  2  s. co  m*/
            }

            boolean learnt = userSkillLevel >= skillLevel;

            dataLine.put(InventionMapping.COLUMN_NAME_LEARNT, learnt);
            dataLine.put(Item.COLUMN_NAME_NAME, skillName);
            dataLine.put(InventionMapping.COLUMN_NAME_SKILL_LEVEL, userSkillLevel);
            data.add(dataLine);

            cursor.moveToNext();
        }

        SimpleAdapter adapter = new SimpleAdapter(getActivity(), data, R.layout.required_skills_row, FROM, TO);

        adapter.setViewBinder(new RequiredSkillsViewBinder());
        ListView listView = (ListView) getView().findViewById(R.id.REQUIRED_SKILLS_LIST);
        listView.setAdapter(adapter);
        int count = cursor.getCount();
        int width = count * ((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 26,
                getResources().getDisplayMetrics()));
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                width);
        listView.setLayoutParams(lp);

        if (fragmentReference != null && fragmentReference.get() != null) {
            fragmentReference.get().updateInventionChances(encryptionSkillLevel, datacore1SkillLevel,
                    datacore2SkillLevel);
            fragmentReference.get().setEncryptionSkillId(encryptionSkillId);
        }
    }
}

From source file:com.geoffreybuttercrumbs.arewethereyet.DrawerFragment.java

private void saved() {
    ////////S-A-V-E-D///////////
    LinearLayout SavedParent = (LinearLayout) V.findViewById(R.id.group_pinned);
    LayoutInflater inflater = getActivity().getLayoutInflater();
    //If there are no pinned alarms
    if (touchSaveIndex(0) < 1) {
        View Saved = inflater.inflate(R.layout.saved_item, null);
        Saved.setOnClickListener(this);

        ((TextView) Saved.findViewById(R.id.savedLabel)).setText("No Pinned Alarms");
        ((TextView) Saved.findViewById(R.id.savedLabel)).setTextColor(0xDD999999);
        ((CheckBox) Saved.findViewById(R.id.saveCB)).setChecked(true);
        Saved.findViewById(R.id.saveCB).setEnabled(false);

        ((CompoundButton) Saved.findViewById(R.id.saveCB)).setOnCheckedChangeListener(this);

        LinearLayout.LayoutParams sparams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        SavedParent.setLayoutParams(sparams);
        SavedParent.addView(Saved);//  w  ww .ja v  a2 s  .  c om
    } else {
        for (int i = 1; i <= touchSaveIndex(0); i++) {

            //                View Saved = new View(getApplicationContext());
            View Saved = inflater.inflate(R.layout.saved_item, null);
            Saved.setOnClickListener(this);

            SharedPreferences prefs = getActivity().getSharedPreferences("AreWeThereYet",
                    Context.MODE_WORLD_WRITEABLE);
            Location location = new Location("POINT_LOCATION");
            location.setLatitude(0);
            location.setLongitude(0);
            String address = "No Pinned Alarms";
            if (prefs.contains(SAVED_LATITUDE_KEY + i)) {
                location.setLatitude(prefs.getFloat(SAVED_LATITUDE_KEY + i, 0));
            }
            if (prefs.contains(SAVED_LONGITUDE_KEY + i)) {
                location.setLongitude(prefs.getFloat(SAVED_LONGITUDE_KEY + i, 0));
            }
            if (prefs.contains(SAVED_ADDRESS_KEY + i)) {
                address = (prefs.getString(SAVED_ADDRESS_KEY + i, ""));
            }

            CharSequence name;
            if (!address.equals("")) {
                name = address;
                ((TextView) Saved.findViewById(R.id.savedLabel)).setTextColor(0xDDFFFFFF);
                ((CheckBox) Saved.findViewById(R.id.saveCB)).setChecked(true);
                Saved.findViewById(R.id.saveCB).setTag(i);
                ((CompoundButton) Saved.findViewById(R.id.saveCB)).setOnCheckedChangeListener(this);
            } else {
                name = "Error";
                ((TextView) Saved.findViewById(R.id.savedLabel)).setTextColor(0xDD999999);
                ((CheckBox) Saved.findViewById(R.id.saveCB)).setChecked(true);
                Saved.findViewById(R.id.saveCB).setEnabled(false);
            }

            ((CompoundButton) Saved.findViewById(R.id.saveCB)).setOnCheckedChangeListener(this);
            ((TextView) Saved.findViewById(R.id.savedLabel)).setText(name);
            ((TextView) Saved.findViewById(R.id.savedLabel)).setTextSize(14);
            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            SavedParent.setLayoutParams(params);
            SavedParent.addView(Saved);

        }
    }
}

From source file:nz.ac.auckland.lablet.script.components.TextComponent.java

@Override
public View createView(Context context, Fragment parent) {
    ScriptTreeNodeSheetBase.Counter counter = this.component.getCounter("QuestionCounter");

    // Note: we have to do this programmatically because findViewById would find the wrong child
    // items if there is more than one text question.

    LinearLayout layout = new LinearLayout(context);
    layout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    layout.setOrientation(LinearLayout.VERTICAL);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        layout.setBackgroundColor(context.getResources().getColor(R.color.sc_question_background_color, null));
    } else {//  w  w w. j a  va 2s . c  om
        layout.setBackgroundColor(context.getResources().getColor(R.color.sc_question_background_color));
    }

    TextView textView = new TextView(context);
    textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        textView.setTextAppearance(android.R.style.TextAppearance_Medium);
    } else {
        textView.setTextAppearance(context, android.R.style.TextAppearance_Medium);
    }
    question_num = counter.increaseValue();
    textView.setText("Q" + question_num + ": " + text);

    EditText editText = new EditText(context);
    editText.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    editText.setText(answer);
    editText.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {

        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {

        }

        @Override
        public void afterTextChanged(Editable editable) {
            answer = editable.toString();
            update();
        }
    });

    layout.addView(textView);
    layout.addView(editText);
    return layout;
}

From source file:com.astuetz.PagerSlidingTabStripWithStyle.java

public PagerSlidingTabStripWithStyle(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    setFillViewport(true);/*from   ww  w. jav a  2 s.  c om*/
    setWillNotDraw(false);

    tabsContainer = new RadioGroup(context);
    tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
    tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    addView(tabsContainer);

    DisplayMetrics dm = getResources().getDisplayMetrics();

    scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm);
    indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm);
    underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm);
    dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm);
    tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm);
    dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm);
    tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm);

    // get system attrs (android:textSize and android:textColor)

    TypedArray a = context.obtainStyledAttributes(attrs, ATTRS);

    tabTextSize = a.getDimensionPixelSize(0, tabTextSize);
    tabTextColor = a.getColor(1, tabTextColor);

    a.recycle();

    // get custom attrs

    a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip);

    indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor);
    underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor);
    dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor);
    indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight,
            indicatorHeight);
    underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight,
            underlineHeight);
    dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding,
            dividerPadding);
    tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding);
    tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground,
            tabBackgroundResId);
    shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand);
    scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset);
    textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps);

    a.recycle();

    rectPaint = new Paint();
    rectPaint.setAntiAlias(true);
    rectPaint.setStyle(Style.FILL);

    dividerPaint = new Paint();
    dividerPaint.setAntiAlias(true);
    dividerPaint.setStrokeWidth(dividerWidth);

    defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.MATCH_PARENT);
    expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f);

    if (locale == null) {
        locale = getResources().getConfiguration().locale;
    }
}

From source file:com.ibuildapp.romanblack.MultiContactsPlugin.ContactDetailsActivity.java

@Override
public void create() {
    try {//from w ww .j a va2s  .  co m
        setContentView(R.layout.grouped_contacts_details);

        Intent currentIntent = getIntent();
        Bundle store = currentIntent.getExtras();
        widget = (Widget) store.getSerializable("Widget");
        if (widget == null) {
            handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100);
            return;
        }

        person = (Person) store.getSerializable("person");
        if (person == null) {
            handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100);
            return;
        }
        setTopBarTitle(widget.getTitle());

        Boolean single = currentIntent.getBooleanExtra("single", true);

        setTopBarLeftButtonTextAndColor(
                single ? getResources().getString(R.string.common_home_upper)
                        : getResources().getString(R.string.common_back_upper),
                getResources().getColor(android.R.color.black), true, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        finish();
                    }
                });
        setTopBarTitleColor(getResources().getColor(android.R.color.black));
        setTopBarBackgroundColor(Statics.color1);

        if ((Boolean.TRUE.equals(widget.getParameter(PARAM_SEND_MAIL)))
                || (Boolean.TRUE.equals(widget.getParameter(PARAM_SEND_SMS)))
                || (Boolean.TRUE.equals(widget.getParameter(PARAM_SEND_SMS)))) {

            ImageView shareButton = (ImageView) getLayoutInflater()
                    .inflate(R.layout.grouped_contacts_share_button, null);
            shareButton.setLayoutParams(
                    new LinearLayout.LayoutParams((int) (29 * getResources().getDisplayMetrics().density),
                            (int) (39 * getResources().getDisplayMetrics().density)));
            shareButton.setColorFilter(Color.BLACK);
            setTopBarRightButton(shareButton, getString(R.string.multicontacts_list_share),
                    new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            DialogSharing.Configuration.Builder sharingDialogBuilder = new DialogSharing.Configuration.Builder();

                            if (Boolean.TRUE.equals(widget.getParameter(PARAM_SEND_MAIL)))
                                sharingDialogBuilder
                                        .setEmailSharingClickListener(new DialogSharing.Item.OnClickListener() {
                                            @Override
                                            public void onClick() {
                                                String message = getContactInfo();
                                                Intent email = new Intent(Intent.ACTION_SEND);
                                                email.putExtra(Intent.EXTRA_TEXT, message);
                                                email.setType("message/rfc822");
                                                startActivity(Intent.createChooser(email,
                                                        getString(R.string.choose_email_client)));
                                            }
                                        });

                            if (Boolean.TRUE.equals(widget.getParameter(PARAM_SEND_SMS)))
                                sharingDialogBuilder
                                        .setSmsSharingClickListener(new DialogSharing.Item.OnClickListener() {
                                            @Override
                                            public void onClick() {
                                                String message = getContactInfo();

                                                try {
                                                    Utils.sendSms(ContactDetailsActivity.this, message);
                                                } catch (ActivityNotFoundException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        });

                            if (Boolean.TRUE.equals(widget.getParameter(PARAM_ADD_CONTACT)))
                                sharingDialogBuilder.addCustomListener(R.string.multicontacts_add_to_phonebook,
                                        R.drawable.gc_add_to_contacts, true,
                                        new DialogSharing.Item.OnClickListener() {
                                            @Override
                                            public void onClick() {
                                                createNewContact(person.getName(), person.getPhone(),
                                                        person.getEmail());
                                            }
                                        });

                            showDialogSharing(sharingDialogBuilder.build());
                        }
                    });

        }

        boolean hasSchema = store.getBoolean("hasschema");
        cachePath = widget.getCachePath() + "/contacts-" + widget.getOrder();

        contacts = person.getContacts();

        if (widget.getTitle().length() > 0) {
            setTitle(widget.getTitle());
        }

        root = (LinearLayout) findViewById(R.id.grouped_contacts_details_root);

        if (hasSchema) {
            root.setBackgroundColor(Statics.color1);
        } else if (widget.isBackgroundURL()) {
            cacheBackgroundFile = cachePath + "/" + Utils.md5(widget.getBackgroundURL());
            File backgroundFile = new File(cacheBackgroundFile);
            if (backgroundFile.exists()) {
                root.setBackgroundDrawable(
                        new BitmapDrawable(BitmapFactory.decodeStream(new FileInputStream(backgroundFile))));
            } else {
                BackgroundDownloadTask dt = new BackgroundDownloadTask();
                dt.execute(widget.getBackgroundURL());
            }
        } else if (widget.isBackgroundInAssets()) {
            AssetManager am = this.getAssets();
            root.setBackgroundDrawable(new BitmapDrawable(am.open(widget.getBackgroundURL())));
        }

        if (contacts != null) {
            ImageView avatarImage = (ImageView) findViewById(R.id.grouped_contacts_details_avatar);

            avatarImage.setImageResource(R.drawable.gc_profile_avatar);
            if (person.hasAvatar() && NetworkUtils.isOnline(this)) {
                avatarImage.setVisibility(View.VISIBLE);
                Glide.with(this).load(person.getAvatarUrl()).placeholder(R.drawable.gc_profile_avatar)
                        .dontAnimate().into(avatarImage);
            } else {
                avatarImage.setVisibility(View.VISIBLE);
                avatarImage.setImageResource(R.drawable.gc_profile_avatar);
            }

            String name = "";
            neededContacts = new ArrayList<>();
            for (Contact con : contacts) {
                if ((con.getType() == 5) || (con.getDescription().length() == 0)) {
                } else {
                    if (con.getType() == 0) {
                        name = con.getDescription();
                    } else
                        neededContacts.add(con);
                }
            }

            if (neededContacts.isEmpty()) {
                handler.sendEmptyMessage(THERE_IS_NO_CONTACT_DATA);
                return;
            }

            headSeparator = findViewById(R.id.gc_head_separator);
            bottomSeparator = findViewById(R.id.gc_bottom_separator);
            imageBottom = findViewById(R.id.gc_image_bottom_layout);
            personName = (TextView) findViewById(R.id.gc_details_description);

            if ("".equals(name))
                personName.setVisibility(View.GONE);
            else {
                personName.setVisibility(View.VISIBLE);
                personName.setText(name);
                personName.setTextColor(Statics.color3);
            }
            if (Statics.isLight) {
                headSeparator.setBackgroundColor(Color.parseColor("#4d000000"));
                bottomSeparator.setBackgroundColor(Color.parseColor("#4d000000"));
            } else {
                headSeparator.setBackgroundColor(Color.parseColor("#4dFFFFFF"));
                bottomSeparator.setBackgroundColor(Color.parseColor("#4dFFFFFF"));
            }

            ViewUtils.setBackgroundLikeHeader(imageBottom, Statics.color1);

            ListView list = (ListView) findViewById(R.id.grouped_contacts_details_list_view);
            list.setDivider(null);

            ContactDetailsAdapter adapter = new ContactDetailsAdapter(ContactDetailsActivity.this,
                    R.layout.grouped_contacts_details_item, neededContacts, isChemeDark(Statics.color1));
            list.setAdapter(adapter);
            list.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> arg0, View view, int position, long id) {
                    listViewItemClick(position);
                }
            });
        }

        if (widget.hasParameter("add_contact")) {
            HashMap<String, String> hm = new HashMap<>();
            for (int i = 0; i < contacts.size(); i++) {
                switch (contacts.get(i).getType()) {
                case 0: {
                    hm.put("contactName", contacts.get(i).getDescription());
                }
                    break;
                case 1: {
                    hm.put("contactNumber", contacts.get(i).getDescription());
                }
                    break;
                case 2: {
                    hm.put("contactEmail", contacts.get(i).getDescription());
                }
                    break;
                case 3: {
                    hm.put("contactSite", contacts.get(i).getDescription());
                }
                    break;
                }
            }
            addNativeFeature(NATIVE_FEATURES.ADD_CONTACT, null, hm);
        }
        if (widget.hasParameter("send_sms")) {
            HashMap<String, String> hm = new HashMap<>();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < contacts.size(); i++) {
                sb.append(contacts.get(i).getDescription());
                if (i < contacts.size() - 1) {
                    sb.append(", ");
                }
            }
            hm.put("text", sb.toString());
            addNativeFeature(NATIVE_FEATURES.SMS, null, hm);
        }
        if (widget.hasParameter("send_mail")) {
            HashMap<String, CharSequence> hm = new HashMap<>();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < contacts.size(); i++) {
                switch (contacts.get(i).getType()) {
                case 0: {
                    sb.append("Name: ");
                }
                    break;
                case 1: {
                    sb.append("Phone: ");
                }
                    break;
                case 2: {
                    sb.append("Email: ");
                }
                    break;
                case 3: {
                    sb.append("Site: ");
                }
                    break;
                case 4: {
                    sb.append("Address: ");
                }
                    break;
                }
                sb.append(contacts.get(i).getDescription());
                sb.append("<br/>");
            }

            if (widget.isHaveAdvertisement()) {
                sb.append("<br>\n (sent from <a href=\"http://ibuildapp.com\">iBuildApp</a>)");
            }

            hm.put("text", sb.toString());
            hm.put("subject", "Contacts");
            addNativeFeature(NATIVE_FEATURES.EMAIL, null, hm);
        }

    } catch (Exception e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }
}