diff --git a/README.md b/README.md index 59138ad..aa51228 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ View aboutPage = new AboutPage(this) .addPlayStore("com.ideashower.readitlater.pro") .addGitHub("medyo") .addInstagram("medyo80") + .addLinkedIn("medyo") + .addWhatsApp("5582924562426") .create(); ``` @@ -52,6 +54,8 @@ The library has already some predefined social networks like : * Instagram * Youtube * PlayStore +* LinkedIn +* WhatsApp ```java addFacebook(String PageID) @@ -60,6 +64,8 @@ addYoutube(String AccountID) addPlayStore(String PackageName) addInstagram(String AccountID) addGitHub(String AccountID) +addLinkedIn(String AccountID) +addWhatsApp(String AccountID) ``` ### 4. Add Custom Element diff --git a/app/src/main/java/mehdi/sakout/aboutpage/sample/MainActivity.java b/app/src/main/java/mehdi/sakout/aboutpage/sample/MainActivity.java index 0398c46..cdcc810 100644 --- a/app/src/main/java/mehdi/sakout/aboutpage/sample/MainActivity.java +++ b/app/src/main/java/mehdi/sakout/aboutpage/sample/MainActivity.java @@ -32,6 +32,8 @@ protected void onCreate(Bundle savedInstanceState) { .addPlayStore("com.ideashower.readitlater.pro") .addInstagram("medyo80") .addGitHub("medyo") + .addLinkedIn("medyo") + .addWhatsApp("5582924562426") .addItem(getCopyRightsElement()) .create(); diff --git a/build.gradle b/build.gradle index 9f38300..7af4552 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:7.2.2' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bdf8b8e..49e2d05 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/library/build.gradle b/library/build.gradle index a992a95..3ca3b09 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -6,8 +6,6 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 30 - versionCode 22 - versionName "2.0.0" vectorDrawables.useSupportLibrary = true } buildTypes { diff --git a/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java b/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java index ce10dce..23c802f 100644 --- a/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java +++ b/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java @@ -381,6 +381,80 @@ public AboutPage addGitHub(String id, String title) { return this; } + /** + * Convenience method for {@link AboutPage#addLinkedIn(java.lang.String, java.lang.String)} but with + * a predefined title string + * + * @param id the facebook id to display + * @return this AboutPage instance for builder pattern support + */ + public AboutPage addLinkedIn(String id) { + return addLinkedIn(id,"Connect with LinkedIn"); + } + + /** + * Add a predefined Element that the opens LinkedIn app with a deep link to the specified user id + * If the LinkedIn application is not installed this will open a web page instead. + * + * @param id the id of the LinkedIn user to display in the Facebook app + * @param title the title to display on this item + * @return this AboutPage instance for builder pattern support + */ + public AboutPage addLinkedIn(String id,String title) { + + String profile_url = "https://www.linkedin.com/in/"+id; + + Element linkedinElement = new Element(); + linkedinElement.setTitle(title); + linkedinElement.setIconDrawable(R.drawable.about_icon_linkedin); + linkedinElement.setIconTint(R.color.about_facebook_color); + linkedinElement.setValue(profile_url); + + Uri uri = Uri.parse(profile_url); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + + linkedinElement.setIntent(intent); + addItem(linkedinElement); + return this; + } + + /** + * Convenience method for {@link AboutPage#addWhatsApp(java.lang.String, java.lang.String)} but with + * a predefined title string + * + * @param id the facebook id to display + * @return this AboutPage instance for builder pattern support + */ + public AboutPage addWhatsApp(String id) { + return addWhatsApp(id,"Connect with WhatsApp"); + } + + /** + * Add a predefined element that opens the whatsapp app with a direct link to the specified user id + * If the WhatsApp app is not installed, this opens a webpage. + * + * @param id WhatsApp phone number to display in WhatsApp app + * @param title the title to display on this item + * @return this AboutPage instance for builder pattern support + */ + public AboutPage addWhatsApp(String id,String title) { + + String profile_url = "https://api.whatsapp.com/send?phone="+id; + + Element whatsAppElement = new Element(); + whatsAppElement.setTitle(title); + whatsAppElement.setIconDrawable(R.drawable.about_icon_whatsapp); + whatsAppElement.setIconTint(R.color.about_whatsapp_color); + whatsAppElement.setValue(profile_url); + + Uri uri = Uri.parse(profile_url); + Intent intent = new Intent(Intent.ACTION_VIEW, uri); + + whatsAppElement.setIntent(intent); + addItem(whatsAppElement); + return this; + } + /** * Convenience method for {@link AboutPage#addWebsite(String, String)} but with * a predefined title string diff --git a/library/src/main/res/drawable/about_icon_linkedin.xml b/library/src/main/res/drawable/about_icon_linkedin.xml new file mode 100644 index 0000000..24cafcd --- /dev/null +++ b/library/src/main/res/drawable/about_icon_linkedin.xml @@ -0,0 +1,9 @@ + + + diff --git a/library/src/main/res/drawable/about_icon_whatsapp.xml b/library/src/main/res/drawable/about_icon_whatsapp.xml new file mode 100644 index 0000000..80f096a --- /dev/null +++ b/library/src/main/res/drawable/about_icon_whatsapp.xml @@ -0,0 +1,10 @@ + + + diff --git a/library/src/main/res/values/colors.xml b/library/src/main/res/values/colors.xml index 2baa95a..8336659 100644 --- a/library/src/main/res/values/colors.xml +++ b/library/src/main/res/values/colors.xml @@ -27,7 +27,7 @@ #689F38 #cd201f #333333 - + #1fa413