Project

General

Profile

Download (2.39 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / dialogs / RubikDialogPrivacy.java @ 441f2db5

1 b1e9596b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6 68191e7d Leszek Koltunski
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8 b1e9596b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10
package org.distorted.dialogs;
11
12
import android.app.Dialog;
13
import android.text.method.LinkMovementMethod;
14
import android.text.method.MovementMethod;
15
import android.view.View;
16
import android.widget.TextView;
17
18
import androidx.fragment.app.FragmentActivity;
19
20
import org.distorted.main.R;
21
import org.distorted.main.RubikActivity;
22
23
///////////////////////////////////////////////////////////////////////////////////////////////////
24
25 c02fa107 Leszek Koltunski
public class RubikDialogPrivacy extends RubikDialogAbstract
26 b1e9596b Leszek Koltunski
  {
27 f8a21f6b Leszek Koltunski
  public int getResource()      { return R.layout.dialog_privacy; }
28
  public int getTitleResource() { return R.string.privacy_policy; }
29
  public boolean hasArgument()  { return false; }
30
  public int getPositive()      { return R.string.accept; }
31
  public int getNegative()      { return R.string.decline; }
32 b1e9596b Leszek Koltunski
33 c02fa107 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
34 b1e9596b Leszek Koltunski
35 f8a21f6b Leszek Koltunski
  public void positiveAction()
36 c02fa107 Leszek Koltunski
    {
37 f8a21f6b Leszek Koltunski
    final RubikActivity act = (RubikActivity)getContext();
38
    if( act!=null ) act.acceptPrivacy();
39 c02fa107 Leszek Koltunski
    }
40 b1e9596b Leszek Koltunski
41 c02fa107 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
42 ffd68f35 Leszek Koltunski
43 f8a21f6b Leszek Koltunski
  public void negativeAction()
44 c02fa107 Leszek Koltunski
    {
45 f8a21f6b Leszek Koltunski
    final RubikActivity act = (RubikActivity)getContext();
46
    if( act!=null ) act.declinePrivacy();
47 c02fa107 Leszek Koltunski
    }
48 ffd68f35 Leszek Koltunski
49 c02fa107 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
50 b1e9596b Leszek Koltunski
51 c02fa107 Leszek Koltunski
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
52
    {
53
    MovementMethod mm = LinkMovementMethod.getInstance();
54
    TextView text = view.findViewById(R.id.privacy_string);
55
    text.setMovementMethod(mm);
56 b1e9596b Leszek Koltunski
    }
57
  }