Java Code Examples for android.content.DialogInterface.OnKeyListener

The following are top voted examples for showing how to use android.content.DialogInterface.OnKeyListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: solved-hacking-problem   File: C0271l.java   View source code 6 votes vote down vote up
public void m2208a(IBinder iBinder) {
    C0264i c0264i = this.f1017b;
    C0230t c0230t = new C0230t(c0264i.m2131e());
    this.f1016a = new C0269g(c0230t.m1964a(), C0240i.abc_list_menu_item_layout);
    this.f1016a.m2199a((C0207y) this);
    this.f1017b.m2111a(this.f1016a);
    c0230t.m1968a(this.f1016a.m2196a(), this);
    View o = c0264i.m2141o();
    if (o != null) {
        c0230t.m1967a(o);
    } else {
        c0230t.m1966a(c0264i.m2140n()).m1969a(c0264i.m2139m());
    }
    c0230t.m1965a((OnKeyListener) this);
    this.f1018c = c0230t.m1970b();
    this.f1018c.setOnDismissListener(this);
    LayoutParams attributes = this.f1018c.getWindow().getAttributes();
    attributes.type = 1003;
    if (iBinder != null) {
        attributes.token = iBinder;
    }
    attributes.flags |= 131072;
    this.f1018c.show();
}
 
Example 2
Project: solved-hacking-problem   File: C0271l.java   View source code 6 votes vote down vote up
public void m2208a(IBinder iBinder) {
    C0264i c0264i = this.f1017b;
    C0230t c0230t = new C0230t(c0264i.m2131e());
    this.f1016a = new C0269g(c0230t.m1964a(), C0240i.abc_list_menu_item_layout);
    this.f1016a.m2199a((C0207y) this);
    this.f1017b.m2111a(this.f1016a);
    c0230t.m1968a(this.f1016a.m2196a(), this);
    View o = c0264i.m2141o();
    if (o != null) {
        c0230t.m1967a(o);
    } else {
        c0230t.m1966a(c0264i.m2140n()).m1969a(c0264i.m2139m());
    }
    c0230t.m1965a((OnKeyListener) this);
    this.f1018c = c0230t.m1970b();
    this.f1018c.setOnDismissListener(this);
    LayoutParams attributes = this.f1018c.getWindow().getAttributes();
    attributes.type = 1003;
    if (iBinder != null) {
        attributes.token = iBinder;
    }
    attributes.flags |= 131072;
    this.f1018c.show();
}
 
Example 3
Project: FMTech   File: PackageWarningSimpleAlertDialog.java   View source code 6 votes vote down vote up
public final Dialog onCreateDialog(Bundle paramBundle)
{
  Dialog localDialog = super.onCreateDialog(paramBundle);
  if (localDialog != null)
  {
    this.packageWarningDialogView = ((PackageWarningDialogView)getConfigurableView());
    this.packageWarningDialogView.setOnContinueAnywayClickListener(this);
    localDialog.setOnKeyListener(new DialogInterface.OnKeyListener()
    {
      public final boolean onKey(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt, KeyEvent paramAnonymousKeyEvent)
      {
        if ((paramAnonymousInt == 4) && (paramAnonymousKeyEvent.getAction() == 1)) {
          PackageWarningSimpleAlertDialog.this.packageWarningDialogView.mResult.putBoolean("pressed_back_button", true);
        }
        return false;
      }
    });
  }
  return localDialog;
}
 
Example 4
Project: libtincent   File: TXAbsActivity.java   View source code 6 votes vote down vote up
/**
 * 显示dialog 并且屏蔽返回按钮
 */
public void showLoadingAndDisableKey() {
	progressDialog.setMessage(getString(R.string.tip_loading));
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME || keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU)) {
				return true;
			}
			return false;
		}
	});
	progressDialog.show();

}
 
Example 5
Project: libtincent   File: TXAbsActivity.java   View source code 6 votes vote down vote up
/**
 * 显示dialog但是返回时,返回上个页面
 */
