Java Code Examples for android.widget.LinearLayout.findViewWithTag()

The following are Jave code examples for showing how to use findViewWithTag() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: FastAndroid   File: CallUserGridView.java   View Source Code Vote up 6 votes
public void updateChildInfo(String childId, UserInfo userInfo) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            AsyncImageView imageView = (AsyncImageView)child.findViewById(R.id.rc_user_portrait);
            imageView.setAvatar(userInfo.getPortraitUri());
            if (enableTitle) {
                TextView textView = (TextView)child.findViewById(R.id.rc_user_name);
                textView.setText(userInfo.getName());
            }
        }
    }
}
 
Example 2
Project: sealtalk-android-master   File: CallUserGridView.java   View Source Code Vote up 6 votes
public void updateChildInfo(String childId, UserInfo userInfo) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            AsyncImageView imageView = (AsyncImageView)child.findViewById(R.id.rc_user_portrait);
            imageView.setAvatar(userInfo.getPortraitUri());
            if (enableTitle) {
                TextView textView = (TextView)child.findViewById(R.id.rc_user_name);
                textView.setText(userInfo.getName());
            }
        }
    }
}
 
Example 3
Project: FastAndroid   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void removeChild(String childId) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    List<LinearLayout> containerList = new ArrayList<>();
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        containerList.add(container);
    }
    for (LinearLayout resultContainer : containerList) {
        if (lastContainer == null) {
            LinearLayout child = (LinearLayout) resultContainer.findViewWithTag(childId);
            if (child != null) {
                resultContainer.removeView(child);
                if (resultContainer.getChildCount() == 0) {
                    linearLayout.removeView(resultContainer);
                    break;
                } else {
                    lastContainer = resultContainer;
                }
            }
        } else {
            View view = resultContainer.getChildAt(0);
            resultContainer.removeView(view);
            lastContainer.addView(view);
            if (resultContainer.getChildCount() == 0) {
                linearLayout.removeView(resultContainer);
                break;
            } else {
                lastContainer = resultContainer;
            }
        }
    }
}
 
Example 4
Project: FastAndroid   File: CallUserGridView.java   View Source Code Vote up 5 votes
public View findChildById(String childId) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            return child;
        }
    }
    return null;
}
 
Example 5
Project: FastAndroid   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void updateChildState(String childId, String state) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            TextView textView = (TextView)child.findViewById(R.id.rc_voip_member_state);
            textView.setText(state);
        }
    }
}
 
Example 6
Project: FastAndroid   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void updateChildState(String childId, boolean visible) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            TextView textView = (TextView)child.findViewById(R.id.rc_voip_member_state);
            textView.setVisibility(visible ? VISIBLE : GONE);
        }
    }
}
 
Example 7
Project: sealtalk-android-master   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void removeChild(String childId) {
    int containerCount = linearLayout.getChildCount();

    LinearLayout lastContainer = null;
    List<LinearLayout> containerList = new ArrayList<>();
    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        containerList.add(container);
    }
    for (LinearLayout resultContainer : containerList) {
        if (lastContainer == null) {
            LinearLayout child = (LinearLayout) resultContainer.findViewWithTag(childId);
            if (child != null) {
                resultContainer.removeView(child);
                if (resultContainer.getChildCount() == 0) {
                    linearLayout.removeView(resultContainer);
                    break;
                } else {
                    lastContainer = resultContainer;
                }
            }
        } else {
            View view = resultContainer.getChildAt(0);
            resultContainer.removeView(view);
            lastContainer.addView(view);
            if (resultContainer.getChildCount() == 0) {
                linearLayout.removeView(resultContainer);
                break;
            } else {
                lastContainer = resultContainer;
            }
        }
    }
}
 
Example 8
Project: sealtalk-android-master   File: CallUserGridView.java   View Source Code Vote up 5 votes
public View findChildById(String childId) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            return child;
        }
    }
    return null;
}
 
Example 9
Project: sealtalk-android-master   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void updateChildState(String childId, String state) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            TextView textView = (TextView)child.findViewById(R.id.rc_voip_member_state);
            textView.setText(state);
        }
    }
}
 
Example 10
Project: sealtalk-android-master   File: CallUserGridView.java   View Source Code Vote up 5 votes
public void updateChildState(String childId, boolean visible) {
    int containerCount = linearLayout.getChildCount();

    for (int i = 0; i < containerCount; i++) {
        LinearLayout container = (LinearLayout) linearLayout.getChildAt(i);
        LinearLayout child = (LinearLayout) container.findViewWithTag(childId);
        if (child != null) {
            TextView textView = (TextView)child.findViewById(R.id.rc_voip_member_state);
            textView.setVisibility(visible ? VISIBLE : GONE);
        }
    }
}