OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.DisplayMetrics; | 8 import android.util.DisplayMetrics; |
9 import android.util.Log; | 9 import android.util.Log; |
10 import android.view.MotionEvent; | 10 import android.view.MotionEvent; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } else if (screenSize < 7.0) { | 113 } else if (screenSize < 7.0) { |
114 mChannelDistance = 28f; | 114 mChannelDistance = 28f; |
115 } else { | 115 } else { |
116 mChannelDistance = 34f; | 116 mChannelDistance = 34f; |
117 } | 117 } |
118 mChannelDistance = mChannelDistance * metrics.density; | 118 mChannelDistance = mChannelDistance * metrics.density; |
119 if (mChannelDistance < 16f) mChannelDistance = 16f; | 119 if (mChannelDistance < 16f) mChannelDistance = 16f; |
120 } | 120 } |
121 | 121 |
122 /** | 122 /** |
123 * Resets the snap scroll mode to default. | |
124 */ | |
125 void resetSnapScrollMode() { | |
126 mSnapScrollMode = SNAP_NONE; | |
127 } | |
128 | |
129 /** | |
130 * @return Whether current snap scroll mode is vertical. | 123 * @return Whether current snap scroll mode is vertical. |
131 */ | 124 */ |
132 boolean isSnapVertical() { | 125 boolean isSnapVertical() { |
133 return mSnapScrollMode == SNAP_VERT; | 126 return mSnapScrollMode == SNAP_VERT; |
134 } | 127 } |
135 | 128 |
136 /** | 129 /** |
137 * @return Whether current snap scroll mode is horizontal. | 130 * @return Whether current snap scroll mode is horizontal. |
138 */ | 131 */ |
139 boolean isSnapHorizontal() { | 132 boolean isSnapHorizontal() { |
140 return mSnapScrollMode == SNAP_HORIZ; | 133 return mSnapScrollMode == SNAP_HORIZ; |
141 } | 134 } |
142 | 135 |
143 /** | 136 /** |
144 * @return Whether currently snapping scrolls. | 137 * @return Whether currently snapping scrolls. |
145 */ | 138 */ |
146 boolean isSnappingScrolls() { | 139 boolean isSnappingScrolls() { |
147 return mSnapScrollMode != SNAP_NONE; | 140 return mSnapScrollMode != SNAP_NONE; |
148 } | 141 } |
149 } | 142 } |
OLD | NEW |