Project

General

Profile

« Previous | Next » 

Revision d00b5346

Added by Leszek Koltunski 8 days ago

Initial support for Algorithmic Kilominx verifier and introduction of it into the App.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogSolvers.java
47 47
///////////////////////////////////////////////////////////////////////////////////////////////////
48 48

  
49 49
  public int getResource()            { return R.layout.dialog_scrollable_panes; }
50
  public int getTitleResource()       { return R.string.solver; }
50
  public int getTitleResource()       { return R.string.solvers; }
51 51
  public boolean hasArgument()        { return true; }
52 52
  public int getPositive()            { return -1; }
53 53
  public int getNegative()            { return -1; }
src/main/java/org/distorted/main/MainObjectPopup.java
72 72
    ///////// SOLVER //////////////////////////////////////////////////
73 73
    Button b1 = layout.findViewById(R.id.objectSolver);
74 74

  
75
    if( object!=null && object.hasSolver() )
75
    if( object!=null )
76 76
      {
77
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,levelHeight);
78
      params.setMargins(marginH,marginH,marginH,marginV);
79
      b1.setLayoutParams(params);
80
      b1.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
77
      int numSolvers = object.numSolvers();
81 78

  
82
      b1.setOnClickListener(new View.OnClickListener()
79
      if( numSolvers>0 )
83 80
        {
84
        @Override
85
        public void onClick(View v)
86
          {
87
          mPopup.dismiss();
88
          act.switchToSolver(ordinal);
89
          }
90
        });
81
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,levelHeight);
82
        params.setMargins(marginH,marginH,marginH,marginV);
83
        b1.setLayoutParams(params);
84
        b1.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
91 85

  
92
      firstButtonShown = true;
86
        if( numSolvers>1 ) b1.setText(act.getString(R.string.solvers));
87

  
88
        b1.setOnClickListener(new View.OnClickListener()
89
          {
90
          @Override
91
          public void onClick(View v)
92
            {
93
            mPopup.dismiss();
94
            act.switchToSolver(ordinal);
95
            }
96
          });
97

  
98
        firstButtonShown = true;
99
        }
100
      else b1.setVisibility(GONE);
93 101
      }
94 102
    else b1.setVisibility(GONE);
95 103

  
src/main/java/org/distorted/objects/RubikObject.java
353 353

  
354 354
///////////////////////////////////////////////////////////////////////////////////////////////////
355 355

  
356
  public boolean hasSolver()
356
  public int numSolvers()
357 357
    {
358
    return mSolverOrdinals!=null;
358
    return mSolverOrdinals!=null ? mSolverOrdinals.length : 0;
359 359
    }
