ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
Android : Data Binding で自動作成されたクラス
日時: 2015/10/05 02:19
名前: lightbox





ActivityMainBinding.java
package sample.lightbox.myapplication.databinding;
import sample.lightbox.myapplication.R;
import sample.lightbox.myapplication.BR;
import android.view.View;
public class ActivityMainBinding extends android.databinding.ViewDataBinding {
	
	private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;
	private static final android.util.SparseIntArray sViewsWithIds;
	static {
		sIncludes = null;
		sViewsWithIds = new android.util.SparseIntArray();
		sViewsWithIds.put(R.id.button, 3);
		sViewsWithIds.put(R.id.listView, 4);
	}
	// views
	public final android.widget.Button button;
	public final android.widget.ListView listView;
	private final android.widget.RelativeLayout mboundView0;
	public final android.widget.TextView textView;
	public final android.widget.TextView textView2;
	// variables
	private sample.lightbox.myapplication.MainActivity.User mUser;
	// values
	// listeners
	
	public ActivityMainBinding(View root) {
		super(root, 1);
		final Object[] bindings = mapBindings(root, 5, sIncludes, sViewsWithIds);
		this.button = (android.widget.Button) bindings[3];
		this.listView = (android.widget.ListView) bindings[4];
		this.mboundView0 = (android.widget.RelativeLayout) bindings[0];
		this.mboundView0.setTag(null);
		this.textView = (android.widget.TextView) bindings[1];
		this.textView.setTag(null);
		this.textView2 = (android.widget.TextView) bindings[2];
		this.textView2.setTag(null);
		setRootTag(root);
		invalidateAll();
	}
	
	@Override
	public void invalidateAll() {
		synchronized(this) {
			mDirtyFlags = 0b1000L;
		}
		requestRebind();
	}
	
	@Override
	public boolean hasPendingBindings() {
		synchronized(this) {
			if (mDirtyFlags != 0) {
				return true;
			}
		}
		return false;
	}
	
	private void log(String msg, long i) {
		android.util.Log.d("BINDER", msg + ":" + Long.toHexString(i));
	}
	
	public boolean setVariable(int variableId, Object variable) {
		switch(variableId) {
			case BR.user :
				setUser((sample.lightbox.myapplication.MainActivity.User) variable);
				return true;
		}
		return false;
	}
	
	public void setUser(sample.lightbox.myapplication.MainActivity.User user) {
		updateRegistration(0, user);
		this.mUser = user;
		synchronized(this) {
			mDirtyFlags |= 0b1L;
		}
		super.requestRebind();
	}
	public sample.lightbox.myapplication.MainActivity.User getUser() {
		return mUser;
	}
	
	@Override
	protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
		switch (localFieldId) {
			case 0 :
				return onChangeUser((sample.lightbox.myapplication.MainActivity.User) object, fieldId);
		}
		return false;
	}
	private boolean onChangeUser(sample.lightbox.myapplication.MainActivity.User user, int fieldId) {
		switch (fieldId) {
			case BR.firstName:
				synchronized(this) {
					mDirtyFlags |= 0b10L;
				}
				return true;
			case BR.lastName:
				synchronized(this) {
					mDirtyFlags |= 0b100L;
				}
				return true;
			case BR._all:
				synchronized(this) {
					mDirtyFlags |= 0b1L;
				}
				return true;
		}
		return false;
	}
	
	@Override
	protected void executeBindings() {
		long dirtyFlags = 0;
		synchronized(this) {
			dirtyFlags = mDirtyFlags;
			mDirtyFlags = 0;
		}
		sample.lightbox.myapplication.MainActivity.User user = mUser;
		java.lang.String firstNameUser = null;
		java.lang.String lastNameUser = null;
	
		if ((dirtyFlags & 0b1111L) != 0) {
		
		
			if ((dirtyFlags & 0b1011L) != 0) {
			
				// read firstName~.~user~
				if ( user != null) {
					firstNameUser = user.getFirstName();
				}
			}
		
			if ((dirtyFlags & 0b1101L) != 0) {
			
				// read lastName~.~user~
				if ( user != null) {
					lastNameUser = user.getLastName();
				}
			}
		}
		// batch finished
		if ((dirtyFlags & 0b1011L) != 0) {
			// api target 1
			this.textView.setText(firstNameUser);
		}
		if ((dirtyFlags & 0b1101L) != 0) {
			// api target 1
			this.textView2.setText(lastNameUser);
		}
	}
	// Listener Stub Implementations
	// dirty flag
	private  long mDirtyFlags = 0b1111111111111111111111111111111111111111111111111111111111111111L;
	
	public static ActivityMainBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {
		return android.databinding.DataBindingUtil.<ActivityMainBinding>inflate(inflater, sample.lightbox.myapplication.R.layout.activity_main, root, attachToRoot);
	}
	public static ActivityMainBinding inflate(android.view.LayoutInflater inflater) {
		return bind(inflater.inflate(sample.lightbox.myapplication.R.layout.activity_main, null, false));
	}
	public static ActivityMainBinding bind(android.view.View view) {
		if (!"layout/activity_main_0".equals(view.getTag())) {
			throw new RuntimeException("view tag isn't correct on view:" + view.getTag());
		}
		return new ActivityMainBinding(view);
	}
}
	/* flag mapping
		flag 0: user~
		flag 1: firstName~.~user~
		flag 2: lastName~.~user~
		flag 3: INVALIDATE ANY
	flag mapping end*/
	//end
メンテナンス

MyitemBinding.java ( No.1 )
日時: 2015/10/05 02:20
名前: lightbox


