Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented and adding LinkedIn and WhatsApp feature, update version #164

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ View aboutPage = new AboutPage(this)
.addPlayStore("com.ideashower.readitlater.pro")
.addGitHub("medyo")
.addInstagram("medyo80")
.addLinkedIn("medyo")
.addWhatsApp("5582924562426")
.create();
```

Expand Down Expand Up @@ -52,6 +54,8 @@ The library has already some predefined social networks like :
* Instagram
* Youtube
* PlayStore
* LinkedIn
* WhatsApp

```java
addFacebook(String PageID)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 0 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 30
versionCode 22
versionName "2.0.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand Down
74 changes: 74 additions & 0 deletions library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions library/src/main/res/drawable/about_icon_linkedin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="50"
android:viewportHeight="50">
<path
android:fillColor="#000000"
android:pathData="M41,4H9C6.24,4 4,6.24 4,9v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5V9C46,6.24 43.76,4 41,4zM17,20v19h-6V20H17zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47s2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53C12.2,17 11,15.87 11,14.47zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08C27,24.96 26,27.02 26,29c0,0.91 0,10 0,10h-6V20h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26V39z" />
</vector>
10 changes: 10 additions & 0 deletions library/src/main/res/drawable/about_icon_whatsapp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:fillColor="#000000"

android:pathData="M 15 3 C 8.373 3 3 8.373 3 15 C 3 17.251208 3.6323415 19.350068 4.7109375 21.150391 L 3.1074219 27 L 9.0820312 25.431641 C 10.829354 26.425062 12.84649 27 15 27 C 21.627 27 27 21.627 27 15 C 27 8.373 21.627 3 15 3 z M 10.892578 9.4023438 C 11.087578 9.4023438 11.287937 9.4011562 11.460938 9.4101562 C 11.674938 9.4151563 11.907859 9.4308281 12.130859 9.9238281 C 12.395859 10.509828 12.972875 11.979906 13.046875 12.128906 C 13.120875 12.277906 13.173313 12.453437 13.070312 12.648438 C 12.972312 12.848437 12.921344 12.969484 12.777344 13.146484 C 12.628344 13.318484 12.465078 13.532109 12.330078 13.662109 C 12.181078 13.811109 12.027219 13.974484 12.199219 14.271484 C 12.371219 14.568484 12.968563 15.542125 13.851562 16.328125 C 14.986562 17.342125 15.944188 17.653734 16.242188 17.802734 C 16.540187 17.951734 16.712766 17.928516 16.884766 17.728516 C 17.061766 17.533516 17.628125 16.864406 17.828125 16.566406 C 18.023125 16.268406 18.222188 16.319969 18.492188 16.417969 C 18.766188 16.515969 20.227391 17.235766 20.525391 17.384766 C 20.823391 17.533766 21.01875 17.607516 21.09375 17.728516 C 21.17075 17.853516 21.170828 18.448578 20.923828 19.142578 C 20.676828 19.835578 19.463922 20.505734 18.919922 20.552734 C 18.370922 20.603734 17.858562 20.7995 15.351562 19.8125 C 12.327563 18.6215 10.420484 15.524219 10.271484 15.324219 C 10.122484 15.129219 9.0605469 13.713906 9.0605469 12.253906 C 9.0605469 10.788906 9.8286563 10.071437 10.097656 9.7734375 C 10.371656 9.4754375 10.692578 9.4023438 10.892578 9.4023438 z" />
</vector>
2 changes: 1 addition & 1 deletion library/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<color name="about_play_store_color">#689F38</color>
<color name="about_youtube_color">#cd201f</color>
<color name="about_github_color">#333333</color>

<color name="about_whatsapp_color">#1fa413</color>


</resources>