public void showLoading() {
	progressDialog.setMessage(getString(R.string.tip_loading));
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_BACK) {
				progressDialog.dismiss();
				backPage();
				return true;
			}
			return false;
		}
	});
	progressDialog.show();
}
 
Example 6
Project: libtincent   File: TXAbsActivity.java   View source code 6 votes vote down vote up
/**
 * 显示dialog但是返回时,返回上个页面
 * 
 * @param content
 *            加载显示的内容
 */
public void showLoading(String content) {
	progressDialog.setMessage(content);
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if (keyCode == KeyEvent.KEYCODE_BACK) {
				progressDialog.dismiss();
				backPage();
				return true;
			}
			return false;
		}
	});
	progressDialog.show();
}
 
Example 7
Project: eDao   File: BaseActivity.java   View source code 6 votes vote down vote up
/**
 * 
 * 
 * @Title: showProgressDialog
 * @Description: TODO 显示进度对话框
 * @author 李苜菲
 * @return
 * @return void
 * @throws @date
 *             2015-8-12下午1:23:53
 */
protected void showProgressDialog(String msg) {
	if (progressDialog == null) {
		progressDialog = new ProgressDialog(this);
		progressDialog.setMessage(msg);
		progressDialog.setCanceledOnTouchOutside(false);
	}
	progressDialog.show();
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			// TODO Auto-generated method stub
			if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
				progressDialog.dismiss();
				progressDialog = null;
				Thread thread = HttpUtil.thread;
				HttpUtil.thread = null;
				thread.interrupt();
				finish();
			}
			return false;
		}
	});
}
 
Example 8
Project: MobileAppForPatient   File: SetABPMConfigDialog.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	// TODO Auto-generated method stub
	super.onCreateView(inflater, container, savedInstanceState);
	View view = inflater.inflate(R.layout.set_abpm_config, container, false);
	
	findViews(view);
	setListeners();
	init();
	
	setCancelable(false);
	
	getDialog().setOnKeyListener(new OnKeyListener() {
		
		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if ((keyCode ==  android.view.KeyEvent.KEYCODE_BACK)) {
				if (event.getAction()!=KeyEvent.ACTION_DOWN) {
					mBtnClose.performClick();
					return true;
				}
			}
			
			return false;
		}
	});
	
	return view;
}
 
Example 9
Project: MobileAppForPatient   File: MeterPreferenceDialog.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	super.onCreateView(inflater, container, savedInstanceState);
       View view = inflater.inflate(R.layout.setting_meter, container, false);
       
       findViews(view);
       setListeners();
	
       setCancelable(false);
       mProgress.setIndeterminate(false);
       mProgress.setProgressDrawable(getResources().getDrawable(R.anim.progress));
       mProgress.setIndeterminateDrawable(getResources().getDrawable(R.anim.progress));
       mProgress.setMinimumHeight(20);
       
       getDialog().setOnKeyListener(new OnKeyListener() {
		
		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if ((keyCode ==  android.view.KeyEvent.KEYCODE_BACK)) {
				if (event.getAction()!=KeyEvent.ACTION_DOWN) {
					mBackOnClickListener.onClick(mBack);
					return true;
				}
             }
			
			return false;
		}
	});

       return view;
}
 
Example 10
Project: libtincent   File: TXAbsActivity.java   View source code 5 votes vote down vote up
/**
 * 显示dialog 并且屏蔽返回按钮
 * 
 * @param content
 *            加载显示的内容
 */
public void showLoadingAndDisableKey(String content) {
	progressDialog.setMessage(content);
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME || keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU)) {
				return true;
			}
			return false;
		}
	});
	progressDialog.show();
}
 
