Lines Matching defs:layout

114      * Moving the selection within the layout
121 public static boolean moveUp(Spannable text, Layout layout) {
137 int line = layout.getLineForOffset(end);
142 if (layout.getParagraphDirection(line) ==
143 layout.getParagraphDirection(line - 1)) {
144 float h = layout.getPrimaryHorizontal(end);
145 move = layout.getOffsetForHorizontal(line - 1, h);
147 move = layout.getLineStart(line - 1);
162 public static boolean moveDown(Spannable text, Layout layout) {
178 int line = layout.getLineForOffset(end);
180 if (line < layout.getLineCount() - 1) {
183 if (layout.getParagraphDirection(line) ==
184 layout.getParagraphDirection(line + 1)) {
185 float h = layout.getPrimaryHorizontal(end);
186 move = layout.getOffsetForHorizontal(line + 1, h);
188 move = layout.getLineStart(line + 1);
204 public static boolean moveLeft(Spannable text, Layout layout) {
209 setSelection(text, chooseHorizontal(layout, -1, start, end));
212 int to = layout.getOffsetToLeftOf(end);
229 public static boolean moveRight(Spannable text, Layout layout) {
234 setSelection(text, chooseHorizontal(layout, 1, start, end));
237 int to = layout.getOffsetToRightOf(end);
252 public static boolean extendUp(Spannable text, Layout layout) {
254 int line = layout.getLineForOffset(end);
259 if (layout.getParagraphDirection(line) ==
260 layout.getParagraphDirection(line - 1)) {
261 float h = layout.getPrimaryHorizontal(end);
262 move = layout.getOffsetForHorizontal(line - 1, h);
264 move = layout.getLineStart(line - 1);
281 public static boolean extendDown(Spannable text, Layout layout) {
283 int line = layout.getLineForOffset(end);
285 if (line < layout.getLineCount() - 1) {
288 if (layout.getParagraphDirection(line) ==
289 layout.getParagraphDirection(line + 1)) {
290 float h = layout.getPrimaryHorizontal(end);
291 move = layout.getOffsetForHorizontal(line + 1, h);
293 move = layout.getLineStart(line + 1);
310 public static boolean extendLeft(Spannable text, Layout layout) {
312 int to = layout.getOffsetToLeftOf(end);
326 public static boolean extendRight(Spannable text, Layout layout) {
328 int to = layout.getOffsetToRightOf(end);
338 public static boolean extendToLeftEdge(Spannable text, Layout layout) {
339 int where = findEdge(text, layout, -1);
344 public static boolean extendToRightEdge(Spannable text, Layout layout) {
345 int where = findEdge(text, layout, 1);
350 public static boolean moveToLeftEdge(Spannable text, Layout layout) {
351 int where = findEdge(text, layout, -1);
356 public static boolean moveToRightEdge(Spannable text, Layout layout) {
357 int where = findEdge(text, layout, 1);
398 private static int findEdge(Spannable text, Layout layout, int dir) {
400 int line = layout.getLineForOffset(pt);
401 int pdir = layout.getParagraphDirection(line);
404 return layout.getLineStart(line);
406 int end = layout.getLineEnd(line);
408 if (line == layout.getLineCount() - 1)
415 private static int chooseHorizontal(Layout layout, int direction,
417 int line1 = layout.getLineForOffset(off1);
418 int line2 = layout.getLineForOffset(off2);
423 float h1 = layout.getPrimaryHorizontal(off1);
424 float h2 = layout.getPrimaryHorizontal(off2);
448 int line = layout.getLineForOffset(off1);
449 int textdir = layout.getParagraphDirection(line);