Example usage for android.widget LinearLayout invalidate

List of usage examples for android.widget LinearLayout invalidate

Introduction

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

Prototype

public void invalidate() 

Source Link

Document

Invalidate the whole view.

Usage

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

@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (isChecked) {
        View recentV = (View) buttonView.getParent();
        setSaved(recentV.getId());/*  w w w  .  java2  s  . c  o  m*/
    } else {
        cleanup((Integer) buttonView.getTag());
        touchSaveIndex(-1);
    }
    clear();
    saved();
    recent();
    LinearLayout SavedParent = (LinearLayout) V.findViewById(R.id.group_pinned);
    LinearLayout RecentParent = (LinearLayout) V.findViewById(R.id.group_recent);
    SavedParent.invalidate();
    RecentParent.invalidate();
}

From source file:com.appfirst.activities.details.AFServerDetail.java

/**
 * Draw a ScrollView to display the CPU value for each core.
 * //  www . java2  s  .c o  m
 * @return a ScrollView containing a list of BarView.
 */
private View createCPUListDialog() {
    ScrollView container = createOuterContainer();
    LinearLayout innerContainer = createInnerContainer();

    List<BasicNameValuePair> items = data.getCpu_cores();
    for (int i = 0; i < items.size(); i++) {
        BasicNameValuePair item = items.get(i);
        Double value = Double.parseDouble(item.getValue());
        LinearLayout row = createTableRow(LinearLayout.HORIZONTAL);
        AFBarView barView = createBarView(value);
        row.addView(barView);
        innerContainer.addView(row);
    }
    container.addView(innerContainer);
    innerContainer.invalidate();
    container.invalidate();
    return container;
}

From source file:com.appfirst.activities.details.AFServerDetail.java

/**
 * Draw a ScrollView to display the Disk usage for each disk.
 * //from w  w  w  .j av  a  2s .  c o  m
 * @return a ScrollView containing a list of AFBarView and AFPieView.
 */
private View createDiskListDialog() {
    // use the scroll view to scale
    ScrollView container = createOuterContainer();
    LinearLayout innerContainer = createInnerContainer();

    List<BasicNameValuePair> items = data.getDisk_percent_part();
    for (int i = 0; i < items.size(); i++) {
        BasicNameValuePair item = items.get(i);
        Double value = Double.parseDouble(item.getValue());
        String name = item.getName();
        LinearLayout row = createTableRow(LinearLayout.HORIZONTAL);
        AFPieView pieView = createPieView(value);
        row.addView(pieView);
        TextView text = new TextView(this);
        text.setPadding(10, 0, 0, 0);
        text.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        text.setText(String.format("%s - %.1f %s used", name, value, "%"));

        row.addView(text);
        innerContainer.addView(row);
    }
    container.addView(innerContainer);
    innerContainer.invalidate();
    container.invalidate();
    return container;
}

From source file:com.appfirst.activities.details.AFServerDetail.java

/**
 * Draw a ScrollView to display the Disk busy for each disk.
 * //from  ww  w.j  a v a  2  s . c o  m
 * @return a ScrollView containing a list of AFBarView and AFPieView.
 */
private View createDiskBusyListDialog() {
    ScrollView container = createOuterContainer();

    LinearLayout innerContainer = createInnerContainer();

    List<BasicNameValuePair> items = data.getDisk_busy();
    for (int i = 0; i < items.size(); i++) {
        BasicNameValuePair item = items.get(i);
        Double value = 0.0;
        try {
            value = Double.parseDouble(item.getValue());
        } catch (Exception e) {
            e.printStackTrace();
            continue;
        }
        String name = item.getName();
        LinearLayout row = createTableRow(LinearLayout.VERTICAL);
        TextView text = new TextView(this);
        text.setPadding(5, 0, 0, 0);
        text.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        text.setText(name);
        AFBarView barView = createBarView(value);

        row.addView(barView);
        row.addView(text);
        innerContainer.addView(row);
    }
    container.addView(innerContainer);
    innerContainer.invalidate();
    container.invalidate();
    return container;
}

