|
1 | 1 | package com.todobom.opennotescanner.helpers; |
2 | 2 |
|
| 3 | +import android.content.Intent; |
3 | 4 | import android.os.Bundle; |
4 | 5 | import android.support.annotation.Nullable; |
5 | 6 | import android.support.v4.app.DialogFragment; |
| 7 | +import android.view.Display; |
6 | 8 | import android.view.LayoutInflater; |
7 | 9 | import android.view.View; |
8 | 10 | import android.view.ViewGroup; |
|
17 | 19 | */ |
18 | 20 | public class AboutFragment extends DialogFragment { |
19 | 21 |
|
| 22 | + private static final String APP_LINK = "https://goo.gl/2JwEPq"; |
20 | 23 | private Runnable mRunOnDetach; |
21 | 24 |
|
22 | 25 | public AboutFragment() { |
@@ -46,28 +49,28 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
46 | 49 |
|
47 | 50 | markdownView.loadMarkdownFile("file:///android_asset/" + getString(R.string.about_filename)); |
48 | 51 |
|
49 | | - /* |
50 | | -
|
51 | | - StringBuilder aboutBuffer=new StringBuilder(); |
52 | | - BufferedReader in; |
53 | | - String aboutString=""; |
54 | | - try { |
55 | | - InputStream aboutStream=getContext().getAssets().open(getString(R.string.about_filename)); |
56 | | - in = new BufferedReader(new InputStreamReader(aboutStream, "UTF-8")); |
57 | | - while ((aboutString=in.readLine()) != null) { |
58 | | - aboutBuffer.append(aboutString + "\n"); |
| 52 | + Display display = getActivity().getWindowManager().getDefaultDisplay(); |
| 53 | + android.graphics.Point size = new android.graphics.Point(); |
| 54 | + display.getRealSize(size); |
| 55 | + |
| 56 | + View aboutContainer = view.findViewById(R.id.about_container); |
| 57 | + ViewGroup.LayoutParams params = aboutContainer.getLayoutParams(); |
| 58 | + params.height = (int) (size.y * .9); |
| 59 | + params.width = (int) (size.x * .9); |
| 60 | + aboutContainer.setLayoutParams(params); |
| 61 | + |
| 62 | + View about_shareapp = view.findViewById(R.id.about_shareapp); |
| 63 | + about_shareapp.setOnClickListener(new View.OnClickListener() { |
| 64 | + @Override |
| 65 | + public void onClick(View v) { |
| 66 | + String shareBody = getString(R.string.share_app_body) + APP_LINK; |
| 67 | + Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); |
| 68 | + sharingIntent.setType("text/plain"); |
| 69 | + sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getString(R.string.share_app_subject)); |
| 70 | + sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); |
| 71 | + startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_app_using))); |
59 | 72 | } |
60 | | - aboutString = aboutBuffer.toString(); |
61 | | - in.close(); |
62 | | -
|
63 | | - markdownView.setStringContent(aboutString); |
64 | | -
|
65 | | - } catch (IOException e) { |
66 | | - e.printStackTrace(); |
67 | | - } |
68 | | -
|
69 | | - /* */ |
70 | | - |
| 73 | + }); |
71 | 74 | } |
72 | 75 |
|
73 | 76 | @Override |
|
0 commit comments