Project

General

Profile

« Previous | Next » 

Revision 8021e4bb

Added by Leszek Koltunski about 4 years ago

- new tutorials
- fix youtube playback

View differences:

src/main/java/org/distorted/tutorial/TutorialList.java
28 28
  CUBE2 ( ObjectList.CUBE, 2,
29 29
          new String[][] {
30 30
                          {"gb","rJlh5p2wAKA","How to Solve a 2x2 Rubik's Cube","Z3"},
31
                          {"es","f85wqJTIDlw","Resolver cubo de Rubik 2X2","Cuby"},
32
                          {"ru","azC6P3VYFkc","КАК СОБРАТЬ КУБИК РУБИКА 2Х2","Евгений Бондаренко"},
33
                          {"fr","qMIB7dYOrHw","Comment résoudre le rubik's cube 2x2","Valentino Cube"},
34
                          {"pl","haNWdAYWGsY","Jak ułożyć: 2x2x2 (podstawy)","DżoDżo"},
31 35
                         }
32 36
        ),
33 37

  
34 38
  CUBE3 ( ObjectList.CUBE, 3,
35 39
          new String[][] {
36 40
                          {"gb","-8ohoCKN0Zw","How to Solve a Rubik's Cube","Z3"},
41
                          {"es","GyY0OxDk5lI","Resolver cubo de Rubik 3x3","Cuby"},
42
                          {"ru","5S2eq81FRzI","КАК СОБРАТЬ КУБИК РУБИКА","Евгений Бондаренко"},
37 43
                          {"pl","cBU9Y729nQM","Jak ułożyć kostkę Rubika 3x3x3","DżoDżo"},
38 44
                         }
39 45
        ),
......
41 47
  CUBE4 ( ObjectList.CUBE, 4,
42 48
          new String[][] {
43 49
                          {"gb","RR77Md71Ymc","How to Solve the 4x4 Rubik's Cube","Z3"},
50
                          {"es","d_4xk1r9hxU","Resolver cubo de Rubik 4x4","Cuby"},
51
                          {"ru","aQNVZlWpqXw","Как собрать кубик рубика 4х4","Евгений Бондаренко"},
52
                          {"pl","LiUxNsowXiI","Jak ułożyć kostkę 4x4x4","DżoDżo"},
44 53
                         }
45 54
        ),
46 55

  
47 56
  CUBE5 ( ObjectList.CUBE, 5,
48 57
          new String[][] {
49 58
                          {"gb","zMkNkXHzQts","How to Solve the 5x5 Rubik's Cube","Z3"},
59
                          {"es","6uaq-xfFs98","Resolver cubo de Rubik 5x5","Cuby"},
60
                          {"pl","ERsPyWOF7mg","Jak ułożyć kostkę 5x5x5","DżoDżo"},
50 61
                         }
51 62
        ),
52 63

  
53 64
  PYRA3 ( ObjectList.PYRA, 3,
54 65
          new String[][] {
55 66
                          {"gb","xIQtn2qazvg","Pyraminx Layer By Layer","Z3"},
67
                          {"es","4cJJe9RAzAU","Resolver Pyraminx","Cuby"},
68
                          {"ru","F4_bhfWyVRQ","КАК СОБРАТЬ ПИРАМИДКУ","Евгений Бондаренко"},
69
                          {"fr","Z2h1YI6jPes","Comment résoudre le Pyraminx","ValentinoCube"},
70
                          {"pl","uNpKpJfAa5I","Jak ułożyć: Pyraminx","DżoDżo"},
56 71
                         }
57 72
        ),
58 73

  
59 74
  PYRA4 ( ObjectList.PYRA, 4,
60 75
          new String[][] {
61 76
                          {"gb","tGQDqDcSa6U","How to Solve the Master (4x4) Pyraminx","Z3"},
77
                          {"es","74PIPm9-uPg","Resolver MASTER PYRAMINX 4x4","Cuby"},
78
                          {"pl","EamwvhmHC7Q","4x4 (Master) Pyraminx PL","MrUk"},
62 79
                         }
63 80
        ),
64 81

  
65 82
  PYRA5 ( ObjectList.PYRA, 5,
66 83
          new String[][] {
67 84
                          {"gb","2nsPEECDdN0","Professor Pyraminx Solve","RedKB"},
85
                          {"es","cSDj8OQK3TU","Tutorial del Professor Pyraminx","QBAndo"},
86
                          {"ru","gMp1tbDyDWg","Как собрать Professor Pyraminx","RBcuber"},
68 87
                         }
69 88
        ),