From source file:com.roamprocess1.roaming4world.ui.messages.ConversationsListFragment.java

@SuppressLint("NewApi")
@Override/*from  w w  w  .j  a  v a  2s .co  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    View v = inflater.inflate(R.layout.message_list_fragment, container, false);
    LinearLayout progressContainer = (LinearLayout) v.findViewById(R.id.progressContainer);

    prefs = getActivity().getSharedPreferences("com.roamprocess1.roaming4world", Context.MODE_PRIVATE);
    stored_chatuserNumber = "com.roamprocess1.roaming4world.stored_chatuserNumber";
    stored_user_country_code = "com.roamprocess1.roaming4world.user_country_code";

    stored_account_register_status = "com.roamprocess1.roaming4world.account_register_status";
    preRegValue = prefs.getString(stored_account_register_status, "Connecting");
    System.out.println("oncreate prefValue" + preRegValue);

    LinearLayout onlinelayout = (LinearLayout) v.findViewById(R.id.onlineStatus);
    LinearLayout header_onlinelayout = (LinearLayout) v.findViewById(R.id.ll_dialer_onlineStatus);

    TextView status_register_account = (TextView) v.findViewById(R.id.status);

    ConnectivityManager connMgr1 = (ConnectivityManager) getActivity()
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo1 = connMgr1.getActiveNetworkInfo();
    if (networkInfo1 != null && networkInfo1.isConnected()) {

        if (status_register_account != null) {
            if (preRegValue.equals("Online")) {
                status_register_account.invalidate();
                onlinelayout.setBackgroundColor(Color.parseColor("#8CC63F"));
                status_register_account.setText("Online");
                status_register_account.invalidate();
                onlinelayout.setVisibility(LinearLayout.GONE);
                header_onlinelayout.setBackgroundColor(Color.parseColor("#8CC63F"));
            } else if (preRegValue.equals("Connecting")) {
                onlinelayout.setBackgroundColor(Color.parseColor("#FFA500"));
                status_register_account.setText("Connecting");
                status_register_account.invalidate();
                onlinelayout.invalidate();
                header_onlinelayout.setBackgroundColor(Color.parseColor("#FFA500"));
                onlinelayout.setVisibility(LinearLayout.GONE);
            }
        }
    } else {
        System.out.println("updateRegistrationsState() : No network");
        status_register_account.invalidate();
        onlinelayout.setBackgroundColor(Color.parseColor("#EB3D35"));
        status_register_account.setText("No Internet Connection");
        status_register_account.invalidate();
        onlinelayout.invalidate();
        onlinelayout.setVisibility(LinearLayout.GONE);
        header_onlinelayout.setBackgroundColor(Color.parseColor("#EB3D35"));

    }

    if (CurrentFragment.progressContainerLayout == false) {
        progressContainer.setVisibility(LinearLayout.GONE);
    }
    CurrentFragment.progressContainerLayout = true;

    ListView lv = (ListView) v.findViewById(android.R.id.list);

    View.OnClickListener addClickButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            System.out.println("conversationsListFragment.java in oncreateview in onClick listener");
            onClickAddMessage();
        }
    };

    // Header view
    mHeaderView = (ViewGroup) inflater.inflate(R.layout.conversation_list_item, lv, false);
    ((TextView) mHeaderView.findViewById(R.id.from)).setText(R.string.new_message);
    ((TextView) mHeaderView.findViewById(R.id.subject)).setText(R.string.create_new_message);
    mHeaderView.findViewById(R.id.quick_contact_photo).setVisibility(View.GONE);
    mHeaderView.setOnClickListener(addClickButtonListener);
    // Empty view
    Button bt = (Button) v.findViewById(android.R.id.empty);

    //  bt.setOnClickListener(addClickButtonListener);
    bt.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent intent = new Intent(getActivity(), MessageSipUri.class);
            getActivity().startActivity(intent);
        }
    });
    /*
    View vv = getActivity().getActionBar().getCustomView();
    imgButton_Chat = (ImageButton) vv.findViewById(R.id.imgRightMenu_chat);
    imgRightMenu = (ImageButton) vv.findViewById(R.id.imgRightMenu);
            
            
            
    imgButton_Chat.setOnClickListener(new View.OnClickListener() {
             
     @Override
     public void onClick(View v) {
    // TODO Auto-generated method stub
    onClickAddMessage();
     }
    });*/

    return v;
}

