Search in sources :

Example 11 with SuperToast

use of com.github.johnpersano.supertoasts.SuperToast in project MaterialCalendar by Haoxiqiang.

the class MessageToast method show.

public static void show(String msg, int style) {
    SuperToast superToast = SuperToast.create(MainApplication.getApplication(), msg, SuperToast.Duration.SHORT);
    TextView superToastTextView = superToast.getTextView();
    superToastTextView.setGravity(Gravity.CENTER_HORIZONTAL);
    superToastTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    superToast.setBackground(style);
    superToast.setAnimations(SuperToast.Animations.FADE);
    superToast.show();
}
Also used : SuperToast(com.github.johnpersano.supertoasts.SuperToast) TextView(android.widget.TextView)

Example 12 with SuperToast

use of com.github.johnpersano.supertoasts.SuperToast in project CoCoin by Nightonke.

the class EditPasswordActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_password);
    overridePendingTransition(R.anim.trans_left_in, R.anim.trans_left_out);
    mContext = this;
    int currentapiVersion = Build.VERSION.SDK_INT;
    if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
        // Do something for lollipop and above versions
        Window window = this.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
    } else {
    // do something for phones running an SDK before lollipop
    }
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    try {
        Interpolator sInterpolator = new AccelerateInterpolator();
        Field mScroller;
        mScroller = ViewPager.class.getDeclaredField("mScroller");
        mScroller.setAccessible(true);
        FixedSpeedScroller scroller = new FixedSpeedScroller(viewPager.getContext(), sInterpolator);
        scroller.setmDuration(1000);
        mScroller.set(viewPager, scroller);
    } catch (NoSuchFieldException e) {
    } catch (IllegalArgumentException e) {
    } catch (IllegalAccessException e) {
    }
    adapter = new PasswordChangeFragmentAdapter(getSupportFragmentManager());
    viewPager.setOffscreenPageLimit(3);
    viewPager.setScrollBarFadeDuration(1000);
    viewPager.setAdapter(adapter);
    myGridView = (MyGridView) findViewById(R.id.gridview);
    myGridViewAdapter = new PasswordChangeButtonGridViewAdapter(this);
    myGridView.setAdapter(myGridViewAdapter);
    myGridView.setOnItemClickListener(gridViewClickListener);
    myGridView.setOnItemLongClickListener(gridViewLongClickListener);
    myGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            myGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            View lastChild = myGridView.getChildAt(myGridView.getChildCount() - 1);
            myGridView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, lastChild.getBottom()));
        }
    });
    back = (MaterialIconView) findViewById(R.id.back);
    back.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    superToast = new SuperToast(this);
    title = (TextView) findViewById(R.id.title);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    if (SettingManager.getInstance().getFirstTime()) {
        title.setText(mContext.getResources().getString(R.string.app_name));
    } else {
        title.setText(mContext.getResources().getString(R.string.change_password));
    }
}
Also used : Window(android.view.Window) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) FixedSpeedScroller(com.nightonke.saver.ui.FixedSpeedScroller) SuperToast(com.github.johnpersano.supertoasts.SuperToast) ViewPager(android.support.v4.view.ViewPager) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) PasswordChangeButtonGridViewAdapter(com.nightonke.saver.adapter.PasswordChangeButtonGridViewAdapter) Field(java.lang.reflect.Field) PasswordChangeFragmentAdapter(com.nightonke.saver.adapter.PasswordChangeFragmentAdapter) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) Interpolator(android.view.animation.Interpolator) ViewTreeObserver(android.view.ViewTreeObserver)

Example 13 with SuperToast

use of com.github.johnpersano.supertoasts.SuperToast in project CoCoin by Nightonke.

