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 addLinkedIn Feature #162

Open
wants to merge 2 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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ View aboutPage = new AboutPage(this)
.addPlayStore("com.ideashower.readitlater.pro")
.addGitHub("medyo")
.addInstagram("medyo80")
.addLinkedIn("saiharig")
.create();
```

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

```java
addFacebook(String PageID)
Expand All @@ -60,6 +62,7 @@ addYoutube(String AccountID)
addPlayStore(String PackageName)
addInstagram(String AccountID)
addGitHub(String AccountID)
addLinkedIn(String AccountID)
```

### 4. Add Custom Element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ protected void onCreate(Bundle savedInstanceState) {
.addPlayStore("com.ideashower.readitlater.pro")
.addInstagram("medyo80")
.addGitHub("medyo")
.addLinkedIn("saiharig")
.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:4.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-6.7.1-all.zip
38 changes: 37 additions & 1 deletion library/src/main/java/mehdi/sakout/aboutpage/AboutPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>
* 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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 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,4 @@
<vector android:height="24dp" android:viewportHeight="50"
android:viewportWidth="50" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<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>