@Override public void handleMessage(Message msg) { Context context = getContext(); if (context == null) { Log.e(TAG, "error handling message, getContext() returned null"); return; } switch (msg.arg1) { case COMMAND_CHANGE_TITLE: if (context instanceof Activity) { ((Activity) context).setTitle((String) msg.obj); } else { Log.e(TAG, "error handling message, getContext() returned no Activity"); } break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { mTextEdit.setVisibility(View.GONE); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); } break; default: if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { Log.e(TAG, "error handling message, command is " + msg.arg1); } } }
public void bindView(View view, Context context, Cursor cursor) { Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationAdapter;->bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V"); MtvReservation mtvreservation = MtvReservationManager.builder(cursor); view.setTag(mtvreservation); String s; String s1; if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext())) s = (new SimpleDateFormat("M/d (EEE) H:mm")).format(new Date(mtvreservation.mTimeStart)); else s = (new SimpleDateFormat("M/d (EEE) h:mm a")).format(new Date(mtvreservation.mTimeStart)); if(mtvreservation.mTimeEnd > 0L) { if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext())) s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("H:mm")).format(new Date(mtvreservation.mTimeEnd))).toString(); else s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("h:mm a")).format(new Date(mtvreservation.mTimeEnd))).toString(); } else { s1 = (new StringBuilder()).append(s).append(" - ").toString(); } ((ImageView)view.findViewById(0x7f0a0053)).setImageDrawable(mIcon[mtvreservation.mPgmType][selectStatusIconIndex(mtvreservation)]); ((TextView)view.findViewById(0x7f0a0113)).setText((new StringBuilder()).append(s1).append(" ").append("Ch ").append(mtvreservation.mPch).append(" ").toString()); ((TextView)view.findViewById(0x7f0a0112)).setText(mtvreservation.mPgmName); view.findViewById(0x7f0a0048).setVisibility(8); }
/** @param view */ public static void showSoftKeyboard(final View view) { if (view == null) { return; } final Runnable action = new Runnable() { @Override public void run() { final InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } }; final View.OnFocusChangeListener restoreOnFocusChangeListener = view.getOnFocusChangeListener(); final View.OnFocusChangeListener temporaryOnFocusChangeListener = new View.OnFocusChangeListener() { @Override public void onFocusChange(final View v, final boolean hasFocus) { view.setOnFocusChangeListener(restoreOnFocusChangeListener); view.postDelayed(action, 25); } }; view.setOnFocusChangeListener(temporaryOnFocusChangeListener); view.requestFocus(); }
public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
private void showUserHashDialog() { String userHash = NavigineApp.Settings.getString("user_hash", ""); LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.user_hash_dialog, null); _userEdit = (EditText) view.findViewById(R.id.user_hash_edit); _userEdit.setText(userHash); _userEdit.setTypeface(Typeface.MONOSPACE); // _userEdit.addTextChangedListener(new TextWatcher() // { // public void afterTextChanged(Editable s) { } // public void beforeTextChanged(CharSequence s, int start, int count, int after) { } // public void onTextChanged(CharSequence s, int start, int before, int count) // { // String text = _userEdit.getText().toString(); // int length = _userEdit.getText().length(); // // if (text.endsWith("-")) // return; // // if (count <= before) // return; // // if (length == 4 || length == 9 || length == 14) // { // _userEdit.setText((text + "-")); // _userEdit.setSelection(length + 1); // } // } // }); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext); alertBuilder.setView(view); alertBuilder.setTitle("Enter user ID"); alertBuilder.setNegativeButton( getString(R.string.cancel_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dlg, int id) {} }); alertBuilder.setPositiveButton( getString(R.string.ok_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dlg, int id) { String userHash = _userEdit.getText().toString(); SharedPreferences.Editor editor = NavigineApp.Settings.edit(); editor.putString("user_hash", userHash); editor.commit(); NavigineApp.applySettings(); refreshMapList(); } }); AlertDialog dialog = alertBuilder.create(); dialog.setCanceledOnTouchOutside(false); dialog.show(); }
@Override public void onFinishInflate() { super.onFinishInflate(); View view = inflate(getContext(), R.layout.cover_anim_view, (ViewGroup) this); Arpan_ßløødy_CoverImages = new ImageView[2]; Arpan_ßløødy_CoverImages[0] = (ImageView) view.findViewById(R.id.image0); Arpan_ßløødy_CoverImages[1] = (ImageView) view.findViewById(R.id.image1); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = new Banner(this); view.setOnClickListener(this); setContentView(view); Log.d(TAG_NAME, "Banner View activated successfully!"); }
private void startAnim(View convertView) { convertView.setPivotX(0.0f); convertView.setPivotY(1.0f); PropertyValuesHolder x = PropertyValuesHolder.ofFloat("scaleX", 0.0f, 1.0f); PropertyValuesHolder y = PropertyValuesHolder.ofFloat("scaleY", 0.0f, 1.0f); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(convertView, x, y); animator.setDuration(animTime); animator.start(); }
@Override public void onClick(View inButton) { boolean isErr = false; if (mTitle.getText().toString().length() == 0) { mTitle.setError("Required"); mTitle.setEms(10); isErr = true; } if (mDesc.getText().toString().length() == 0) { mDesc.setActivated(true); mDesc.setError("Required"); isErr = true; } if (inButton.getId() == openWeb.getId()) web.setVisibility(View.VISIBLE); else if (inButton.getId() == mAvail.getId()) startActivity(new Intent(this, CheckActivity.class)); else if (inButton.getId() == mBack.getId()) finish(); else if (inButton.getId() == mSub.getId()) { AlertDialog.Builder al = new AlertDialog.Builder(this); if (isErr) return; else al.setTitle("Continue?") .setIcon(R.drawable.ornament) .setMessage("Your listing is going to be submitted to your chosen category.") .setPositiveButton( "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) { payment = new ArrayList<String>(); if (mCard.isChecked()) payment.add("Card"); if (mCheck.isChecked()) payment.add("Check"); if (mOnline.isChecked()) payment.add("Online"); if (mCash.isChecked()) payment.add("Cash"); // Toast.makeText(getApplicationContext(), payment.toString(), // Toast.LENGTH_LONG).show(); Intent intent = new Intent(getApplicationContext(), StartActivity.class); intent.putExtra("Payment", payment); intent.putExtra("Category", mChosenCategory); intent.putExtra("Title", mTitle.getText().toString()); intent.putExtra("Price", mPrice.getText().toString()); intent.putExtra("Description", mDesc.getText().toString()); intent.putExtra("Location", mLocation.getText().toString()); intent.putExtra("Photo", jpegData); startActivity(intent); } }) .setNegativeButton( "Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int x) {} }) .show(); } else startActivityForResult( new Intent(this, com.lightbox.android.camera.activities.Camera.class), REQ); }
@Override private void start(View view, long l, float f, float f2, float f3, float f4, float f5, float f6) { view.setScaleX(f); view.setScaleY(f); view.setTranslationX(f3); view.setTranslationY(f4); ViewPropertyAnimator viewPropertyAnimator = view.animate().translationX(f5).translationY(f6).scaleX(f2).scaleY(f2).setDuration(l); viewPropertyAnimator.start(); }
@Override public void animate(View view) { f = pickScale(); f2 = pickScale(); f3 = pickTranslation(view.getWidth(), f); f4 = pickTranslation(view.getHeight(), f); f5 = pickTranslation(view.getWidth(), f2); f6 = pickTranslation(view.getHeight(), f2); start(view, Image_Animation_Duration, f, f2, f3, f4, f5, f6); }
private void initPagerItems() { for (int i = 0; i < bitmapList.size(); i++) { View v = LayoutInflater.from(this).inflate(R.layout.call_activity_itempage, null); ImageView imageView = (ImageView) v.findViewById(R.id.contactIv); TextView textView = (TextView) v.findViewById(R.id.contactTv); imageView.setImageBitmap(bitmapList.get(i)); textView.setText(nameList.get(i)); viewArrayList.add(v); } }
@Override public boolean onTouch(View view, MotionEvent event) { String str = null; int i = 0; str = "x=" + event.getX(i) / view.getMeasuredWidth() + ",y=" + event.getY(i) / view.getMeasuredHeight(); textView.setText(str); return false; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(getActivity()).inflate(R.layout.item_song, null); holder.mTvName = (TextView) convertView.findViewById(R.id.tv_name); holder.mTvArtist = (TextView) convertView.findViewById(R.id.tv_artist); holder.mTvDuration = (TextView) convertView.findViewById(R.id.tv_duration); holder.aboveView = convertView.findViewById(R.id.item_root); holder.behindView = convertView.findViewById(R.id.behind); convertView.setTag(holder); convertViewList.add((PullRightLayout) convertView); } else { holder = (ViewHolder) convertView.getTag(); } if (HideApplication.showListAnim) { startAnim(convertView); } SongInfo info = SongManager.with(getActivity()).getSongByIndex(position); holder.mTvName.setText(info.getTitle()); holder.mTvArtist.setText(info.getArtist() + " - " + info.getAlbum()); holder.mTvDuration.setText( CommonUtils.durationToString(info.getDuration()) + " - " + CommonUtils.getFileSize(info.getPath())); setItemSelected(holder, info.getId() == playingId); convertView.setOnClickListener(new OnItemClick(position)); holder.behindView.setOnClickListener(new OnBehindClick(position)); return convertView; }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout mainView = null; mainView = new FrameLayout(this); setContentView(mainView); View view = null; view = new MyView(this); view.setLongClickable(true); view.setOnTouchListener(this); mainView.addView(view); textView = new TextView(this); mainView.addView(textView); }
public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); if (event.getAction() == MotionEvent.ACTION_DOWN) { Toast.makeText(HandleEvent.this, "Touch Event Received", Toast.LENGTH_SHORT).show(); return true; } return false; }
public void restartGame(View v) { for (int i = 1; i <= 9; i++) { View mainView = findViewById( getResources() .getIdentifier("mainView" + Integer.toString(i), "id", getPackageName())); if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { mainView.setBackgroundDrawable(getResources().getDrawable(R.drawable.empty)); } else { mainView.setBackground(getResources().getDrawable(R.drawable.empty)); } player = 1; matriz = new int[3][3]; tv.setText("Jogador 1"); tv1.setText(""); vencedor = false; } }
public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); if (event.getAction() == MotionEvent.ACTION_DOWN) { x += 15; y += 15; invalidate(); return true; } return false; }
public void mOnClick(View v) { switch (v.getId()) { case R.id.btncopy: copyIntent(); break; case R.id.btnpaste: pasteIntent(); break; } }
@Override public void handleMessage(Message msg) { Context context = getContext(); if (context == null) { Log.e(TAG, "error handling message, getContext() returned null"); return; } switch (msg.arg1) { case COMMAND_CHANGE_TITLE: if (context instanceof Activity) { ((Activity) context).setTitle((String) msg.obj); } else { Log.e(TAG, "error handling message, getContext() returned no Activity"); } break; case COMMAND_TEXTEDIT_HIDE: if (mTextEdit != null) { mTextEdit.setVisibility(View.GONE); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); } break; case COMMAND_SET_KEEP_SCREEN_ON: { Window window = ((Activity) context).getWindow(); if (window != null) { if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } } break; } default: if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { Log.e(TAG, "error handling message, command is " + msg.arg1); } } }
@Override public void run() { AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(w, h + HEIGHT_PADDING, x, y); if (mTextEdit == null) { mTextEdit = new DummyEdit(getContext()); mLayout.addView(mTextEdit, params); } else { mTextEdit.setLayoutParams(params); } mTextEdit.setVisibility(View.VISIBLE); mTextEdit.requestFocus(); InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); }
private ViewHolder getViewHolder(final View workingView) { final Object tag = workingView.getTag(); ViewHolder viewHolder = null; if (null == tag || !(tag instanceof ViewHolder)) { viewHolder = new ViewHolder(); viewHolder.nameView = (TextView) workingView.findViewById(R.id.name); viewHolder.dateView = (TextView) workingView.findViewById(R.id.date); viewHolder.sizeView = (TextView) workingView.findViewById(R.id.size); viewHolder.imageView = (ImageView) workingView.findViewById(R.id.image); workingView.setTag(viewHolder); } else { viewHolder = (ViewHolder) tag; } return viewHolder; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; PhotoGridHolder holder = null; if (row == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new PhotoGridHolder(); holder.itemImageView = (ImageView) row.findViewById(R.id.galleryGridImage); row.setTag(holder); } else { holder = (PhotoGridHolder) row.getTag(); } String filename = getItem(position); String path = context.getFilesDir().getAbsolutePath() + "/images/" + filename; holder.itemImageView.setImageURI(Uri.parse(path)); return row; }
protected void onDraw(Canvas cs) { super.onDraw(cs); // 描画方法の設定 Paint p = new Paint(); p.setColor(Color.BLACK); p.setStyle(Paint.Style.FILL); p.setStrokeWidth(8); // 円の描画 cs.drawCircle(x, y, 50, p); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } Message m = items.get(position); // if (m != null) { m.createColorFromString(m.from); TextView tt = (TextView) v.findViewById(R.id.username); TextView bt = (TextView) v.findViewById(R.id.message); if (isMonospaced) { tt.setTypeface(Typeface.MONOSPACE); bt.setTypeface(Typeface.MONOSPACE); } tt.setText(m.getFrom()); tt.setTextColor(m.color); bt.setText(m.getMessage()); // } return v; }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (paint == null) { paint = new Paint(); luar = new LinearGradient( 0.f, 0.f, 0.f, this.getMeasuredHeight(), 0xffffffff, 0xff000000, TileMode.CLAMP); } int rgb = Color.HSVToColor(color); Shader dalam = new LinearGradient(0.f, 0.f, this.getMeasuredWidth(), 0.f, 0xffffffff, rgb, TileMode.CLAMP); ComposeShader shader = new ComposeShader(luar, dalam, PorterDuff.Mode.MULTIPLY); paint.setShader(shader); canvas.drawRect(0.f, 0.f, this.getMeasuredWidth(), this.getMeasuredHeight(), paint); }
/** @param view */ public static void hideSoftKeyboard(final View view) { if (view == null) { return; } final Runnable action = new Runnable() { @Override public void run() { final InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow( view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); } }; view.postDelayed(action, 25); }
@Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent; String parentPN; // 蹂댄샇���꾪솕踰덊샇 /** 媛�踰꾪듉蹂꾨줈 �댁빞���쇱쓣 梨꾩썙�k뒗�� */ switch (v.getId()) { case R.id.mystatbtn: intent = new Intent(Menus.this, Mystat.class); startActivity(intent); break; case R.id.noticebtn: intent = new Intent(Menus.this, Notice.class); startActivity(intent); break; case R.id.requestbtn: intent = new Intent(Menus.this, RequestTalk.class); startActivity(intent); break; case R.id.hospitalinfobtn: intent = new Intent(Menus.this, Hospitalinfo.class); startActivity(intent); break; case R.id.qrreadbtn: intent = new Intent(Menus.this, QRread.class); startActivity(intent); break; case R.id.parentcallbtn: parentPN = "01193699621"; // 蹂댄샇���꾪솕踰덊샇 DB�먯꽌 媛�졇��빞 �� intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + parentPN)); startActivity(intent); break; case R.id.emergencybtn: // 蹂묒썝��湲닿툒肄� ((Button) findViewById(R.id.emergencybtn)).setBackgroundColor(Color.GREEN); ((Button) findViewById(R.id.emergencybtn)).setText("�좉퀬 �꾨즺"); break; } }
private void createFloatingWindow() { SharedPreferences shared = getSharedPreferences("float_flag", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = shared.edit(); editor.putInt("float", 1); editor.commit(); windowManager = (WindowManager) getApplicationContext().getSystemService("window"); wmParams = ((ProfilerApplication) getApplication()).getMywmParams(); wmParams.type = 2002; wmParams.flags |= 8; wmParams.gravity = Gravity.LEFT | Gravity.TOP; wmParams.x = 0; wmParams.y = 0; wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT; wmParams.format = 1; windowManager.addView(floatingView, wmParams); floatingView.setOnTouchListener( new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { x = event.getRawX(); y = event.getRawY() - 25; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mTouchStartX = event.getX(); mTouchStartY = event.getY(); break; case MotionEvent.ACTION_MOVE: updateViewPosition(); break; case MotionEvent.ACTION_UP: updateViewPosition(); mTouchStartX = mTouchStartY = 0; break; } return true; } }); }
public boolean onKeyDown(int KeyCode, KeyEvent event) { super.onKeyDown(KeyCode, event); if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (KeyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: x -= 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: x += 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_UP: y -= 15; invalidate(); return true; case KeyEvent.KEYCODE_DPAD_DOWN: y += 15; invalidate(); return true; } } return false; }