Project

General

Profile

« Previous | Next » 

Revision b710a574

Added by Leszek Koltunski 6 months ago

Progress with tutorials.

View differences:

src/main/java/org/distorted/tutorials/TutorialActivity.java
11 11

  
12 12
import java.io.InputStream;
13 13

  
14
import android.content.Intent;
15 14
import android.os.Build;
16 15
import android.os.Bundle;
17 16
import android.util.DisplayMetrics;
......
23 22

  
24 23
import androidx.appcompat.app.AppCompatActivity;
25 24

  
25
import org.distorted.dialogs.RubikDialogTutorialSingle;
26 26
import org.distorted.library.main.DistortedLibrary;
27 27

  
28
import org.distorted.main_old.RubikActivity;
28
import org.distorted.main.MainActivity;
29 29
import org.distorted.objectlib.main.InitAssets;
30 30
import org.distorted.objectlib.main.ObjectControl;
31 31
import org.distorted.objectlib.main.TwistyObject;
......
35 35
import org.distorted.objects.RubikObject;
36 36
import org.distorted.objects.RubikObjectList;
37 37
import org.distorted.os.OSInterface;
38
import org.distorted.purchase.PurchaseActivity;
39 38

  
40 39
///////////////////////////////////////////////////////////////////////////////////////////////////
41 40

  
......
44 43
    private static final String URL = "https://www.youtube.com/embed/";
45 44
    private static final int ACTIVITY_NUMBER = 1;
46 45
    public static final float BAR_RATIO = 0.17f;
47
    public static final int FLAGS = RubikActivity.FLAGS;
46
    public static final int FLAGS = MainActivity.FLAGS;
48 47

  
49 48
    private static int mScreenWidth, mScreenHeight;
50 49
    private int mCurrentApiVersion;
51 50
    private TutorialScreen mScreen;
52
    private String mURL;
53 51
    private int mObjectOrdinal;
54 52
    private TutorialWebView mWebView;
55 53
    private boolean mIsFree;
......
70 68

  
71 69
      if(b != null)
72 70
        {
73
        mURL           = b.getString("url");
74 71
        mObjectOrdinal = b.getInt("obj");
75 72
        RubikObject obj= RubikObjectList.getObject(mObjectOrdinal);
76 73
        mIsFree = (obj!=null && obj.isFree());
......
83 80

  
84 81
      hideNavigationBar();
85 82
      cutoutHack();
83
      showDialog();
84
      }
85

  
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

  
88
    private void showDialog()
89
      {
90
      RubikObjectList.setCurrObject(mObjectOrdinal);
91
      Bundle bundle = new Bundle();
92
      bundle.putString("argument",RubikObjectList.getCurrentName());
93
      RubikDialogTutorialSingle diag = new RubikDialogTutorialSingle();
94
      diag.setArguments(bundle);
95
      diag.show( getSupportFragmentManager(), RubikDialogTutorialSingle.getDialogTag() );
86 96
      }
87 97

  
88 98
///////////////////////////////////////////////////////////////////////////////////////////////////
......
113 123

  
114 124
///////////////////////////////////////////////////////////////////////////////////////////////////
115 125

  
116
    @Override
117
    public void onAttachedToWindow()
126
    public void loadTutorial(String url)
118 127
      {
119
      super.onAttachedToWindow();
120

  
121 128
      if( mWebView==null )
122 129
        {
123 130
        WebView videoView = findViewById(R.id.tutorialVideoView);
124 131
        mWebView = new TutorialWebView(videoView);
125
        mWebView.load(URL+mURL);
132
        mWebView.load(URL+url);
126 133
        }
127 134
      }
128 135

  
......
262 269
      TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
263 270
      return view.getObjectControl();
264 271
      }
265

  
266
///////////////////////////////////////////////////////////////////////////////////////////////////
267

  
268
    public void switchToPurchase()
269
      {
270
      Intent intent = new Intent(this, PurchaseActivity.class);
271
      intent.putExtra("obj", mObjectOrdinal);
272
      startActivity(intent);
273
      }
274 272
}

Also available in: Unified diff