Example 11
Project: mpd-control   File: MainApplication.java   View source code 5 votes vote down vote up
private void connectMPD() 
{
	dismissAlertDialog();
	
	if (currentActivity != null) 
	{
           ad = new ProgressDialog(currentActivity);
           ad.setTitle(getResources().getString(R.string.app_connecting));
           ad.setMessage(getResources().getString(R.string.app_connecting_to_server));
           ad.setCancelable(false);
           ad.setOnKeyListener(new OnKeyListener() 
           {
               public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) 
               {
                   return true;
               }
           });
           
           try 
           {
               ad.show();
           }
           catch (BadTokenException e)
           {
           }
       }
	
	cancelDisconnectSheduler();
	
	oMPDAsyncHelper.connect();
}
 
Example 12
Project: JayJayLab-Android-Demo   File: ProgressDialog.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {		
	getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
	getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
       getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
	getDialog().setCancelable(false);
	getDialog().setCanceledOnTouchOutside(false);
	getDialog().setOnKeyListener(new OnKeyListener() {			
		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
			if(keyCode == KeyEvent.KEYCODE_BACK) 
				return true;
			
			return false;
		}
	});

	View view = inflater.inflate(R.layout.progress_bar, container);

       Bundle bundle = getArguments();
       if(bundle != null) {
           int stringResId = bundle.getInt("stringResId", -1);
           if (stringResId != -1) {
               TextView message = (TextView) view.findViewById(R.id.textview);
               message.setText(stringResId);
               message.setVisibility(View.VISIBLE);
           }
       }
	return view;
}
 
Example 13
Project: mpdroid-2014   File: MPDApplication.java   View source code 5 votes vote down vote up
private void connectMPD() {
	// dismiss possible dialog
	dismissAlertDialog();
	
	// show connecting to server dialog
	if (currentActivity != null) {
		ad = new ProgressDialog(currentActivity);
		ad.setTitle(getResources().getString(R.string.connecting));
		ad.setMessage(getResources().getString(R.string.connectingToServer));
		ad.setCancelable(false);
		ad.setOnKeyListener(new OnKeyListener() {
			public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
				// Handle all keys!
				return true;
			}
		});
		try {
			ad.show();
		} catch (BadTokenException e) {
			// Can't display it. Don't care.
		}
	}
	
	cancelDisconnectSheduler();
	
	// really connect
	oMPDAsyncHelper.connect();
}
 
Example 14
Project: Androzic   File: Splash.java   View source code 5 votes vote down vote up
private void showEula()
{
	final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
	boolean hasBeenShown = prefs.getBoolean(getString(R.string.app_eulaaccepted), false);
	if (hasBeenShown == false)
	{
		final SpannableString message = new SpannableString(Html.fromHtml(getString(R.string.app_eula).replace("/n", "<br/>")));
		Linkify.addLinks(message, Linkify.WEB_URLS);

		AlertDialog.Builder builder = new AlertDialog.Builder(this).setTitle(getString(R.string.app_name)).setIcon(R.drawable.icon).setMessage(message)
				.setPositiveButton(android.R.string.ok, new Dialog.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialogInterface, int i)
					{
						prefs.edit().putBoolean(getString(R.string.app_eulaaccepted), true).commit();
						wait = false;
						dialogInterface.dismiss();
					}
				}).setOnKeyListener(new OnKeyListener() {
					@Override
					public boolean onKey(DialogInterface dialoginterface, int keyCode, KeyEvent event)
					{
						return !(keyCode == KeyEvent.KEYCODE_HOME);
					}
				}).setCancelable(false);

		AlertDialog d = builder.create();

		d.show();
		// Make the textview clickable. Must be called after show()
		((TextView) d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
	}
	else
	{
		wait = false;
	}
}
 
Example 15
Project: boohee_v5.6   File: AlertDialog.java   View source code 4 votes vote down vote up
public Builder setOnKeyListener(OnKeyListener onKeyListener) {
    this.P.mOnKeyListener = onKeyListener;
    return this;
}
 
Example 16
Project: solved-hacking-problem   File: C0230t.java   View source code 4 votes vote down vote up
public C0230t m1965a(OnKeyListener onKeyListener) {
    this.f840a.f817r = onKeyListener;
    return this;
}
 
