Android Open Source - markj Jw View Controller






From Project

Back to project page markj.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project markj listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.markjmind.mobile.api.android.controller;
/*w w w . j  av  a2 s  .c  om*/


import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;

/**
 * start : 2012.08.21<br>
 * <br>
 * ??????? ????? ?????? ????? <br>
 * ????????? ??????? ????? Layout Controller ????.<br>
 * ????? Layout??? ?? ???? ?? ???? ????????? <br>
 * ?? Layout?? ????? Utill??? ????.<br>
 * 
 * @author ???
 * @version 2012.08.30
 */
public class JwViewController {
  
  public static View lastChild(ViewGroup parantView){
    return parantView.getChildAt(parantView.getChildCount()-1);
  }
  
  public static View addLayout(View childView, ViewGroup parantView){
    parantView.addView(childView,parantView.getLayoutParams());  
    return lastChild(parantView);
  }
  public static View addLayout(int child_layout_id, ViewGroup parantView){
    
//    return lastChild((ViewGroup)View.inflate(parantView.getContext(),child_layout_id, parantView));
    return lastChild((ViewGroup)((LayoutInflater)parantView.getContext().getSystemService(parantView.getContext().LAYOUT_INFLATER_SERVICE)).inflate(child_layout_id, parantView));
  }
  
  
  public static View addLayout(View childView, int parant_gourp_id,Activity activity){
    ViewGroup parantView =(ViewGroup)getView(parant_gourp_id,activity);
    return addLayout(childView,parantView);
  }
  
  
  public static View addLayout(int child_layout_id, int parant_gourp_id, Activity activity){
    ViewGroup parantView =(ViewGroup)getView(parant_gourp_id, activity);
    return addLayout(child_layout_id,parantView);
  }
  
  
  public static View addLayout(int child_layout_id, ViewGroup parantView,int index){
    View addView = getViewInfalter(child_layout_id,parantView.getContext());
    parantView.addView(addView, index);
    return addView;
  }
  public static View changeLayout(int child_layout_id, ViewGroup parantView){
    parantView.removeAllViews();
    return addLayout(child_layout_id,parantView);    
  }
  public static View changeLayout(View childView, ViewGroup parantView){
    parantView.removeAllViews();
    return addLayout(childView,parantView);
  }
  
  
  public static View changeLayout(View childView, int parant_gourp_id, Activity activity){
    ViewGroup parantView =(ViewGroup)getView(parant_gourp_id,activity);
    parantView.removeAllViews();
    return addLayout(childView,parantView);
  }
  
  
  public static View changeLayout(int child_layout_id, int parant_gourp_id, Activity context){
    ViewGroup parantView =(ViewGroup)getView(parant_gourp_id,context);
    parantView.removeAllViews();
    return addLayout(child_layout_id,parantView);    
  }
  
  
  public static void addListView(int R_layout_listview_id,int R_id_listview_id,View tagetView,int R_id_tagetGroupview_id,BaseAdapter baseAdapter){
    View listview_layout  = View.inflate(tagetView.getContext(),R_layout_listview_id, null);
      ListView listView = (ListView)listview_layout.findViewById(R_id_listview_id);
    listView.setAdapter(baseAdapter);  
    
      ViewGroup parantView = (ViewGroup)tagetView.findViewById(R_id_tagetGroupview_id);
      parantView.addView(listview_layout);
  }
  
  public static void addListView(int R_layout_listview_id,int R_id_listview_id,ViewGroup tagetViewGroup,BaseAdapter baseAdapter){
    View listview_layout  = View.inflate(tagetViewGroup.getContext(),R_layout_listview_id, null);
      ListView listView = (ListView)listview_layout.findViewById(R_id_listview_id);
    listView.setAdapter(baseAdapter);  

    tagetViewGroup.addView(listview_layout);
  }
  
  public static void changeListView(int R_layout_listview_id,int R_id_listview_id,View tagetView,int R_id_tagetGroupview_id,BaseAdapter baseAdapter){
    ViewGroup parantView = (ViewGroup)tagetView.findViewById(R_id_tagetGroupview_id);
    parantView.removeAllViews(); 
    JwViewController.addListView(R_layout_listview_id, R_id_listview_id, tagetView, R_id_tagetGroupview_id, baseAdapter);
  }

  public static void changeListView(int R_layout_listview_id,int R_id_listview_id,ViewGroup tagetViewGroup,BaseAdapter baseAdapter){
    tagetViewGroup.removeAllViews(); 
    JwViewController.addListView(R_layout_listview_id, R_id_listview_id, tagetViewGroup, baseAdapter);
  }
  
  public static View getViewInfalter(int layout_id, Context context){
//    return LayoutInflater.from(context).inflate(layout_id, null);
    return ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(layout_id, null);
//    return View.inflate(context, layout_id,null);
  }
  
  public static View getView(int R_id, Activity activity){
    return activity.findViewById(R_id);
  }
  public static View getView(int R_id, Dialog dialog){
    return dialog.findViewById(R_id);
  }
  
