Repository: PonnamKarthik/RichLinkPreview
Branch: master
Commit: 9251662f1005
Files: 62
Total size: 111.7 KB
Directory structure:
gitextract_5yg07epf/
├── .gitignore
├── .idea/
│ ├── codeStyles/
│ │ └── Project.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ └── vcs.xml
├── LICENSE
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── io/
│ │ └── github/
│ │ └── ponnamkarthik/
│ │ └── sample/
│ │ └── ExampleInstrumentedTest.java
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── io/
│ │ │ └── github/
│ │ │ └── ponnamkarthik/
│ │ │ └── sample/
│ │ │ ├── ListActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── NonScrollListView.java
│ │ │ └── adapters/
│ │ │ └── URLAdapter.java
│ │ └── res/
│ │ ├── drawable/
│ │ │ └── ic_launcher_background.xml
│ │ ├── drawable-v24/
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── layout/
│ │ │ ├── activity_list.xml
│ │ │ ├── activity_main.xml
│ │ │ └── layout_list.xml
│ │ ├── mipmap-anydpi-v26/
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ └── values/
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test/
│ └── java/
│ └── io/
│ └── github/
│ └── ponnamkarthik/
│ └── sample/
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── richlinkpreview/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ ├── androidTest/
│ │ └── java/
│ │ └── io/
│ │ └── github/
│ │ └── ponnamkarthik/
│ │ └── richlinkpreview/
│ │ └── ExampleInstrumentedTest.java
│ ├── main/
│ │ ├── AndroidManifest.xml
│ │ ├── java/
│ │ │ └── io/
│ │ │ └── github/
│ │ │ └── ponnamkarthik/
│ │ │ └── richlinkpreview/
│ │ │ ├── MetaData.java
│ │ │ ├── ResponseListener.java
│ │ │ ├── RichLinkListener.java
│ │ │ ├── RichLinkView.java
│ │ │ ├── RichLinkViewSkype.java
│ │ │ ├── RichLinkViewTelegram.java
│ │ │ ├── RichLinkViewTwitter.java
│ │ │ ├── RichPreview.java
│ │ │ ├── URLSpanNoUnderline.java
│ │ │ └── ViewListener.java
│ │ └── res/
│ │ ├── drawable/
│ │ │ ├── bg_card.xml
│ │ │ ├── bg_radius.xml
│ │ │ ├── bg_skype.xml
│ │ │ └── bg_telegram.xml
│ │ ├── layout/
│ │ │ ├── link_layout.xml
│ │ │ ├── skype_link_layout.xml
│ │ │ ├── telegram_link_layout.xml
│ │ │ └── twitter_link_layout.xml
│ │ └── values/
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test/
│ └── java/
│ └── io/
│ └── github/
│ └── ponnamkarthik/
│ └── richlinkpreview/
│ └── ExampleUnitTest.java
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
================================================
FILE: .idea/codeStyles/Project.xml
================================================
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
================================================
FILE: .idea/gradle.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/richlinkpreview" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
================================================
FILE: .idea/modules.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/richlink.iml" filepath="$PROJECT_DIR$/richlink.iml" />
<module fileurl="file://$PROJECT_DIR$/richlinkpreview/richlinkpreview.iml" filepath="$PROJECT_DIR$/richlinkpreview/richlinkpreview.iml" />
</modules>
</component>
</project>
================================================
FILE: .idea/runConfigurations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# RichLink-Preview
A Rich Link Preview Library for Android
[]( https://android-arsenal.com/details/1/6702 )
> Sample Image
<img src="https://github.com/PonnamKarthik/RichLinkPreview/raw/master/screenshots/sample.png" width="300" alt="ScreenShot">
#### Import using Gradle
~~~gradle
compile 'io.github.ponnamkarthik:richlinkpreview:1.0.9'
~~~
for android studio 3.x
~~~gradle
implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.9'
### jsoup library required
Implementation 'org.jsoup:jsoup:1.12.1'
~~~
#### To implement existing layout using XML
Add below code in activity_main.xml
~~~xml
<!--default view or whatsapp -->
<io.github.ponnamkarthik.richlinkpreview.RichLinkView
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkView>
<!-- Telegram -->
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewTelegram
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewTelegram>
<!-- Skype -->
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewSkype
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewSkype>
<!-- Twitter -->
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter>
~~~
In your MainActivity.java add below code
~~~java
public class MainActivity extends AppCompatActivity {
RichLinkView richLinkView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ...
//
richLinkView = (RichLinkView) findViewById(R.id.richLinkView);
richLinkView.setLink("https://stackoverflow.com", new ViewListener() {
@Override
public void onSuccess(boolean status) {
}
@Override
public void onError(Exception e) {
}
});
}
}
~~~
~~~java
RichLinkView richLinkView;
RichLinkViewTelegram richLinkViewTelegram;
RichLinkViewSkype richLinkViewSkype;
RichLinkViewTwitter richLinkViewTwitter;
//Set Link is same as default
~~~
> **OR**
#### If you want to implement your own layout.
~~~java
private MetaData data;
RichPreview richPreview = new RichPreview(new ResponseListener() {
@Override
public void onData(MetaData metaData) {
data = metaData;
//Implement your Layout
}
@Override
public void onError(Exception e) {
//handle error
}
});
~~~
> if you want to set obtained meta data to view
~~~java
richLinkView.setLinkFromMeta(metaData)
or
MetaData metaData = new MetaData();
metaData.setTitle("Title");
metaData.setDescription("Custom Meta Data");
metaData.setFavicon("http://favicon url");
metaData.setImageurl("http://image url");
metaData.setSitename("Custom Meta data site");
richLinkView.setLinkFromMeta(metaData);
~~~
> Set your own CickListener
~~~java
//at first disable default click
richLinkView.setDefaultClickListener(false);
//set your own click listener
richLinkView.setClickListener(new RichLinkListener() {
@Override
public void onClicked(View view, MetaData meta) {
//do stuff
Toast.makeText(getApplicationContext(), meta.getTitle(), Toast.LENGTH_SHORT).show();
}
});
~~~
> MetaData
```java
metaData.getTitle();
metaData.getImageurl();
metaData.getDescription();
metaData.getSitename();
metaData.getUrl();
metaData.getMediatype();
```
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "io.github.ponnamkarthik.sample"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(':richlinkpreview')
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: app/src/androidTest/java/io/github/ponnamkarthik/sample/ExampleInstrumentedTest.java
================================================
package io.github.ponnamkarthik.sample;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("io.github.ponnamkarthik.sample", appContext.getPackageName());
}
}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.github.ponnamkarthik.sample">
<application
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ListActivity" />
</application>
</manifest>
================================================
FILE: app/src/main/java/io/github/ponnamkarthik/sample/ListActivity.java
================================================
package io.github.ponnamkarthik.sample;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.ListView;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import io.github.ponnamkarthik.sample.adapters.URLAdapter;
public class ListActivity extends AppCompatActivity {
ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
listView = findViewById(R.id.list);
ArrayList<URL> urls = new ArrayList<>();
try {
urls.add(new URL("https://www.flipkart.com/"));
urls.add(new URL("https://google.com"));
urls.add(new URL("https://skype.com"));
urls.add(new URL("https://twitter.com"));
urls.add(new URL("https://www.flipkart.com/"));
urls.add(new URL("https://google.com"));
urls.add(new URL("https://skype.com"));
urls.add(new URL("https://twitter.com"));
urls.add(new URL("https://www.flipkart.com/"));
urls.add(new URL("https://google.com"));
urls.add(new URL("https://skype.com"));
urls.add(new URL("https://twitter.com"));
urls.add(new URL("https://www.flipkart.com/"));
urls.add(new URL("https://google.com"));
urls.add(new URL("https://skype.com"));
urls.add(new URL("https://twitter.com"));
URLAdapter urlAdapter = new URLAdapter(this, urls);
listView.setAdapter(urlAdapter);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
================================================
FILE: app/src/main/java/io/github/ponnamkarthik/sample/MainActivity.java
================================================
package io.github.ponnamkarthik.sample;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import io.github.ponnamkarthik.richlinkpreview.MetaData;
import io.github.ponnamkarthik.richlinkpreview.RichLinkListener;
import io.github.ponnamkarthik.richlinkpreview.RichLinkView;
import io.github.ponnamkarthik.richlinkpreview.RichLinkViewSkype;
import io.github.ponnamkarthik.richlinkpreview.RichLinkViewTelegram;
import io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter;
import io.github.ponnamkarthik.richlinkpreview.ViewListener;
public class MainActivity extends AppCompatActivity {
RichLinkView richLinkView;
RichLinkViewTelegram richLinkView1;
RichLinkViewSkype richLinkView2;
RichLinkViewTwitter richLinkView3;
Button goToList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
richLinkView = findViewById(R.id.richLinkView);
richLinkView1 = findViewById(R.id.richLinkView1);
richLinkView2 = findViewById(R.id.richLinkView2);
richLinkView3 = findViewById(R.id.richLinkView3);
goToList = findViewById(R.id.go_to_list);
richLinkView.setLink("https://whatsapp.com" ,new ViewListener() {
@Override
public void onSuccess(boolean status) {
}
@Override
public void onError(Exception e) {
}
});
richLinkView1.setLink("https://telegram.org" ,new ViewListener() {
@Override
public void onSuccess(boolean status) {
}
@Override
public void onError(Exception e) {
}
});
richLinkView2.setLink("https://www.skype.com" ,new ViewListener() {
@Override
public void onSuccess(boolean status) {
}
@Override
public void onError(Exception e) {
}
});
richLinkView3.setLink("https://twitter.com" ,new ViewListener() {
@Override
public void onSuccess(boolean status) {
}
@Override
public void onError(Exception e) {
}
});
//custom clickListener
richLinkView.setDefaultClickListener(false);
richLinkView.setClickListener(new RichLinkListener() {
@Override
public void onClicked(View view, MetaData meta) {
Toast.makeText(getApplicationContext(), meta.getTitle(), Toast.LENGTH_SHORT).show();
}
});
goToList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, ListActivity.class));
}
});
}
}
================================================
FILE: app/src/main/java/io/github/ponnamkarthik/sample/NonScrollListView.java
================================================
package io.github.ponnamkarthik.sample;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
/**
* Created by ponna on 19-11-2017.
*/
public class NonScrollListView extends ListView {
public NonScrollListView(Context context) {
super(context);
}
public NonScrollListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public NonScrollListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
}
================================================
FILE: app/src/main/java/io/github/ponnamkarthik/sample/adapters/URLAdapter.java
================================================
package io.github.ponnamkarthik.sample.adapters;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Toast;
import java.net.URL;
import java.util.ArrayList;
import io.github.ponnamkarthik.richlinkpreview.MetaData;
import io.github.ponnamkarthik.richlinkpreview.RichLinkListener;
import io.github.ponnamkarthik.richlinkpreview.RichLinkView;
import io.github.ponnamkarthik.richlinkpreview.ViewListener;
import io.github.ponnamkarthik.sample.R;
/**
* Created by ponna on 04-03-2018.
*/
public class URLAdapter extends BaseAdapter {
//RichLinkView richLinkView;
Context context;
ArrayList<URL> urls;
String currURL="";
ArrayList<MetaData> metaData= new ArrayList<>();
public URLAdapter(Context context, ArrayList<URL> urls){
this.context = context;
this.urls = urls;
for(int i = 0; i < urls.size(); i++) {
metaData.add(null);
}
}
@Override
public int getCount() {
return ((urls == null) ? 0 : urls.size());
}
@Override
public Object getItem(int i) {
return urls.get(i);
}
@Override
public int getViewTypeCount() {
return getCount();
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public long getItemId(int i) {
return i;
}
public static class ViewHolder{
RichLinkView richLinkView;
}
@Override
public View getView(final int i, View view, ViewGroup viewGroup) {
final ViewHolder viewHolder;
if(view == null) {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(context);
view = inflater.inflate(R.layout.layout_list, viewGroup, false);
viewHolder.richLinkView = view.findViewById(R.id.richLinkView);
view.setTag(viewHolder);
}
else {
viewHolder = (ViewHolder) view.getTag();
}
if(urls.get(i)!=null) {
final URL url = urls.get(i);
if(metaData.get(i) != null) {
viewHolder.richLinkView.setLinkFromMeta(metaData.get(i));
} else {
viewHolder.richLinkView.setLink(url.toString(), new ViewListener() {
@Override
public void onSuccess(boolean status) {
try {
metaData.set(i, viewHolder.richLinkView.getMetaData());
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
@Override
public void onError(Exception e) {
Log.i("Karthik", "Error:" + e);
}
});
}
viewHolder.richLinkView.setDefaultClickListener(false);
viewHolder.richLinkView.setClickListener(new RichLinkListener() {
@Override
public void onClicked(View view, MetaData meta) {
//do stuff
Toast.makeText(context, meta.getTitle(), Toast.LENGTH_SHORT).show();
}
});
}
return view;
}
}
================================================
FILE: app/src/main/res/drawable/ic_launcher_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>
================================================
FILE: app/src/main/res/drawable-v24/ic_launcher_foreground.xml
================================================
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>
================================================
FILE: app/src/main/res/layout/activity_list.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="io.github.ponnamkarthik.sample.MainActivity">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="io.github.ponnamkarthik.sample.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:animateLayoutChanges="true"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<io.github.ponnamkarthik.richlinkpreview.RichLinkView
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkView>
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewTelegram
android:layout_marginTop="16dp"
android:id="@+id/richLinkView1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewTelegram>
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewSkype
android:layout_marginTop="16dp"
android:id="@+id/richLinkView2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewSkype>
<io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter
android:layout_marginTop="16dp"
android:id="@+id/richLinkView3"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter>
<Button
android:id="@+id/go_to_list"
android:layout_gravity="center"
android:textAllCaps="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GO to ListView"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
================================================
FILE: app/src/main/res/layout/layout_list.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<io.github.ponnamkarthik.richlinkpreview.RichLinkView
android:id="@+id/richLinkView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</io.github.ponnamkarthik.richlinkpreview.RichLinkView>
</RelativeLayout>
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">sample</string>
</resources>
================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
================================================
FILE: app/src/test/java/io/github/ponnamkarthik/sample/ExampleUnitTest.java
================================================
package io.github.ponnamkarthik.sample;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Sun Oct 07 10:33:52 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: richlinkpreview/.gitignore
================================================
/build
================================================
FILE: richlinkpreview/build.gradle
================================================
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'RichLinkPreview'
bintrayName = 'RichLinkPreview'
publishedGroupId = 'io.github.ponnamkarthik'
libraryName = 'richlinkpreview'
artifact = 'richlinkpreview'
libraryDescription = 'A Rich Link Preview Library for Android'
siteUrl = 'https://github.com/PonnamKarthik/RichLink-Preview'
gitUrl = 'https://github.com/PonnamKarthik/RichLink-Preview.git'
libraryVersion = '1.0.9'
developerId = 'KarthikPonnam'
developerName = 'Karthik Ponnam'
developerEmail = 'ponnamkarthik3@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.annotation:annotation:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'com.squareup.picasso:picasso:2.71828'
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
================================================
FILE: richlinkpreview/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: richlinkpreview/src/androidTest/java/io/github/ponnamkarthik/richlinkpreview/ExampleInstrumentedTest.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("io.github.ponnamkarthik.richlinkpreview.test", appContext.getPackageName());
}
}
================================================
FILE: richlinkpreview/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.ponnamkarthik.richlinkpreview" >
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/MetaData.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
/**
* Created by ponna on 16-01-2018.
*/
public class MetaData {
private String url = "";
private String imageurl = "";
private String title = "";
private String description = "";
private String sitename = "";
private String mediatype = "";
private String favicon = "";
private String originalUrl = "";
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getImageurl() {
return imageurl;
}
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getSitename() {
return sitename;
}
public void setSitename(String sitename) {
this.sitename = sitename;
}
public String getMediatype() {
return mediatype;
}
public void setMediatype(String mediatype) {
this.mediatype = mediatype;
}
public String getFavicon() {
return favicon;
}
public void setFavicon(String favicon) {
this.favicon = favicon;
}
public String getOriginalUrl() {
return originalUrl;
}
public void setOriginalUrl(String originalUrl) {
this.originalUrl = originalUrl;
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ResponseListener.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
/**
* Created by ponna on 16-01-2018.
*/
public interface ResponseListener {
void onData(MetaData metaData);
void onError(Exception e);
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkListener.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.view.View;
/**
* Created by ponna on 03-03-2018.
*/
public interface RichLinkListener {
void onClicked(View view, MetaData meta);
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkView.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
/**
* Created by ponna on 16-01-2018.
*/
public class RichLinkView extends RelativeLayout {
private View view;
Context context;
private MetaData meta;
LinearLayout linearLayout;
ImageView imageView;
TextView textViewTitle;
TextView textViewDesp;
TextView textViewUrl;
private String main_url;
private boolean isDefaultClick = true;
private RichLinkListener richLinkListener;
public RichLinkView(Context context) {
super(context);
this.context = context;
}
public RichLinkView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public RichLinkView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public RichLinkView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
this.context = context;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
}
public void initView() {
if(findLinearLayoutChild() != null) {
this.view = findLinearLayoutChild();
} else {
this.view = this;
inflate(context, R.layout.link_layout,this);
}
linearLayout = findViewById(R.id.rich_link_card);
imageView = findViewById(R.id.rich_link_image);
textViewTitle = findViewById(R.id.rich_link_title);
textViewDesp = findViewById(R.id.rich_link_desp);
textViewUrl = findViewById(R.id.rich_link_url);
if(meta.getImageurl().equals("") || meta.getImageurl().isEmpty()) {
imageView.setVisibility(GONE);
} else {
imageView.setVisibility(VISIBLE);
Picasso.get()
.load(meta.getImageurl())
.into(imageView);
}
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
textViewTitle.setVisibility(GONE);
} else {
textViewTitle.setVisibility(VISIBLE);
textViewTitle.setText(meta.getTitle());
}
if(meta.getUrl().isEmpty() || meta.getUrl().equals("")) {
textViewUrl.setVisibility(GONE);
} else {
textViewUrl.setVisibility(VISIBLE);
textViewUrl.setText(meta.getUrl());
}
if(meta.getDescription().isEmpty() || meta.getDescription().equals("")) {
textViewDesp.setVisibility(GONE);
} else {
textViewDesp.setVisibility(VISIBLE);
textViewDesp.setText(meta.getDescription());
}
linearLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(isDefaultClick) {
richLinkClicked();
} else {
if(richLinkListener != null) {
richLinkListener.onClicked(view, meta);
} else {
richLinkClicked();
}
}
}
});
}
private void richLinkClicked() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(main_url));
context.startActivity(intent);
}
public void setDefaultClickListener(boolean isDefault) {
isDefaultClick = isDefault;
}
public void setClickListener(RichLinkListener richLinkListener1) {
richLinkListener = richLinkListener1;
}
protected LinearLayout findLinearLayoutChild() {
if (getChildCount() > 0 && getChildAt(0) instanceof LinearLayout) {
return (LinearLayout) getChildAt(0);
}
return null;
}
public void setLinkFromMeta(MetaData metaData) {
meta = metaData;
initView();
}
public MetaData getMetaData() {
return meta;
}
public void setLink(String url, final ViewListener viewListener) {
main_url = url;
RichPreview richPreview = new RichPreview(new ResponseListener() {
@Override
public void onData(MetaData metaData) {
meta = metaData;
if(!meta.getTitle().isEmpty() || !meta.getTitle().equals("")) {
viewListener.onSuccess(true);
}
initView();
}
@Override
public void onError(Exception e) {
viewListener.onError(e);
}
});
richPreview.getPreview(url);
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewSkype.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
/**
* Created by ponna on 16-01-2018.
*/
public class RichLinkViewSkype extends RelativeLayout {
private View view;
Context context;
private MetaData meta;
RelativeLayout relativeLayout;
ImageView imageView;
ImageView imageViewFavIcon;
TextView textViewTitle;
TextView textViewDesp;
TextView textViewUrl;
private String main_url;
private boolean isDefaultClick = true;
private RichLinkListener richLinkListener;
public RichLinkViewSkype(Context context) {
super(context);
this.context = context;
}
public RichLinkViewSkype(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public RichLinkViewSkype(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public RichLinkViewSkype(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
this.context = context;
}
public void initView() {
if(findRelativeLayoutChild() != null) {
this.view = findRelativeLayoutChild();
} else {
this.view = this;
inflate(context, R.layout.skype_link_layout,this);
}
relativeLayout = findViewById(R.id.rich_link_card);
imageView = findViewById(R.id.rich_link_image);
imageViewFavIcon = findViewById(R.id.rich_link_favicon);
textViewTitle = findViewById(R.id.rich_link_title);
textViewDesp = findViewById(R.id.rich_link_desp);
textViewUrl = findViewById(R.id.rich_link_url);
if(meta.getImageurl().equals("") || meta.getImageurl().isEmpty()) {
imageView.setVisibility(GONE);
} else {
imageView.setVisibility(VISIBLE);
Picasso.get()
.load(meta.getImageurl())
.into(imageView);
}
if(meta.getFavicon().equals("") || meta.getFavicon().isEmpty()) {
imageViewFavIcon.setVisibility(GONE);
} else {
imageViewFavIcon.setVisibility(VISIBLE);
Picasso.get()
.load(meta.getFavicon())
.into(imageViewFavIcon);
}
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
textViewTitle.setVisibility(GONE);
} else {
textViewTitle.setVisibility(VISIBLE);
textViewTitle.setText(meta.getTitle());
}
if(meta.getUrl().isEmpty() || meta.getUrl().equals("")) {
textViewUrl.setVisibility(GONE);
} else {
textViewUrl.setVisibility(VISIBLE);
textViewUrl.setText(meta.getUrl());
}
if(meta.getDescription().isEmpty() || meta.getDescription().equals("")) {
textViewDesp.setVisibility(GONE);
} else {
textViewDesp.setVisibility(VISIBLE);
textViewDesp.setText(meta.getDescription());
}
relativeLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(isDefaultClick) {
richLinkClicked();
} else {
if(richLinkListener != null) {
richLinkListener.onClicked(view, meta);
} else {
richLinkClicked();
}
}
}
});
}
private void richLinkClicked() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(main_url));
context.startActivity(intent);
}
protected RelativeLayout findRelativeLayoutChild() {
if (getChildCount() > 0 && getChildAt(0) instanceof LinearLayout) {
return (RelativeLayout) getChildAt(0);
}
return null;
}
public void setLinkFromMeta(MetaData metaData) {
meta = metaData;
initView();
}
public MetaData getMetaData() {
return meta;
}
public void setDefaultClickListener(boolean isDefault) {
isDefaultClick = isDefault;
}
public void setClickListener(RichLinkListener richLinkListener1) {
richLinkListener = richLinkListener1;
}
public void setLink(String url, final ViewListener viewListener) {
main_url = url;
RichPreview richPreview = new RichPreview(new ResponseListener() {
@Override
public void onData(MetaData metaData) {
meta = metaData;
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
viewListener.onSuccess(true);
}
initView();
}
@Override
public void onError(Exception e) {
viewListener.onError(e);
}
});
richPreview.getPreview(url);
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTelegram.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.Spannable;
import android.text.style.URLSpan;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
/**
* Created by ponna on 16-01-2018.
*/
public class RichLinkViewTelegram extends RelativeLayout {
private View view;
Context context;
private MetaData meta;
LinearLayout linearLayout;
ImageView imageView;
TextView textViewTitle;
TextView textViewDesp;
TextView textViewUrl;
TextView textViewOriginalUrl;
private String main_url;
private boolean isDefaultClick = true;
private RichLinkListener richLinkListener;
public RichLinkViewTelegram(Context context) {
super(context);
this.context = context;
}
public RichLinkViewTelegram(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public RichLinkViewTelegram(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public RichLinkViewTelegram(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
this.context = context;
}
public void initView() {
if(findLinearLayoutChild() != null) {
this.view = findLinearLayoutChild();
} else {
this.view = this;
inflate(context, R.layout.telegram_link_layout,this);
}
linearLayout = findViewById(R.id.rich_link_card);
imageView = findViewById(R.id.rich_link_image);
textViewTitle = findViewById(R.id.rich_link_title);
textViewDesp = findViewById(R.id.rich_link_desp);
textViewUrl = findViewById(R.id.rich_link_url);
textViewOriginalUrl = findViewById(R.id.rich_link_original_url);
textViewOriginalUrl.setText(main_url);
removeUnderlines((Spannable)textViewOriginalUrl.getText());
if(meta.getImageurl().equals("") || meta.getImageurl().isEmpty()) {
imageView.setVisibility(GONE);
} else {
imageView.setVisibility(VISIBLE);
Picasso.get()
.load(meta.getImageurl())
.into(imageView);
}
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
textViewTitle.setVisibility(GONE);
} else {
textViewTitle.setVisibility(VISIBLE);
textViewTitle.setText(meta.getTitle());
}
if(meta.getUrl().isEmpty() || meta.getUrl().equals("")) {
textViewUrl.setVisibility(GONE);
} else {
textViewUrl.setVisibility(VISIBLE);
textViewUrl.setText(meta.getUrl());
}
if(meta.getDescription().isEmpty() || meta.getDescription().equals("")) {
textViewDesp.setVisibility(GONE);
} else {
textViewDesp.setVisibility(VISIBLE);
textViewDesp.setText(meta.getDescription());
}
linearLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(isDefaultClick) {
richLinkClicked();
} else {
if(richLinkListener != null) {
richLinkListener.onClicked(view, meta);
} else {
richLinkClicked();
}
}
}
});
}
private void richLinkClicked() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(main_url));
context.startActivity(intent);
}
protected LinearLayout findLinearLayoutChild() {
if (getChildCount() > 0 && getChildAt(0) instanceof LinearLayout) {
return (LinearLayout) getChildAt(0);
}
return null;
}
public void setLinkFromMeta(MetaData metaData) {
meta = metaData;
initView();
}
public MetaData getMetaData() {
return meta;
}
public void setDefaultClickListener(boolean isDefault) {
isDefaultClick = isDefault;
}
public void setClickListener(RichLinkListener richLinkListener1) {
richLinkListener = richLinkListener1;
}
public void setLink(String url, final ViewListener viewListener) {
main_url = url;
RichPreview richPreview = new RichPreview(new ResponseListener() {
@Override
public void onData(MetaData metaData) {
meta = metaData;
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
viewListener.onSuccess(true);
}
initView();
}
@Override
public void onError(Exception e) {
viewListener.onError(e);
}
});
richPreview.getPreview(url);
}
private static void removeUnderlines(Spannable p_Text) {
URLSpan[] spans = p_Text.getSpans(0, p_Text.length(), URLSpan.class);
for(URLSpan span:spans) {
int start = p_Text.getSpanStart(span);
int end = p_Text.getSpanEnd(span);
p_Text.removeSpan(span);
span = new URLSpanNoUnderline(span.getURL());
p_Text.setSpan(span, start, end, 0);
}
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTwitter.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
/**
* Created by ponna on 16-01-2018.
*/
public class RichLinkViewTwitter extends RelativeLayout {
private View view;
Context context;
private MetaData meta;
LinearLayout linearLayout;
ImageView imageView;
TextView textViewTitle;
TextView textViewDesp;
TextView textViewUrl;
private String main_url;
private boolean isDefaultClick = true;
private RichLinkListener richLinkListener;
public RichLinkViewTwitter(Context context) {
super(context);
this.context = context;
}
public RichLinkViewTwitter(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public RichLinkViewTwitter(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public RichLinkViewTwitter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
this.context = context;
}
public void initView() {
if(findLinearLayoutChild() != null) {
this.view = findLinearLayoutChild();
} else {
this.view = this;
inflate(context, R.layout.twitter_link_layout,this);
}
linearLayout = findViewById(R.id.rich_link_card);
imageView = findViewById(R.id.rich_link_image);
textViewTitle = findViewById(R.id.rich_link_title);
textViewDesp = findViewById(R.id.rich_link_desp);
if(meta.getImageurl().equals("") || meta.getImageurl().isEmpty()) {
imageView.setVisibility(GONE);
} else {
imageView.setVisibility(VISIBLE);
Picasso.get()
.load(meta.getImageurl())
.into(imageView);
}
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
textViewTitle.setVisibility(GONE);
} else {
textViewTitle.setVisibility(VISIBLE);
textViewTitle.setText(meta.getTitle());
}
if(meta.getDescription().isEmpty() || meta.getDescription().equals("")) {
textViewDesp.setVisibility(GONE);
} else {
textViewDesp.setVisibility(VISIBLE);
textViewDesp.setText(meta.getDescription());
}
linearLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(isDefaultClick) {
richLinkClicked();
} else {
if(richLinkListener != null) {
richLinkListener.onClicked(view, meta);
} else {
richLinkClicked();
}
}
}
});
}
private void richLinkClicked() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(main_url));
context.startActivity(intent);
}
protected LinearLayout findLinearLayoutChild() {
if (getChildCount() > 0 && getChildAt(0) instanceof LinearLayout) {
return (LinearLayout) getChildAt(0);
}
return null;
}
public void setLinkFromMeta(MetaData metaData) {
meta = metaData;
initView();
}
public MetaData getMetaData() {
return meta;
}
public void setDefaultClickListener(boolean isDefault) {
isDefaultClick = isDefault;
}
public void setClickListener(RichLinkListener richLinkListener1) {
richLinkListener = richLinkListener1;
}
public void setLink(String url, final ViewListener viewListener) {
main_url = url;
RichPreview richPreview = new RichPreview(new ResponseListener() {
@Override
public void onData(MetaData metaData) {
meta = metaData;
if(meta.getTitle().isEmpty() || meta.getTitle().equals("")) {
viewListener.onSuccess(true);
}
initView();
}
@Override
public void onError(Exception e) {
viewListener.onError(e);
}
});
richPreview.getPreview(url);
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichPreview.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.webkit.URLUtil;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Created by ponna on 16-01-2018.
*/
public class RichPreview {
MetaData metaData;
ResponseListener responseListener;
String url;
String userAgent;
public RichPreview(ResponseListener responseListener) {
this.responseListener = responseListener;
metaData = new MetaData();
}
public void getPreview(String url) {
this.url = url;
metaData.setOriginalUrl(url);
new getData().execute();
}
public void getPreview(String url, String userAgent) {
this.userAgent = userAgent;
getPreview(url);
}
private class getData extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
Document doc = null;
try {
Connection connection = Jsoup.connect(url)
.timeout(30 * 1000);
if (!TextUtils.isEmpty(userAgent)) {
connection = connection.userAgent(userAgent);
}
doc = connection.get();
Elements elements = doc.getElementsByTag("meta");
// getTitle doc.select("meta[property=og:title]")
String title = doc.select("meta[property=og:title]").attr("content");
if (title == null || title.isEmpty()) {
title = doc.title();
}
metaData.setTitle(title);
//getDescription
String description = doc.select("meta[name=description]").attr("content");
if (description.isEmpty() || description == null) {
description = doc.select("meta[name=Description]").attr("content");
}
if (description.isEmpty() || description == null) {
description = doc.select("meta[property=og:description]").attr("content");
}
if (description.isEmpty() || description == null) {
description = "";
}
metaData.setDescription(description);
// getMediaType
Elements mediaTypes = doc.select("meta[name=medium]");
String type = "";
if (mediaTypes.size() > 0) {
String media = mediaTypes.attr("content");
type = media.equals("image") ? "photo" : media;
} else {
type = doc.select("meta[property=og:type]").attr("content");
}
metaData.setMediatype(type);
//getImages
Elements imageElements = doc.select("meta[property=og:image]");
if (imageElements.size() > 0) {
String image = imageElements.attr("content");
if (!image.isEmpty()) {
metaData.setImageurl(resolveURL(url, image));
}
}
//get image from meta[name=og:image]
if(Metadata.getImageurl().isEmpty())
{
Elements imageElements = doc.select("meta[name=og:image]");
if(imageElements.size() > 0) {
String image = imageElements.attr("content");
if(!image.isEmpty()) {
metaData.setImageurl(resolveURL(url, image));
}
}
}
if(metaData.getImageurl().isEmpty()) {
String src = doc.select("link[rel=image_src]").attr("href");
if (!src.isEmpty()) {
metaData.setImageurl(resolveURL(url, src));
} else {
src = doc.select("link[rel=apple-touch-icon]").attr("href");
if (!src.isEmpty()) {
metaData.setImageurl(resolveURL(url, src));
metaData.setFavicon(resolveURL(url, src));
} else {
src = doc.select("link[rel=icon]").attr("href");
if (!src.isEmpty()) {
metaData.setImageurl(resolveURL(url, src));
metaData.setFavicon(resolveURL(url, src));
}
}
}
}
//Favicon
String src = doc.select("link[rel=apple-touch-icon]").attr("href");
if (!src.isEmpty()) {
metaData.setFavicon(resolveURL(url, src));
} else {
src = doc.select("link[rel=icon]").attr("href");
if (!src.isEmpty()) {
metaData.setFavicon(resolveURL(url, src));
}
}
for(Element element : elements) {
if(element.hasAttr("property")) {
String str_property = element.attr("property").trim();
if(str_property.equals("og:url")) {
metaData.setUrl(element.attr("content"));
}
if(str_property.equals("og:site_name")) {
metaData.setSitename(element.attr("content"));
}
}
}
if (metaData.getUrl().equals("") || metaData.getUrl().isEmpty()) {
URI uri = null;
try {
uri = new URI(url);
} catch (URISyntaxException e) {
e.printStackTrace();
}
if (url == null || uri == null) {
metaData.setUrl(url);
} else {
metaData.setUrl(uri.getHost());
}
}
} catch (IOException e) {
e.printStackTrace();
responseListener.onError(new Exception(
"No Html Received from " + url + " Check your Internet " + e.getLocalizedMessage()));
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
responseListener.onData(metaData);
}
}
private String resolveURL(String url, String part) {
if (URLUtil.isValidUrl(part)) {
return part;
} else {
URI base_uri = null;
try {
base_uri = new URI(url);
base_uri = base_uri.resolve(part);
return base_uri.toString();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/URLSpanNoUnderline.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import android.text.TextPaint;
import android.text.style.URLSpan;
/**
* Created by ponna on 20-01-2018.
*/
public class URLSpanNoUnderline extends URLSpan {
public URLSpanNoUnderline(String p_Url) {
super(p_Url);
}
public void updateDrawState(TextPaint p_DrawState) {
super.updateDrawState(p_DrawState);
p_DrawState.setUnderlineText(false);
}
}
================================================
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ViewListener.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
/**
* Created by ponna on 16-01-2018.
*/
public interface ViewListener {
void onSuccess(boolean status);
void onError(Exception e);
}
================================================
FILE: richlinkpreview/src/main/res/drawable/bg_card.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/bg_card" />
<corners android:radius="5dp" />
</shape>
================================================
FILE: richlinkpreview/src/main/res/drawable/bg_radius.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/md_white_1000" />
<corners android:radius="5dp" />
</shape>
================================================
FILE: richlinkpreview/src/main/res/drawable/bg_skype.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:type="linear"
android:angle="270"
android:startColor="@color/skype_start_color"
android:endColor="@color/skype_end_color" />
<corners android:radius="5dp" />
</shape>
================================================
FILE: richlinkpreview/src/main/res/drawable/bg_telegram.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:color="@color/md_light_blue_500" android:width="3dp" />
</shape>
</item>
<item android:left="3dp">
<shape android:shape="rectangle">
<solid android:color="@color/md_white_1000" />
</shape>
</item>
</layer-list>
================================================
FILE: richlinkpreview/src/main/res/layout/link_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:gravity="center"
android:padding="5dp"
android:background="@drawable/bg_card"
android:id="@+id/rich_link_card"
android:layout_margin="5dp">
<ImageView
android:scaleType="centerCrop"
android:id="@+id/rich_link_image"
android:layout_width="110dp"
android:layout_height="90dp" />
<LinearLayout
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_title"
android:textColor="@color/grey_900"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:maxLines="2"
android:ellipsize="end"
android:id="@+id/rich_link_desp"
android:textColor="@color/blue_grey_300"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_url"
android:textColor="@color/blue_grey_700"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
</LinearLayout>
</LinearLayout>
================================================
FILE: richlinkpreview/src/main/res/layout/skype_link_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="150dp"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rich_link_card"
android:background="@drawable/bg_radius"
android:layout_margin="5dp">
<ImageView
android:scaleType="centerInside"
android:id="@+id/rich_link_image"
android:layout_width="match_parent"
android:layout_height="150dp" />
<RelativeLayout
android:background="@drawable/bg_skype"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:paddingLeft="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_title"
android:textColor="@color/md_white_1000"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:maxLines="2"
android:ellipsize="end"
android:id="@+id/rich_link_desp"
android:textColor="@color/md_white_1000"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<LinearLayout
android:gravity="center"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:scaleType="centerInside"
android:id="@+id/rich_link_favicon"
android:layout_width="20dp"
android:layout_height="20dp" />
<TextView
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_url"
android:textColor="@color/md_white_1000"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
================================================
FILE: richlinkpreview/src/main/res/layout/telegram_link_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:gravity="center"
android:padding="10dp"
android:background="@drawable/bg_radius"
android:id="@+id/rich_link_card"
android:layout_margin="5dp">
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="@color/md_light_blue_400"
android:autoLink="web"
tools:text="Original Link"
android:textColorLink="@color/md_light_blue_400"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rich_link_original_url"/>
<LinearLayout
android:background="@drawable/bg_telegram"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_weight="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_url"
android:textColor="@color/md_light_blue_500"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:textStyle="bold"
android:maxLines="2"
android:ellipsize="end"
android:id="@+id/rich_link_title"
android:textColor="@color/grey_900"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:maxLines="2"
android:ellipsize="end"
android:id="@+id/rich_link_desp"
android:textColor="@color/blue_grey_300"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
</LinearLayout>
<ImageView
android:scaleType="centerInside"
android:id="@+id/rich_link_image"
android:layout_width="110dp"
android:layout_height="90dp" />
</LinearLayout>
</LinearLayout>
================================================
FILE: richlinkpreview/src/main/res/layout/twitter_link_layout.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:gravity="center"
android:padding="5dp"
android:background="@drawable/bg_radius"
android:id="@+id/rich_link_card"
android:layout_margin="5dp">
<ImageView
android:scaleType="centerCrop"
android:id="@+id/rich_link_image"
android:layout_width="110dp"
android:layout_height="90dp" />
<LinearLayout
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
android:id="@+id/rich_link_title"
android:textColor="@color/grey_900"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
<TextView
android:maxLines="2"
android:ellipsize="end"
android:id="@+id/rich_link_desp"
android:textColor="@color/blue_grey_300"
android:padding="2dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Data"/>
</LinearLayout>
</LinearLayout>
================================================
FILE: richlinkpreview/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="grey_900">#212121</color>
<color name="blue_grey_300">#616f76</color>
<color name="blue_grey_700">#434f54</color>
<color name="bg_card">#e0f9cc</color>
<color name="skype_start_color">#201db0ed</color>
<color name="skype_end_color">#30000000</color>
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<color name="md_red_300">#E57373</color>
<color name="md_red_400">#EF5350</color>
<color name="md_red_500">#F44336</color>
<color name="md_red_600">#E53935</color>
<color name="md_red_700">#D32F2F</color>
<color name="md_red_800">#C62828</color>
<color name="md_red_900">#B71C1C</color>
<color name="md_red_A100">#FF8A80</color>
<color name="md_red_A200">#FF5252</color>
<color name="md_red_A400">#FF1744</color>
<color name="md_red_A700">#D50000</color>
<!-- pinks -->
<color name="md_pink_50">#FCE4EC</color>
<color name="md_pink_100">#F8BBD0</color>
<color name="md_pink_200">#F48FB1</color>
<color name="md_pink_300">#F06292</color>
<color name="md_pink_400">#EC407A</color>
<color name="md_pink_500">#E91E63</color>
<color name="md_pink_600">#D81B60</color>
<color name="md_pink_700">#C2185B</color>
<color name="md_pink_800">#AD1457</color>
<color name="md_pink_900">#880E4F</color>
<color name="md_pink_A100">#FF80AB</color>
<color name="md_pink_A200">#FF4081</color>
<color name="md_pink_A400">#F50057</color>
<color name="md_pink_A700">#C51162</color>
<!-- purples -->
<color name="md_purple_50">#F3E5F5</color>
<color name="md_purple_100">#E1BEE7</color>
<color name="md_purple_200">#CE93D8</color>
<color name="md_purple_300">#BA68C8</color>
<color name="md_purple_400">#AB47BC</color>
<color name="md_purple_500">#9C27B0</color>
<color name="md_purple_600">#8E24AA</color>
<color name="md_purple_700">#7B1FA2</color>
<color name="md_purple_800">#6A1B9A</color>
<color name="md_purple_900">#4A148C</color>
<color name="md_purple_A100">#EA80FC</color>
<color name="md_purple_A200">#E040FB</color>
<color name="md_purple_A400">#D500F9</color>
<color name="md_purple_A700">#AA00FF</color>
<!-- deep purples -->
<color name="md_deep_purple_50">#EDE7F6</color>
<color name="md_deep_purple_100">#D1C4E9</color>
<color name="md_deep_purple_200">#B39DDB</color>
<color name="md_deep_purple_300">#9575CD</color>
<color name="md_deep_purple_400">#7E57C2</color>
<color name="md_deep_purple_500">#673AB7</color>
<color name="md_deep_purple_600">#5E35B1</color>
<color name="md_deep_purple_700">#512DA8</color>
<color name="md_deep_purple_800">#4527A0</color>
<color name="md_deep_purple_900">#311B92</color>
<color name="md_deep_purple_A100">#B388FF</color>
<color name="md_deep_purple_A200">#7C4DFF</color>
<color name="md_deep_purple_A400">#651FFF</color>
<color name="md_deep_purple_A700">#6200EA</color>
<!-- indigo -->
<color name="md_indigo_50">#E8EAF6</color>
<color name="md_indigo_100">#C5CAE9</color>
<color name="md_indigo_200">#9FA8DA</color>
<color name="md_indigo_300">#7986CB</color>
<color name="md_indigo_400">#5C6BC0</color>
<color name="md_indigo_500">#3F51B5</color>
<color name="md_indigo_600">#3949AB</color>
<color name="md_indigo_700">#303F9F</color>
<color name="md_indigo_800">#283593</color>
<color name="md_indigo_900">#1A237E</color>
<color name="md_indigo_A100">#8C9EFF</color>
<color name="md_indigo_A200">#536DFE</color>
<color name="md_indigo_A400">#3D5AFE</color>
<color name="md_indigo_A700">#304FFE</color>
<!--blue-->
<color name="md_blue_50">#E3F2FD</color>
<color name="md_blue_100">#BBDEFB</color>
<color name="md_blue_200">#90CAF9</color>
<color name="md_blue_300">#64B5F6</color>
<color name="md_blue_400">#42A5F5</color>
<color name="md_blue_500">#2196F3</color>
<color name="md_blue_600">#1E88E5</color>
<color name="md_blue_700">#1976D2</color>
<color name="md_blue_800">#1565C0</color>
<color name="md_blue_900">#0D47A1</color>
<color name="md_blue_A100">#82B1FF</color>
<color name="md_blue_A200">#448AFF</color>
<color name="md_blue_A400">#2979FF</color>
<color name="md_blue_A700">#2962FF</color>
<!-- light blue-->
<color name="md_light_blue_50">#E1F5FE</color>
<color name="md_light_blue_100">#B3E5FC</color>
<color name="md_light_blue_200">#81D4fA</color>
<color name="md_light_blue_300">#4fC3F7</color>
<color name="md_light_blue_400">#29B6FC</color>
<color name="md_light_blue_500">#03A9F4</color>
<color name="md_light_blue_600">#039BE5</color>
<color name="md_light_blue_700">#0288D1</color>
<color name="md_light_blue_800">#0277BD</color>
<color name="md_light_blue_900">#01579B</color>
<color name="md_light_blue_A100">#80D8FF</color>
<color name="md_light_blue_A200">#40C4FF</color>
<color name="md_light_blue_A400">#00B0FF</color>
<color name="md_light_blue_A700">#0091EA</color>
<!-- cyan -->
<color name="md_cyan_50">#E0F7FA</color>
<color name="md_cyan_100">#B2EBF2</color>
<color name="md_cyan_200">#80DEEA</color>
<color name="md_cyan_300">#4DD0E1</color>
<color name="md_cyan_400">#26C6DA</color>
<color name="md_cyan_500">#00BCD4</color>
<color name="md_cyan_600">#00ACC1</color>
<color name="md_cyan_700">#0097A7</color>
<color name="md_cyan_800">#00838F</color>
<color name="md_cyan_900">#006064</color>
<color name="md_cyan_A100">#84FFFF</color>
<color name="md_cyan_A200">#18FFFF</color>
<color name="md_cyan_A400">#00E5FF</color>
<color name="md_cyan_A700">#00B8D4</color>
<!-- teal -->
<color name="md_teal_50">#E0F2F1</color>
<color name="md_teal_100">#B2DFDB</color>
<color name="md_teal_200">#80CBC4</color>
<color name="md_teal_300">#4DB6AC</color>
<color name="md_teal_400">#26A69A</color>
<color name="md_teal_500">#009688</color>
<color name="md_teal_600">#00897B</color>
<color name="md_teal_700">#00796B</color>
<color name="md_teal_800">#00695C</color>
<color name="md_teal_900">#004D40</color>
<color name="md_teal_A100">#A7FFEB</color>
<color name="md_teal_A200">#64FFDA</color>
<color name="md_teal_A400">#1DE9B6</color>
<color name="md_teal_A700">#00BFA5</color>
<!-- green -->
<color name="md_green_50">#E8F5E9</color>
<color name="md_green_100">#C8E6C9</color>
<color name="md_green_200">#A5D6A7</color>
<color name="md_green_300">#81C784</color>
<color name="md_green_400">#66BB6A</color>
<color name="md_green_500">#4CAF50</color>
<color name="md_green_600">#43A047</color>
<color name="md_green_700">#388E3C</color>
<color name="md_green_800">#2E7D32</color>
<color name="md_green_900">#1B5E20</color>
<color name="md_green_A100">#B9F6CA</color>
<color name="md_green_A200">#69F0AE</color>
<color name="md_green_A400">#00E676</color>
<color name="md_green_A700">#00C853</color>
<!--light green-->
<color name="md_light_green_50">#F1F8E9</color>
<color name="md_light_green_100">#DCEDC8</color>
<color name="md_light_green_200">#C5E1A5</color>
<color name="md_light_green_300">#AED581</color>
<color name="md_light_green_400">#9CCC65</color>
<color name="md_light_green_500">#8BC34A</color>
<color name="md_light_green_600">#7CB342</color>
<color name="md_light_green_700">#689F38</color>
<color name="md_light_green_800">#558B2F</color>
<color name="md_light_green_900">#33691E</color>
<color name="md_light_green_A100">#CCFF90</color>
<color name="md_light_green_A200">#B2FF59</color>
<color name="md_light_green_A400">#76FF03</color>
<color name="md_light_green_A700">#64DD17</color>
<!-- lime-->
<color name="md_lime_50">#F9FBE7</color>
<color name="md_lime_100">#F0F4C3</color>
<color name="md_lime_200">#E6EE9C</color>
<color name="md_lime_300">#DCE775</color>
<color name="md_lime_400">#D4E157</color>
<color name="md_lime_500">#CDDC39</color>
<color name="md_lime_600">#C0CA33</color>
<color name="md_lime_700">#A4B42B</color>
<color name="md_lime_800">#9E9D24</color>
<color name="md_lime_900">#827717</color>
<color name="md_lime_A100">#F4FF81</color>
<color name="md_lime_A200">#EEFF41</color>
<color name="md_lime_A400">#C6FF00</color>
<color name="md_lime_A700">#AEEA00</color>
<!--yellow -->
<color name="md_yellow_50">#FFFDE7</color>
<color name="md_yellow_100">#FFF9C4</color>
<color name="md_yellow_200">#FFF590</color>
<color name="md_yellow_300">#FFF176</color>
<color name="md_yellow_400">#FFEE58</color>
<color name="md_yellow_500">#FFEB3B</color>
<color name="md_yellow_600">#FDD835</color>
<color name="md_yellow_700">#FBC02D</color>
<color name="md_yellow_800">#F9A825</color>
<color name="md_yellow_900">#F57F17</color>
<color name="md_yellow_A100">#FFFF82</color>
<color name="md_yellow_A200">#FFFF00</color>
<color name="md_yellow_A400">#FFEA00</color>
<color name="md_yellow_A700">#FFD600</color>
<!--amber-->
<color name="md_amber_50">#FFF8E1</color>
<color name="md_amber_100">#FFECB3</color>
<color name="md_amber_200">#FFE082</color>
<color name="md_amber_300">#FFD54F</color>
<color name="md_amber_400">#FFCA28</color>
<color name="md_amber_500">#FFC107</color>
<color name="md_amber_600">#FFB300</color>
<color name="md_amber_700">#FFA000</color>
<color name="md_amber_800">#FF8F00</color>
<color name="md_amber_900">#FF6F00</color>
<color name="md_amber_A100">#FFE57F</color>
<color name="md_amber_A200">#FFD740</color>
<color name="md_amber_A400">#FFC400</color>
<color name="md_amber_A700">#FFAB00</color>
<!--orange-->
<color name="md_orange_50">#FFF3E0</color>
<color name="md_orange_100">#FFE0B2</color>
<color name="md_orange_200">#FFCC80</color>
<color name="md_orange_300">#FFB74D</color>
<color name="md_orange_400">#FFA726</color>
<color name="md_orange_500">#FF9800</color>
<color name="md_orange_600">#FB8C00</color>
<color name="md_orange_700">#F57C00</color>
<color name="md_orange_800">#EF6C00</color>
<color name="md_orange_900">#E65100</color>
<color name="md_orange_A100">#FFD180</color>
<color name="md_orange_A200">#FFAB40</color>
<color name="md_orange_A400">#FF9100</color>
<color name="md_orange_A700">#FF6D00</color>
<!--deep orange-->
<color name="md_deep_orange_50">#FBE9A7</color>
<color name="md_deep_orange_100">#FFCCBC</color>
<color name="md_deep_orange_200">#FFAB91</color>
<color name="md_deep_orange_300">#FF8A65</color>
<color name="md_deep_orange_400">#FF7043</color>
<color name="md_deep_orange_500">#FF5722</color>
<color name="md_deep_orange_600">#F4511E</color>
<color name="md_deep_orange_700">#E64A19</color>
<color name="md_deep_orange_800">#D84315</color>
<color name="md_deep_orange_900">#BF360C</color>
<color name="md_deep_orange_A100">#FF9E80</color>
<color name="md_deep_orange_A200">#FF6E40</color>
<color name="md_deep_orange_A400">#FF3D00</color>
<color name="md_deep_orange_A700">#DD2600</color>
<!--brown -->
<color name="md_brown_50">#EFEBE9</color>
<color name="md_brown_100">#D7CCC8</color>
<color name="md_brown_200">#BCAAA4</color>
<color name="md_brown_300">#A1887F</color>
<color name="md_brown_400">#8D6E63</color>
<color name="md_brown_500">#795548</color>
<color name="md_brown_600">#6D4C41</color>
<color name="md_brown_700">#5D4037</color>
<color name="md_brown_800">#4E342E</color>
<color name="md_brown_900">#3E2723</color>
<!--grey-->
<color name="md_grey_50">#FAFAFA</color>
<color name="md_grey_100">#F5F5F5</color>
<color name="md_grey_200">#EEEEEE</color>
<color name="md_grey_300">#E0E0E0</color>
<color name="md_grey_400">#BDBDBD</color>
<color name="md_grey_500">#9E9E9E</color>
<color name="md_grey_600">#757575</color>
<color name="md_grey_700">#616161</color>
<color name="md_grey_800">#424242</color>
<color name="md_grey_900">#212121</color>
<color name="md_black_1000">#000000</color>
<color name="md_white_1000">#ffffff</color>
<!--blue grey-->
<color name="md_blue_grey_50">#ECEFF1</color>
<color name="md_blue_grey_100">#CFD8DC</color>
<color name="md_blue_grey_200">#B0BBC5</color>
<color name="md_blue_grey_300">#90A4AE</color>
<color name="md_blue_grey_400">#78909C</color>
<color name="md_blue_grey_500">#607D8B</color>
<color name="md_blue_grey_600">#546E7A</color>
<color name="md_blue_grey_700">#455A64</color>
<color name="md_blue_grey_800">#37474F</color>
<color name="md_blue_grey_900">#263238</color>
</resources>
================================================
FILE: richlinkpreview/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">RichLinkPreview</string>
</resources>
================================================
FILE: richlinkpreview/src/test/java/io/github/ponnamkarthik/richlinkpreview/ExampleUnitTest.java
================================================
package io.github.ponnamkarthik.richlinkpreview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: settings.gradle
================================================
include ':app', ':richlinkpreview'
gitextract_5yg07epf/ ├── .gitignore ├── .idea/ │ ├── codeStyles/ │ │ └── Project.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── LICENSE ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── io/ │ │ └── github/ │ │ └── ponnamkarthik/ │ │ └── sample/ │ │ └── ExampleInstrumentedTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── io/ │ │ │ └── github/ │ │ │ └── ponnamkarthik/ │ │ │ └── sample/ │ │ │ ├── ListActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── NonScrollListView.java │ │ │ └── adapters/ │ │ │ └── URLAdapter.java │ │ └── res/ │ │ ├── drawable/ │ │ │ └── ic_launcher_background.xml │ │ ├── drawable-v24/ │ │ │ └── ic_launcher_foreground.xml │ │ ├── layout/ │ │ │ ├── activity_list.xml │ │ │ ├── activity_main.xml │ │ │ └── layout_list.xml │ │ ├── mipmap-anydpi-v26/ │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ └── values/ │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test/ │ └── java/ │ └── io/ │ └── github/ │ └── ponnamkarthik/ │ └── sample/ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── richlinkpreview/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── io/ │ │ └── github/ │ │ └── ponnamkarthik/ │ │ └── richlinkpreview/ │ │ └── ExampleInstrumentedTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── io/ │ │ │ └── github/ │ │ │ └── ponnamkarthik/ │ │ │ └── richlinkpreview/ │ │ │ ├── MetaData.java │ │ │ ├── ResponseListener.java │ │ │ ├── RichLinkListener.java │ │ │ ├── RichLinkView.java │ │ │ ├── RichLinkViewSkype.java │ │ │ ├── RichLinkViewTelegram.java │ │ │ ├── RichLinkViewTwitter.java │ │ │ ├── RichPreview.java │ │ │ ├── URLSpanNoUnderline.java │ │ │ └── ViewListener.java │ │ └── res/ │ │ ├── drawable/ │ │ │ ├── bg_card.xml │ │ │ ├── bg_radius.xml │ │ │ ├── bg_skype.xml │ │ │ └── bg_telegram.xml │ │ ├── layout/ │ │ │ ├── link_layout.xml │ │ │ ├── skype_link_layout.xml │ │ │ ├── telegram_link_layout.xml │ │ │ └── twitter_link_layout.xml │ │ └── values/ │ │ ├── colors.xml │ │ └── strings.xml │ └── test/ │ └── java/ │ └── io/ │ └── github/ │ └── ponnamkarthik/ │ └── richlinkpreview/ │ └── ExampleUnitTest.java └── settings.gradle
SYMBOL INDEX (116 symbols across 18 files)
FILE: app/src/androidTest/java/io/github/ponnamkarthik/sample/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: app/src/main/java/io/github/ponnamkarthik/sample/ListActivity.java
class ListActivity (line 14) | public class ListActivity extends AppCompatActivity {
method onCreate (line 18) | @Override
FILE: app/src/main/java/io/github/ponnamkarthik/sample/MainActivity.java
class MainActivity (line 18) | public class MainActivity extends AppCompatActivity {
method onCreate (line 27) | @Override
FILE: app/src/main/java/io/github/ponnamkarthik/sample/NonScrollListView.java
class NonScrollListView (line 13) | public class NonScrollListView extends ListView {
method NonScrollListView (line 15) | public NonScrollListView(Context context) {
method NonScrollListView (line 19) | public NonScrollListView(Context context, AttributeSet attrs) {
method NonScrollListView (line 23) | public NonScrollListView(Context context, AttributeSet attrs, int defS...
method onMeasure (line 27) | @Override
FILE: app/src/main/java/io/github/ponnamkarthik/sample/adapters/URLAdapter.java
class URLAdapter (line 25) | public class URLAdapter extends BaseAdapter {
method URLAdapter (line 34) | public URLAdapter(Context context, ArrayList<URL> urls){
method getCount (line 42) | @Override
method getItem (line 47) | @Override
method getViewTypeCount (line 52) | @Override
method getItemViewType (line 57) | @Override
method getItemId (line 62) | @Override
class ViewHolder (line 67) | public static class ViewHolder{
method getView (line 71) | @Override
FILE: app/src/test/java/io/github/ponnamkarthik/sample/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
FILE: richlinkpreview/src/androidTest/java/io/github/ponnamkarthik/richlinkpreview/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/MetaData.java
class MetaData (line 7) | public class MetaData {
method getUrl (line 18) | public String getUrl() {
method setUrl (line 22) | public void setUrl(String url) {
method getImageurl (line 26) | public String getImageurl() {
method setImageurl (line 30) | public void setImageurl(String imageurl) {
method getTitle (line 34) | public String getTitle() {
method setTitle (line 38) | public void setTitle(String title) {
method getDescription (line 42) | public String getDescription() {
method setDescription (line 46) | public void setDescription(String description) {
method getSitename (line 50) | public String getSitename() {
method setSitename (line 54) | public void setSitename(String sitename) {
method getMediatype (line 58) | public String getMediatype() {
method setMediatype (line 62) | public void setMediatype(String mediatype) {
method getFavicon (line 66) | public String getFavicon() {
method setFavicon (line 70) | public void setFavicon(String favicon) {
method getOriginalUrl (line 74) | public String getOriginalUrl() {
method setOriginalUrl (line 78) | public void setOriginalUrl(String originalUrl) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ResponseListener.java
type ResponseListener (line 7) | public interface ResponseListener {
method onData (line 9) | void onData(MetaData metaData);
method onError (line 11) | void onError(Exception e);
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkListener.java
type RichLinkListener (line 9) | public interface RichLinkListener {
method onClicked (line 11) | void onClicked(View view, MetaData meta);
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkView.java
class RichLinkView (line 21) | public class RichLinkView extends RelativeLayout {
method RichLinkView (line 40) | public RichLinkView(Context context) {
method RichLinkView (line 45) | public RichLinkView(Context context, AttributeSet attrs) {
method RichLinkView (line 50) | public RichLinkView(Context context, AttributeSet attrs, int defStyleA...
method RichLinkView (line 55) | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
method onFinishInflate (line 61) | @Override
method initView (line 67) | public void initView() {
method richLinkClicked (line 129) | private void richLinkClicked() {
method setDefaultClickListener (line 135) | public void setDefaultClickListener(boolean isDefault) {
method setClickListener (line 139) | public void setClickListener(RichLinkListener richLinkListener1) {
method findLinearLayoutChild (line 143) | protected LinearLayout findLinearLayoutChild() {
method setLinkFromMeta (line 150) | public void setLinkFromMeta(MetaData metaData) {
method getMetaData (line 155) | public MetaData getMetaData() {
method setLink (line 159) | public void setLink(String url, final ViewListener viewListener) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewSkype.java
class RichLinkViewSkype (line 21) | public class RichLinkViewSkype extends RelativeLayout {
method RichLinkViewSkype (line 41) | public RichLinkViewSkype(Context context) {
method RichLinkViewSkype (line 46) | public RichLinkViewSkype(Context context, AttributeSet attrs) {
method RichLinkViewSkype (line 51) | public RichLinkViewSkype(Context context, AttributeSet attrs, int defS...
method RichLinkViewSkype (line 56) | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
method initView (line 62) | public void initView() {
method richLinkClicked (line 134) | private void richLinkClicked() {
method findRelativeLayoutChild (line 139) | protected RelativeLayout findRelativeLayoutChild() {
method setLinkFromMeta (line 146) | public void setLinkFromMeta(MetaData metaData) {
method getMetaData (line 151) | public MetaData getMetaData() {
method setDefaultClickListener (line 156) | public void setDefaultClickListener(boolean isDefault) {
method setClickListener (line 160) | public void setClickListener(RichLinkListener richLinkListener1) {
method setLink (line 165) | public void setLink(String url, final ViewListener viewListener) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTelegram.java
class RichLinkViewTelegram (line 23) | public class RichLinkViewTelegram extends RelativeLayout {
method RichLinkViewTelegram (line 43) | public RichLinkViewTelegram(Context context) {
method RichLinkViewTelegram (line 48) | public RichLinkViewTelegram(Context context, AttributeSet attrs) {
method RichLinkViewTelegram (line 53) | public RichLinkViewTelegram(Context context, AttributeSet attrs, int d...
method RichLinkViewTelegram (line 58) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
method initView (line 64) | public void initView() {
method richLinkClicked (line 130) | private void richLinkClicked() {
method findLinearLayoutChild (line 135) | protected LinearLayout findLinearLayoutChild() {
method setLinkFromMeta (line 142) | public void setLinkFromMeta(MetaData metaData) {
method getMetaData (line 147) | public MetaData getMetaData() {
method setDefaultClickListener (line 152) | public void setDefaultClickListener(boolean isDefault) {
method setClickListener (line 156) | public void setClickListener(RichLinkListener richLinkListener1) {
method setLink (line 160) | public void setLink(String url, final ViewListener viewListener) {
method removeUnderlines (line 182) | private static void removeUnderlines(Spannable p_Text) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTwitter.java
class RichLinkViewTwitter (line 21) | public class RichLinkViewTwitter extends RelativeLayout {
method RichLinkViewTwitter (line 40) | public RichLinkViewTwitter(Context context) {
method RichLinkViewTwitter (line 45) | public RichLinkViewTwitter(Context context, AttributeSet attrs) {
method RichLinkViewTwitter (line 50) | public RichLinkViewTwitter(Context context, AttributeSet attrs, int de...
method RichLinkViewTwitter (line 55) | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
method initView (line 61) | public void initView() {
method richLinkClicked (line 121) | private void richLinkClicked() {
method findLinearLayoutChild (line 126) | protected LinearLayout findLinearLayoutChild() {
method setLinkFromMeta (line 133) | public void setLinkFromMeta(MetaData metaData) {
method getMetaData (line 138) | public MetaData getMetaData() {
method setDefaultClickListener (line 143) | public void setDefaultClickListener(boolean isDefault) {
method setClickListener (line 147) | public void setClickListener(RichLinkListener richLinkListener1) {
method setLink (line 151) | public void setLink(String url, final ViewListener viewListener) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichPreview.java
class RichPreview (line 21) | public class RichPreview {
method RichPreview (line 28) | public RichPreview(ResponseListener responseListener) {
method getPreview (line 33) | public void getPreview(String url) {
method getPreview (line 39) | public void getPreview(String url, String userAgent) {
class getData (line 44) | private class getData extends AsyncTask<Void, Void, Void> {
method doInBackground (line 47) | @Override
method onPostExecute (line 180) | @Override
method resolveURL (line 187) | private String resolveURL(String url, String part) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/URLSpanNoUnderline.java
class URLSpanNoUnderline (line 10) | public class URLSpanNoUnderline extends URLSpan {
method URLSpanNoUnderline (line 11) | public URLSpanNoUnderline(String p_Url) {
method updateDrawState (line 15) | public void updateDrawState(TextPaint p_DrawState) {
FILE: richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ViewListener.java
type ViewListener (line 7) | public interface ViewListener {
method onSuccess (line 9) | void onSuccess(boolean status);
method onError (line 11) | void onError(Exception e);
FILE: richlinkpreview/src/test/java/io/github/ponnamkarthik/richlinkpreview/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
Condensed preview — 62 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (125K chars).
[
{
"path": ".gitignore",
"chars": 118,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n"
},
{
"path": ".idea/codeStyles/Project.xml",
"chars": 1775,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <code_scheme name=\"Project\" version=\"173\">\n <Objective-C-extension"
},
{
"path": ".idea/gradle.xml",
"chars": 687,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GradleSettings\">\n <option name=\"linke"
},
{
"path": ".idea/misc.xml",
"chars": 2101,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"NullableNotNullManager\">\n <option nam"
},
{
"path": ".idea/modules.xml",
"chars": 498,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectModuleManager\">\n <modules>\n "
},
{
"path": ".idea/runConfigurations.xml",
"chars": 564,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"RunConfigurationProducerService\">\n <o"
},
{
"path": ".idea/vcs.xml",
"chars": 167,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 4062,
"preview": "# RichLink-Preview\nA Rich Link Preview Library for Android\n\n[ users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "gradlew",
"chars": 4971,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2314,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
},
{
"path": "richlinkpreview/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "richlinkpreview/build.gradle",
"chars": 1777,
"preview": "apply plugin: 'com.android.library'\n\n\next {\n bintrayRepo = 'RichLinkPreview'\n bintrayName = 'RichLinkPreview'\n\n "
},
{
"path": "richlinkpreview/proguard-rules.pro",
"chars": 751,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "richlinkpreview/src/androidTest/java/io/github/ponnamkarthik/richlinkpreview/ExampleInstrumentedTest.java",
"chars": 770,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.content.Context;\nimport androidx.test.InstrumentationRe"
},
{
"path": "richlinkpreview/src/main/AndroidManifest.xml",
"chars": 206,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"io.github.ponnamkarthik.richlinkprevie"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/MetaData.java",
"chars": 1611,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\n/**\n * Created by ponna on 16-01-2018.\n */\n\npublic class MetaData {\n\n "
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ResponseListener.java",
"chars": 201,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\n/**\n * Created by ponna on 16-01-2018.\n */\n\npublic interface ResponseL"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkListener.java",
"chars": 207,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.view.View;\n\n/**\n * Created by ponna on 03-03-2018.\n */\n"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkView.java",
"chars": 5110,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport "
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewSkype.java",
"chars": 5484,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport "
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTelegram.java",
"chars": 5775,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\ni"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichLinkViewTwitter.java",
"chars": 4774,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport "
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/RichPreview.java",
"chars": 7308,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.os.AsyncTask;\nimport android.text.TextUtils;\nimport and"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/URLSpanNoUnderline.java",
"chars": 440,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport android.text.TextPaint;\nimport android.text.style.URLSpan;\n\n/**"
},
{
"path": "richlinkpreview/src/main/java/io/github/ponnamkarthik/richlinkpreview/ViewListener.java",
"chars": 197,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\n/**\n * Created by ponna on 16-01-2018.\n */\n\npublic interface ViewListe"
},
{
"path": "richlinkpreview/src/main/res/drawable/bg_card.xml",
"chars": 197,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n <solid an"
},
{
"path": "richlinkpreview/src/main/res/drawable/bg_radius.xml",
"chars": 233,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n xmlns:android=\"http://schemas.android.com/ap"
},
{
"path": "richlinkpreview/src/main/res/drawable/bg_skype.xml",
"chars": 354,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape android:shape=\"rectangle\"\n xmlns:android=\"http://schemas.android.com/ap"
},
{
"path": "richlinkpreview/src/main/res/drawable/bg_telegram.xml",
"chars": 450,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item"
},
{
"path": "richlinkpreview/src/main/res/layout/link_layout.xml",
"chars": 1916,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "richlinkpreview/src/main/res/layout/skype_link_layout.xml",
"chars": 3162,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n an"
},
{
"path": "richlinkpreview/src/main/res/layout/telegram_link_layout.xml",
"chars": 2864,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "richlinkpreview/src/main/res/layout/twitter_link_layout.xml",
"chars": 1570,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "richlinkpreview/src/main/res/values/colors.xml",
"chars": 13127,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"grey_900\">#212121</color>\n <color name=\"blue_grey"
},
{
"path": "richlinkpreview/src/main/res/values/strings.xml",
"chars": 78,
"preview": "<resources>\n <string name=\"app_name\">RichLinkPreview</string>\n</resources>\n"
},
{
"path": "richlinkpreview/src/test/java/io/github/ponnamkarthik/richlinkpreview/ExampleUnitTest.java",
"chars": 417,
"preview": "package io.github.ponnamkarthik.richlinkpreview;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Exam"
},
{
"path": "settings.gradle",
"chars": 35,
"preview": "include ':app', ':richlinkpreview'\n"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the PonnamKarthik/RichLinkPreview GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 62 files (111.7 KB), approximately 30.7k tokens, and a symbol index with 116 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.