10 |
10 |
package org.distorted.dialogs;
|
11 |
11 |
|
12 |
12 |
import android.app.Dialog;
|
|
13 |
import android.content.Intent;
|
13 |
14 |
import android.content.pm.PackageInfo;
|
14 |
15 |
import android.content.pm.PackageManager;
|
15 |
16 |
import android.content.res.Resources;
|
|
17 |
import android.net.Uri;
|
16 |
18 |
import android.view.View;
|
17 |
19 |
import android.view.Window;
|
18 |
20 |
import android.view.WindowManager;
|
|
21 |
import android.widget.LinearLayout;
|
19 |
22 |
import android.widget.TextView;
|
20 |
23 |
|
21 |
24 |
import androidx.fragment.app.FragmentActivity;
|
22 |
25 |
|
|
26 |
import org.distorted.main.BuildConfig;
|
23 |
27 |
import org.distorted.main.R;
|
24 |
28 |
import org.distorted.main.RubikActivity;
|
25 |
29 |
|
... | ... | |
109 |
113 |
newV.setText(WHATS_NEW);
|
110 |
114 |
TextView comV = view.findViewById(R.id.coming_message);
|
111 |
115 |
comV.setText(WHATS_COMING);
|
|
116 |
|
|
117 |
LinearLayout layoutShare = view.findViewById(R.id.about_share_layout);
|
|
118 |
|
|
119 |
layoutShare.setOnClickListener(new View.OnClickListener()
|
|
120 |
{
|
|
121 |
@Override
|
|
122 |
public void onClick(View v)
|
|
123 |
{
|
|
124 |
share(act);
|
|
125 |
}
|
|
126 |
});
|
|
127 |
|
|
128 |
LinearLayout layoutEmail = view.findViewById(R.id.about_email_layout);
|
|
129 |
|
|
130 |
layoutEmail.setOnClickListener(new View.OnClickListener()
|
|
131 |
{
|
|
132 |
@Override
|
|
133 |
public void onClick(View v)
|
|
134 |
{
|
|
135 |
email(act);
|
|
136 |
}
|
|
137 |
});
|
|
138 |
}
|
|
139 |
|
|
140 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
141 |
|
|
142 |
private void share(FragmentActivity act)
|
|
143 |
{
|
|
144 |
Resources res = act.getResources();
|
|
145 |
String name = res.getString(R.string.app_name);
|
|
146 |
|
|
147 |
Intent intent = new Intent();
|
|
148 |
intent.setAction(Intent.ACTION_SEND);
|
|
149 |
intent.putExtra(Intent.EXTRA_TEXT,
|
|
150 |
name+": https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID);
|
|
151 |
intent.setType("text/plain");
|
|
152 |
|
|
153 |
if (intent.resolveActivity(act.getPackageManager()) != null)
|
|
154 |
{
|
|
155 |
startActivity(intent);
|
|
156 |
}
|
|
157 |
}
|
|
158 |
|
|
159 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
160 |
|
|
161 |
private void email(FragmentActivity act)
|
|
162 |
{
|
|
163 |
Resources res = act.getResources();
|
|
164 |
String[] email = { res.getString(R.string.email_address) };
|
|
165 |
String version = findCurrentVersion((RubikActivity)act);
|
|
166 |
String name = res.getString(R.string.app_name);
|
|
167 |
|
|
168 |
Intent intent = new Intent(Intent.ACTION_SENDTO);
|
|
169 |
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
|
|
170 |
intent.putExtra(Intent.EXTRA_EMAIL, email);
|
|
171 |
intent.putExtra(Intent.EXTRA_SUBJECT, name+" "+version);
|
|
172 |
|
|
173 |
if (intent.resolveActivity(act.getPackageManager()) != null)
|
|
174 |
{
|
|
175 |
startActivity(intent);
|
|
176 |
}
|
112 |
177 |
}
|
113 |
178 |
|
114 |
179 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Dialog About.