项目:VideoRecorder-master
文件:FFmpegPreviewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ffmpeg_preview);
cancelBtn = (Button) findViewById(R.id.play_cancel);
cancelBtn.setonClickListener(this);
displayMetrics displaymetrics = new displayMetrics();
getwindowManager().getDefaultdisplay().getMetrics(displaymetrics);
surfaceView = (TextureView) findViewById(R.id.preview_video);
RelativeLayout previewVideoParent = (RelativeLayout)findViewById(R.id.preview_video_parent);
LayoutParams layoutParams = (LayoutParams) previewVideoParent
.getLayoutParams();
layoutParams.width = displaymetrics.widthPixels;
layoutParams.height = displaymetrics.widthPixels;
previewVideoParent.setLayoutParams(layoutParams);
surfaceView.setSurfaceTextureListener(this);
surfaceView.setonClickListener(this);
path = getIntent().getStringExtra("path");
imagePlay = (ImageView) findViewById(R.id.previre_play);
imagePlay.setonClickListener(this);
mediaPlayer = new MediaPlayer();
mediaPlayer.setonCompletionListener(this);
}
项目:CCDownload
文件:PopMenu.java
@Override
public View getView(int position,View convertView,ViewGroup parent) {
RelativeLayout layoutView = new RelativeLayout(context);
TextView textView = new TextView(context);
textView.setTextSize(13);
textView.setText(itemList.get(position));
textView.setTag(position);
if (checkedPosition == position || itemList.size() == 1) {
// layoutView.setBackgroundColor(0x8033B5E5);
textView.setTextColor(context.getResources().getColor(R.color.rb_text_check));
} else {
textView.setTextColor(Color.WHITE);
}
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutView.addView(textView,params);
layoutView.setMinimumHeight(ParamsUtil.dpToPx(context,26));
return layoutView;
}
项目:CCDownload
文件:PopMenu.java
public PopMenu(Context context,int resid,int checkedPosition,int height) {
this.context = context;
this.checkedPosition = checkedPosition;
itemList = new ArrayList<String>();
RelativeLayout view = new RelativeLayout(context);
// view.setBackgroundResource(resid);
listView = new ListView(context);
listView.setPadding(0,ParamsUtil.dpToPx(context,3),3));
view.addView(listView,new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
listView.setAdapter(new PopAdapter());
listView.setonItemClickListener(this);
popupWindow = new PopupWindow(view,context.getResources().getDimensionPixelSize(R.dimen.popmenu_width),height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178,0)));
}
项目:CCDownload
文件:InputInfoActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
service = new Intent(this,UploadService.class);
inputLayout = new RelativeLayout(this);
inputLayout.setBackgroundColor(Color.WHITE);
inputLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
inputLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
getCategory();
initView();
bindService(service,serviceConnection,Context.BIND_AUTO_CREATE);
String path = getIntent().getStringExtra("filePath");
if (path != null) {
filePath = path;
}
getActionBar().setdisplayHomeAsUpEnabled(true);
uploadButton.setonClickListener(this);
setContentView(inputLayout);
}
项目:CCDownload
文件:DownloadedFragment.java
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
RelativeLayout downloadLayout = new RelativeLayout(activity.getApplicationContext());
downloadLayout.setBackgroundColor(Color.WHITE);
receiver = new DownloadedReceiver();
activity.registerReceiver(receiver,new IntentFilter(ConfigUtil.ACTION_DOWNLOADED));
downloadedListView = new ListView(context);
downloadedListView.setPadding(10,10,10);
downloadedListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams downloadedLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
downloadLayout.addView(downloadedListView,downloadedLayoutParams);
initData();
downloadedListView.setonItemClickListener(onItemClickListener);
downloadedListView.setonCreateContextMenuListener(onCreateContextMenuListener);
return downloadLayout;
}
项目:letv
文件:AdViewProxy.java
private void init(Context context,AttributeSet attrs) {
try {
this.mJarClassLoader = JarLoader.getJarClassLoader(context,"Letv_Ads.apk",JarConstant.LETV_ADS_PACKAGENAME);
this.mJarResources = JarResources.getResourceByCl(this.mJarClassLoader,context);
mloadClass = JarLoader.loadClass(context,JarConstant.LETV_ADS_PACKAGENAME,JarConstant.LETV_ADS_VIEW_CLASS);
Constructor<?> localConstructor = mloadClass.getConstructor(new Class[]{Context.class,AttributeSet.class,Resources.class});
if (this.mJarResources != null) {
updateConfiguration(this.mJarResources.getResources());
this.mRemoteView = (RelativeLayout) localConstructor.newInstance(new Object[]{context,attrs,this.mJarResources.getResources()});
}
} catch (Exception e) {
e.printstacktrace();
LogInfo.log(TAG,"Exception e=" + e.toString());
}
if (this.mRemoteView != null) {
LogInfo.log(TAG,"addView mRemoteView=" + this.mRemoteView);
addView(this.mRemoteView,new LayoutParams(-1,-1));
}
}
项目:letv
文件:MyPlayRecordFragment.java
protected void showDeleteLayout() {
if (getActivity() != null && this.mHeaderLayout != null) {
LayoutParams params = (LayoutParams) this.mpullListView.getLayoutParams();
if (!this.mIsDelete || this.mlistadapter == null || this.mlistadapter.getCount() <= 0) {
params.bottomMargin = 0;
this.mHeaderLayout.setVisibility(8);
upDateLogin();
return;
}
this.mHeaderLayout.setVisibility(0);
if (this.mHeaderLayout.getHeight() == 0) {
params.bottomMargin = ((UIs.zoomrealHeight(50) * 3) / 4) + 1;
} else {
params.bottomMargin = this.mHeaderLayout.getHeight();
}
this.mpullListView.setLayoutParams(params);
}
}
项目:ThunderMusic
文件:ColorPickerPreference.java
@Override
protected View onCreateDialogView() {
RelativeLayout relativeLayout = new RelativeLayout(getContext());
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutParams.addRule(RelativeLayout.BELOW,2);
LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);
colorPickerView = new ColorPicker(getContext());
colorPickerView.setId(1);
currentColor = new TextView(getContext());
currentColor.setTextSize(16);
currentColor.setId(2);
relativeLayout.addView(colorPickerView,layoutParams);
relativeLayout.addView(currentColor,layoutParamsText);
return relativeLayout;
}
项目:letv
文件:ChannelTabPageIndicator.java
protected void addTab(int index,CharSequence text,int iconResId) {
TabView tabView = new TabView(this,getContext(),text);
tabView.setIndex(index);
tabView.setFocusable(true);
tabView.setonClickListener(this.mTabClickListener);
if (iconResId != 0) {
tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId,0);
}
int width = this.mMeanWidth == -1 ? getTabWidth(text) : this.mMeanWidth;
if (this.mMeanWidth != -1) {
tabView.setSize(this.mMeanWidth,UIsUtils.dipToPx(38.0f));
} else {
tabView.setSize(width,UIsUtils.dipToPx(38.0f));
}
RelativeLayout relativeLayout = new RelativeLayout(this.mContext);
relativeLayout.setGravity(17);
relativeLayout.setLayoutParams(new LayoutParams(-2,UIsUtils.dipToPx(38.0f)));
LayoutParams params = new LayoutParams(-2,UIsUtils.dipToPx(38.0f));
params.setMargins(TAB_MARGIN,TAB_MARGIN,0);
tabView.setLayoutParams(params);
relativeLayout.addView(tabView);
if (this.mIsHome) {
ThemeDataManager.getInstance(this.mContext).setContentTheme(tabView,ThemeDataManager.NAME_TOP_NAVIGATION_COLOR);
}
ImageView imageView = new ImageView(this.mContext);
LayoutParams imageViewParams = new LayoutParams(width,UIsUtils.dipToPx(2.0f));
imageViewParams.setMargins(TAB_MARGIN,UIsUtils.dipToPx(36.0f),0);
imageView.setLayoutParams(imageViewParams);
relativeLayout.addView(imageView);
imageView.setBackgroundDrawable(getResources().getDrawable(2130838177));
if (this.mIsHome) {
ThemeDataManager.getInstance(this.mContext).setShapeSelectorViewTheme(imageView,ThemeDataManager.NAME_TOP_NAVIGATION_COLOR,2,true);
}
this.mTabLayout.addView(relativeLayout);
}
项目:sctalk
文件:MessageActivity.java
@Override
public void onGlobalLayout() {
Rect r = new Rect();
baseRoot.getGlobalVisibleRect(r);
// 进入Activity时会布局,第一次调用onGlobalLayout,先记录开始软键盘没有弹出时底部的位置
if (rootBottom == Integer.MIN_VALUE) {
rootBottom = r.bottom;
return;
}
// adjustResize,软键盘弹出后高度会变小
if (r.bottom < rootBottom) {
//按照键盘高度设置表情框和发送图片按钮框的高度
keyboardHeight = rootBottom - r.bottom;
SystemConfigSp.instance().init(MessageActivity.this);
SystemConfigSp.instance().setIntConfig(currentInputMethod,keyboardHeight);
LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
params.height = keyboardHeight;
LayoutParams params1 = (LayoutParams) emoLayout.getLayoutParams();
params1.height = keyboardHeight;
}
}
项目:letv
文件:AlbumPlayActivity.java
private void initWebView() {
if (this.mWebView == null) {
this.mWebView = new WebView(this);
this.mWebView.setBackgroundColor(-1);
this.rootView.addView(this.mWebView,-1));
this.mWebView.getSettings().setUseWideViewPort(true);
this.mWebView.getSettings().setSupportZoom(true);
this.mWebView.getSettings().setBuiltInZoomControls(true);
this.mWebView.setVerticalScrollBarEnabled(true);
this.mWebView.setHorizontalScrollBarEnabled(true);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setDomStorageEnabled(true);
this.mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view,String url) {
AlbumPlayActivity.this.mWebView.loadUrl(url);
return super.shouldOverrideUrlLoading(view,url);
}
});
this.mWebView.setClickable(false);
}
}
项目:letv
文件:ChannelFragmentAdapter.java
private ImageView addMirrorView(ViewGroup parent,RecyclerView recyclerView,View view) {
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true);
ImageView mirrorView = new ImageView(recyclerView.getContext());
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
mirrorView.setimageBitmap(bitmap);
view.setDrawingCacheEnabled(false);
int[] locations = new int[2];
view.getLocationOnScreen(locations);
int[] parenLocations = new int[2];
recyclerView.getLocationOnScreen(parenLocations);
LayoutParams params = new LayoutParams(bitmap.getWidth(),bitmap.getHeight());
params.setMargins(locations[0],(locations[1] - parenLocations[1]) + UIsUtils.dipToPx(44.0f),0);
parent.addView(mirrorView,params);
return mirrorView;
}
项目:letv
文件:MyPlayRecordActivity.java
private void initNavigationBar() {
RelativeLayout my_playrecrod_content = (RelativeLayout) findViewById(R.id.my_collect_content);
LayoutParams params = (LayoutParams) my_playrecrod_content.getLayoutParams();
params.bottomMargin = 0;
my_playrecrod_content.setLayoutParams(params);
this.mBackImageView = (ImageView) findViewById(2131362351);
this.mEditView = (TextView) findViewById(2131362354);
this.mEditView.setText(2131099788);
this.mEditView.setTextColor(this.mContext.getResources().getColor(2131493261));
this.mTitleView = (TextView) findViewById(2131362352);
this.mLoginTip = (RelativeLayout) findViewById(R.id.my_collect_bottom_login_btn);
this.mLoginTip.setVisibility(8);
this.mTitleView.setText(getResources().getString(2131100479));
this.mBackImageView.setonClickListener(this.onClickEvent);
this.mTitleView.setonClickListener(this.onClickEvent);
this.mEditView.setonClickListener(this.onClickEvent);
}
项目:letv
文件:LiveFragment.java
private void initHeaderView() {
this.mHeaderView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.view_live_header,null);
this.mViewpager = (ViewPager) this.mHeaderView.findViewById(R.id.view_live_header_viewpager);
this.mRecyclerview = (RecyclerView) this.mHeaderView.findViewById(R.id.view_live_header_recyclerview);
this.mIvSingle = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_single);
this.mIvDouble = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_double);
this.mHeaderView.setClipChildren(false);
int width = UIsUtils.getScreenWidth() - UIsUtils.dipToPx(40.0f);
this.mViewPagerHeight = (width * 240) / 320;
LayoutParams params = (LayoutParams) this.mViewpager.getLayoutParams();
params.width = width;
params.height = this.mViewPagerHeight;
this.mViewpager.setLayoutParams(params);
initHeaderImageView();
initViewPager();
initRecyclerView();
this.mListView.addHeaderView(this.mHeaderView);
}
项目:letv
文件:LivePlayerView.java
项目:letv
文件:LivePlayerController.java
private void qualityShow(boolean show) {
this.qualityShowing = show;
this.mTVSpreadLayout.setVisibility(4);
if (show) {
int[] locations = new int[2];
this.mQuality.getLocationInWindow(locations);
int x = locations[0];
this.mBottomBar.getLocationOnScreen(locations);
int y = locations[1];
LayoutParams params = (LayoutParams) this.mQualityLayout.getLayoutParams();
params.leftMargin = (((this.mQuality.getMeasuredWidth() >> 1) + x) - (this.mLevelBtnLayout.getMeasuredWidth() >> 1)) - this.mTVSpreadLayout.getMeasuredWidth();
params.topMargin = (y - this.mQualityLayout.getMeasuredHeight()) - 10;
this.mQualityLayout.setLayoutParams(params);
this.mQualityLayout.requestLayout();
this.mQualityLayout.setVisibility(0);
this.mQuality.setBackgroundResource(2130837620);
return;
}
this.mQualityLayout.setVisibility(8);
this.mQuality.setBackgroundResource(2130837742);
this.is4KClick = false;
this.is1080pClick = false;
}
项目:letv
文件:PKDialog.java
private void createViews() {
this.mFlMain = new com.tencent.open.c.a((Context) this.mWeakContext.get());
this.mFlMain.setBackgroundColor(1711276032);
this.mFlMain.setLayoutParams(new LayoutParams(-1,-1));
this.mWebView = new b((Context) this.mWeakContext.get());
this.mWebView.setBackgroundColor(0);
this.mWebView.setBackgroundDrawable(null);
if (VERSION.SDK_INT >= 11) {
try {
View.class.getmethod("setLayerType",new Class[]{Integer.TYPE,Paint.class}).invoke(this.mWebView,new Object[]{Integer.valueOf(1),new Paint()});
} catch (Exception e) {
e.printstacktrace();
}
}
ViewGroup.LayoutParams layoutParams = new LayoutParams(-1,this.mWebviewHeight);
layoutParams.addRule(13,-1);
this.mWebView.setLayoutParams(layoutParams);
this.mFlMain.addView(this.mWebView);
this.mFlMain.a(this);
setContentView(this.mFlMain);
}
项目:buildAPKsSamples
文件:CurvedMotion.java
/**
* Toggles button location on click between top-left and bottom-right
*/
private void moveButton() {
LayoutParams params = (LayoutParams) mButton.getLayoutParams();
if (mTopLeft) {
params.removeRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.addRule(RelativeLayout.ALIGN_PARENT_BottOM);
} else {
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
params.removeRule(RelativeLayout.ALIGN_PARENT_BottOM);
}
mButton.setLayoutParams(params);
mTopLeft = !mTopLeft;
}
@Override
public void doOnViewCreated(View v,@Nullable Bundle savedInstanceState) {
statusCircle = v.findViewById(R.id.statusCircle);
statusHint = (OnesheeldTextView) v.findViewById(R.id.statusHint);
rmsIndicator = (TextView) v.findViewById(R.id.rmsLevelIndicator);
recognizedResult = (OnesheeldTextView) v
.findViewById(R.id.recognizedResult);
params = (LayoutParams) rmsIndicator.getLayoutParams();
statusCircle.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (stepValue == 0)
stepValue = statusCircle.getHeight() / 10;
}
});
}
@Override
public void doOnViewCreated(View v,@Nullable Bundle savedInstanceState) {
soundLevelIndicator = (TextView) v
.findViewById(R.id.soundLevelIndicator);
micValue = (OnesheeldTextView) v.findViewById(R.id.micValue);
micState = (OnesheeldTextView) v.findViewById(R.id.micState);
params = (LayoutParams) soundLevelIndicator.getLayoutParams();
soundLevelIndicator.getViewTreeObserver().addOnGlobalLayoutListener(
new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
stepValue = soundLevelIndicator.getHeight() / 80;
}
});
}
private void createViews() {
this.mFlMain = new com.tencent.open.c.a((Context) this.mWeakContext.get());
this.mFlMain.setBackgroundColor(1711276032);
this.mFlMain.setLayoutParams(new LayoutParams(-1,Paint.class})
.invoke(this.mWebView,-1);
this.mWebView.setLayoutParams(layoutParams);
this.mFlMain.addView(this.mWebView);
this.mFlMain.a(this);
setContentView(this.mFlMain);
}
public ProgressWebView(Activity activity) {
super(activity);
this.g = activity;
this.d = new ProgressBar(activity,null,16842872);
this.d.setLayoutParams(new LayoutParams(-1,o.a(activity,5.0f)));
addView(this.d);
setDownloadListener(new p(this));
setWebChromeClient(new t(this));
setWebViewClient(new q(this));
getSettings().setJavaScriptEnabled(true);
getSettings().setUseWideViewPort(true);
getSettings().setDomStorageEnabled(true);
getSettings().setLoadWithOverviewmode(true);
getSettings().setBuiltInZoomControls(false);
getSettings().setUserAgentString(a(new StringBuilder(this.i)));
}
private RelativeLayout getPageView() {
this.rlPage = new RelativeLayout(getContext());
this.rlPage.setBackgroundDrawable(this.background);
if (this.dialogMode) {
RelativeLayout rlDialog = new RelativeLayout(getContext());
rlDialog.setBackgroundColor(-1070452174);
int dp_8 = R.dipToPx(getContext(),8);
LayoutParams lpDialog = new LayoutParams(R.getScreenWidth(getContext()) - (dp_8 * 2),-2);
lpDialog.topMargin = dp_8;
lpDialog.bottomMargin = dp_8;
lpDialog.addRule(13);
rlDialog.setLayoutParams(lpDialog);
this.rlPage.addView(rlDialog);
rlDialog.addView(getPageTitle());
rlDialog.addView(getPageBody());
rlDialog.addView(getimagePin());
} else {
this.rlPage.addView(getPageTitle());
this.rlPage.addView(getPageBody());
this.rlPage.addView(getimagePin());
}
return this.rlPage;
}
private TitleLayout getPageTitle() {
this.llTitle = new TitleLayout(getContext());
this.llTitle.setId(1);
this.llTitle.getBtnBack().setonClickListener(this);
int resId = R.getStringRes(this.activity,"multi_share");
if (resId > 0) {
this.llTitle.getTvTitle().setText(resId);
}
this.llTitle.getBtnRight().setVisibility(0);
resId = R.getStringRes(this.activity,"share");
if (resId > 0) {
this.llTitle.getBtnRight().setText(resId);
}
this.llTitle.getBtnRight().setonClickListener(this);
LayoutParams lp = new LayoutParams(-2,-2);
lp.addRule(9);
lp.addRule(10);
lp.addRule(11);
this.llTitle.setLayoutParams(lp);
return this.llTitle;
}
private LinearLayout getPageBody() {
this.llBody = new LinearLayout(getContext());
this.llBody.setId(2);
int resId = R.getBitmapRes(this.activity,"edittext_back");
if (resId > 0) {
this.llBody.setBackgroundResource(resId);
}
this.llBody.setorientation(1);
LayoutParams lpBody = new LayoutParams(-2,-2);
lpBody.addRule(5,this.llTitle.getId());
lpBody.addRule(3,this.llTitle.getId());
lpBody.addRule(7,this.llTitle.getId());
if (!this.dialogMode) {
lpBody.addRule(12);
}
int dp_3 = R.dipToPx(getContext(),3);
lpBody.setMargins(dp_3,dp_3,dp_3);
this.llBody.setLayoutParams(lpBody);
this.llBody.addView(getMainBody());
this.llBody.addView(getSep());
this.llBody.addView(getPlatformlist());
return this.llBody;
}
private LinearLayout getMainBody() {
LinearLayout llMainBody = new LinearLayout(getContext());
llMainBody.setorientation(1);
LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(-1,-2);
lpMain.weight = 1.0f;
int dp_4 = R.dipToPx(getContext(),4);
lpMain.setMargins(dp_4,dp_4,dp_4);
llMainBody.setLayoutParams(lpMain);
LinearLayout llContent = new LinearLayout(getContext());
LinearLayout.LayoutParams lpContent = new LinearLayout.LayoutParams(-1,-2);
lpContent.weight = 1.0f;
llMainBody.addView(llContent,lpContent);
this.etContent = new EditText(getContext());
this.etContent.setGravity(51);
this.etContent.setBackgroundDrawable(null);
this.etContent.setText(String.valueOf(this.shareParamMap.get("text")));
this.etContent.addTextChangedListener(this);
LinearLayout.LayoutParams lpEt = new LinearLayout.LayoutParams(-2,-2);
lpEt.weight = 1.0f;
this.etContent.setLayoutParams(lpEt);
llContent.addView(this.etContent);
llContent.addView(getThumbView());
llMainBody.addView(getBodyBottom());
return llMainBody;
}
项目:CCDownload
文件:PlayChangeVideoPopupWindow.java
public PlayChangeVideoPopupWindow(Context context,int height) {
this.context = context;
RelativeLayout view = new RelativeLayout(context);
listView = new ListView(context);
listView.setPadding(0,3));
view.addView(listView,new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
adapter = new VideosAdapter();
listView.setAdapter(adapter);
popupWindow = new PopupWindow(view,height * 2 / 3,height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178,0)));
}
项目:CCDownload
文件:UploadFragment.java
@Override
public View onCreateView(LayoutInflater inflater,Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
receiver = new UploadReceiver();
activity.registerReceiver(receiver,new IntentFilter(ConfigUtil.ACTION_UPLOAD));
service = new Intent(context,UploadService.class);
binderService();
RelativeLayout view = new RelativeLayout(context);
view.setBackgroundColor(Color.WHITE);
LayoutParams uploadLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
uploadListView = new ListView(context);
uploadListView.setDivider(getResources().getDrawable(R.drawable.line));
view.addView(uploadListView,uploadLayoutParams);
uploadListView.setonItemClickListener(onItemClickListener);
uploadListView.setonCreateContextMenuListener(onCreateContextMenuListener);
initUploadList();
LayoutParams uploadButtonLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
uploadButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BottOM);
uploadButtonLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
uploadButton = new Button(context);
view.addView(uploadButton,uploadButtonLayoutParams);
uploadButton.setText("上传");
uploadButton.setTextColor(0xFFFFFFFF);
uploadButton.setonClickListener(uploadOnClickListener);
timer.schedule(timerTask,1000);
return view;
}
项目:CCDownload
文件:AccountInfoActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
getActionBar().setdisplayHomeAsUpEnabled(true);
RelativeLayout accountLayout = new RelativeLayout(this);
accountLayout.setBackgroundColor(Color.WHITE);
LayoutParams accountLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
accountLayout.setLayoutParams(accountLayoutParams);
ListView accountListView = new ListView(this);
accountListView.setPadding(10,10);
accountListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams accountListViewParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
accountLayout.addView(accountListView,accountListViewParams);
List<Pair<String,String>> pairs = new ArrayList<Pair<String,String>>();
Pair<String,String> userIdPair = new Pair<String,String>("User ID",ConfigUtil.USERID);
pairs.add(userIdPair);
Pair<String,String> apiKeyPair = new Pair<String,String>("API Key",ConfigUtil.API_KEY);
pairs.add(apiKeyPair);
AccountViewAdapter accountViewAdapter = new AccountViewAdapter(this,pairs);
accountListView.setAdapter(accountViewAdapter);
setContentView(accountLayout);
super.onCreate(savedInstanceState);
}
项目:CCDownload
文件:DownloadFragment.java
@Override
public View onCreateView(LayoutInflater inflater,Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
receiver = new DownloadedReceiver();
activity.registerReceiver(receiver,new IntentFilter(ConfigUtil.ACTION_DOWNLOADING));
RelativeLayout downloadRelativeLayout = new RelativeLayout(context);
downloadRelativeLayout.setBackgroundColor(Color.WHITE);
downloadRelativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
downloadListView = new ListView(context);
downloadListView.setPadding(10,10);
downloadListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams listViewLayout = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
downloadRelativeLayout.addView(downloadListView,listViewLayout);
// 生成动态数组,加入数据
pairs = new ArrayList<Pair<String,Integer>>();
for (int i = 0; i < downloadVideoIds.length; i++) {
Pair<String,Integer> pair = new Pair<String,Integer>(downloadVideoIds[i],R.drawable.download);
pairs.add(pair);
}
downloadListViewAdapter = new DownloadListViewAdapter(context,pairs);
downloadListView.setAdapter(downloadListViewAdapter);
downloadListView.setonItemClickListener(onItemClickListener);
service = new Intent(context,DownloadService.class);
activity.bindService(service,Context.BIND_AUTO_CREATE);
initDownloaderHashMap();
return downloadRelativeLayout;
}
项目:CCDownload
文件:DownloadingFragment.java
private void initView(RelativeLayout view ){
view.setBackgroundColor(Color.WHITE);
LayoutParams downloadingLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
downloadingListView = new ListView(context);
downloadingListView.setPadding(10,10);
downloadingListView.setDivider(getResources().getDrawable(R.drawable.line));
view.addView(downloadingListView,downloadingLayoutParams);
downloadingListView.setonItemClickListener(onItemClickListener);
downloadingListView.setonCreateContextMenuListener(onCreateContextMenuListener);
}
项目:CCDownload
文件:AccountViewAdapter.java
private View getItemView(Pair<String,String> pair){
RelativeLayout accountView = new RelativeLayout(context);
TextView textView = new TextView(context);
textView.setText(pair.first + " : " + pair.second);
textView.setTextSize(16);
textView.setPadding(10,30,0);
textView.setMinHeight(ParamsUtil.dpToPx(context,48));
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_VERTICAL);
accountView.addView(textView,params);
return accountView;
}
项目:CCDownload
文件:PlayerUtil.java
public static void resizeAdView(Activity activity,WindowManager wm,final ImageView iv,int adWidth,int adHeight) {
if (adWidth == 0 || adHeight == 0) {
return;
}
int screenWidth = wm.getDefaultdisplay().getWidth();
int screenHeight = wm.getDefaultdisplay().getHeight();
if (PlayerUtil.isPortrait()) {
screenHeight = screenHeight * 2 / 5;
} else {
// 全屏下,广告素材为屏幕60%
screenWidth = screenWidth * 6 / 10;
screenHeight = screenHeight * 6 / 10;
}
// 等比缩放比例计算
float widthRatio = (float) screenWidth / (float) adWidth;
float heightRatio = (float) screenHeight / (float) adHeight;
if (widthRatio > heightRatio) {
screenWidth = (int) ((float) adWidth * heightRatio);
} else {
screenHeight = (int) ((float) adHeight * widthRatio);
}
final LayoutParams ivAdLayoutParams = new LayoutParams(screenWidth,screenHeight);
ivAdLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
iv.setLayoutParams(ivAdLayoutParams);
}
});
}
项目:CCDownload
文件:PlayFragment.java
@Override
public View onCreateView(LayoutInflater inflater,Bundle savedInstanceState) {
context = getActivity().getApplicationContext();
RelativeLayout playLayout = new RelativeLayout(context);
playLayout.setBackgroundColor(Color.WHITE);
LayoutParams playLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
playLayout.setLayoutParams(playLayoutParams);
playListView = new ListView(context);
playListView.setDivider(getResources().getDrawable(R.drawable.line));
playListView.setDividerHeight(2);
playListView.setPadding(10,10);
LayoutParams playListLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
playLayout.addView(playListView,playListLayoutParams);
// 生成动态数组,加入数据
pairs = new ArrayList<Pair<String,Integer>>();
for (int i = 0; i < playVideoIds.length; i++) {
Pair<String,Integer>(playVideoIds[i],R.drawable.play);
pairs.add(pair);
}
videoListViewAdapter = new VideoListViewAdapter(context,pairs);
playListView.setAdapter(videoListViewAdapter);
playListView.setonItemClickListener(onItemClickListener);
return playLayout;
}
项目:CCDownload
文件:MediaPlayActivity.java
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (isPrepared) {
// 刷新界面
setLayoutVisibility(View.GONE,false);
setLayoutVisibility(View.VISIBLE,true);
}
lockView.setSelected(false);
if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
getwindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
rlBelow.setVisibility(View.VISIBLE);
ivFullscreen.setimageResource(R.drawable.fullscreen_close);
if (playChangeVideoPopupWindow != null) {
playChangeVideoPopupWindow.dismiss();
}
if (playTopPopupWindow != null) {
playTopPopupWindow.dismiss();
}
} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
getwindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
rlBelow.setVisibility(View.GONE);
ivFullscreen.setimageResource(R.drawable.fullscreen_open);
}
setSurfaceViewLayout();
}
项目:Swface
文件:BaseVideoActivity.java
private void setSurfaceSize() {
displayMetrics metrics = new displayMetrics();
getwindowManager().getDefaultdisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = (int) (width * PREVIEW_WIDTH / (float)PREVIEW_HEIGHT);
RelativeLayout.LayoutParams params = new LayoutParams(width,height);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
mPreviewSurface.setLayoutParams(params);
mFaceSurface.setLayoutParams(params);
}
项目:WithYou
文件:VideoVerify.java
private void setSurfaceSize() {
displayMetrics metrics = new displayMetrics();
getwindowManager().getDefaultdisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = (int) (width * PREVIEW_WIDTH / (float)PREVIEW_HEIGHT);
RelativeLayout.LayoutParams params = new LayoutParams(width,height);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
mPreviewSurface.setLayoutParams(params);
mFaceSurface.setLayoutParams(params);
}
private void createListenerView() {
this.listenerView = new View(this.context) {
protected boolean fitSystemWindows(Rect insets) {
if (insets.top == 0) {
InBoxViewManager.this.logger.info("fitSystemWindows : 0");
InBoxViewManager.this.setTabVisibility(Boolean.valueOf(false),eVisibilityReason.FullScreenMode);
} else {
InBoxViewManager.this.logger.info("fitSystemWindows : != 0");
InBoxViewManager.this.setTabVisibility(Boolean.valueOf(true),eVisibilityReason.FullScreenMode);
}
return super.fitSystemWindows(insets);
}
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == 4) {
}
return super.dispatchKeyEvent(event);
}
};
this.listenerView.setonsystemUIVisibilitychangelistener(new OnsystemUIVisibilitychangelistener() {
public void onsystemUIVisibilityChange(int visibility) {
if ((visibility & 4) == 0) {
InBoxViewManager.this.setTabVisibility(Boolean.valueOf(true),eVisibilityReason.FullScreenMode);
} else {
InBoxViewManager.this.setTabVisibility(Boolean.valueOf(false),eVisibilityReason.FullScreenMode);
}
}
});
WindowManager.LayoutParams params = new WindowManager.LayoutParams(-2,-2,2002,65816,-3);
params.width = 1;
params.height = 1;
params.gravity = 51;
getwindowManager().addView(this.listenerView,params);
}
项目:sctalk
文件:MessageActivity.java
private void initSoftInputMethod() {
this.getwindow().setSoftInputMode(WindowManager.LayoutParams.soFT_INPUT_ADJUST_RESIZE);
inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
receiver = new switchInputMethodReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.INPUT_METHOD_CHANGED");
registerReceiver(receiver,filter);
SystemConfigSp.instance().init(this);
currentInputMethod = Settings.Secure.getString(MessageActivity.this.getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
keyboardHeight = SystemConfigSp.instance().getIntConfig(currentInputMethod);
}
项目:letv
文件:MyPlayRecordFragment.java
private void upDateLogin() {
LayoutParams params = (LayoutParams) this.mpullListView.getLayoutParams();
if (this.mIsLogin) {
this.mBottomLogin.setVisibility(8);
params.bottomMargin = 0;
} else {
this.mBottomLogin.setVisibility(0);
params.bottomMargin = this.mBottomLogin.getHeight();
}
this.mpullListView.setLayoutParams(params);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。