Search in sources :

Example 1 with Reachability

use of com.sakebook.android.library.reachability.Reachability in project Reachability by sakebook.

the class CustomAnimationActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_animation);
    ImageView view = new ImageView(this);
    view.setBackgroundResource(R.drawable.custom_button_selector);
    view.setScaleType(ImageView.ScaleType.CENTER);
    mReachability = new Reachability(this);
    mReachability.canTouchableBackView(true);
    mReachability.setBackImageResource(R.drawable.tiles);
    // Should call before makeHoverView!
    mReachability.setHoverView(view, android.R.drawable.ic_partial_secure, android.R.drawable.ic_secure);
    mReachability.makeHoverView(Reachability.Position.CENTER);
    mReachability.setCustomSlideInAnimation(1000, new AnticipateOvershootInterpolator(), fromLeftAnimation());
    mReachability.setCustomSlideOutAnimation(1000, new AnticipateOvershootInterpolator(), toRightAnimation());
    findViewById(R.id.switch_hover).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mReachability.switchHover();
        }
    });
}
Also used : ImageView(android.widget.ImageView) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) ImageView(android.widget.ImageView) View(android.view.View) Reachability(com.sakebook.android.library.reachability.Reachability)

Example 2 with Reachability

use of com.sakebook.android.library.reachability.Reachability in project Reachability by sakebook.

the class MyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    mReachability = new Reachability(this);
    mReachability.setBackImageResource(R.drawable.tiles);
    mReachability.canTouchableBackView(true);
    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mReachability.switchBack();
        }
    });
    findViewById(R.id.fragment).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MyActivity.this, DrawerActivity.class);
            startActivity(intent);
        }
    });
    findViewById(R.id.hover).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MyActivity.this, BackandHoverActivity.class);
            startActivity(intent);
        }
    });
    findViewById(R.id.animation).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MyActivity.this, CustomAnimationActivity.class);
            startActivity(intent);
        }
    });
}
Also used : Intent(android.content.Intent) View(android.view.View) Reachability(com.sakebook.android.library.reachability.Reachability)

Example 3 with Reachability

use of com.sakebook.android.library.reachability.Reachability in project Reachability by sakebook.

the class BackandHoverActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_back_and_hover);
    mReachability = new Reachability(this);
    mReachability.makeHoverView(Reachability.Position.RIGHT);
    findViewById(R.id.switch_hover).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mReachability.switchHover();
        }
    });
    findViewById(R.id.switch_back).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mReachability.switchBack();
        }
    });
}
Also used : View(android.view.View) Reachability(com.sakebook.android.library.reachability.Reachability)

Example 4 with Reachability

use of com.sakebook.android.library.reachability.Reachability in project Reachability by sakebook.

the class NavigationDrawerFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Read in the flag indicating whether or not the user has demonstrated awareness of the
    // drawer. See PREF_USER_LEARNED_DRAWER for details.
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
    if (savedInstanceState != null) {
        mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
        mFromSavedInstanceState = true;
    }
    mReachability = new Reachability(getActivity());
    mReachability.makeHoverView(Reachability.Position.LEFT);
    mReachability.setBackColor(Color.BLACK);
    mReachability.canTouchableBackView(false);
    // Select either the default item (0) or the last selected item.
    selectItem(mCurrentSelectedPosition);
}
Also used : SharedPreferences(android.content.SharedPreferences) Reachability(com.sakebook.android.library.reachability.Reachability)

Aggregations

Reachability (com.sakebook.android.library.reachability.Reachability)4 View (android.view.View)3 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)1 ImageView (android.widget.ImageView)1