Project

General

Profile

« Previous | Next » 

Revision b1e9596b

Added by Leszek Koltunski almost 4 years ago

Display the 'Privacy Policy' dialog (only if locale is set to ZH - chinese requirement)

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbout.java
79 79
    final View view = inflater.inflate(R.layout.dialog_about, null);
80 80
    TextView text = view.findViewById(R.id.about_version);
81 81
    String appName = getString(R.string.app_name);
82
    String appVers;
83 82

  
84
    try
85
      {
86
      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
87
      appVers = pInfo.versionName;
88
      }
89
    catch (PackageManager.NameNotFoundException e)
90
      {
91
      appVers = "1.2.2";
92
      }
93 83

  
94 84
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
95
    text.setText(getString(R.string.ap_placeholder,appName, appVers));
85
    text.setText(getString(R.string.ap_placeholder,appName, getAppVers(act)));
96 86

  
97 87
    MovementMethod mm = LinkMovementMethod.getInstance();
98 88
    TextView text1 = view.findViewById(R.id.about_section1);
......
105 95
    text3.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
106 96
    text3.setMovementMethod(mm);
107 97

  
98
    TextView text4 = view.findViewById(R.id.about_section4);
99

  
100
    if( RubikActivity.localeIsChinese() )
101
      {
102
      text4.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
103
      text4.setMovementMethod(mm);
104
      }
105
    else
106
      {
107
      text4.setVisibility(View.GONE);
108
      }
109

  
108 110
    builder.setView(view);
109 111

  
110 112
    Dialog dialog = builder.create();
......
128 130

  
129 131
    return dialog;
130 132
    }
133

  
134
///////////////////////////////////////////////////////////////////////////////////////////////////
135

  
136
  private String getAppVers(FragmentActivity act)
137
    {
138
    try
139
      {
140
      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
141
      return pInfo.versionName;
142
      }
143
    catch (PackageManager.NameNotFoundException e)
144
      {
145
      return "unknown";
146
      }
147
    }
131 148
  }

Also available in: Unified diff