Android Open Source - joanne Toast Animation Canceler






From Project

Back to project page joanne.

License

The source code is released under:

GNU General Public License

If you think the Android project joanne listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gmail.altakey.joanne.hack;
/*w  ww  .  j  av  a  2s  .  co  m*/
import android.util.Log;
import android.view.WindowManager;
import android.widget.Toast;

import java.lang.reflect.Field;

public class ToastAnimationCanceler {
    private final Toast mToast;

    public ToastAnimationCanceler(final Toast t) {
        mToast = t;
    }

    public void apply() {
        try {
            final Field tnField = mToast.getClass().getDeclaredField("mTN");
            tnField.setAccessible(true);
            final Object TN = tnField.get(mToast);
            final Field paramsField = TN.getClass().getDeclaredField("mParams");
            paramsField.setAccessible(true);
            final WindowManager.LayoutParams params = (WindowManager.LayoutParams)paramsField.get(TN);
            params.windowAnimations = android.R.style.Animation;
            params.flags &= ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        } catch (NoSuchFieldException e) {
            Log.w("TAC", "cannot find TN", e);
        } catch (IllegalAccessException e) {
            Log.w("TAC", "cannot access TN", e);
        }
    }
}




Java Source Code List

com.gmail.altakey.joanne.activity.MainActivity.java
com.gmail.altakey.joanne.activity.SettingsActivity.java
com.gmail.altakey.joanne.fragment.ProcessingDialog.java
com.gmail.altakey.joanne.fragment.WelcomeFragment.java
com.gmail.altakey.joanne.hack.ToastAnimationCanceler.java
com.gmail.altakey.joanne.service.TweetBroadcastService.java
com.gmail.altakey.joanne.service.TwitterAuthService.java
com.gmail.altakey.joanne.util.IdListCoder.java
com.gmail.altakey.joanne.util.UserRelation.java
com.gmail.altakey.joanne.view.OutlinedTextView.java
com.gmail.altakey.joanne.view.RadioProfile.java
com.gmail.altakey.joanne.view.Radio.java
com.gmail.altakey.joanne.view.TweetDisplayBuilder.java
com.gmail.altakey.joanne.view.TweetView.java