Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogPrivacy.java @ 5e6d3e7d

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// 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
///////////////////////////////////////////////////////////////////////////////////////////////////
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
public class RubikDialogPrivacy extends RubikDialogAbstract
26
  {
27
  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

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
  public void positiveAction()
36
    {
37
    final RubikActivity act = (RubikActivity)getContext();
38
    if( act!=null ) act.acceptPrivacy();
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

    
43
  public void negativeAction()
44
    {
45
    final RubikActivity act = (RubikActivity)getContext();
46
    if( act!=null ) act.declinePrivacy();
47
    }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
  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
    }
57
  }
(12-12/26)