  public static View getView(int R_id, View view){
    return view.findViewById(R_id);
  }
  
  public static View getViewTag(Object tag, int parants_id, Activity activity){
    return getTagView(tag, getView(parants_id,activity));
  }
  public static View getViewTag(Object tag, int parants_id, Dialog dialog){
    return getTagView(tag, getView(parants_id,dialog));
  }
  
  
  public static View getViewTag(Object tag, View parants){
    return parants.findViewWithTag(tag);
  }
  public static View getTagView(Object tag, View parants){
    return parants.findViewWithTag(tag);
  }
  
  
  
}




Java Source Code List

com.markjmind.mobile.api.android.controller.JwAsyncTask.java
com.markjmind.mobile.api.android.controller.JwMapperException.java
com.markjmind.mobile.api.android.controller.JwMemberMapper.java
com.markjmind.mobile.api.android.controller.JwStringID.java
com.markjmind.mobile.api.android.controller.JwViewController.java
com.markjmind.mobile.api.android.controller.JwViewerCache.java
com.markjmind.mobile.api.android.controller.JwViewer.java
com.markjmind.mobile.api.android.controller.Jwc.java
com.markjmind.mobile.api.android.controller.OnClickListenerReceiver.java
com.markjmind.mobile.api.android.controller.ViewerXmlMapper.java
com.markjmind.mobile.api.android.exception.JwErrorCode.java
com.markjmind.mobile.api.android.exception.JwException.java
com.markjmind.mobile.api.android.json.JSONMsgString.java
com.markjmind.mobile.api.android.json.JwJOSNTreeArray.java
com.markjmind.mobile.api.android.json.JwJSONReader.java
com.markjmind.mobile.api.android.ui.JwAnimation.java
com.markjmind.mobile.api.android.ui.JwGroup.java
com.markjmind.mobile.api.android.ui.JwMenu.java
com.markjmind.mobile.api.android.ui.JwOnGroupSelect.java
com.markjmind.mobile.api.android.ui.JwTabGroup.java
com.markjmind.mobile.api.android.ui.JwTouchGroupListener.java
com.markjmind.mobile.api.android.ui.JwTouchGroup.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroupLisener.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroup.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphBoard.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.HBackLineSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.LineGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.PieGraph.java
com.markjmind.mobile.api.android.ui.drawgraph.RectGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.SimpleStyle.java
com.markjmind.mobile.api.android.ui.drawgraph.TextArraySkin.java
com.markjmind.mobile.api.android.ui.drawgraph.VBackLineSkin.java
com.markjmind.mobile.api.android.ui.graph.Arc.java
com.markjmind.mobile.api.android.ui.graph.BarElement.java
com.markjmind.mobile.api.android.ui.graph.BarLayout.java
com.markjmind.mobile.api.android.ui.graph.Bar.java
com.markjmind.mobile.api.android.ui.graph.IPieSkin.java
com.markjmind.mobile.api.android.ui.graph.LineLayout.java
com.markjmind.mobile.api.android.ui.graph.MeasureLayout.java
com.markjmind.mobile.api.android.ui.graph.PieArcRoundSkin.java
com.markjmind.mobile.api.android.ui.graph.PieLayout.java
com.markjmind.mobile.api.android.ui.graph.PiePercentSkin.java
com.markjmind.mobile.api.android.ui.view.JwBaseDropDown.java
com.markjmind.mobile.api.android.ui.view.JwDropDown.java
com.markjmind.mobile.api.android.ui.view.JwSlidingLayout.java
com.markjmind.mobile.api.android.ui.view.JwWheelView.java
com.markjmind.mobile.api.android.ui.view.StickerListener.java
com.markjmind.mobile.api.android.ui.view.StickerView.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewAutoScale.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewFonts.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewWrapScale.java
com.markjmind.mobile.api.android.ui.wrapper.JwAlertDialog.java
com.markjmind.mobile.api.android.ui.wrapper.JwToast.java
com.markjmind.mobile.api.android.util.JwFile.java
com.markjmind.mobile.api.android.util.JwPreferenceList.java
com.markjmind.mobile.api.android.util.JwPreference.java
com.markjmind.mobile.api.android.util.JwSound.java
com.markjmind.mobile.api.android.util.JwTextUtils.java
com.markjmind.mobile.api.android.util.PhoneInfo.java
com.markjmind.mobile.api.android.util.WebConnection.java
com.markjmind.mobile.api.android.xml.JwDomHandler.java
com.markjmind.mobile.api.android.xml.JwDomLoader.java
com.markjmind.mobile.api.android.xml.JwEditElementHandler.java
com.markjmind.mobile.api.android.xml.JwXmlLoader.java
com.markjmind.mobile.api.android.xml.JwXmlResoure.java
com.markjmind.mobile.api.hub.ArrayJDhub.java
com.markjmind.mobile.api.hub.DBhub.java
com.markjmind.mobile.api.hub.JDhub.java
com.markjmind.mobile.api.hub.Loader.java
com.markjmind.mobile.api.hub.StoreList.java
com.markjmind.mobile.api.hub.Store.java