List of usage examples for android.os Handler postDelayed
public final boolean postDelayed(Runnable r, long delayMillis)
From source file:com.arquitetaweb.comanda.fragment.ConsumoFragment.java
@SuppressWarnings("unused") private void showFooter(Integer seconds) { Handler handler = null; handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { mQuickReturnView.setTranslationY(0); }//w w w. j av a 2s .co m }, seconds * 1000); }
From source file:org.awokenwell.proximity.ProximitySensorListener.java
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackS=Context The callback id used when calling back into JavaScript. * @return True if the action was valid. * @throws JSONException //from w ww.j a v a2 s. c o m */ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("start")) { this.start(); } else if (action.equals("stop")) { this.stop(); } else if (action.equals("getProximityState")) { // If not running, then this is an async call, so don't worry about waiting if (this.status != ProximitySensorListener.RUNNING) { int r = this.start(); if (r == ProximitySensorListener.ERROR_FAILED_TO_START) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, ProximitySensorListener.ERROR_FAILED_TO_START)); return true; } // Set a timeout callback on the main thread. Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed(new Runnable() { public void run() { ProximitySensorListener.this.timeout(); } }, 2000); } callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getProximity())); } else if (action.equals("enableProximityScreenOff")) { this.enableProximityScreenOff(); } else if (action.equals("disableProximityScreenOff")) { this.disableProximityScreenOff(); } else { // Unsupported action return false; } return true; }
From source file:com.evandroid.musica.activities.MainActivity.java
@Override public void onClick(View view) { if (view == itemLibrary) { changeFragment(new MainFragment()); } else if (view == itemPlaylists) { changeFragment(new PlaylistFragment()); } else if (view == itemQueue) { changeFragment(new QueueFragment()); }//from w w w .j a v a 2 s . c om else if (view == itemNowPlaying) { NavigationUtils.navigateToNowplaying(MainActivity.this, false); } else if (view == itemSettings) { NavigationUtils.navigateToSettings(MainActivity.this); } else if (view == itemAbout) { resideMenu.closeMenu(); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Helpers.showAbout(MainActivity.this); } }, 350); } else if (view == itemHelp) { Intent intent = new Intent(Intent.ACTION_VIEW); Uri data = Uri.parse("mailto:evan7droid@gmail.com"); intent.setData(data); startActivity(intent); } resideMenu.closeMenu(); }
From source file:fr.bde_eseo.eseomega.profile.ViewProfileFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Find layout elements View rootView = inflater.inflate(R.layout.fragment_view_profile, container, false); tvUserName = (TextView) rootView.findViewById(R.id.tvUserName); tvDisconnect = (TextView) rootView.findViewById(R.id.tvDisconnect); imageView = (CircleImageView) rootView.findViewById(R.id.circleView); // Get current profile profile = new UserProfile(); profile.readProfilePromPrefs(getActivity()); //Log.d("PROFILE", profile.getId() + ", " + profile.getPushToken()); userName = profile.getName();//from w w w . j ava 2 s . co m tvUserName.setText(userName); userFirst = profile.getFirstName(); setImageView(); // If user want to change its profile picture, call Intent to gallery imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { verifyStoragePermissions(getActivity()); Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent, INTENT_GALLERY_ID); } }); // If disconnects, reset profile and says bye-bye tvDisconnect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tvDisconnect.setBackgroundColor(0x2fffffff); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { tvDisconnect.setBackgroundColor(0x00ffffff); } }, 500); MaterialDialog mdConfirm = new MaterialDialog.Builder(getActivity()).title("Dconnexion") .content("Hey, " + userFirst + ", en tes-vous vraiment sr ?\nVous ne pourrez plus accder nos services (et a, c'est dommage).") .positiveText("Oui, au revoir").negativeText("Non, je reste").cancelable(false) .callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { super.onPositive(dialog); AsyncDisconnect asyncDisconnect = new AsyncDisconnect(getActivity(), profile); asyncDisconnect.execute(profile); /* materialDialog = new MaterialDialog.Builder(getActivity()) .title("Au revoir, " + userFirst + ".") .content("Votre profil a t dconnect de nos services.") .negativeText("Fermer") .cancelable(false) .iconRes(R.drawable.ic_oppress) .limitIconToDefaultSize() .show();*/ } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); Toast.makeText(getActivity(), "Vous avez fait le bon choix.", Toast.LENGTH_SHORT) .show(); } }).iconRes(R.drawable.ic_devil).limitIconToDefaultSize().show(); } }); return rootView; }
From source file:com.dmitrymalkovich.android.githubanalytics.traffic.TrafficFragment.java
@Override public void onResume() { super.onResume(); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override//from w ww . ja va 2 s . com public void run() { mChartViews.requestLayout(); mChartClones.requestLayout(); } }, 50); }
From source file:angeloid.dreamnarae.Delete_Main.java
private void DialogProgress2(boolean close) { if (!close) { dialog_delete2 = ProgressDialog.show(getActivity(), "", "Loading..", true); Handler mHandler2 = new Handler(); mHandler2.postDelayed(new Runnable() { @Override/* w ww. j ava2 s. c om*/ public void run() { DialogProgress2(true); // . Delete_Helper2.instantExec_delete2(getActivity(), "busybox mount -o rw,remount /system ; "); StringBuilder delete2 = new StringBuilder(); try { Thread.sleep(2000); // Mount rw /system delete2.append("mount -o rw,remount /system;"); // Delete Flag Files delete2.append("rm /system/SPiCa;"); delete2.append("rm /system/DN;"); delete2.append("rm /system/Miracle;"); delete2.append("rm /system/Save;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_spica;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_save;"); delete2.append("rm /system/etc/init.d/98banner_dreamnarae_prev;"); delete2.append("rm /system/98banner_dreamnarae_spica;"); delete2.append("rm /system/98banner_dreamnarae_miracle;"); delete2.append("rm /system/98banner_dreamnarae_save;"); delete2.append("rm /system/98banner_dreamnarae_prev;"); // Delete old Script Manager Files delete2.append("rm /system/bin/EnableDN.sh;"); delete2.append("rm /data/DNEnable;"); delete2.append("rm /system/bin/RemoveDN.sh;"); delete2.append("rm /data/DNMiracle.sh;"); delete2.append("rm /data/DNSPiCa.sh;"); delete2.append("rm /data/DNSave.sh;"); delete2.append("rm /data/DNPrev.sh;"); // Delete New Script Manager Files delete2.append("rm /system/etc/install-recovery.sh;"); // Delete DreamNarae SPiCa delete2.append("rm /system/etc/init.d/00prop;"); delete2.append("rm /system/etc/init.d/01io;"); delete2.append("rm /system/etc/init.d/02freq;"); delete2.append("rm /system/etc/init.d/03zipalign;"); delete2.append("rm /system/etc/init.d/01kswapd0;"); delete2.append("rm /system/etc/init.d/02io;"); delete2.append("rm /system/etc/init.d/03freq;"); delete2.append("rm /system/etc/init.d/04zipalign;"); delete2.append("rm /system/angeloidteam/dreamnarae/00prop;"); delete2.append("rm /system/angeloidteam/dreamnarae/01io;"); delete2.append("rm /system/angeloidteam/dreamnarae/02freq;"); //Delete DreamNarae Miracle delete2.append("rm /system/etc/init.d/00set;"); delete2.append("rm /system/etc/init.d/01property;"); delete2.append("rm /system/etc/init.d/02vsls;"); delete2.append("rm /system/etc/init.d/03dch;"); delete2.append("rm /system/etc/init.d/04zip;"); delete2.append("rm /system/angeloidteam/dreamnarae/00set;"); delete2.append("rm /system/angeloidteam/dreamnarae/01property;"); delete2.append("rm /system/angeloidteam/dreamnarae/02vsls;"); delete2.append("rm /system/angeloidteam/dreamnarae/03dch;"); //Delete DreamNarae Save delete2.append("rm /system/etc/init.d/00sp;"); delete2.append("rm /system/etc/init.d/01v;"); delete2.append("rm /system/etc/init.d/02deep;"); delete2.append("rm /system/etc/init.d/03zip;"); delete2.append("rm /system/angeloidteam/dreamnarae/00sp;"); delete2.append("rm /system/angeloidteam/dreamnarae/01v;"); delete2.append("rm /system/angeloidteam/dreamnarae/02deep;"); // Delete DreamNarae Prev delete2.append("rm /system/etc/init.d/00proppv;"); delete2.append("rm /system/etc/init.d/01kswapd0pv;"); delete2.append("rm /system/etc/init.d/02iopv;"); delete2.append("rm /system/etc/init.d/03freqpv;"); delete2.append("rm /system/etc/init.d/04zippv;"); delete2.append("rm /system/etc/init.d/01iopv;"); delete2.append("rm /system/etc/init.d/02freqpv;"); delete2.append("rm /system/angeloidteam/dreamnarae/00propv;"); delete2.append("rm /system/angeloidteam/dreamnarae/01iopv;"); delete2.append("rm /system/angeloidteam/dreamnarae/02freqpv;"); // Mount ro /system delete2.append("busybox mount -o ro,remount /system;"); try { Thread.sleep(3000); Delete_Helper2.instantExec_delete2(getActivity(), delete2.toString()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 15000); } else { dialog_delete2.dismiss(); // DialogProgress(true) ,false } }
From source file:angeloid.dreamnarae.Delete_Main.java
private void DialogProgress(boolean close) { if (!close) { dialog_delete = ProgressDialog.show(getActivity(), "", "Loading..", true); Handler mHandler = new Handler(); mHandler.postDelayed(new Runnable() { @Override/* w w w . j av a2 s .c o m*/ public void run() { DialogProgress(true); // . Delete_Helper.instantExec_delete(getActivity(), "busybox mount -o rw,remount /system ; "); StringBuilder delete = new StringBuilder(); try { Thread.sleep(2000); // Mount rw /system delete.append("mount -o rw,remount /system;"); // Delete Flag Files delete.append("rm /system/SPiCa;"); delete.append("rm /system/DN;"); delete.append("rm /system/Miracle;"); delete.append("rm /system/Save;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_spica;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_miracle;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_save;"); delete.append("rm /system/etc/init.d/98banner_dreamnarae_prev;"); delete.append("rm /system/98banner_dreamnarae_spica;"); delete.append("rm /system/98banner_dreamnarae_miracle;"); delete.append("rm /system/98banner_dreamnarae_save;"); delete.append("rm /system/98banner_dreamnarae_prev;"); // Delete old Script Manager Files delete.append("rm /system/bin/EnableDN.sh;"); delete.append("rm /data/DNEnable;"); delete.append("rm /system/bin/RemoveDN.sh;"); delete.append("rm /data/DNMiracle.sh;"); delete.append("rm /data/DNSPiCa.sh;"); delete.append("rm /data/DNSave.sh;"); delete.append("rm /data/DNPrev.sh;"); // Delete New Script Manager Files delete.append("rm /system/etc/install-recovery.sh;"); // Delete DreamNarae SPiCa delete.append("rm /system/etc/init.d/00prop;"); delete.append("rm /system/etc/init.d/01io;"); delete.append("rm /system/etc/init.d/02freq;"); delete.append("rm /system/etc/init.d/03zipalign;"); delete.append("rm /system/etc/init.d/01kswapd0;"); delete.append("rm /system/etc/init.d/02io;"); delete.append("rm /system/etc/init.d/03freq;"); delete.append("rm /system/etc/init.d/04zipalign;"); delete.append("rm /system/angeloidteam/dreamnarae/00prop;"); delete.append("rm /system/angeloidteam/dreamnarae/01io;"); delete.append("rm /system/angeloidteam/dreamnarae/02freq;"); //Delete DreamNarae Miracle delete.append("rm /system/etc/init.d/00set;"); delete.append("rm /system/etc/init.d/01property;"); delete.append("rm /system/etc/init.d/02vsls;"); delete.append("rm /system/etc/init.d/03dch;"); delete.append("rm /system/etc/init.d/04zip;"); delete.append("rm /system/angeloidteam/dreamnarae/00set;"); delete.append("rm /system/angeloidteam/dreamnarae/01property;"); delete.append("rm /system/angeloidteam/dreamnarae/02vsls;"); delete.append("rm /system/angeloidteam/dreamnarae/03dch;"); //Delete DreamNarae Save delete.append("rm /system/etc/init.d/00sp;"); delete.append("rm /system/etc/init.d/01v;"); delete.append("rm /system/etc/init.d/02deep;"); delete.append("rm /system/etc/init.d/03zip;"); delete.append("rm /system/angeloidteam/dreamnarae/00sp;"); delete.append("rm /system/angeloidteam/dreamnarae/01v;"); delete.append("rm /system/angeloidteam/dreamnarae/02deep;"); // Delete DreamNarae Prev delete.append("rm /system/etc/init.d/00proppv;"); delete.append("rm /system/etc/init.d/01kswapd0pv;"); delete.append("rm /system/etc/init.d/02iopv;"); delete.append("rm /system/etc/init.d/03freqpv;"); delete.append("rm /system/etc/init.d/04zippv;"); delete.append("rm /system/etc/init.d/01iopv;"); delete.append("rm /system/etc/init.d/02freqpv;"); delete.append("rm /system/angeloidteam/dreamnarae/00propv;"); delete.append("rm /system/angeloidteam/dreamnarae/01iopv;"); delete.append("rm /system/angeloidteam/dreamnarae/02freqpv;"); // Mount ro /system delete.append("busybox mount -o ro,remount /system;"); // Reboot device(Only to Progress1) delete.append("reboot;"); try { Thread.sleep(3000); Delete_Helper.instantExec_delete(getActivity(), delete.toString()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 10000); } else { dialog_delete.dismiss(); // DialogProgress(true) ,false } }
From source file:com.citrus.sample.UserManagementFragment.java
private void modifyLinkUserExtendedUi(LinkUserExtendedResponse linkUserExtendedResponse) { LinkUserSignInType linkUserSignInType = linkUserExtendedResponse.getLinkUserSignInType(); if (linkUserSignInType != LinkUserSignInType.None) { String linkUserMessage = linkUserExtendedResponse.getLinkUserMessage(); textMessage.setText(linkUserMessage); btnSignIn.setVisibility(View.VISIBLE); btnLinkUser.setVisibility(View.GONE); editOtp.setVisibility(View.VISIBLE); editPassword.setVisibility(View.VISIBLE); btnResend.setVisibility(View.VISIBLE); editEmailId.setEnabled(false);/* www . j av a2s . c om*/ editEmailId.setHint(""); editMobileNo.setEnabled(false); if (TextUtils.isEmpty(editEmailId.getText().toString())) { btnResetPassword.setVisibility(View.INVISIBLE); } Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { btnResend.setClickable(true); btnResend.setEnabled(true); } }, RESEND_TIMER); switch (linkUserSignInType) { case SignInTypeMOtpOrPassword: // Show Mobile otp and password sign in screen editOtp.setHint("Mobile OTP"); rootView.findViewById(R.id.oRTextViewId).setVisibility(View.VISIBLE); break; case SignInTypeMOtp: // Show Mobile otp sign in screen editOtp.setHint("Mobile OTP"); editPassword.setVisibility(View.GONE); break; case SignInTypeEOtpOrPassword: // Show Email otp and password sign in screen editOtp.setHint("Email OTP"); rootView.findViewById(R.id.oRTextViewId).setVisibility(View.VISIBLE); break; case SignInTypeEOtp: // Show Email otp sign in screen editOtp.setHint("Email OTP"); editPassword.setVisibility(View.GONE); break; default: break; } } }
From source file:com.supremainc.biostar2.LoginActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); mUserDataProvider = UserDataProvider.getInstance(getApplicationContext()); mUserDataProvider.init(getApplicationContext()); //app once init mLayout = new LoginActivityLayout(this, mLoginActivityLayoutEvent); mLayout.initView();/*ww w . j a v a 2 s .com*/ initCrashReport(); initValue(); checkNotificationStart(); registerBroadcast(); if (mUserDataProvider.isLogined()) { mUserDataProvider.simpleLogin(mLoginListener, mSimpleLoginErrorListener, null); } else { Handler handler = new Handler(); handler.removeCallbacks(mSplash); handler.postDelayed(mSplash, 1000); } }
From source file:com.dwdesign.tweetings.fragment.MentionsFragment.java
@Override public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { super.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount); if (firstVisibleItem == 0 && !isReadTrackingSuspended) { Intent intent = new Intent(BROADCAST_TABS_READ_TWEETS); intent.putExtra(INTENT_KEY_UPDATE_TAB, TAB_MENTIONS); mActivity.sendBroadcast(intent); } else if (firstVisibleItem > 0 && isReadTrackingSuspended) { final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override/*from ww w .j a va2 s .com*/ public void run() { isReadTrackingSuspended = false; } }, 500); } }