use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class HierarchicalMove method sendMessage.
public void sendMessage(View view) {
TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
int widthSpec = wide ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT;
LayoutParams params = new LayoutParams(widthSpec, LayoutParams.WRAP_CONTENT);
for (int i = 0; i < buttons.length; ++i) {
buttons[i].setLayoutParams(params);
}
wide = !wide;
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class CrossfadeMultiple method sendMessage.
public void sendMessage(View view) {
TransitionManager.beginDelayedTransition(mSceneRoot, mTransition);
int id = view.getId();
LayoutParams params = null;
switch(id) {
case R.id.button1:
params = new LayoutParams(200, 200);
mButton.setText("A");
mTextView.setText("1111111");
mImageView.setImageResource(R.drawable.self_portrait_square_100);
break;
case R.id.button2:
params = new LayoutParams(400, 200);
mButton.setText("B");
mTextView.setText("2222222");
mImageView.setImageResource(R.drawable.self_portrait_square_200);
break;
case R.id.button3:
params = new LayoutParams(200, 400);
mButton.setText("C");
mTextView.setText("3333333");
mImageView.setImageResource(R.drawable.self_portrait_square_400);
break;
}
mButton.setLayoutParams(params);
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class DelayedTransition method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.two_buttons);
final Button button1 = (Button) findViewById(R.id.button1);
final Button button2 = (Button) findViewById(R.id.button2);
final LinearLayout container = (LinearLayout) findViewById(R.id.container);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int buttonWidth = button1.getWidth();
int containerWidth = container.getWidth();
if (buttonWidth < containerWidth) {
TransitionManager.beginDelayedTransition(container, null);
button1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
TransitionManager.beginDelayedTransition(container, null);
button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
} else {
TransitionManager.beginDelayedTransition(container, null);
button1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
TransitionManager.beginDelayedTransition(container, null);
button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
}
});
}
use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class PowerTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(LOGTAG, "onCreate, inst=" + Integer.toHexString(hashCode()));
LinearLayout contentView = new LinearLayout(this);
contentView.setOrientation(LinearLayout.VERTICAL);
setContentView(contentView);
setTitle("Idle");
webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
webViewClient = new SimpleWebViewClient();
chromeClient = new SimpleChromeClient();
webView.setWebViewClient(webViewClient);
webView.setWebChromeClient(chromeClient);
contentView.addView(webView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0f));
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_TIMEOUT:
handleTimeout();
return;
case MSG_NAVIGATE:
manualDelay = msg.arg2;
navigate(msg.getData().getString(MSG_NAV_URL), msg.arg1);
logTime = msg.getData().getBoolean(MSG_NAV_LOGTIME);
return;
}
}
};
pageDoneLock = new Object();
}
use of android.widget.LinearLayout.LayoutParams in project QRCode by 5peak2me.
the class ResultActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
Bundle extras = getIntent().getExtras();
mResultImage = (ImageView) findViewById(R.id.result_image);
mResultText = (TextView) findViewById(R.id.result_text);
if (null != extras) {
int width = extras.getInt("width");
int height = extras.getInt("height");
LayoutParams lps = new LayoutParams(width, height);
lps.topMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics());
lps.leftMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
lps.rightMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics());
mResultImage.setLayoutParams(lps);
String result = extras.getString("result");
mResultText.setText(result);
Bitmap barcode = null;
byte[] compressedBitmap = extras.getByteArray(DecodeThread.BARCODE_BITMAP);
if (compressedBitmap != null) {
barcode = BitmapFactory.decodeByteArray(compressedBitmap, 0, compressedBitmap.length, null);
// Mutable copy:
barcode = barcode.copy(Bitmap.Config.RGB_565, true);
}
mResultImage.setImageBitmap(barcode);
}
}
Aggregations