diff --git a/README.md b/README.md index 59138ad..d647d65 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ View aboutPage = new AboutPage(this) .addPlayStore("com.ideashower.readitlater.pro") .addGitHub("medyo") .addInstagram("medyo80") + .addLinkedIn("saiharig") .create(); ``` @@ -52,6 +53,7 @@ The library has already some predefined social networks like : * Instagram * Youtube * PlayStore +* LinkedIn ```java addFacebook(String PageID) @@ -60,6 +62,7 @@ addYoutube(String AccountID) addPlayStore(String PackageName) addInstagram(String AccountID) addGitHub(String AccountID) +addLinkedIn(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..5db98ab 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,7 @@ protected void onCreate(Bundle savedInstanceState) { .addPlayStore("com.ideashower.readitlater.pro") .addInstagram("medyo80") .addGitHub("medyo") + .addLinkedIn("saiharig") .addItem(getCopyRightsElement()) .create(); diff --git a/build.gradle b/build.gradle index 9f38300..b3c83da 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:4.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..0f4323d 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-6.7.1-all.zip diff --git a/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java b/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java index ce10dce..480e202 100644 --- a/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java +++ b/library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java @@ -32,7 +32,7 @@ * The main class of this library with many predefined methods to add Elements for common items in * an About page. This class creates a {@link android.view.View} that can be passed as the root view * in {@link Fragment#onCreateView(LayoutInflater, ViewGroup, Bundle)} or passed to the {@link android.app.Activity#setContentView(View)} - * in an activity's {@link android.app.Activity#onCreate(Bundle)} (Bundle)} method + * in an activity's (Bundle)} method *
* To create a custom item in the about page, pass an instance of {@link mehdi.sakout.aboutpage.Element}
* to the {@link AboutPage#addItem(Element)} method.
@@ -127,6 +127,42 @@ public AboutPage addEmail(String email, 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#addFacebook(java.lang.String, java.lang.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..9ae23bb
--- /dev/null
+++ b/library/src/main/res/drawable/about_icon_linkedin.xml
@@ -0,0 +1,4 @@
+