From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java

public void addResultListItem(String title, String value, LinearLayout netLayout) {
    final float scale = activity.getResources().getDisplayMetrics().density;
    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);

    LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    final View measurementItemView = inflater.inflate(R.layout.classification_list_item, netLayout, false);

    final TextView itemTitle = (TextView) measurementItemView.findViewById(R.id.classification_item_title);
    itemTitle.setText(title);//from   w w w.  j a va 2s . c o m

    final ImageView itemClassification = (ImageView) measurementItemView
            .findViewById(R.id.classification_item_color);
    itemClassification.setImageResource(Helperfunctions.getClassificationColor(-1));

    itemClassification.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            activity.showHelp(R.string.url_help_result, false);
        }
    });

    final TextView itemValue = (TextView) measurementItemView.findViewById(R.id.classification_item_value);
    itemValue.setText(value);

    netLayout.addView(measurementItemView);

    final View divider = new View(activity);
    divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1));
    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

    netLayout.addView(divider);

    netLayout.invalidate();
}

From source file:at.alladin.rmbt.android.map.overlay.RMBTBalloonOverlayView.java

public void setBalloonData(final RMBTBalloonOverlayItem item, final ViewGroup parent) {
    // map our custom item data to fields
    //        title.setText(item.getTitle());
    resultItems = item.getResultItems();

    resultListView.removeAllViews();/*from   ww  w  .ja v  a2 s  . c o m*/

    final float scale = getResources().getDisplayMetrics().density;

    final int leftRightItem = Helperfunctions.dpToPx(5, scale);
    final int topBottomItem = Helperfunctions.dpToPx(3, scale);

    final int leftRightDiv = Helperfunctions.dpToPx(0, scale);
    final int topBottomDiv = Helperfunctions.dpToPx(0, scale);
    final int heightDiv = Helperfunctions.dpToPx(1, scale);

    final int topBottomImg = Helperfunctions.dpToPx(1, scale);

    if (resultItems != null && resultItems.length() > 0) {

        for (int i = 0; i < 1; i++)
            // JSONObject resultListItem;
            try {
                final JSONObject result = resultItems.getJSONObject(i);

                final LayoutInflater resultInflater = (LayoutInflater) context
                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                final View resultView = resultInflater.inflate(R.layout.balloon_overlay_listitem, parent);

                final LinearLayout measurementLayout = (LinearLayout) resultView
                        .findViewById(R.id.resultMeasurementList);
                measurementLayout.setVisibility(View.GONE);

                final LinearLayout netLayout = (LinearLayout) resultView.findViewById(R.id.resultNetList);
                netLayout.setVisibility(View.GONE);

                final TextView measurementHeader = (TextView) resultView.findViewById(R.id.resultMeasurement);
                measurementHeader.setVisibility(View.GONE);

                final TextView netHeader = (TextView) resultView.findViewById(R.id.resultNet);
                netHeader.setVisibility(View.GONE);

                final TextView dateHeader = (TextView) resultView.findViewById(R.id.resultDate);
                dateHeader.setVisibility(View.GONE);

                dateHeader.setText(result.optString("time_string"));

                final JSONArray measurementArray = result.getJSONArray("measurement");

                final JSONArray netArray = result.getJSONArray("net");

                for (int j = 0; j < measurementArray.length(); j++) {

                    final JSONObject singleItem = measurementArray.getJSONObject(j);

                    final LinearLayout measurememtItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item);

                    measurememtItemLayout.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT));

                    measurememtItemLayout.setGravity(Gravity.CENTER_VERTICAL);
                    measurememtItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem,
                            topBottomItem);

                    final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle);
                    itemTitle.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f));
                    itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle);
                    itemTitle.setWidth(0);
                    itemTitle.setGravity(Gravity.LEFT);
                    itemTitle.setText(singleItem.getString("title"));

                    measurememtItemLayout.addView(itemTitle);

                    final ImageView itemClassification = new ImageView(context);
                    itemClassification.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f));
                    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);
                    // itemClassification.set setGravity(Gravity.LEFT);

                    itemClassification.setImageDrawable(getResources().getDrawable(
                            Helperfunctions.getClassificationImage(singleItem.getInt("classification"))));

                    measurememtItemLayout.addView(itemClassification);

                    final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue);
                    itemValue.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f));
                    itemValue.setTextAppearance(context, R.style.balloonResultItemValue);
                    itemValue.setWidth(0);
                    itemValue.setGravity(Gravity.LEFT);
                    itemValue.setText(singleItem.getString("value"));

                    measurememtItemLayout.addView(itemValue);

                    measurementLayout.addView(measurememtItemLayout);

                    final View divider = new View(context);
                    divider.setLayoutParams(new LinearLayout.LayoutParams(
                            android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1));
                    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                    measurementLayout.addView(divider);

                    measurementLayout.invalidate();
                }

                for (int j = 0; j < netArray.length(); j++) {

                    final JSONObject singleItem = netArray.getJSONObject(j);

                    final LinearLayout netItemLayout = new LinearLayout(context); // (LinearLayout)measurememtItemView.findViewById(R.id.measurement_item);

                    netItemLayout.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
                    netItemLayout.setPadding(leftRightItem, topBottomItem, leftRightItem, topBottomItem);

                    netItemLayout.setGravity(Gravity.CENTER_VERTICAL);

                    final TextView itemTitle = new TextView(context, null, R.style.balloonResultItemTitle);
                    itemTitle.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.4f));
                    itemTitle.setTextAppearance(context, R.style.balloonResultItemTitle);
                    itemTitle.setWidth(0);
                    itemTitle.setGravity(Gravity.LEFT);
                    itemTitle.setText(singleItem.getString("title"));

                    netItemLayout.addView(itemTitle);

                    final ImageView itemClassification = new ImageView(context);
                    itemClassification.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0.1f));
                    itemClassification.setPadding(0, topBottomImg, 0, topBottomImg);

                    itemClassification.setImageDrawable(
                            context.getResources().getDrawable(R.drawable.traffic_lights_none));
                    netItemLayout.addView(itemClassification);

                    final TextView itemValue = new TextView(context, null, R.style.balloonResultItemValue);
                    itemValue.setLayoutParams(
                            new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0.5f));
                    itemValue.setTextAppearance(context, R.style.balloonResultItemValue);
                    itemValue.setWidth(0);
                    itemValue.setGravity(Gravity.LEFT);
                    itemValue.setText(singleItem.optString("value", null));

                    netItemLayout.addView(itemValue);

                    netLayout.addView(netItemLayout);

                    final View divider = new View(context);
                    divider.setLayoutParams(new LinearLayout.LayoutParams(
                            android.view.ViewGroup.LayoutParams.MATCH_PARENT, heightDiv, 1));
                    divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv);

                    divider.setBackgroundResource(R.drawable.bg_trans_light_10);

                    netLayout.addView(divider);

                    netLayout.invalidate();
                }

                measurementHeader.setVisibility(View.VISIBLE);
                netHeader.setVisibility(View.VISIBLE);

                measurementLayout.setVisibility(View.VISIBLE);
                netLayout.setVisibility(View.VISIBLE);

                dateHeader.setVisibility(View.VISIBLE);

                resultListView.addView(resultView);

                Log.d(DEBUG_TAG, "View Added");
                // codeText.setText(resultListItem.getString("sync_code"));

            } catch (final JSONException e) {
                e.printStackTrace();
            }

        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);

        resultListView.setVisibility(View.VISIBLE);

        resultListView.invalidate();
    } else {
        Log.i(DEBUG_TAG, "LEERE LISTE");
        progessBar.setVisibility(View.GONE);
        emptyView.setVisibility(View.VISIBLE);
        emptyView.setText(context.getString(R.string.error_no_data));
        emptyView.invalidate();
    }
}