Dismiss the soft keybord on page change
Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
Binary file not shown.
@@ -26,8 +26,10 @@ import android.os.PowerManager;
|
|||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
import android.support.v4.view.ViewPager.OnPageChangeListener;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import com.TwentyCodes.android.FindMyCarLib.UI.CustomViewPager;
|
import com.TwentyCodes.android.FindMyCarLib.UI.CustomViewPager;
|
||||||
import com.TwentyCodes.android.FindMyCarLib.UI.fragments.DirectionsListFragment;
|
import com.TwentyCodes.android.FindMyCarLib.UI.fragments.DirectionsListFragment;
|
||||||
@@ -53,7 +55,7 @@ import com.skyhookwireless.wps.WPSReturnCode;
|
|||||||
* This is the Main Activity of FMC Full & Lite
|
* This is the Main Activity of FMC Full & Lite
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
public class Main extends FragmentActivity implements RegistrationCallback, MapFragmentListener, OnDirectionSelectedListener {
|
public class Main extends FragmentActivity implements RegistrationCallback, MapFragmentListener, OnDirectionSelectedListener, OnPageChangeListener {
|
||||||
|
|
||||||
private static final String SPLASH = "splash";
|
private static final String SPLASH = "splash";
|
||||||
private static final String TAG = "Main";
|
private static final String TAG = "Main";
|
||||||
@@ -332,6 +334,8 @@ public class Main extends FragmentActivity implements RegistrationCallback, MapF
|
|||||||
mPager.setCurrentItem(1);
|
mPager.setCurrentItem(1);
|
||||||
mIndicator.setCurrentItem(1);
|
mIndicator.setCurrentItem(1);
|
||||||
mPager.setPagingEnabled(false);
|
mPager.setPagingEnabled(false);
|
||||||
|
|
||||||
|
mIndicator.setOnPageChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -580,5 +584,27 @@ public class Main extends FragmentActivity implements RegistrationCallback, MapF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* called when the pager's page is changed
|
||||||
|
* we use this to dismiss the soft keyboard
|
||||||
|
* (non-Javadoc)
|
||||||
|
* @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrollStateChanged(int)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int arg0) {
|
||||||
|
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(mPager.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||||
|
// unused
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int arg0) {
|
||||||
|
// unused
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user