the class SetPasswordActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_password);
    overridePendingTransition(R.anim.trans_left_in, R.anim.trans_left_out);
    mContext = this;
    int currentapiVersion = Build.VERSION.SDK_INT;
    if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
        // Do something for lollipop and above versions
        Window window = this.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
    } else {
    // do something for phones running an SDK before lollipop
    }
    viewPager = (ViewPager) findViewById(R.id.viewpager);
    try {
        Interpolator sInterpolator = new AccelerateInterpolator();
        Field mScroller;
        mScroller = ViewPager.class.getDeclaredField("mScroller");
        mScroller.setAccessible(true);
        FixedSpeedScroller scroller = new FixedSpeedScroller(viewPager.getContext(), sInterpolator);
        scroller.setmDuration(1000);
        mScroller.set(viewPager, scroller);
    } catch (NoSuchFieldException e) {
    } catch (IllegalArgumentException e) {
    } catch (IllegalAccessException e) {
    }
    passwordAdapter = new PasswordChangeFragmentAdapter(getSupportFragmentManager());
    viewPager.setOffscreenPageLimit(2);
    viewPager.setScrollBarFadeDuration(1000);
    viewPager.setAdapter(passwordAdapter);
    myGridView = (MyGridView) findViewById(R.id.gridview);
    myGridViewAdapter = new PasswordChangeButtonGridViewAdapter(this);
    myGridView.setAdapter(myGridViewAdapter);
    myGridView.setOnItemClickListener(gridViewClickListener);
    myGridView.setOnItemLongClickListener(gridViewLongClickListener);
    myGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            myGridView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            View lastChild = myGridView.getChildAt(myGridView.getChildCount() - 1);
            myGridView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, lastChild.getBottom()));
        }
    });
    back = (MaterialIconView) findViewById(R.id.back);
    back.setVisibility(View.INVISIBLE);
    superToast = new SuperToast(this);
    title = (TextView) findViewById(R.id.title);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    if (SettingManager.getInstance().getFirstTime()) {
        title.setText(mContext.getResources().getString(R.string.app_name));
    } else {
        title.setText(mContext.getResources().getString(R.string.change_password));
    }
}
Also used : Window(android.view.Window) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) FixedSpeedScroller(com.nightonke.saver.ui.FixedSpeedScroller) SuperToast(com.github.johnpersano.supertoasts.SuperToast) ViewPager(android.support.v4.view.ViewPager) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) PasswordChangeButtonGridViewAdapter(com.nightonke.saver.adapter.PasswordChangeButtonGridViewAdapter) Field(java.lang.reflect.Field) PasswordChangeFragmentAdapter(com.nightonke.saver.adapter.PasswordChangeFragmentAdapter) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) Interpolator(android.view.animation.Interpolator) ViewTreeObserver(android.view.ViewTreeObserver)

Example 14 with SuperToast

use of com.github.johnpersano.supertoasts.SuperToast in project CoCoin by Nightonke.

the class CustomViewFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = getContext();
    superToast = new SuperToast(mContext);
    superToast.setAnimations(SuperToast.Animations.POPUP);
    superToast.setDuration(SuperToast.Duration.SHORT);
    superToast.setTextColor(Color.parseColor("#ffffff"));
    superToast.setTextSize(SuperToast.TextSize.SMALL);
    superToast.setBackground(SuperToast.Background.RED);
    superToast.getTextView().setTypeface(CoCoinUtil.typefaceLatoLight);
}
Also used : SuperToast(com.github.johnpersano.supertoasts.SuperToast)

Example 15 with SuperToast

use of com.github.johnpersano.supertoasts.SuperToast in project CoCoin by Nightonke.

the class CoCoinToast method showToast.

public void showToast(int text, int color) {
    SuperToast.cancelAllSuperToasts();
    SuperToast superToast = new SuperToast(CoCoinApplication.getAppContext());
    superToast.setAnimations(CoCoinUtil.TOAST_ANIMATION);
    superToast.setDuration(SuperToast.Duration.SHORT);
    superToast.setTextColor(Color.parseColor("#ffffff"));
    superToast.setTextSize(SuperToast.TextSize.SMALL);
    superToast.setText(CoCoinApplication.getAppContext().getResources().getString(text));
    superToast.setBackground(color);
    superToast.getTextView().setTypeface(CoCoinUtil.typefaceLatoLight);
    superToast.show();
}
Also used : SuperToast(com.github.johnpersano.supertoasts.SuperToast)

Aggregations

SuperToast (com.github.johnpersano.supertoasts.SuperToast)15 ViewPager (android.support.v4.view.ViewPager)5 View (android.view.View)5 ViewTreeObserver (android.view.ViewTreeObserver)5 AdapterView (android.widget.AdapterView)5 TextView (android.widget.TextView)5 MyGridView (com.nightonke.saver.ui.MyGridView)5 Window (android.view.Window)4 PasswordChangeButtonGridViewAdapter (com.nightonke.saver.adapter.PasswordChangeButtonGridViewAdapter)3 PasswordChangeFragmentAdapter (com.nightonke.saver.adapter.PasswordChangeFragmentAdapter)3 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 Interpolator (android.view.animation.Interpolator)2 RelativeLayout (android.widget.RelativeLayout)2 ButtonGridViewAdapter (com.nightonke.saver.adapter.ButtonGridViewAdapter)2 EditMoneyRemarkFragmentAdapter (com.nightonke.saver.adapter.EditMoneyRemarkFragmentAdapter)2 TagChooseFragmentAdapter (com.nightonke.saver.adapter.TagChooseFragmentAdapter)2 CoCoinScrollableViewPager (com.nightonke.saver.ui.CoCoinScrollableViewPager)2 FixedSpeedScroller (com.nightonke.saver.ui.FixedSpeedScroller)2 Field (java.lang.reflect.Field)2 MaterialIconView (net.steamcrafted.materialiconlib.MaterialIconView)2