@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_camera); thumbnail = (ImageView) findViewById(R.id.camera_thumbnail); cam = Camera.open(); final FrameLayout preview = (FrameLayout) findViewById(R.id.cameraPreview); Log.d(TAG, preview + ""); camPreview = new CameraPreview(this, cam); preview.addView(camPreview); thumbnail.bringToFront(); changeThumbnail(); camPreview.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (!isTaken) { isTaken = true; cam.takePicture(null, null, picJpgListener); Toast.makeText(CameraActivity.this, "保存中", Toast.LENGTH_SHORT).show(); } return false; } }); }
public View getView(int position, View convertView, ViewGroup parent) { ImageView i = new ImageView(mContext); i.setFocusable(true); i.setFocusableInTouchMode(true); i.setImageResource(myCards[position]); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setAdjustViewBounds(true); i.bringToFront(); return i; }
private void setTargetOffsetTop(int offset, boolean requiresUpdate) { mRefreshView.bringToFront(); // mRefreshView.offsetTopAndBottom(offset); mTarget.offsetTopAndBottom(offset); mRefreshDrawable.offsetTopAndBottom(offset); mCurrentOffsetTop = mTarget.getTop(); if (requiresUpdate && android.os.Build.VERSION.SDK_INT < 11) { invalidate(); } }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.imageButton: sampleImage.setImageResource(R.drawable.pic1); frameImage.bringToFront(); break; case R.id.imageButton2: sampleImage.setImageResource(R.drawable.pic2); frameImage.bringToFront(); break; case R.id.imageButton3: sampleImage.setImageResource(R.drawable.pic3); frameImage.bringToFront(); break; case R.id.imageButton4: sampleImage.setImageResource(R.drawable.pic4); frameImage.bringToFront(); break; } }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); super.onCreate(savedInstanceState); if (mainmenu.height <= 480) { setContentView(R.layout.puzzle1small); } else { setContentView(R.layout.puzzle2); } p3lay = (RelativeLayout) findViewById(R.id.mainlay); p3lay.setBackgroundResource(R.drawable.p3bg); mp = new playaudio(getApplicationContext(), R.raw.puzzle3); mp.start(); p3imgv1 = (ImageView) findViewById(R.id.ltop); p3imgv2 = (ImageView) findViewById(R.id.lmiddle); p3imgv3 = (ImageView) findViewById(R.id.lbottom); p3imgv4 = (ImageView) findViewById(R.id.mtop); p3imgv5 = (ImageView) findViewById(R.id.mmiddle); p3imgv6 = (ImageView) findViewById(R.id.mbottom); p3imgv7 = (ImageView) findViewById(R.id.rmost); p3imgv4.bringToFront(); p3imgv1.setOnDragListener(new Mydraglistner()); p3imgv2.setOnDragListener(new Mydraglistner()); p3imgv3.setOnDragListener(new Mydraglistner()); p3imgv4.setOnDragListener(new Mydraglistner()); p3imgv5.setOnDragListener(new Mydraglistner()); p3imgv6.setOnDragListener(new Mydraglistner()); p3imgv7.setOnDragListener(new Mydraglistner()); p3dragv = (ImageView) findViewById(R.id.pdragv); p3dragv.setImageResource(R.drawable.p2img7); p3dragv.setOnTouchListener(new Mytouchlistener()); }
@Override public void onWindowFocusChanged(boolean hasFocus) { if (firstQuestion == true) { // Layout Variables glLeft = gridLayout.getLeft(); Log.i("rlLeft", Integer.toString(glLeft)); glTop = gridLayout.getTop(); Log.i("rlTop", Integer.toString(glTop)); glWidth = gridLayout.getWidth(); Log.i("rlWidth", Float.toString(glWidth)); glHeight = gridLayout.getHeight(); Log.i("rlHeight", Float.toString(glHeight)); glv.initGrid(glWidth, glHeight); setLinePositions(glv); // Init Skills Layout // Layout Variables slLeft = skillsLayout.getLeft(); // Log.i("rlLeft", Integer.toString(glLeft)); slTop = skillsLayout.getTop(); // Log.i("rlTop", Integer.toString(glTop)); slWidth = skillsLayout.getWidth(); // Log.i("rlWidth", Float.toString(glWidth)); slHeight = skillsLayout.getHeight(); // Log.i("rlHeight", Float.toString(glHeight)); coordNumbersX.bringToFront(); coordNumbersY.bringToFront(); brackets.bringToFront(); initQuestion(); } }
/** 指定光标相对位置 */ private void setBorderParams(final View item) { cursor.clearAnimation(); cursor.setVisibility(View.VISIBLE); final RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) item.getLayoutParams(); final int l = params.leftMargin + paddingLeft - boarderLeft; final int t = params.topMargin + paddingTop - boarderTop; final int r = l + itemWidth + boarderRight; final int b = t + itemHeight + boarderBottom; // 判断动画类型 switch (animationType) { case ANIM_DEFAULT: cursor.layout(l, t, r, b); item.bringToFront(); cursor.bringToFront(); if (scalable) { scaleToLarge(item); } break; case ANIM_TRASLATE: ValueAnimator transAnimatorX = ObjectAnimator.ofFloat(cursor, "x", cursor.getLeft(), l); ValueAnimator transAnimatorY = ObjectAnimator.ofFloat(cursor, "y", cursor.getTop(), t); cursor.layout(l, t, r, b); item.bringToFront(); cursor.bringToFront(); if (scalable) { scaleToLarge(item); } if (focusIsOut) { return; } animatorSet = new AnimatorSet(); animatorSet.play(transAnimatorY).with(transAnimatorX); animatorSet.setDuration(durationTraslate); animatorSet.setInterpolator(new DecelerateInterpolator(1)); // animatorSet.addListener(new AnimatorListener() { // // @Override // public void onAnimationStart(Animator arg0) { // } // // @Override // public void onAnimationRepeat(Animator arg0) { // } // // @Override // public void onAnimationEnd(Animator arg0) { // cursor.layout(l, t, r, b); // item.bringToFront(); // cursor.bringToFront(); // if (scalable) { // scaleToLarge(item); // } // } // // @Override // public void onAnimationCancel(Animator arg0) { // } // }); animatorSet.start(); break; } }
// Init NumberPAD + AnserPannel private void initNumberPadAndAnswePanel() { // Init Number Panel for (int i = 0; i < npAmmount; i++) { arrayNumberPannelViewNegative.add( new NewNumberPanel( this, new RelativeLayout.LayoutParams(npWidth, npHeight), slWidth, slHeight, arrayAnswerPanelView)); arrayNumberPannelViewNegative.get(i).setLayoutOffsetX(slLeft); arrayNumberPannelViewNegative.get(i).setLayoutOffsetY(slTop); arrayNumberPannelViewNegative.get(i).setOnCollisionDetectedListener(collisionListener); // digitInPanel.add(i); } for (int i = 0; i < npAmmount; i++) { arrayNumberPannelViewNegative2.add( new NewNumberPanel( this, new RelativeLayout.LayoutParams(npWidth, npHeight), slWidth, slHeight, arrayAnswerPanelView)); arrayNumberPannelViewNegative2.get(i).setLayoutOffsetX(slLeft); arrayNumberPannelViewNegative2.get(i).setLayoutOffsetY(slTop); arrayNumberPannelViewNegative2.get(i).setOnCollisionDetectedListener(collisionListener); // digitInPanel.add(i); } for (int i = 0; i < npAmmount; i++) { arrayNumberPannelView.add( new NewNumberPanel( this, new RelativeLayout.LayoutParams(npWidth, npHeight), slWidth, slHeight, arrayAnswerPanelView)); arrayNumberPannelView.get(i).setLayoutOffsetX(slLeft); arrayNumberPannelView.get(i).setLayoutOffsetY(slTop); arrayNumberPannelView.get(i).setOnCollisionDetectedListener(collisionListener); // digitInPanel.add(i); } for (int i = 0; i < npAmmount; i++) { arrayNumberPannelView2.add( new NewNumberPanel( this, new RelativeLayout.LayoutParams(npWidth, npHeight), slWidth, slHeight, arrayAnswerPanelView)); arrayNumberPannelView2.get(i).setLayoutOffsetX(slLeft); arrayNumberPannelView2.get(i).setLayoutOffsetY(slTop); arrayNumberPannelView2.get(i).setOnCollisionDetectedListener(collisionListener); // digitInPanel.add(i); } arrayNumberPannelView .get(0) .initNumberPad( arrayNumberPannelView, skillsLayout, npAmmount, 1, slWidth, slHeight, npWidth, npHeight); arrayNumberPannelView2 .get(0) .initNumberPad( arrayNumberPannelView2, skillsLayout, npAmmount, 1, slWidth, slHeight, npWidth, npHeight); arrayNumberPannelViewNegative .get(0) .initNumberPad( arrayNumberPannelViewNegative, skillsLayout, npAmmount, -1, slWidth, slHeight, npWidth, npHeight); arrayNumberPannelViewNegative2 .get(0) .initNumberPad( arrayNumberPannelViewNegative2, skillsLayout, npAmmount, -1, slWidth, slHeight, npWidth, npHeight); // Init Answer Panel for (int i = 0; i < apAmmount; i++) { arrayAnswerPanelView.add( new AnswerPanel( this, new RelativeLayout.LayoutParams(apWidth, apHeight), slWidth, slHeight)); arrayAnswerPanelView.get(i).setStartX((npWidth * i) + (npWidth / 3)); arrayAnswerPanelView.get(i).setStartY(npHeight / 3); arrayAnswerPanelView.get(i).setState(1); skillsLayout.addView(arrayAnswerPanelView.get(i)); digitInPanel.add(100); } resetAnserPanel.setVisibility(View.VISIBLE); resetAnserPanel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { NewNumberPanel n; for (int i = 0; i < apAmmount; i++) { if (arrayAnswerPanelView.get(i).getCurrentNumberPanel() == null) { continue; } else { n = arrayAnswerPanelView.get(i).getCurrentNumberPanel(); n.resetNumberPanelPosition(n); } arrayAnswerPanelView.get(i).unloadAnswerPanel(); } } }); coordNumbersX.bringToFront(); coordNumbersY.bringToFront(); brackets.bringToFront(); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // initialize our instance of CallbackManager callbackManager = CallbackManager.Factory.create(); // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_one, container, false); logo = (ImageView) view.findViewById(R.id.conveneLogo); logo.bringToFront(); userName = (TextView) view.findViewById(R.id.userName); btnSyncContacts = (Button) view.findViewById(R.id.btnSearchContacts); info = (TextView) view.findViewById(R.id.info); orText = (TextView) view.findViewById(R.id.ortext); profileImage = (ImageView) view.findViewById(R.id.profileimage); backButtons = (LinearLayout) view.findViewById(R.id.backButtonsContainer); loginButton = (LoginButton) view.findViewById(R.id.login_button); lvFriend = (ListView) view.findViewById(R.id.lvFriend); userInfo = (RelativeLayout) view.findViewById(R.id.fbInfoContainer); // get user permission to access to friends list loginButton.setReadPermissions(Arrays.asList("user_friends")); loginButton.setFragment(this); // create a callback to handle the results of the login attempts and // register it with the CallbackManager loginButton.registerCallback( callbackManager, new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Log.d("FragmentOne.FBLOGIN", "Login attempt a success!!."); } @Override public void onCancel() { Log.d("FragmentOne.FBLOGIN", "Login attempt cancelled."); } @Override public void onError(FacebookException e) { Log.d("FragmentOne.FBLOGIN", "Login attempt failed."); } }); friendListArray.clear(); // NOTE: simple list item 1 = Android predefined TextView resource id // adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, // friendListArray); newadapter = new myAdapter(getContext(), R.layout.list_row, friendListArray); lvFriend.setAdapter(newadapter); lvFriend.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { int friendListID = (int) id; newadapter.setSelectedIndex(position); People person = (People) lvFriend.getItemAtPosition(friendListID); utils.setFriend(person.name); } }); Profile profile = Profile.getCurrentProfile(); if (profile == null) { // } else { FbProfileInfo FBInfo = new FbProfileInfo(getActivity()); FBInfo.getProfileInformation(getActivity()); setUpFriendListPage(); } return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; OCFile file = null; LayoutInflater inflator = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (mFiles != null && mFiles.size() > position) { file = mFiles.get(position); } // Find out which layout should be displayed ViewType viewType; if (!mGridMode) { viewType = ViewType.LIST_ITEM; } else if (file.isImage()) { viewType = ViewType.GRID_IMAGE; } else { viewType = ViewType.GRID_ITEM; } // Create View switch (viewType) { case GRID_IMAGE: view = inflator.inflate(R.layout.grid_image, null); break; case GRID_ITEM: view = inflator.inflate(R.layout.grid_item, null); break; case LIST_ITEM: view = inflator.inflate(R.layout.list_item, null); break; } view.invalidate(); if (file != null) { ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail); fileIcon.setTag(file.getFileId()); TextView fileName; String name = file.getFileName(); LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ListItemLayout); linearLayout.setContentDescription("LinearLayout-" + name); switch (viewType) { case LIST_ITEM: TextView fileSizeV = (TextView) view.findViewById(R.id.file_size); TextView lastModV = (TextView) view.findViewById(R.id.last_mod); ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); lastModV.setVisibility(View.VISIBLE); lastModV.setText(showRelativeTimestamp(file)); checkBoxV.setVisibility(View.GONE); fileSizeV.setVisibility(View.VISIBLE); fileSizeV.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); if (!file.isFolder()) { AbsListView parentList = (AbsListView) parent; if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) { checkBoxV.setVisibility(View.GONE); } else { if (parentList.isItemChecked(position)) { checkBoxV.setImageResource(android.R.drawable.checkbox_on_background); } else { checkBoxV.setImageResource(android.R.drawable.checkbox_off_background); } checkBoxV.setVisibility(View.VISIBLE); } } } else { // Folder fileSizeV.setVisibility(View.INVISIBLE); } case GRID_ITEM: // filename fileName = (TextView) view.findViewById(R.id.Filename); name = file.getFileName(); fileName.setText(name); case GRID_IMAGE: // sharedIcon ImageView sharedIconV = (ImageView) view.findViewById(R.id.sharedIcon); if (file.isShareByLink()) { sharedIconV.setVisibility(View.VISIBLE); sharedIconV.bringToFront(); } else { sharedIconV.setVisibility(View.GONE); } // local state ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator); localStateView.bringToFront(); FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); boolean downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)); OperationsServiceBinder opsBinder = mTransferServiceGetter.getOperationsServiceBinder(); downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, file.getRemotePath())); if (downloading) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { localStateView.setImageResource(R.drawable.local_file_indicator); localStateView.setVisibility(View.VISIBLE); } else { localStateView.setVisibility(View.INVISIBLE); } // share with me icon if (!file.isFolder()) { ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon); sharedWithMeIconV.bringToFront(); if (checkIfFileIsSharedWithMe(file)) { sharedWithMeIconV.setVisibility(View.VISIBLE); } else { sharedWithMeIconV.setVisibility(View.GONE); } } break; } // For all Views // this if-else is needed even though favorite icon is visible by default // because android reuses views in listview if (!file.keepInSync()) { view.findViewById(R.id.favoriteIcon).setVisibility(View.GONE); } else { view.findViewById(R.id.favoriteIcon).setVisibility(View.VISIBLE); } // No Folder if (!file.isFolder()) { if (file.isImage() && file.getRemoteId() != null) { // Thumbnail in Cache? Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(String.valueOf(file.getRemoteId())); if (thumbnail != null && !file.needsUpdateThumbnail()) { fileIcon.setImageBitmap(thumbnail); } else { // generate new Thumbnail if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) { final ThumbnailsCacheManager.ThumbnailGenerationTask task = new ThumbnailsCacheManager.ThumbnailGenerationTask( fileIcon, mStorageManager, mAccount); if (thumbnail == null) { thumbnail = ThumbnailsCacheManager.mDefaultImg; } final ThumbnailsCacheManager.AsyncDrawable asyncDrawable = new ThumbnailsCacheManager.AsyncDrawable( mContext.getResources(), thumbnail, task); fileIcon.setImageDrawable(asyncDrawable); task.execute(file); } } } else { fileIcon.setImageResource( DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())); } } else { // Folder if (checkIfFileIsSharedWithMe(file)) { fileIcon.setImageResource(R.drawable.shared_with_me_folder); } else if (file.isShareByLink()) { // If folder is sharedByLink, icon folder must be changed to // folder-public one fileIcon.setImageResource(R.drawable.folder_public); } else { fileIcon.setImageResource( DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())); } } } return view; }