360 360

  
361 361
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/solverui/ScreenSolver.java
297 297
        {
298 298
        int[] result = solver.validatePosition(object);
299 299

  
300
        if( result[0]>=0 )
300
        if( result[0]>=0 ) // position is valid
301 301
          {
302 302
          if( solverOrdinals.length==1 ) // just one solver - simply launch it
303 303
            {
src/main/res/layout/popup_menu.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
   android:id="@+id/menuGrid"
4
   android:layout_width="wrap_content"
5
   android:layout_height="wrap_content"
6
   android:gravity="center"
7
   android:orientation="vertical">
8

  
9
   <Button
10
      android:id="@+id/menuStars"
11
      android:text="@string/stars"
12
      android:layout_width="match_parent"
13
      android:layout_height="0dp"
14
      android:layout_weight="1.0"
15
      android:paddingRight="10dp"
16
      android:paddingLeft="10dp"
17
      android:singleLine="true"
18
      android:backgroundTint="?darkC"
19
      android:gravity="center"/>
20

  
21
   <Button
22
      android:id="@+id/menuSolver"
23
      android:text="@string/solver"
24
      android:layout_width="match_parent"
25
      android:layout_height="0dp"
26
      android:layout_weight="1.0"
27
      android:paddingRight="10dp"
28
      android:paddingLeft="10dp"
29
      android:singleLine="true"
30
      android:backgroundTint="?darkC"
31
      android:gravity="center"/>
32

  
33
   <Button
34
      android:id="@+id/menuHighScores"
35
      android:text="@string/scores"
36
      android:layout_width="match_parent"
37
      android:layout_height="0dp"
38
      android:layout_weight="1.0"
39
      android:paddingRight="10dp"
40
      android:paddingLeft="10dp"
41
      android:singleLine="true"
42
      android:backgroundTint="?darkC"
43
      android:gravity="center"/>
44

  
45
   <Button
46
      android:id="@+id/menuPrettyPatterns"
47
      android:text="@string/patterns"
48
      android:layout_width="match_parent"
49
      android:layout_height="0dp"
50
      android:layout_weight="1.0"
51
      android:paddingRight="10dp"
52
      android:paddingLeft="10dp"
53
      android:singleLine="true"
54
      android:backgroundTint="?darkC"
55
      android:gravity="center"/>
56

  
57
   <Button
58
      android:id="@+id/menuTutorials"
59
      android:text="@string/tutorials"
60
      android:layout_width="match_parent"
61
      android:layout_height="0dp"
62
      android:layout_weight="1.0"
63
      android:paddingRight="10dp"
64
      android:paddingLeft="10dp"
65
      android:singleLine="true"
66
      android:backgroundTint="?darkC"
67
      android:gravity="center"/>
68

  
69
   <Button
70
      android:id="@+id/menuBandaged"
71
      android:text="@string/bandaged"
72
      android:layout_width="match_parent"
73
      android:layout_height="0dp"
74
      android:layout_weight="1.0"
75
      android:paddingRight="10dp"
76
      android:paddingLeft="10dp"
77
      android:singleLine="true"
78
      android:backgroundTint="?darkC"
79
      android:gravity="center"/>
80

  
81
   <Button
82
      android:id="@+id/menuNew"
83
      android:text="@string/about"
84
      android:layout_width="match_parent"
85
      android:layout_height="0dp"
86
      android:layout_weight="1.0"
87
      android:paddingRight="10dp"
88
      android:paddingLeft="10dp"
89
      android:singleLine="true"
90
      android:backgroundTint="?darkC"
91
      android:gravity="center"/>
92

  
93
   <TextView
94
       android:id="@+id/menuLevels"
95
       android:layout_width="match_parent"
96
       android:text="@string/levels"
97
       android:layout_height="0dp"
98
       android:layout_weight="0.6"
99
       android:gravity="center"/>
100

  
101
   <LinearLayout
102
        android:layout_width="match_parent"
103
        android:layout_height="0dp"
104
        android:layout_weight="1.0"
105
        android:gravity="center"
106
        android:orientation="horizontal">
107

  
108
        <Button
109
           android:id="@+id/level1"
110
           android:text="@string/level1"
111
           android:layout_width="30dp"
112
           android:layout_height="30dp"
113
           android:paddingRight="10dp"
114
           android:paddingLeft="10dp"
115
           android:backgroundTint="?darkC"/>
116
        <Button
117
           android:id="@+id/level2"
118
           android:text="@string/level2"
119
           android:layout_width="30dp"
120
           android:layout_height="30dp"
121
           android:paddingRight="10dp"
122
           android:paddingLeft="10dp"
123
           android:backgroundTint="?darkC"/>
124
        <Button
125
           android:id="@+id/level3"
126
           android:text="@string/level3"
127
           android:layout_width="30dp"
128
           android:layout_height="30dp"
129
           android:paddingRight="10dp"
130
           android:paddingLeft="10dp"
131
           android:backgroundTint="?darkC"/>
132
   </LinearLayout>
133

  
134
   <LinearLayout
135
        android:layout_width="match_parent"
136
        android:layout_height="0dp"
137
        android:layout_weight="1.0"
138
        android:gravity="center"
139
        android:orientation="horizontal">
140

  
141
        <Button
142
           android:id="@+id/level4"
143
           android:text="@string/level4"
144
           android:layout_width="30dp"
145
           android:layout_height="30dp"
146
           android:paddingRight="10dp"
147
           android:paddingLeft="10dp"
148
           android:backgroundTint="?darkC"/>
149
        <Button
150
           android:id="@+id/level5"
151
           android:text="@string/level5"
152
           android:layout_width="30dp"
153
           android:layout_height="30dp"
154
           android:paddingRight="10dp"
155
           android:paddingLeft="10dp"
156
           android:backgroundTint="?darkC"/>
157
        <Button
158
           android:id="@+id/level6"
159
           android:text="@string/level6"
160
           android:layout_width="30dp"
161
           android:layout_height="30dp"
162
           android:paddingRight="10dp"
163
           android:paddingLeft="10dp"
164
           android:backgroundTint="?darkC"/>
165
   </LinearLayout>
166

  
167
   <LinearLayout
168
        android:layout_width="match_parent"
169
        android:layout_height="0dp"
170
        android:layout_weight="1.0"
171
        android:gravity="center"
172
        android:orientation="horizontal">
173

  
174
        <Button
175
           android:id="@+id/level7"
176
           android:text="@string/level7"
177
           android:layout_width="30dp"
178
           android:layout_height="30dp"
179
           android:paddingRight="10dp"
180
           android:paddingLeft="10dp"
181
           android:backgroundTint="?darkC"/>
182
        <Button
183
           android:id="@+id/level8"
184
           android:text="@string/level8"
185
           android:layout_width="30dp"
186
           android:layout_height="30dp"
187
           android:paddingRight="10dp"
188
           android:paddingLeft="10dp"
189
           android:backgroundTint="?darkC"/>
190
        <Button
191
           android:id="@+id/levelM"
192
           android:text="@string/levelM"
193
           android:layout_width="30dp"
194
           android:layout_height="30dp"
195
           android:paddingRight="10dp"
196
           android:paddingLeft="10dp"
197
           android:backgroundTint="?darkC"/>
198
   </LinearLayout>
199
</LinearLayout>
src/main/res/values-de/strings.xml
47 47
    <string name="no_updates">Nicht gefunden</string>
48 48
    <string name="install">Installieren</string>
49 49
    <string name="abandon_solve">Give up</string>
50
    <string name="use_solver">Benutze</string>
50
    <string name="use_solver">Verwenden</string>
51 51
    <string name="whatsnew">Was gibt\'s Neues</string>
52 52
    <string name="share">Teilen Sie diese App</string>
53 53
    <string name="contact">Kontakt</string>
......
66 66
    <string name="scores">Highscores</string>
67 67
    <string name="patterns">Hübsche Muster</string>
68 68
    <string name="control">Den Würfel steuern</string>
69
    <string name="solver">Löser</string>
69
    <string name="solvers">Löser</string>
70 70
    <string name="tutorials">Tutorials</string>
71 71
    <string name="about">Über die App</string>
72 72
    <string name="bandaged">Bandaged</string>
src/main/res/values-es/strings.xml
47 47
    <string name="no_updates">Extraviado</string>
48 48
    <string name="install">Instalar</string>
49 49
    <string name="abandon_solve">Abandonar</string>
50
    <string name="use_solver">Utilizar</string>
50
    <string name="use_solver">Usar</string>
51 51
    <string name="whatsnew">Qué hay de nuevo</string>
52 52
    <string name="share">Comparte esta app</string>
53 53
    <string name="contact">Contacto</string>
......
66 66
    <string name="scores">Leaderboard</string>
67 67
    <string name="patterns">Patrones</string>
68 68
    <string name="control">Controla el cubo</string>
69
    <string name="solver">Solucionadores</string>
69
    <string name="solvers">Solucionadores</string>
70 70
    <string name="tutorials">Tutoriales</string>
71 71
    <string name="about">Acerca de</string>
72 72
    <string name="bandaged">Bandaged</string>
src/main/res/values-fr/strings.xml
66 66
    <string name="scores">Meilleurs scores</string>
67 67
    <string name="patterns">Jolis motifs</string>
68 68
    <string name="control">Contrôle du cube</string>
69
    <string name="solver">Solveurs</string>
69
    <string name="solvers">Solveurs</string>
70 70
    <string name="tutorials">Tutoriels</string>
71 71
    <string name="about">À propos de</string>
72 72
    <string name="bandaged">Bandaged</string>
src/main/res/values-ja/strings.xml
47 47
    <string name="no_updates">見つかりません</string>
48 48
    <string name="install">インストール</string>
49 49
    <string name="abandon_solve">あきらめる</string>
50
    <string name="use_solver">使用する</string>
50
    <string name="use_solver">使用</string>
51 51
    <string name="whatsnew">新着情報</string>
52 52
    <string name="share">このアプリを共有する</string>
53 53
    <string name="contact">お問い合わせ</string>
......
66 66
    <string name="scores">ハイスコア</string>
67 67
    <string name="patterns">プリティパターン</string>
68 68
    <string name="control">キューブの制御</string>
69
    <string name="solver">ソルバー</string>
69
    <string name="solvers">ソルバー</string>
70 70
    <string name="tutorials">チュートリアル</string>
71 71
    <string name="about">アプリについて</string>
72 72
    <string name="bandaged">包帯</string>
src/main/res/values-ko/strings.xml
66 66
    <string name="scores">고득점</string>
67 67
    <string name="patterns">예쁜 패턴</string>
68 68
    <string name="control">큐브 제어</string>
69
    <string name="solver">솔버</string>
69
    <string name="solvers">솔버</string>
70 70
    <string name="tutorials">튜토리얼</string>
71 71
    <string name="about">정보</string>
72 72
    <string name="bandaged">밴디지</string>
src/main/res/values-pl/strings.xml
66 66
    <string name="scores">Lista najlepszych</string>
67 67
    <string name="patterns">Piękne Wzory</string>
68 68
    <string name="control">Obroty Kostki</string>
69
    <string name="solver">Rozwiązywacze</string>
69
    <string name="solvers">Rozwiązywacze</string>
70 70
    <string name="tutorials">Tutoriale</string>
71 71
    <string name="about">O aplikacji</string>
72 72
    <string name="bandaged">Bandaged</string>
src/main/res/values-ru/strings.xml
47 47
    <string name="no_updates">Не найдено</string>
48 48
    <string name="install">Установите</string>
49 49
    <string name="abandon_solve">Сдаться</string>
50
    <string name="use_solver">Попробуй</string>
50
    <string name="use_solver">Использовай</string>
51 51
    <string name="whatsnew">Новинки</string>
52 52
    <string name="share">Поделись этим</string>
53 53
    <string name="contact">Контакт</string>
......
66 66
    <string name="scores">Высокие баллы</string>
67 67
    <string name="patterns">Красивые узоры</string>
68 68
    <string name="control">Управление кубом</string>
69
    <string name="solver">Решатели</string>
69
    <string name="solvers">Решатели</string>
70 70
    <string name="tutorials">Учебники</string>
71 71
    <string name="about">О нас</string>
72 72
    <string name="bandaged">Бандаж</string>
src/main/res/values-zh-rCN/strings.xml
47 47
    <string name="no_updates">未找到更新</string>
48 48
    <string name="install">安装</string>
49 49
    <string name="abandon_solve">放弃</string>
50
    <string name="use_solver">尝试</string>
50
    <string name="use_solver">使用</string>
51 51
    <string name="whatsnew">新奇事物</string>
52 52
    <string name="share">分享这个应用程序</string>
53 53
    <string name="contact">联系我们</string>
......
66 66
    <string name="scores">高分</string>
67 67
    <string name="patterns">模式</string>
68 68
    <string name="control">控制立方体</string>
69
    <string name="solver">求解器</string>
69
    <string name="solvers">求解器</string>
70 70
    <string name="tutorials">讲解</string>
71 71
    <string name="about">关于</string>
72 72
    <string name="bandaged">捆绑魔方</string>
src/main/res/values-zh-rTW/strings.xml
47 47
    <string name="no_updates">未找到更新</string>
48 48
    <string name="install">安裝</string>
49 49
    <string name="abandon_solve">放棄</string>
50
    <string name="use_solver">嘗試</string>
50
    <string name="use_solver">使用</string>
51 51
    <string name="whatsnew">新奇事物</string>
52 52
    <string name="share">分享這個應用程序</string>
53 53
    <string name="contact">聯繫我們</string>
......
66 66
    <string name="scores">高分</string>
67 67
    <string name="patterns">模式</string>
68 68
    <string name="control">控制立方體</string>
69
    <string name="solver">求解器</string>
69
    <string name="solvers">求解器</string>
70 70
    <string name="tutorials">講解</string>
71 71
    <string name="about">關於</string>
72 72
    <string name="bandaged">捆绑魔方</string>
src/main/res/values/strings.xml
49 49
    <string name="no_updates">No update found</string>
50 50
    <string name="install">Install</string>
51 51
    <string name="abandon_solve">Give up</string>
52
    <string name="use_solver">Try</string>
52
    <string name="use_solver">Use</string>
53 53
    <string name="whatsnew">What\'s new</string>
54 54
    <string name="share">Share this app</string>
55 55
    <string name="contact">Contact us</string>
......
60 60
    <string name="scores">High Scores</string>
61 61
    <string name="patterns">Pretty Patterns</string>
62 62
    <string name="control">Control the Cube</string>
63
    <string name="solver">Solvers</string>
63
    <string name="solvers">Solvers</string>
64 64
    <string name="tutorials">Tutorials</string>
65 65
    <string name="about">About</string>
66 66
    <string name="bandaged">Bandaged</string>

Also available in: Unified diff