From bc653adc7209f1771dd4312968b8f41579902a8a Mon Sep 17 00:00:00 2001 From: Naman Dwivedi Date: Tue, 6 Oct 2020 00:18:20 +0530 Subject: [PATCH] update about dialog --- app/build.gradle | 2 +- .../com/naman14/timber/utils/Helpers.java | 86 ++------------ .../main/res/layout/layout_about_dialog.xml | 108 ------------------ app/src/main/res/values/strings.xml | 7 ++ 4 files changed, 18 insertions(+), 185 deletions(-) delete mode 100644 app/src/main/res/layout/layout_about_dialog.xml diff --git a/app/build.gradle b/app/build.gradle index bff85d502..73a9f2d59 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,7 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "androidx.appcompat:appcompat:1.0.2" - implementation "com.google.android.material:material:1.2.1" + implementation "com.google.android.material:material:1.0.0" implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.recyclerview:recyclerview:1.1.0" implementation "androidx.palette:palette:1.0.0" diff --git a/app/src/main/java/com/naman14/timber/utils/Helpers.java b/app/src/main/java/com/naman14/timber/utils/Helpers.java index 607640836..260b7689c 100644 --- a/app/src/main/java/com/naman14/timber/utils/Helpers.java +++ b/app/src/main/java/com/naman14/timber/utils/Helpers.java @@ -29,11 +29,14 @@ import androidx.fragment.app.FragmentTransaction; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; + +import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; +import com.afollestad.materialdialogs.MaterialDialog; import com.naman14.timber.R; public class Helpers { @@ -57,96 +60,27 @@ public static String getATEKey(Context context) { public static class AboutDialog extends DialogFragment { - String urlgooglelus = "https://plus.google.com/u/0/+NamanDwivedi14"; - String urlcommunity = "https://plus.google.com/communities/111029425713454201429"; - String urltwitter = "https://twitter.com/naman1405"; - String urlgithub = "https://github.com/naman14"; - String urlsource = "https://github.com/naman14/Timber/issues"; - public AboutDialog() { } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - LayoutInflater layoutInflater = (LayoutInflater) getActivity().getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - LinearLayout aboutBodyView = (LinearLayout) layoutInflater.inflate(R.layout.layout_about_dialog, null); - - TextView appversion = (TextView) aboutBodyView.findViewById(R.id.app_version_name); - - TextView googleplus = (TextView) aboutBodyView.findViewById(R.id.googleplus); - TextView twitter = (TextView) aboutBodyView.findViewById(R.id.twitter); - TextView github = (TextView) aboutBodyView.findViewById(R.id.github); - TextView source = (TextView) aboutBodyView.findViewById(R.id.source); - TextView community = (TextView) aboutBodyView.findViewById(R.id.feature_request); - - TextView dismiss = (TextView) aboutBodyView.findViewById(R.id.dismiss_dialog); - dismiss.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - dismiss(); - } - }); - googleplus.setPaintFlags(googleplus.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - twitter.setPaintFlags(twitter.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - github.setPaintFlags(github.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - - googleplus.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(urlgooglelus)); - startActivity(i); - } - - }); - twitter.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(urltwitter)); - startActivity(i); - } - - }); - github.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(urlgithub)); - startActivity(i); - } - - }); - source.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(urlsource)); - startActivity(i); - } - }); - community.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(urlcommunity)); - startActivity(i); - } - }); + String appName = "Timber"; try { PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); String version = pInfo.versionName; int versionCode = pInfo.versionCode; - appversion.setText("Timber " + version); + appName = "Timber " + version; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } - return new AlertDialog.Builder(getActivity()) - .setView(aboutBodyView) - .create(); + return new MaterialDialog.Builder(getActivity()) + .title(appName) + .content(Html.fromHtml(getString(R.string.about_dialog_body))) + .positiveText("Dismiss") + .build(); } } diff --git a/app/src/main/res/layout/layout_about_dialog.xml b/app/src/main/res/layout/layout_about_dialog.xml deleted file mode 100644 index 6b9b8b06e..000000000 --- a/app/src/main/res/layout/layout_about_dialog.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 25c09c085..198cd0a8e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -167,4 +167,11 @@ \"No current track selected. Loading... + Timber is a fully featured open source music player.

+ Designed and developed by Naman Dwivedi. Check out my + Website and GitHub +

Also checkout TimberX, + material themed music player that works across all form factors. + ]]>