日時: 2015/10/05 02:20
名前: lightbox
package sample.lightbox.myapplication.databinding;
import sample.lightbox.myapplication.R;
import sample.lightbox.myapplication.BR;
import android.view.View;
public class MyitemBinding extends android.databinding.ViewDataBinding {
	
	private static final android.databinding.ViewDataBinding.IncludedLayouts sIncludes;
	private static final android.util.SparseIntArray sViewsWithIds;
	static {
		sIncludes = null;
		sViewsWithIds = null;
	}
	// views
	private final android.widget.LinearLayout mboundView0;
	public final android.widget.TextView text1;
	public final android.widget.TextView textView3;
	// variables
	private sample.lightbox.myapplication.MainActivity.Item mItem;
	// values
	// listeners
	
	public MyitemBinding(View root) {
		super(root, 1);
		final Object[] bindings = mapBindings(root, 3, sIncludes, sViewsWithIds);
		this.mboundView0 = (android.widget.LinearLayout) bindings[0];
		this.mboundView0.setTag(null);
		this.text1 = (android.widget.TextView) bindings[2];
		this.text1.setTag(null);
		this.textView3 = (android.widget.TextView) bindings[1];
		this.textView3.setTag(null);
		setRootTag(root);
		invalidateAll();
	}
	
	@Override
	public void invalidateAll() {
		synchronized(this) {
			mDirtyFlags = 0b1000L;
		}
		requestRebind();
	}
	
	@Override
	public boolean hasPendingBindings() {
		synchronized(this) {
			if (mDirtyFlags != 0) {
				return true;
			}
		}
		return false;
	}
	
	private void log(String msg, long i) {
		android.util.Log.d("BINDER", msg + ":" + Long.toHexString(i));
	}
	
	public boolean setVariable(int variableId, Object variable) {
		switch(variableId) {
			case BR.item :
				setItem((sample.lightbox.myapplication.MainActivity.Item) variable);
				return true;
		}
		return false;
	}
	
	public void setItem(sample.lightbox.myapplication.MainActivity.Item item) {
		updateRegistration(0, item);
		this.mItem = item;
		synchronized(this) {
			mDirtyFlags |= 0b1L;
		}
		super.requestRebind();
	}
	public sample.lightbox.myapplication.MainActivity.Item getItem() {
		return mItem;
	}
	
	@Override
	protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
		switch (localFieldId) {
			case 0 :
				return onChangeItem((sample.lightbox.myapplication.MainActivity.Item) object, fieldId);
		}
		return false;
	}
	private boolean onChangeItem(sample.lightbox.myapplication.MainActivity.Item item, int fieldId) {
		switch (fieldId) {
			case BR.title:
				synchronized(this) {
					mDirtyFlags |= 0b10L;
				}
				return true;
			case BR.text:
				synchronized(this) {
					mDirtyFlags |= 0b100L;
				}
				return true;
			case BR._all:
				synchronized(this) {
					mDirtyFlags |= 0b1L;
				}
				return true;
		}
		return false;
	}
	
	@Override
	protected void executeBindings() {
		long dirtyFlags = 0;
		synchronized(this) {
			dirtyFlags = mDirtyFlags;
			mDirtyFlags = 0;
		}
		java.lang.String textItem = null;
		java.lang.String titleItem = null;
		sample.lightbox.myapplication.MainActivity.Item item = mItem;
	
		if ((dirtyFlags & 0b1111L) != 0) {
		
		
			if ((dirtyFlags & 0b1101L) != 0) {
			
				// read text~.~item~
				if ( item != null) {
					textItem = item.getText();
				}
			}
		
			if ((dirtyFlags & 0b1011L) != 0) {
			
				// read title~.~item~
				if ( item != null) {
					titleItem = item.getTitle();
				}
			}
		}
		// batch finished
		if ((dirtyFlags & 0b1101L) != 0) {
			// api target 1
			this.text1.setText(textItem);
		}
		if ((dirtyFlags & 0b1011L) != 0) {
			// api target 1
			this.textView3.setText(titleItem);
		}
	}
	// Listener Stub Implementations
	// dirty flag
	private  long mDirtyFlags = 0b1111111111111111111111111111111111111111111111111111111111111111L;
	
	public static MyitemBinding inflate(android.view.LayoutInflater inflater, android.view.ViewGroup root, boolean attachToRoot) {
		return android.databinding.DataBindingUtil.<MyitemBinding>inflate(inflater, sample.lightbox.myapplication.R.layout.myitem, root, attachToRoot);
	}
	public static MyitemBinding inflate(android.view.LayoutInflater inflater) {
		return bind(inflater.inflate(sample.lightbox.myapplication.R.layout.myitem, null, false));
	}
	public static MyitemBinding bind(android.view.View view) {
		if (!"layout/myitem_0".equals(view.getTag())) {
			throw new RuntimeException("view tag isn't correct on view:" + view.getTag());
		}
		return new MyitemBinding(view);
	}
}
	/* flag mapping
		flag 0: item~
		flag 1: title~.~item~
		flag 2: text~.~item~
		flag 3: INVALIDATE ANY
	flag mapping end*/
	//end
このアーティクルの参照用URLをクリップボードにコピー メンテナンス
BR.java ( No.2 )
日時: 2015/10/05 02:21
名前: lightbox
package sample.lightbox.myapplication;

public class BR {
    public static final int _all = 0;
    public static final int firstName = 1;
    public static final int item = 2;
    public static final int lastName = 3;
    public static final int text = 4;
    public static final int title = 5;
    public static final int user = 6;
}
このアーティクルの参照用URLをクリップボードにコピー メンテナンス