70 89

  
71 90
  DIAM2 ( ObjectList.DIAM, 2,
72 91
          new String[][] {
73 92
                          {"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
93
                          {"ru","k8B6RFcNoGw","Как собрать Skewb Diamond","Алексей Ярыгин"},
94
                          {"fr","tqbkgwNcZCE","Comment résoudre le Skewb Diamond","Valentino Cube"},
95
                          {"pl","61_Z4TpLMBc","Diamond skewb TUTORIAL PL","MrUk"},
74 96
                         }
75 97
        ),
76 98

  
77 99
  DINO3 ( ObjectList.DINO, 3,
78 100
          new String[][] {
79 101
                          {"gb","puTJZqFBQwo","Dino Skewb Cube Tutorial","Bearded Cubing"},
102
                          {"es","6o1Yo5iCxvI","Resolver CUBO DINO","Cuby"},
103
                          {"fr","hNkpte7Mesc","Comment résoudre le Dino Cube","Valentino Cube"},
104
                          {"pl","o05DYu8UMio","Dino cube TUTORIAL PL","MrUk"},
80 105
                         }
81 106
        ),
82 107

  
83 108
  REDI3 ( ObjectList.REDI, 3,
84 109
          new String[][] {
85 110
                          {"gb","Qn7TJED6O-4","How to Solve the MoYu Redi Cube","Z3"},
111
                          {"es","g0M38Aotgac","Resolver REDI CUBE","Cuby"},
112
                          {"fr","zw7UZcqqsgA","Comment résoudre le Redi Cube","ValentinoCube"},
113
                          {"pl","vxo3lXMsWQI","Jak ułożyć redi cube?","DJ rubiks"},
86 114
                         }
87 115
        ),
88 116

  
89 117
  HELI3 ( ObjectList.HELI, 3,
90 118
          new String[][] {
91 119
                          {"gb","-suwJpd_PO8","Helicopter Cube Tutorial","Bearded Cubing"},
120
                          {"es","DWG9n_YyGPA","Resolver HELICOPTER CUBE","Cuby"},
121
                          {"pl","zoBZame4gFo","Helicopter cube TUTORIAL PL","MrUk"},
92 122
                         }
93 123
        ),
94 124

  
95 125
  SKEW2 ( ObjectList.SKEW, 2,
96 126
          new String[][] {
97 127
                          {"gb","I6132yshkeU","How to Solve the Skewb","Z3"},
128
                          {"es","wxQX3HhPgds","Resolver Skewb (Principiantes)","Cuby"},
129
                          {"fr","apIF6QHhVpY","Comment résoudre le Skewb","Valentino Cube"},
130
                          {"pl","ofRu1fByNpk","Jak ułożyć: Skewb","DżoDżo"},
98 131
                         }
99 132
        ),
100 133

  
101 134
  SKEW3 ( ObjectList.SKEW, 3,
102 135
          new String[][] {
103 136
                          {"gb","Jiuf7zQyPYI","Master Skewb Cube Tutorial","Bearded Cubing"},
137
                          {"es","8TP6p63KQCA","MASTER SKEWB EN ESPAÑOL","jorlozCubes"},
138
                          {"pl","Y7l3AYFvDJI","Master skewb TUTORIAL PL","MrUk"},
104 139
                         }
105 140
        ),
106 141

  
107 142
  IVY2 ( ObjectList.IVY, 2,
108 143
          new String[][] {
109 144
                          {"gb","QMzeJobSu1M","How to Solve the Ivy Cube","Z3"},
145
                          {"es","2-Gf2cmEJDs","Resolver IVY CUBE","Cuby"},
146
                          {"fr","mn7YTnYu3Uc","Comment résoudre le Ivy Cube","ValentinoCube"},
147
                          {"pl","8s_0VxNvFA8","Jak ułożyć ivy cube","DubiCube"},
110 148
                         }
111 149
        );
112 150

  
src/main/java/org/distorted/tutorial/TutorialWebView.java
23 23
import android.content.Context;
24 24
import android.content.res.Resources;
25 25
import android.webkit.WebView;
26
import android.webkit.WebViewClient;
26 27

  
27 28
import org.distorted.main.R;
28 29

  
......
47 48
      mContext = context;
48 49
      mWebView.setBackgroundColor(0);
49 50
      mWebView.getSettings().setJavaScriptEnabled(true);
51

  
52
      mWebView.setWebViewClient(new WebViewClient()
53
        {
54
        @Override
55
        public boolean shouldOverrideUrlLoading(WebView view, String url)
56
          {
57
          return false;
58
          }
59
        });
50 60
      }
51 61

  
52 62
///////////////////////////////////////////////////////////////////////////////////////////////////
......
54 64
    public void load(String url)
55 65
      {
56 66
      mUrl = url;
57
      String data = readFromfile(mContext);
58
      data = data.replace("%1", url);
59
      mWebView.loadData(data, "text/html", "UTF-8");
60
      }
61

  
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

  
64
    public String readFromfile(Context context)
65
      {
66
      StringBuilder returnString = new StringBuilder();
67
      InputStream fIn       = null;
68
      InputStreamReader isr = null;
69
      BufferedReader input  = null;
70

  
71
      try
72
        {
73
        Resources res = context.getResources();
74
        fIn = res.openRawResource(R.raw.webvideo);
75
        isr = new InputStreamReader(fIn);
76
        input = new BufferedReader(isr);
77
        String line;
78 67

  
79
        while ((line = input.readLine()) != null)
80
          {
81
          returnString.append(line);
82
          }
83
        }
84
      catch (Exception e)
85
        {
86
        e.getMessage();
87
        }
88
      finally
89
        {
90
        try
91
          {
92
          if (isr   != null) isr.close();
93
          if (fIn   != null) fIn.close();
94
          if (input != null) input.close();
95
          }
96
        catch (Exception e2)
97
          {
98
          e2.getMessage();
99
          }
100
        }
68
      String data1 = "<html><body><iframe width=\"100%\" height=\"100%\" src=\"";
69
      String data2 = "\" frameborder=\"0\" allowfullscreen></iframe></body></html>";
101 70

  
102
      return returnString.toString();
71
      mWebView.loadData(data1+url+data2, "text/html", "UTF-8");
103 72
      }
104 73

  
105 74
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/raw/webvideo.html
1
<!DOCTYPE html>
2
<html lang="en">
3
    <head>
4
        <meta charset="utf-8">
5
        <style>
6
            iframe   { border: 0; position:fixed; width:100%; height:100%; bgcolor="#000000"; }
7
            body     { margin: 0; bgcolor="#000000"; }
8
        </style>
9
    </head>
10
    <body>
11
        <iframe src="%1" frameborder="0" allowfullscreen></iframe>
12
    </body>
13
</html>

Also available in: Unified diff