21
21
import android .annotation .SuppressLint ;
22
22
import android .annotation .TargetApi ;
23
23
import android .content .Context ;
24
+ import android .content .res .Configuration ;
24
25
import android .content .res .Resources ;
25
26
import android .graphics .Typeface ;
26
27
import android .os .Build .VERSION ;
@@ -60,7 +61,7 @@ public class Composition extends AppCompatTextView {
60
61
private Integer key_back_color ;
61
62
private Typeface tfText , tfLabel , tfCandidate , tfComment ;
62
63
private final int [] composition_pos = new int [2 ];
63
- private int max_length , sticky_lines ;
64
+ private int max_length , sticky_lines , sticky_lines_land ;
64
65
private int max_entries = Candidate .getMaxCandidateCount ();
65
66
private boolean candidate_use_cursor , show_comment ;
66
67
private int highlightIndex ;
@@ -261,6 +262,7 @@ public void reset(Context context) {
261
262
setPadding (margin_x , margin_y , margin_x , margin_bottom );
262
263
max_length = config .getInt ("layout/max_length" );
263
264
sticky_lines = config .getInt ("layout/sticky_lines" );
265
+ sticky_lines_land = config .getInt ("layout/sticky_lines_land" );
264
266
movable = config .getString ("layout/movable" );
265
267
all_phrases = config .getBoolean ("layout/all_phrases" );
266
268
tfLabel = config .getFont ("label_font" );
@@ -366,6 +368,12 @@ private void appendCandidates(Map<?, ?> m, int length, int end_num) {
366
368
String line = Config .getString (m , "sep" );
367
369
368
370
int line_length = 0 ;
371
+ int sticky_lines_now = sticky_lines ;
372
+ if (getResources ().getConfiguration ().orientation == Configuration .ORIENTATION_LANDSCAPE ) {
373
+ sticky_lines_now = sticky_lines_land ;
374
+ }
375
+ // Timber.d("sticky_lines_now = %d", sticky_lines_now);
376
+
369
377
String [] labels = Rime .getSelectLabels ();
370
378
int i = -1 ;
371
379
candidate_num = 0 ;
@@ -384,7 +392,7 @@ private void appendCandidates(Map<?, ?> m, int length, int end_num) {
384
392
final String line_sep ;
385
393
if (candidate_num == 0 ) {
386
394
line_sep = sep ;
387
- } else if ((sticky_lines > 0 && sticky_lines >= i )
395
+ } else if ((sticky_lines_now > 0 && sticky_lines_now >= i )
388
396
|| (max_length > 0 && line_length + cand .length () > max_length )) {
389
397
line_sep = "\n " ;
390
398
line_length = 0 ;
0 commit comments