Example 17
Project: solved-hacking-problem   File: C0230t.java   View source code 4 votes vote down vote up
public C0230t m1965a(OnKeyListener onKeyListener) {
    this.f840a.f817r = onKeyListener;
    return this;
}
 
Example 18
Project: MaterialPreference   File: PreferenceDialogBuilder.java   View source code 4 votes vote down vote up
public PreferenceDialogBuilder setOnKeyListener(OnKeyListener onKeyListener) {
    mBuilder.setOnKeyListener(onKeyListener);
    return this;
}
 
Example 19
Project: MaterialPreference   File: PreferenceDialogBuilder.java   View source code 4 votes vote down vote up
public PreferenceDialogBuilder setOnKeyListener(OnKeyListener onKeyListener) {
    mBuilder.setOnKeyListener(onKeyListener);
    return this;
}
 
Example 20
Project: FMTech   File: AlertDialog.java   View source code 4 votes vote down vote up
public final Builder setOnKeyListener(DialogInterface.OnKeyListener paramOnKeyListener)
{
  this.P.mOnKeyListener = paramOnKeyListener;
  return this;
}
 
Example 21
Project: gokit-android   File: GosDeviceControlActivity.java   View source code 4 votes vote down vote up
/**
 * 初始化控件.
 */
private void initViews() {
	tvColorText = (TextView) findViewById(R.id.tvColorText);
	llColor = (LinearLayout) findViewById(R.id.ll_color);
	swRed = (Switch) findViewById(R.id.sw_red);
	swInfrared = (Switch) findViewById(R.id.sw_infrared);
	tvRed = (TextView) findViewById(R.id.tv_red);
	tvGreen = (TextView) findViewById(R.id.tv_green);
	tvBlue = (TextView) findViewById(R.id.tv_blue);
	tvSpeed = (TextView) findViewById(R.id.tv_speed);
	tvTemplate = (TextView) findViewById(R.id.tv_template);
	tvHumidity = (TextView) findViewById(R.id.tv_humidity);
	sbRed = (SeekBar) findViewById(R.id.sb_red);
	sbGreen = (SeekBar) findViewById(R.id.sb_green);
	sbBlue = (SeekBar) findViewById(R.id.sb_blue);
	sbSpeed = (SeekBar) findViewById(R.id.sb_speed);

	redadd = (ImageView) findViewById(R.id.redadd);
	redsub = (ImageView) findViewById(R.id.redsub);
	greenadd = (ImageView) findViewById(R.id.greenadd);
	greensub = (ImageView) findViewById(R.id.greensub);
	blueadd = (ImageView) findViewById(R.id.blueadd);
	bluesub = (ImageView) findViewById(R.id.bluesub);
	speedadd = (ImageView) findViewById(R.id.speedadd);
	speedsub = (ImageView) findViewById(R.id.speedsub);

	String waitingText = (String) getText(R.string.waiting_device_ready);
	setProgressDialog(waitingText, true, false);
	progressDialog.setOnKeyListener(new OnKeyListener() {

		@Override
		public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {

			if (keyCode == KeyEvent.KEYCODE_BACK) {
				if (progressDialog.isShowing()) {
					GosDeviceControlActivity.this.finish();
					return true;
				}
			}

			return false;
		}
	});
}
 
Example 22
Project: UIWidget   File: UIActionSheetView.java   View source code 2 votes vote down vote up
/**
 * 设置监听键盘事件
 *
 * @param listener
 * @return
 */
public UIActionSheetView setOnKeyListener(OnKeyListener listener) {
    dialog.setOnKeyListener(listener);
    return this;
}
 
Example 23
Project: AndroidMaterialPreferences   File: DialogPreference.java   View source code 2 votes vote down vote up
/**
 * Sets the listener, which should be notified, when a key has been dispatched to the
 * preference's dialog.
 *
 * @param listener
 *         The listener, which should be set, as an instance of the type {@link OnKeyListener}
 *         or null, if no listener should be notified
 */
public final void setOnKeyListener(@Nullable final OnKeyListener listener) {
    onKeyListener = listener;
}