Repository: akashandroid90/ImageLetterIcon
Branch: master
Commit: 1d3bc2249f25
Files: 32
Total size: 83.0 KB
Directory structure:
gitextract_ff1qdxwa/
├── .gitignore
├── LICENSE
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── imagelettericon/
│ │ └── MainActivity.java
│ └── res/
│ ├── layout/
│ │ ├── activity_main.xml
│ │ └── list_item.xml
│ ├── menu/
│ │ └── menu.xml
│ ├── values/
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── values-w820dp/
│ └── dimens.xml
├── build.gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
├── imageletter/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── github/
│ │ └── akashandroid90/
│ │ └── imageletter/
│ │ ├── MaterialLetterIcon.java
│ │ ├── RoundedImageViewWithBorder.java
│ │ ├── TintableImageView.java
│ │ └── drawable/
│ │ ├── RoundedDrawable.java
│ │ └── TextDrawable.java
│ └── res/
│ └── values/
│ └── attrs.xml
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.gradle
gradle
/local.properties
.idea
/.idea
/build
*.iml
================================================
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
================================================
# ImageLetterIcon
Material letter icon with circle background. Also supports for image for user contact.
[](https://android-arsenal.com/details/1/2762)
[  ](https://bintray.com/akashandroid90/maven/image-letter-icon/_latestVersion)
<a href='https://bintray.com/akashandroid90/maven/image-letter-icon/view?source=watch' alt='Get automatic notifications about new "image-letter-icon" versions'><img src='https://www.bintray.com/docs/images/bintray_badge_color.png'></a>
<a href="https://play.google.com/store/apps/details?id=com.imagelettericon" alt="Download from Google Play">
<img src="http://www.android.com/images/brand/android_app_on_play_large.png">
</a>




Gradle
-------------------------
```
dependencies {
compile 'com.github.akashandroid90:imageletter:1.8@aar'
}
```
ChangeLog
-----
bug fixes
vector drawable support
Usage
-----
Declare in XML (see xml attributes below for customization):
```xml
<com.github.akashandroid90.imageletter.MaterialLetterIcon
android:layout_width="@dimen/letter_icon_size"
android:layout_height="@dimen/letter_icon_size" />
```
Or static initializer (see xml attributes below for customization):
```java
MaterialLetterIcon icon = new MaterialLetterIcon.Builder(context) //
.shapeColor(getResources().getColor(R.color.circle_color))
.setShapeType(MaterialLetterIcon.SHAPE_CIRCLE)
.letter("S")
.letterColor(getResources().getColor(R.color.letter_color))
.letterSize(26)
.lettersNumber(1)
.letterTypeface(yourTypeface)
.initials(false)
.initialsNumber(2)
.create();
```
Configure using xml attributes or setters in code:
```java
app:shape_color="@color/black" // shape color
app:shape_type="circle" // shape type
app:letter="" // letter or string to get first letter from
app:letter_color="@color/white" // letter color
app:letter_size="26" // letter size SP
app:letters_number="1" // number of letters to get from string
app:initials="false" // turn on initials mode
app:initials_number="2" // number of initials to be showed
app:corner_radius="1dp" // radius of image to make at corner
app:is_oval="true" // to make a circular image
app:border_width="1dp" // border width around the image
app:border_color="@color/black" //border color around image
```
Donations
---------
This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Your donation is highly appreciated (and I love food, coffee and beer). Thank you!
**PayPal**
* **[Donate $5]**: Thank's for creating this project, here's a coffee (or some beer) for you!
* **[Donate $10]**: Wow, I am stunned. Let me take you to the movies!
* **[Donate $15]**: I really appreciate your work, let's grab some lunch!
* **[Donate $25]**: That's some awesome stuff you did right there, dinner is on me!
* **[Donate $50]**: I really really want to support this project, great job!
* **[Donate $100]**: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
* **[Donate $2799]**: Go buddy, buy Macbook Pro for yourself!
Of course, you can also choose what you want to donate, all donations are awesome!
Developed By
--------------------
Akash Jain
[Donate $5]: https://www.paypal.me/akashandroid/5
[Donate $10]: https://www.paypal.me/akashandroid/10
[Donate $15]: https://www.paypal.me/akashandroid/15
[Donate $25]: https://www.paypal.me/akashandroid/25
[Donate $50]: https://www.paypal.me/akashandroid/50
[Donate $100]: https://www.paypal.me/akashandroid/100
[Donate $2799]: https://www.paypal.me/akashandroid/2799
================================================
FILE: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion compilesdk
buildToolsVersion buildtool
defaultConfig {
applicationId "com.imagelettericon"
minSdkVersion minsdk
targetSdkVersion targetsdk
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:recyclerview-v7:'+androidlib
compile 'com.android.support:design:'+androidlib
compile 'com.intuit.sdp:sdp-android:1.0.5'
compile project(':imageletter')
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\ide\android\Android SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}
================================================
FILE: app/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.imagelettericon">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: app/src/main/java/com/imagelettericon/MainActivity.java
================================================
package com.imagelettericon;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.github.akashandroid90.imageletter.MaterialLetterIcon;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private static final String[] desuNoto = {
"Alane Avey", "Belen Brewster", "Brandon Brochu", "Carli Carrol", "Della Delrio",
"Esther Echavarria", "Etha Edinger", "Felipe Flecha", "Ilse Island", "Kecia Keltz",
"Lourie Lucas", "Lucille Leachman", "Mandi Mcqueeney", "Murray Matchett", "Nadia Nero",
"Nannie Nipp", "Ozella Otis", "Pauletta Poehler", "Roderick Rippy", "Sherril Sager",
"Taneka Tenorio", "Treena Trentham", "Ulrike Uhlman", "Virgina Viau", "Willis Wysocki"
};
private static final String[] countries = {
"Albania", "Australia", "Belgium", "Canada", "China", "Dominica", "Egypt", "Estonia",
"Finland", "France", "Germany", "Honduras", "Italy", "Japan", "Madagascar", "Netherlands",
"Norway", "Panama", "Portugal", "Romania", "Russia", "Slovakia", "Vatican", "Zimbabwe"
};
private static final int CONTACTS = 0;
private static final int COUNTRIES = 1;
private static final int ALTERNATECOUNTRIES = 2;
private static final int ALTERNATECONTACTS = 3;
private static final Random RANDOM = new Random();
private RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
setupRecyclerView();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public void onBackPressed() {
showDialog();
}
private void showDialog() {
new AlertDialog.Builder(this).setMessage("Are you sure want to exit from app?").setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
finish();
}
}).setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).setNeutralButton("Rate us", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.imagelettericon"));
startActivity(intent);
}
}).create().show();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.contacts:
setContactsAdapter(desuNoto);
return true;
case R.id.countries:
setCountriesAdapter(countries);
return true;
case R.id.alternate_countries:
setAlternateCountriesAdapter(countries);
return true;
case R.id.alternate_contacts:
setAlternateContactsAdapter(countries);
return true;
case R.id.play_store:
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.imagelettericon"));
startActivity(intent);
return true;
case R.id.other_apps:
intent= new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://search?q=pub:AkashJain"));
startActivity(intent);
return true;
case R.id.github:
intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/akashandroid90/ImageLetterIcon"));
startActivity(intent);
return true;
case R.id.share:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Material Icon");
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://play.google.com/store/apps/details?id=com.imagelettericon");
sendIntent.setType("text/plain");
startActivity(sendIntent);
return true;
}
return super.onOptionsItemSelected(item);
}
private void setupRecyclerView() {
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
setContactsAdapter(desuNoto);
}
private void setContactsAdapter(String[] array) {
recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(this, Arrays.asList(array), CONTACTS));
}
private void setCountriesAdapter(String[] array) {
recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(this, Arrays.asList(array), COUNTRIES));
}
private void setAlternateCountriesAdapter(String[] array) {
recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(this, Arrays.asList(array), ALTERNATECOUNTRIES));
}
private void setAlternateContactsAdapter(String[] array) {
recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(this, Arrays.asList(array), ALTERNATECONTACTS));
}
public static class SimpleStringRecyclerViewAdapter
extends RecyclerView.Adapter<SimpleStringRecyclerViewAdapter.ViewHolder> {
private final TypedValue mTypedValue = new TypedValue();
private int mBackground;
private List<String> mValues;
private int[] mMaterialColors;
private int[] mImageResource;
private int mType;
SimpleStringRecyclerViewAdapter(Context context, List<String> items, int type) {
context.getTheme().resolveAttribute(R.attr.selectableItemBackground, mTypedValue, true);
mMaterialColors = context.getResources().getIntArray(R.array.colors);
mImageResource = new int[]{R.drawable.one, R.drawable.two, R.drawable.three, R.drawable.four,
R.drawable.five, R.drawable.six, R.drawable.seven, R.drawable.eight, R.drawable.nine};
mBackground = mTypedValue.resourceId;
mValues = items;
mType = type;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
view.setBackgroundResource(mBackground);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
switch (mType) {
case CONTACTS:
// holder.mIcon.setImageDrawable(TextDrawable.builder().beginConfig().textColor(Color.WHITE).bold().toUpperCase().endConfig().buildRect("aa",Color.RED));
holder.mIcon.setTextSize(18);
holder.mIcon.setOval(false);
holder.mIcon.setTextColor(Color.WHITE);
holder.mIcon.setBorderColor(Color.BLACK);
holder.mIcon.setBorderWidth(1);
holder.mIcon.setShapeColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]);
holder.mIcon.setText(mValues.get(position));
break;
case COUNTRIES:
holder.mIcon.setLetterCount(3);
holder.mIcon.setTextSize(16);
holder.mIcon.setOval(true);
holder.mIcon.setText(mValues.get(position));
holder.mIcon.setShapeColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]);
break;
case ALTERNATECOUNTRIES:
if (position % 2 == 0) {
holder.mIcon.setOval(true);
holder.mIcon.setImageResource(mImageResource[RANDOM.nextInt(mImageResource.length)]);
} else {
holder.mIcon.setOval(true);
holder.mIcon.setShapeColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]);
holder.mIcon.setText(mValues.get(position));
holder.mIcon.setLetterCount(2);
holder.mIcon.setTextSize(18);
}
break;
case ALTERNATECONTACTS:
holder.mIcon.setCornerRadius(holder.itemView.getResources().getDimensionPixelSize(R.dimen._50sdp));
if (position % 2 == 0) {
holder.mIcon.setOval(false);
holder.mIcon.setImageResource(mImageResource[RANDOM.nextInt(mImageResource.length)]);
} else {
holder.mIcon.setOval(false);
holder.mIcon.setShapeColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]);
holder.mIcon.setText(mValues.get(position));
holder.mIcon.setLetterCount(2);
holder.mIcon.setTextSize(18);
}
break;
}
holder.mBoundString = mValues.get(position);
holder.mTextView.setText(mValues.get(position));
}
@Override
public int getItemCount() {
return mValues.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final MaterialLetterIcon mIcon;
public final TextView mTextView;
public String mBoundString;
public ViewHolder(View view) {
super(view);
mView = view;
mIcon = (MaterialLetterIcon) view.findViewById(R.id.icon);
mTextView = (TextView) view.findViewById(android.R.id.text1);
}
@Override
public String toString() {
return super.toString() + " '" + mTextView.getText();
}
}
}
}
================================================
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"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
================================================
FILE: app/src/main/res/layout/list_item.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"
android:gravity="center_vertical"
android:layout_margin="@dimen/_10sdp"
android:padding="@dimen/_10sdp">
<com.github.akashandroid90.imageletter.MaterialLetterIcon
xmlns:image="http://schemas.android.com/apk/res-auto"
android:id="@+id/icon"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:layout_marginRight="@dimen/_16sdp"
android:layout_marginEnd="@dimen/_16sdp"
image:border_color="@android:color/black"
image:border_width="@dimen/_1sdp"
image:srcCompat="@mipmap/ic_launcher"
image:is_oval="true"/>
<android.support.v7.widget.AppCompatTextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceListItem" />
</LinearLayout>
================================================
FILE: app/src/main/res/menu/menu.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/contacts"
android:title="@string/menu_contacts"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/countries"
android:title="@string/menu_countries"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/alternate_contacts"
android:title="@string/menu_alternate_contacts"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/alternate_countries"
android:title="@string/menu_alternate_countries"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/play_store"
android:title="@string/menu_play_store"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/other_apps"
android:title="@string/menu_other_apps"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/github"
android:title="@string/menu_github"
android:orderInCategory="100"
app:showAsAction="never" />
<item
android:id="@+id/share"
android:title="@string/menu_share"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
================================================
FILE: app/src/main/res/values/arrays.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="colors">
<item>@color/color_1</item>
<item>@color/color_2</item>
<item>@color/color_3</item>
<item>@color/color_4</item>
<item>@color/color_5</item>
<item>@color/color_6</item>
<item>@color/color_7</item>
<item>@color/color_8</item>
<item>@color/color_9</item>
<item>@color/color_10</item>
<item>@color/color_11</item>
</array>
</resources>
================================================
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>
<color name="color_1">#DB4437</color>
<color name="color_2">#E91E63</color>
<color name="color_3">#FF5722</color>
<color name="color_4">#EF6C00</color>
<color name="color_5">#689F38</color>
<color name="color_6">#0097A7</color>
<color name="color_7">#4285F4</color>
<color name="color_8">#039BE5</color>
<color name="color_9">#3F51B5</color>
<color name="color_10">#673AB7</color>
<color name="color_11">#757575</color>
</resources>
================================================
FILE: app/src/main/res/values/dimens.xml
================================================
<resources>
<dimen name="list_item_avatar_size">50dp</dimen>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">Material Icon</string>
<string name="menu_countries">Show countries</string>
<string name="menu_alternate_countries">Show alternate countries</string>
<string name="menu_contacts">Show contacts</string>
<string name="menu_alternate_contacts">Show alternate contacts</string>
<string name="banner_ad_unit_id">ca-app-pub-5883105630361246/1929299012</string>
<string name="interstitial_ad"> ca-app-pub-5883105630361246/4184761412</string>
<string name="menu_other_apps">Other Apps</string>
<string name="menu_github">Github</string>
<string name="menu_play_store">Play store</string>
<string name="menu_share">Share</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/main/res/values-w820dp/dimens.xml
================================================
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
================================================
FILE: build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext.buildtool = '26.0.2'
ext.compilesdk = 26
ext.targetsdk = 26
ext.minsdk = 14
ext.androidlib = '26.0.0-alpha1'
ext.playservicelib = '11.0.4'
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
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.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# 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: imageletter/.gitignore
================================================
/build
================================================
FILE: imageletter/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion compilesdk
buildToolsVersion buildtool
defaultConfig {
minSdkVersion minsdk
targetSdkVersion targetsdk
versionCode 1
versionName '1.13'
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations{
compile.exclude module: 'support-media-compat'
compile.exclude module: 'support-core-utils'
compile.exclude module: 'support-core-ui'
compile.exclude module: 'animated-vector-drawable'
compile.exclude module: 'support-fragment'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:'+androidlib
}
================================================
FILE: imageletter/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\ide\android\Android SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# 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 *;
#}
#-optimizationpasses 5
#-renamesourcefileattribute SourceFile
#-optimizations !code/simplification/advanced,code/simplification/*
#
##-keep public class * extends View {
##public <init>(android.content.Context);
##public <init>(android.content.Context, android.util.AttributeSet);
##public <init>(android.content.Context, android.util.AttributeSet, int);
##public void set*(...);
##}
#
#-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
#
#-keep class com.github.akashandroid90.imageletter.** { *; }
#
-keep public class * extends android.view.View {
void set*(***);
*** get*();
}
================================================
FILE: imageletter/src/main/AndroidManifest.xml
================================================
<manifest package="com.github.akashandroid90.imageletter">
<application/>
</manifest>
================================================
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/MaterialLetterIcon.java
================================================
package com.github.akashandroid90.imageletter;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import com.github.akashandroid90.imageletter.drawable.TextDrawable;
public class MaterialLetterIcon extends RoundedImageViewWithBorder {
private TextDrawable.IShapeBuilder mBuilder;
private String mText;
private int mTextSize;
private int mTextColor;
private int mShapeColor;
private int mLetterCount;
private Typeface mTypeface;
private boolean bold, uppercase;
private boolean mOval;
public MaterialLetterIcon(Context context) {
this(context, null);
}
public MaterialLetterIcon(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MaterialLetterIcon(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mBuilder = TextDrawable.builder();
TypedArray attr = context.obtainStyledAttributes(attrs, R.styleable.MaterialLetterIcon, defStyle, 0);
mLetterCount = attr.getInt(R.styleable.MaterialLetterIcon_text_number, 2);
mTextSize = attr.getInt(R.styleable.MaterialLetterIcon_text_size, 26);
mTextColor = attr.getColor(R.styleable.MaterialLetterIcon_text_color, Color.WHITE);
mShapeColor = attr.getColor(R.styleable.MaterialLetterIcon_shape_color, Color.RED);
bold = attr.getBoolean(R.styleable.MaterialLetterIcon_is_bold, false);
uppercase = attr.getBoolean(R.styleable.MaterialLetterIcon_is_uppercase, false);
computeText(attr.getString(R.styleable.MaterialLetterIcon_text));
attr.recycle();
updateDrawable();
}
private int toPx(int dp) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
}
private void updateDrawable() {
if (TextUtils.isEmpty(mText)) {
return;
}
TextDrawable.IConfigBuilder iConfigBuilder = mBuilder.beginConfig().withBorder(getBorderWidth()).textColor(mTextColor).borderColor(getBorderColor());
if (mTypeface != null)
iConfigBuilder.useFont(mTypeface);
if (mTextSize > 0)
iConfigBuilder.fontSize(toPx(mTextSize));
if (isBold())
iConfigBuilder.bold();
if (isUppercase())
iConfigBuilder.toUpperCase();
mBuilder = iConfigBuilder.endConfig();
Drawable mDrawable;
if (isOval())
mDrawable = mBuilder.buildRound(mText, mShapeColor);
else if (getCornerRadius() > 0)
mDrawable = mBuilder.buildRoundRect(mText, mShapeColor, getCornerRadius() / 5);
else mDrawable = mBuilder.buildRect(mText, mShapeColor);
setImageDrawable(mDrawable);
}
private void computeText(String text) {
if (TextUtils.isEmpty(text)) {
return;
}
String initials[] = text.split("\\s+");
StringBuilder initialsPlain = new StringBuilder(mLetterCount);
for (String initial : initials) {
initialsPlain.append(initial.substring(0, 1));
}
mText = initialsPlain.toString();
mText = mText.substring(0, mLetterCount > mText.length() ? mText.length() : mLetterCount);
}
public String getText() {
return mText;
}
public void setText(String text) {
computeText(text);
updateDrawable();
}
public int getTextSize() {
return mTextSize;
}
public void setTextSize(int textSize) {
mTextSize = textSize;
updateDrawable();
}
public void setTypeface(Typeface typeface) {
mTypeface = typeface;
updateDrawable();
}
public Typeface getTypeFace() {
return mTypeface;
}
public int getShapeColor() {
return mShapeColor;
}
public void setShapeColor(@ColorInt int color) {
mShapeColor = color;
updateDrawable();
}
public int getTextColor() {
return mTextColor;
}
public void setTextColor(@ColorInt int color) {
mTextColor = color;
updateDrawable();
}
public boolean isBold() {
return bold;
}
public void setBold(boolean bold) {
this.bold = bold;
}
public boolean isUppercase() {
return uppercase;
}
public void setUppercase(boolean uppercase) {
this.uppercase = uppercase;
}
public int getLetterCount() {
return mLetterCount;
}
public void setLetterCount(int mLetterCount) {
this.mLetterCount = mLetterCount;
}
public void setBorderColor(int color) {
setBorderColors(ColorStateList.valueOf(color));
}
}
================================================
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/RoundedImageViewWithBorder.java
================================================
package com.github.akashandroid90.imageletter;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
import android.os.Build;
import android.support.v7.content.res.AppCompatResources;
import android.util.AttributeSet;
import com.github.akashandroid90.imageletter.drawable.RoundedDrawable;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class RoundedImageViewWithBorder extends TintableImageView {
public static final int DEFAULT_RADIUS = 0;
public static final int DEFAULT_BORDER_WIDTH = 0;
private static final ScaleType[] sScaleTypeArray = {
ScaleType.MATRIX,
ScaleType.FIT_XY,
ScaleType.FIT_START,
ScaleType.FIT_CENTER,
ScaleType.FIT_END,
ScaleType.CENTER,
ScaleType.CENTER_CROP,
ScaleType.CENTER_INSIDE
};
private int mCornerRadius = DEFAULT_RADIUS;
private int mBorderWidth = DEFAULT_BORDER_WIDTH;
private ColorStateList mBorderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
private boolean mOval = false;
private boolean mRoundBackground = false;
private int mResource;
private Drawable mDrawable;
private Drawable mBackgroundDrawable;
private ScaleType mScaleType;
public RoundedImageViewWithBorder(Context context) {
this(context, null);
}
public RoundedImageViewWithBorder(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundedImageViewWithBorder(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundedImageView, defStyle, 0);
int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1);
if (index >= 0) {
setScaleType(sScaleTypeArray[index]);
}
mCornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_corner_radius, -1);
mBorderWidth = a.getDimensionPixelSize(R.styleable.RoundedImageView_border_width, -1);
// don't allow negative values for radius and border
if (mCornerRadius < 0) {
mCornerRadius = DEFAULT_RADIUS;
}
if (mBorderWidth < 0) {
mBorderWidth = DEFAULT_BORDER_WIDTH;
}
mBorderColor = a.getColorStateList(R.styleable.RoundedImageView_border_color);
if (mBorderColor == null) {
mBorderColor = ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
}
mRoundBackground = a.getBoolean(R.styleable.RoundedImageView_round_background, false);
mOval = a.getBoolean(R.styleable.RoundedImageView_is_oval, false);
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
a.recycle();
}
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
invalidate();
}
@Override
public ScaleType getScaleType() {
return mScaleType;
}
@Override
public void setScaleType(ScaleType scaleType) {
if (scaleType == null) {
throw new NullPointerException();
}
if (mScaleType != scaleType) {
mScaleType = scaleType;
switch (scaleType) {
case CENTER:
case CENTER_CROP:
case CENTER_INSIDE:
case FIT_CENTER:
case FIT_START:
case FIT_END:
case FIT_XY:
super.setScaleType(ScaleType.FIT_XY);
break;
default:
super.setScaleType(scaleType);
break;
}
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
invalidate();
}
}
@Override
public void setImageDrawable(Drawable drawable) {
mResource = 0;
mDrawable = RoundedDrawable.fromDrawable(drawable);
updateDrawableAttrs();
super.setImageDrawable(mDrawable);
}
@Override
public void setImageBitmap(Bitmap bm) {
mResource = 0;
mDrawable = RoundedDrawable.fromBitmap(bm);
updateDrawableAttrs();
super.setImageDrawable(mDrawable);
}
@Override
public void setImageURI(Uri uri) {
mResource = 0;
try {
InputStream inputStream = getContext().getContentResolver().openInputStream(uri);
mDrawable = Drawable.createFromStream(inputStream, uri.toString());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
mDrawable = RoundedDrawable.fromDrawable(mDrawable);
updateDrawableAttrs();
super.setImageDrawable(mDrawable);
}
@Override
public void setImageResource(int resId) {
if (mResource != resId) {
mResource = resId;
mDrawable = resolveResource();
updateDrawableAttrs();
super.setImageDrawable(mDrawable);
}
}
private Drawable resolveResource() {
Drawable d = null;
if (mResource != 0) {
try {
d = AppCompatResources.getDrawable(getContext(), mResource);
} catch (Exception e) {
mResource = 0;
}
}
return RoundedDrawable.fromDrawable(d);
}
@Override
public void setBackground(Drawable background) {
setBackgroundDrawable(background);
}
private void updateDrawableAttrs() {
updateAttrs(mDrawable, false);
}
private void updateBackgroundDrawableAttrs() {
updateAttrs(mBackgroundDrawable, true);
}
private void updateAttrs(Drawable drawable, boolean background) {
if (drawable == null) {
return;
}
if (drawable instanceof RoundedDrawable) {
((RoundedDrawable) drawable)
.setScaleType(mScaleType)
.setCornerRadius(background && !mRoundBackground ? 0 : mCornerRadius)
.setBorderWidth(mBorderWidth)
.setBorderColors(mBorderColor)
.setOval(mOval);
} else if (drawable instanceof LayerDrawable) {
// loop through layers to and set drawable attrs
LayerDrawable ld = ((LayerDrawable) drawable);
int layers = ld.getNumberOfLayers();
for (int i = 0; i < layers; i++) {
updateAttrs(ld.getDrawable(i), background);
}
}
}
@Override
public void setBackgroundDrawable(Drawable background) {
mBackgroundDrawable = RoundedDrawable.fromDrawable(background);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
super.setBackground(mBackgroundDrawable);
else
super.setBackgroundDrawable(mBackgroundDrawable);
}
public int getCornerRadius() {
return mCornerRadius;
}
public void setCornerRadius(int radius) {
if (mCornerRadius == radius) {
return;
}
mCornerRadius = radius;
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
}
public int getBorderWidth() {
return mBorderWidth;
}
public void setBorderWidth(int width) {
if (mBorderWidth == width) {
return;
}
mBorderWidth = width;
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
invalidate();
}
public int getBorderColor() {
if (mBorderColor != null)
return mBorderColor.getDefaultColor();
else return RoundedDrawable.DEFAULT_BORDER_COLOR;
}
public void setBorderColor(int color) {
setBorderColors(ColorStateList.valueOf(color));
}
public ColorStateList getBorderColors() {
return mBorderColor;
}
public void setBorderColors(ColorStateList colors) {
if (mBorderColor.equals(colors)) {
return;
}
mBorderColor = (colors != null) ? colors : ColorStateList.valueOf(RoundedDrawable.DEFAULT_BORDER_COLOR);
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
if (mBorderWidth > 0) {
invalidate();
}
}
public boolean isOval() {
return mOval;
}
public void setOval(boolean oval) {
mOval = oval;
updateDrawableAttrs();
updateBackgroundDrawableAttrs();
invalidate();
}
public boolean isRoundBackground() {
return mRoundBackground;
}
public void setRoundBackground(boolean roundBackground) {
if (mRoundBackground == roundBackground) {
return;
}
mRoundBackground = roundBackground;
updateBackgroundDrawableAttrs();
invalidate();
}
}
================================================
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/TintableImageView.java
================================================
package com.github.akashandroid90.imageletter;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
public class TintableImageView extends AppCompatImageView {
private ColorStateList mTint, mBackgroundTint;
public TintableImageView(Context context) {
super(context);
}
public TintableImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public TintableImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintableImageView, defStyle, 0);
mTint = a.getColorStateList(R.styleable.TintableImageView_image_tint);
mBackgroundTint = a.getColorStateList(R.styleable.TintableImageView_background_tint);
a.recycle();
}
@Override
protected void drawableStateChanged() {
super.drawableStateChanged();
if (mTint != null) {
if (mTint.isStateful())
setColorFilter(mTint.getColorForState(getDrawableState(), 0));
else setColorFilter(mTint);
}
Drawable drawable = getBackground();
if (mBackgroundTint != null && drawable != null) {
Drawable wrap = DrawableCompat.wrap(drawable);
wrap = wrap.mutate();
if (mBackgroundTint.isStateful())
DrawableCompat.setTint(wrap, ContextCompat.getColor(getContext(), mBackgroundTint.getColorForState(getDrawableState(), 0)));
else DrawableCompat.setTintList(wrap, mBackgroundTint);
DrawableCompat.setTintMode(wrap, PorterDuff.Mode.SRC_IN);
}
}
public void removeTint() {
mTint = null;
clearColorFilter();
}
public void setColorFilter(ColorStateList tint) {
this.mTint = tint;
setColorFilter(tint.getColorForState(getDrawableState(), 0));
}
}
================================================
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/RoundedDrawable.java
================================================
package com.github.akashandroid90.imageletter.drawable;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.widget.ImageView.ScaleType;
public class RoundedDrawable extends Drawable {
public static final int DEFAULT_BORDER_COLOR = Color.BLACK;
private final RectF mBounds = new RectF();
private final RectF mDrawableRect = new RectF();
private final RectF mBitmapRect = new RectF();
private final BitmapShader mBitmapShader;
private final Paint mBitmapPaint;
private final int mBitmapWidth;
private final int mBitmapHeight;
private final RectF mBorderRect = new RectF();
private final Paint mBorderPaint;
private final Matrix mShaderMatrix = new Matrix();
private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR);
private float mCornerRadius = 0;
private boolean mOval = false;
private float mBorderWidth = 0;
private ScaleType mScaleType = ScaleType.FIT_XY;
public RoundedDrawable(Bitmap bitmap) {
mBitmapWidth = bitmap.getWidth();
mBitmapHeight = bitmap.getHeight();
mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight);
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapShader.setLocalMatrix(mShaderMatrix);
mBitmapPaint = new Paint();
mBitmapPaint.setStyle(Paint.Style.FILL);
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint = new Paint();
mBorderPaint.setStyle(Paint.Style.STROKE);
if(mBorderColor!=null){
if (mBorderColor.isStateful())
mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR));
else mBorderPaint.setColor(mBorderColor.getDefaultColor());
} else mBorderPaint.setColor(DEFAULT_BORDER_COLOR);
mBorderPaint.setStrokeWidth(mBorderWidth);
}
public static Drawable fromBitmap(Bitmap bitmap) {
if (bitmap != null) {
return new RoundedDrawable(bitmap);
} else {
return null;
}
}
public static Drawable fromDrawable(Drawable drawable) {
if (drawable != null) {
if (drawable instanceof RoundedDrawable) {
// just return if it's already a RoundedDrawable
return drawable;
} else if (drawable instanceof ColorDrawable) {
// FIXME we don't support ColorDrawables yet
return drawable;
} else if (drawable instanceof LayerDrawable) {
LayerDrawable ld = (LayerDrawable) drawable;
int num = ld.getNumberOfLayers();
// loop through layers to and change to RoundedDrawables if possible
for (int i = 0; i < num; i++) {
Drawable d = ld.getDrawable(i);
ld.setDrawableByLayerId(ld.getId(i), fromDrawable(d));
}
return ld;
}
// try to get a bitmap from the drawable and
Bitmap bm = drawableToBitmap(drawable);
if (bm != null) {
return new RoundedDrawable(bm);
}
}
return drawable;
}
public static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
Bitmap bitmap;
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
if (width > 0 && height > 0) {
bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
} else {
bitmap = null;
}
return bitmap;
}
@Override
public boolean isStateful() {
return mBorderColor.isStateful();
}
@Override
protected boolean onStateChange(int[] state) {
int newColor = mBorderColor.getColorForState(state, 0);
if (mBorderPaint.getColor() != newColor) {
mBorderPaint.setColor(newColor);
return true;
} else {
return super.onStateChange(state);
}
}
private void updateShaderMatrix() {
mBorderRect.set(mBounds);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
float scale;
float dx;
float dy;
switch (mScaleType) {
case CENTER:
mBorderRect.set(mBounds);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mShaderMatrix.set(null);
mShaderMatrix.setTranslate((int) ((mDrawableRect.width() - mBitmapWidth) * 0.5f + 0.5f), (int) ((mDrawableRect.height() - mBitmapHeight) * 0.5f + 0.5f));
break;
case CENTER_CROP:
mBorderRect.set(mBounds);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mShaderMatrix.set(null);
dx = 0;
dy = 0;
if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
scale = mDrawableRect.height() / (float) mBitmapHeight;
dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
} else {
scale = mDrawableRect.width() / (float) mBitmapWidth;
dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
}
mShaderMatrix.setScale(scale, scale);
mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth);
break;
case CENTER_INSIDE:
mShaderMatrix.set(null);
if (mBitmapWidth <= mBounds.width() && mBitmapHeight <= mBounds.height()) {
scale = 1.0f;
} else {
scale = Math.min(mBounds.width() / (float) mBitmapWidth,
mBounds.height() / (float) mBitmapHeight);
}
dx = (int) ((mBounds.width() - mBitmapWidth * scale) * 0.5f + 0.5f);
dy = (int) ((mBounds.height() - mBitmapHeight * scale) * 0.5f + 0.5f);
mShaderMatrix.setScale(scale, scale);
mShaderMatrix.postTranslate(dx, dy);
mBorderRect.set(mBitmapRect);
mShaderMatrix.mapRect(mBorderRect);
mDrawableRect.set(mBorderRect.left + mBorderWidth, mBorderRect.top + mBorderWidth, mBorderRect.right - mBorderWidth, mBorderRect.bottom - mBorderWidth);
mShaderMatrix.setRectToRect(mBitmapRect, mDrawableRect, Matrix.ScaleToFit.FILL);
break;
case FIT_CENTER:
mBorderRect.set(mBitmapRect);
mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.CENTER);
mShaderMatrix.mapRect(mBorderRect);
mDrawableRect.set(mBorderRect.left + mBorderWidth, mBorderRect.top + mBorderWidth, mBorderRect.right - mBorderWidth, mBorderRect.bottom - mBorderWidth);
mShaderMatrix.setRectToRect(mBitmapRect, mDrawableRect, Matrix.ScaleToFit.FILL);
break;
case FIT_END:
mBorderRect.set(mBitmapRect);
mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.END);
mShaderMatrix.mapRect(mBorderRect);
mDrawableRect.set(mBorderRect.left + mBorderWidth, mBorderRect.top + mBorderWidth, mBorderRect.right - mBorderWidth, mBorderRect.bottom - mBorderWidth);
mShaderMatrix.setRectToRect(mBitmapRect, mDrawableRect, Matrix.ScaleToFit.FILL);
break;
case FIT_START:
mBorderRect.set(mBitmapRect);
mShaderMatrix.setRectToRect(mBitmapRect, mBounds, Matrix.ScaleToFit.START);
mShaderMatrix.mapRect(mBorderRect);
mDrawableRect.set(mBorderRect.left + mBorderWidth, mBorderRect.top + mBorderWidth, mBorderRect.right - mBorderWidth, mBorderRect.bottom - mBorderWidth);
mShaderMatrix.setRectToRect(mBitmapRect, mDrawableRect, Matrix.ScaleToFit.FILL);
break;
case FIT_XY:
default:
mBorderRect.set(mBounds);
mDrawableRect.set(0 + mBorderWidth, 0 + mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mShaderMatrix.set(null);
mShaderMatrix.setRectToRect(mBitmapRect, mDrawableRect, Matrix.ScaleToFit.FILL);
break;
}
mBorderRect.inset(mBorderWidth / 2, mBorderWidth / 2);
mBitmapShader.setLocalMatrix(mShaderMatrix);
}
@Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mBounds.set(bounds);
updateShaderMatrix();
}
@Override
public void draw(Canvas canvas) {
if (mOval) {
if (mBorderWidth > 0) {
canvas.drawOval(mBorderRect, mBorderPaint);
canvas.drawOval(mDrawableRect, mBitmapPaint);
} else {
canvas.drawOval(mDrawableRect, mBitmapPaint);
}
} else {
if (mBorderWidth > 0) {
canvas.drawRoundRect(mBorderRect, mCornerRadius, mCornerRadius, mBorderPaint);
canvas.drawRoundRect(mDrawableRect, Math.max(mCornerRadius - mBorderWidth, 0), Math.max(mCornerRadius - mBorderWidth, 0), mBitmapPaint);
} else {
canvas.drawRoundRect(mDrawableRect, mCornerRadius, mCornerRadius, mBitmapPaint);
}
}
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
@Override
public void setAlpha(int alpha) {
mBitmapPaint.setAlpha(alpha);
invalidateSelf();
}
@Override
public void setColorFilter(ColorFilter cf) {
mBitmapPaint.setColorFilter(cf);
invalidateSelf();
}
@Override
public void setDither(boolean dither) {
mBitmapPaint.setDither(dither);
invalidateSelf();
}
@Override
public void setFilterBitmap(boolean filter) {
mBitmapPaint.setFilterBitmap(filter);
invalidateSelf();
}
@Override
public int getIntrinsicWidth() {
return mBitmapWidth;
}
@Override
public int getIntrinsicHeight() {
return mBitmapHeight;
}
public float getCornerRadius() {
return mCornerRadius;
}
public RoundedDrawable setCornerRadius(float radius) {
mCornerRadius = radius;
return this;
}
public float getBorderWidth() {
return mBorderWidth;
}
public RoundedDrawable setBorderWidth(int width) {
mBorderWidth = width*5;
mBorderPaint.setStrokeWidth(mBorderWidth);
return this;
}
public int getBorderColor() {
if(mBorderColor!=null)
return mBorderColor.getDefaultColor();
else return DEFAULT_BORDER_COLOR;
}
public RoundedDrawable setBorderColor(int color) {
return setBorderColors(ColorStateList.valueOf(color));
}
public ColorStateList getBorderColors() {
return mBorderColor;
}
public RoundedDrawable setBorderColors(ColorStateList colors) {
mBorderColor = colors != null ? colors : ColorStateList.valueOf(0);
if (mBorderColor.isStateful())
mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR));
else mBorderPaint.setColor(mBorderColor.getDefaultColor());
return this;
}
public boolean isOval() {
return mOval;
}
public RoundedDrawable setOval(boolean oval) {
mOval = oval;
return this;
}
public ScaleType getScaleType() {
return mScaleType;
}
public RoundedDrawable setScaleType(ScaleType scaleType) {
if (scaleType == null) {
scaleType = ScaleType.FIT_XY;
}
if (mScaleType != scaleType) {
mScaleType = scaleType;
updateShaderMatrix();
}
return this;
}
}
================================================
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/TextDrawable.java
================================================
package com.github.akashandroid90.imageletter.drawable;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.RoundRectShape;
public class TextDrawable extends ShapeDrawable {
private static final float SHADE_FACTOR = 0.9f;
private final Paint textPaint;
private final Paint borderPaint;
private final String text;
private final int color;
private final int borderColor;
private final RectShape shape;
private final int height;
private final int width;
private final int fontSize;
private final float radius;
private final int borderThickness;
private TextDrawable(Builder builder) {
super(builder.shape);
// shape properties
shape = builder.shape;
height = builder.height;
width = builder.width;
radius = builder.radius;
// text and color
text = builder.toUpperCase ? builder.text.toUpperCase() : builder.text;
color = builder.color;
borderColor = builder.borderColor;
// text paint settings
fontSize = builder.fontSize;
textPaint = new Paint();
textPaint.setColor(builder.textColor);
textPaint.setAntiAlias(true);
textPaint.setFakeBoldText(builder.isBold);
textPaint.setStyle(Paint.Style.FILL);
textPaint.setTypeface(builder.font);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setStrokeWidth(builder.borderThickness);
// border paint settings
borderThickness = builder.borderThickness;
borderPaint = new Paint();
borderPaint.setColor(borderColor);
borderPaint.setStyle(Paint.Style.STROKE);
borderPaint.setStrokeWidth(borderThickness);
// drawable paint color
Paint paint = getPaint();
paint.setColor(color);
}
private static int getDarkerShade(int color) {
return Color.rgb((int) (SHADE_FACTOR * Color.red(color)),
(int) (SHADE_FACTOR * Color.green(color)),
(int) (SHADE_FACTOR * Color.blue(color)));
}
public static IShapeBuilder builder() {
return new Builder();
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
Rect r = getBounds();
// draw border
if (borderThickness > 0) {
drawBorder(canvas);
}
int count = canvas.save();
canvas.translate(r.left, r.top);
// draw text
int width = this.width < 0 ? r.width() : this.width;
int height = this.height < 0 ? r.height() : this.height;
int fontSize = this.fontSize < 0 ? (Math.min(width, height) / 2) : this.fontSize;
textPaint.setTextSize(fontSize);
canvas.drawText(text, width / 2, height / 2 - ((textPaint.descent() + textPaint.ascent()) / 2), textPaint);
canvas.restoreToCount(count);
}
private void drawBorder(Canvas canvas) {
RectF rect = new RectF(getBounds());
rect.inset(borderThickness / 2, borderThickness / 2);
if (shape instanceof OvalShape) {
canvas.drawOval(rect, borderPaint);
} else if (shape instanceof RoundRectShape) {
canvas.drawRoundRect(rect, radius, radius, borderPaint);
} else {
canvas.drawRect(rect, borderPaint);
}
}
@Override
public void setAlpha(int alpha) {
textPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter cf) {
textPaint.setColorFilter(cf);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
@Override
public int getIntrinsicWidth() {
return width;
}
@Override
public int getIntrinsicHeight() {
return height;
}
public interface IConfigBuilder {
IConfigBuilder width(int width);
IConfigBuilder height(int height);
IConfigBuilder textColor(int color);
IConfigBuilder borderColor(int color);
IConfigBuilder withBorder(int thickness);
IConfigBuilder useFont(Typeface font);
IConfigBuilder fontSize(int size);
IConfigBuilder bold();
IConfigBuilder toUpperCase();
IShapeBuilder endConfig();
}
public interface IBuilder {
TextDrawable build(String text, int color);
}
public interface IShapeBuilder {
IConfigBuilder beginConfig();
IBuilder rect();
IBuilder round();
IBuilder roundRect(int radius);
TextDrawable buildRect(String text, int color);
TextDrawable buildRoundRect(String text, int color, int radius);
TextDrawable buildRound(String text, int color);
}
public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder {
private String text;
private int color;
private int borderColor;
private int borderThickness;
private int width;
private int height;
private Typeface font;
private RectShape shape;
private int textColor;
private int fontSize;
private boolean isBold;
private boolean toUpperCase;
private float radius;
private Builder() {
text = "";
color = Color.GRAY;
borderColor = getDarkerShade(color);
textColor = Color.WHITE;
borderThickness = 0;
width = -1;
height = -1;
shape = new RectShape();
font = Typeface.DEFAULT;
fontSize = -1;
isBold = false;
toUpperCase = false;
}
public IConfigBuilder width(int width) {
this.width = width;
return this;
}
public IConfigBuilder height(int height) {
this.height = height;
return this;
}
public IConfigBuilder textColor(int color) {
this.textColor = color;
return this;
}
public IConfigBuilder borderColor(int color) {
this.borderColor = color;
return this;
}
public IConfigBuilder withBorder(int thickness) {
this.borderThickness = thickness;
return this;
}
public IConfigBuilder useFont(Typeface font) {
this.font = font;
return this;
}
public IConfigBuilder fontSize(int size) {
this.fontSize = size;
return this;
}
public IConfigBuilder bold() {
this.isBold = true;
return this;
}
public IConfigBuilder toUpperCase() {
this.toUpperCase = true;
return this;
}
@Override
public IConfigBuilder beginConfig() {
return this;
}
@Override
public IShapeBuilder endConfig() {
return this;
}
@Override
public IBuilder rect() {
this.shape = new RectShape();
return this;
}
@Override
public IBuilder round() {
this.shape = new OvalShape();
return this;
}
@Override
public IBuilder roundRect(int radius) {
this.radius = radius;
float[] radii = {radius, radius, radius, radius, radius, radius, radius, radius};
this.shape = new RoundRectShape(radii, null, null);
return this;
}
@Override
public TextDrawable buildRect(String text, int color) {
rect();
return build(text, color);
}
@Override
public TextDrawable buildRoundRect(String text, int color, int radius) {
roundRect(radius);
return build(text, color);
}
@Override
public TextDrawable buildRound(String text, int color) {
round();
return build(text, color);
}
@Override
public TextDrawable build(String text, int color) {
this.color = color;
this.text = text;
return new TextDrawable(this);
}
}
}
================================================
FILE: imageletter/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RoundedImageView">
<attr name="corner_radius" format="dimension" />
<attr name="border_width" format="dimension" />
<attr name="border_color" format="color" />
<attr name="round_background" format="boolean" />
<attr name="is_oval" format="boolean" />
<attr name="android:scaleType" />
</declare-styleable>
<declare-styleable name="MaterialLetterIcon">
<attr name="text" format="string" />
<attr name="text_color" format="color" />
<attr name="shape_color" format="color" />
<attr name="text_size" format="integer" />
<attr name="text_number" format="integer"/>
<attr name="is_uppercase" format="boolean" />
<attr name="is_bold" format="boolean" />
</declare-styleable>
<declare-styleable name="TintableImageView">
<attr name="image_tint" format="reference|color" />
<attr name="background_tint" format="reference|color" />
</declare-styleable>
</resources>
================================================
FILE: settings.gradle
================================================
include ':app', ':imageletter'
gitextract_ff1qdxwa/ ├── .gitignore ├── LICENSE ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── imagelettericon/ │ │ └── MainActivity.java │ └── res/ │ ├── layout/ │ │ ├── activity_main.xml │ │ └── list_item.xml │ ├── menu/ │ │ └── menu.xml │ ├── values/ │ │ ├── arrays.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── values-w820dp/ │ └── dimens.xml ├── build.gradle ├── gradle.properties ├── gradlew ├── gradlew.bat ├── imageletter/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── github/ │ │ └── akashandroid90/ │ │ └── imageletter/ │ │ ├── MaterialLetterIcon.java │ │ ├── RoundedImageViewWithBorder.java │ │ ├── TintableImageView.java │ │ └── drawable/ │ │ ├── RoundedDrawable.java │ │ └── TextDrawable.java │ └── res/ │ └── values/ │ └── attrs.xml └── settings.gradle
SYMBOL INDEX (160 symbols across 6 files)
FILE: app/src/main/java/com/imagelettericon/MainActivity.java
class MainActivity (line 27) | public class MainActivity extends AppCompatActivity {
method onCreate (line 46) | @Override
method onCreateOptionsMenu (line 53) | @Override
method onBackPressed (line 60) | @Override
method showDialog (line 65) | private void showDialog() {
method onOptionsItemSelected (line 88) | @Override
method setupRecyclerView (line 131) | private void setupRecyclerView() {
method setContactsAdapter (line 136) | private void setContactsAdapter(String[] array) {
method setCountriesAdapter (line 140) | private void setCountriesAdapter(String[] array) {
method setAlternateCountriesAdapter (line 145) | private void setAlternateCountriesAdapter(String[] array) {
method setAlternateContactsAdapter (line 149) | private void setAlternateContactsAdapter(String[] array) {
class SimpleStringRecyclerViewAdapter (line 153) | public static class SimpleStringRecyclerViewAdapter
method SimpleStringRecyclerViewAdapter (line 163) | SimpleStringRecyclerViewAdapter(Context context, List<String> items,...
method onCreateViewHolder (line 173) | @Override
method onBindViewHolder (line 180) | @Override
method getItemCount (line 230) | @Override
class ViewHolder (line 235) | public class ViewHolder extends RecyclerView.ViewHolder {
method ViewHolder (line 241) | public ViewHolder(View view) {
method toString (line 248) | @Override
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/MaterialLetterIcon.java
class MaterialLetterIcon (line 16) | public class MaterialLetterIcon extends RoundedImageViewWithBorder {
method MaterialLetterIcon (line 27) | public MaterialLetterIcon(Context context) {
method MaterialLetterIcon (line 31) | public MaterialLetterIcon(Context context, AttributeSet attrs) {
method MaterialLetterIcon (line 35) | public MaterialLetterIcon(Context context, AttributeSet attrs, int def...
method toPx (line 51) | private int toPx(int dp) {
method updateDrawable (line 55) | private void updateDrawable() {
method computeText (line 78) | private void computeText(String text) {
method getText (line 91) | public String getText() {
method setText (line 95) | public void setText(String text) {
method getTextSize (line 100) | public int getTextSize() {
method setTextSize (line 104) | public void setTextSize(int textSize) {
method setTypeface (line 109) | public void setTypeface(Typeface typeface) {
method getTypeFace (line 114) | public Typeface getTypeFace() {
method getShapeColor (line 118) | public int getShapeColor() {
method setShapeColor (line 122) | public void setShapeColor(@ColorInt int color) {
method getTextColor (line 127) | public int getTextColor() {
method setTextColor (line 131) | public void setTextColor(@ColorInt int color) {
method isBold (line 136) | public boolean isBold() {
method setBold (line 140) | public void setBold(boolean bold) {
method isUppercase (line 144) | public boolean isUppercase() {
method setUppercase (line 148) | public void setUppercase(boolean uppercase) {
method getLetterCount (line 152) | public int getLetterCount() {
method setLetterCount (line 156) | public void setLetterCount(int mLetterCount) {
method setBorderColor (line 160) | public void setBorderColor(int color) {
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/RoundedImageViewWithBorder.java
class RoundedImageViewWithBorder (line 19) | public class RoundedImageViewWithBorder extends TintableImageView {
method RoundedImageViewWithBorder (line 42) | public RoundedImageViewWithBorder(Context context) {
method RoundedImageViewWithBorder (line 46) | public RoundedImageViewWithBorder(Context context, AttributeSet attrs) {
method RoundedImageViewWithBorder (line 50) | public RoundedImageViewWithBorder(Context context, AttributeSet attrs,...
method drawableStateChanged (line 77) | @Override
method getScaleType (line 83) | @Override
method setScaleType (line 88) | @Override
method setImageDrawable (line 115) | @Override
method setImageBitmap (line 123) | @Override
method setImageURI (line 131) | @Override
method setImageResource (line 145) | @Override
method resolveResource (line 155) | private Drawable resolveResource() {
method setBackground (line 167) | @Override
method updateDrawableAttrs (line 172) | private void updateDrawableAttrs() {
method updateBackgroundDrawableAttrs (line 176) | private void updateBackgroundDrawableAttrs() {
method updateAttrs (line 180) | private void updateAttrs(Drawable drawable, boolean background) {
method setBackgroundDrawable (line 201) | @Override
method getCornerRadius (line 210) | public int getCornerRadius() {
method setCornerRadius (line 214) | public void setCornerRadius(int radius) {
method getBorderWidth (line 223) | public int getBorderWidth() {
method setBorderWidth (line 227) | public void setBorderWidth(int width) {
method getBorderColor (line 237) | public int getBorderColor() {
method setBorderColor (line 243) | public void setBorderColor(int color) {
method getBorderColors (line 247) | public ColorStateList getBorderColors() {
method setBorderColors (line 251) | public void setBorderColors(ColorStateList colors) {
method isOval (line 263) | public boolean isOval() {
method setOval (line 267) | public void setOval(boolean oval) {
method isRoundBackground (line 274) | public boolean isRoundBackground() {
method setRoundBackground (line 278) | public void setRoundBackground(boolean roundBackground) {
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/TintableImageView.java
class TintableImageView (line 14) | public class TintableImageView extends AppCompatImageView {
method TintableImageView (line 17) | public TintableImageView(Context context) {
method TintableImageView (line 21) | public TintableImageView(Context context, AttributeSet attrs) {
method TintableImageView (line 25) | public TintableImageView(Context context, AttributeSet attrs, int defS...
method drawableStateChanged (line 33) | @Override
method removeTint (line 54) | public void removeTint() {
method setColorFilter (line 59) | public void setColorFilter(ColorStateList tint) {
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/RoundedDrawable.java
class RoundedDrawable (line 22) | public class RoundedDrawable extends Drawable {
method RoundedDrawable (line 40) | public RoundedDrawable(Bitmap bitmap) {
method fromBitmap (line 60) | public static Drawable fromBitmap(Bitmap bitmap) {
method fromDrawable (line 68) | public static Drawable fromDrawable(Drawable drawable) {
method drawableToBitmap (line 95) | public static Bitmap drawableToBitmap(Drawable drawable) {
method isStateful (line 113) | @Override
method onStateChange (line 118) | @Override
method updateShaderMatrix (line 129) | private void updateShaderMatrix() {
method onBoundsChange (line 208) | @Override
method draw (line 215) | @Override
method getOpacity (line 234) | @Override
method setAlpha (line 239) | @Override
method setColorFilter (line 245) | @Override
method setDither (line 251) | @Override
method setFilterBitmap (line 257) | @Override
method getIntrinsicWidth (line 263) | @Override
method getIntrinsicHeight (line 268) | @Override
method getCornerRadius (line 273) | public float getCornerRadius() {
method setCornerRadius (line 277) | public RoundedDrawable setCornerRadius(float radius) {
method getBorderWidth (line 282) | public float getBorderWidth() {
method setBorderWidth (line 286) | public RoundedDrawable setBorderWidth(int width) {
method getBorderColor (line 292) | public int getBorderColor() {
method setBorderColor (line 298) | public RoundedDrawable setBorderColor(int color) {
method getBorderColors (line 302) | public ColorStateList getBorderColors() {
method setBorderColors (line 306) | public RoundedDrawable setBorderColors(ColorStateList colors) {
method isOval (line 314) | public boolean isOval() {
method setOval (line 318) | public RoundedDrawable setOval(boolean oval) {
method getScaleType (line 323) | public ScaleType getScaleType() {
method setScaleType (line 327) | public RoundedDrawable setScaleType(ScaleType scaleType) {
FILE: imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/TextDrawable.java
class TextDrawable (line 16) | public class TextDrawable extends ShapeDrawable {
method TextDrawable (line 31) | private TextDrawable(Builder builder) {
method getDarkerShade (line 68) | private static int getDarkerShade(int color) {
method builder (line 74) | public static IShapeBuilder builder() {
method draw (line 78) | @Override
method drawBorder (line 99) | private void drawBorder(Canvas canvas) {
method setAlpha (line 112) | @Override
method setColorFilter (line 117) | @Override
method getOpacity (line 122) | @Override
method getIntrinsicWidth (line 127) | @Override
method getIntrinsicHeight (line 132) | @Override
type IConfigBuilder (line 137) | public interface IConfigBuilder {
method width (line 138) | IConfigBuilder width(int width);
method height (line 140) | IConfigBuilder height(int height);
method textColor (line 142) | IConfigBuilder textColor(int color);
method borderColor (line 144) | IConfigBuilder borderColor(int color);
method withBorder (line 146) | IConfigBuilder withBorder(int thickness);
method useFont (line 148) | IConfigBuilder useFont(Typeface font);
method fontSize (line 150) | IConfigBuilder fontSize(int size);
method bold (line 152) | IConfigBuilder bold();
method toUpperCase (line 154) | IConfigBuilder toUpperCase();
method endConfig (line 156) | IShapeBuilder endConfig();
type IBuilder (line 159) | public interface IBuilder {
method build (line 160) | TextDrawable build(String text, int color);
type IShapeBuilder (line 163) | public interface IShapeBuilder {
method beginConfig (line 164) | IConfigBuilder beginConfig();
method rect (line 166) | IBuilder rect();
method round (line 168) | IBuilder round();
method roundRect (line 170) | IBuilder roundRect(int radius);
method buildRect (line 172) | TextDrawable buildRect(String text, int color);
method buildRoundRect (line 174) | TextDrawable buildRoundRect(String text, int color, int radius);
method buildRound (line 176) | TextDrawable buildRound(String text, int color);
class Builder (line 179) | public static class Builder implements IConfigBuilder, IShapeBuilder, ...
method Builder (line 195) | private Builder() {
method width (line 210) | public IConfigBuilder width(int width) {
method height (line 215) | public IConfigBuilder height(int height) {
method textColor (line 220) | public IConfigBuilder textColor(int color) {
method borderColor (line 225) | public IConfigBuilder borderColor(int color) {
method withBorder (line 230) | public IConfigBuilder withBorder(int thickness) {
method useFont (line 235) | public IConfigBuilder useFont(Typeface font) {
method fontSize (line 240) | public IConfigBuilder fontSize(int size) {
method bold (line 245) | public IConfigBuilder bold() {
method toUpperCase (line 250) | public IConfigBuilder toUpperCase() {
method beginConfig (line 255) | @Override
method endConfig (line 260) | @Override
method rect (line 265) | @Override
method round (line 271) | @Override
method roundRect (line 277) | @Override
method buildRect (line 285) | @Override
method buildRoundRect (line 291) | @Override
method buildRound (line 297) | @Override
method build (line 303) | @Override
Condensed preview — 32 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (90K chars).
[
{
"path": ".gitignore",
"chars": 59,
"preview": ".gradle\ngradle\n/local.properties\n.idea\n/.idea\n/build\n*.iml\n"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 4274,
"preview": "# ImageLetterIcon\nMaterial letter icon with circle background. Also supports for image for user contact.\n\n[![Android Ars"
},
{
"path": "app/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "app/build.gradle",
"chars": 749,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion compilesdk\n buildToolsVersion buildtool\n\n "
},
{
"path": "app/proguard-rules.pro",
"chars": 657,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in D:"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 686,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.imagelettericon\">\n\n <uses-permissio"
},
{
"path": "app/src/main/java/com/imagelettericon/MainActivity.java",
"chars": 11278,
"preview": "package com.imagelettericon;\n\nimport android.content.Context;\nimport android.content.DialogInterface;\nimport android.con"
},
{
"path": "app/src/main/res/layout/activity_main.xml",
"chars": 556,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "app/src/main/res/layout/list_item.xml",
"chars": 1086,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n "
},
{
"path": "app/src/main/res/menu/menu.xml",
"chars": 1472,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmlns:app="
},
{
"path": "app/src/main/res/values/arrays.xml",
"chars": 500,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <array name=\"colors\">\n <item>@color/color_1</item>\n "
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 673,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#3F51B5</color>\n <color name=\"color"
},
{
"path": "app/src/main/res/values/dimens.xml",
"chars": 78,
"preview": "<resources>\n <dimen name=\"list_item_avatar_size\">50dp</dimen>\n</resources>\n"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 715,
"preview": "<resources>\n <string name=\"app_name\">Material Icon</string>\n <string name=\"menu_countries\">Show countries</string>"
},
{
"path": "app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "app/src/main/res/values-w820dp/dimens.xml",
"chars": 358,
"preview": "<resources>\n <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n (such as s"
},
{
"path": "build.gradle",
"chars": 640,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n r"
},
{
"path": "gradle.properties",
"chars": 855,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) 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": "imageletter/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "imageletter/build.gradle",
"chars": 861,
"preview": "apply plugin: 'com.android.library'\nandroid {\n compileSdkVersion compilesdk\n buildToolsVersion buildtool\n\n defa"
},
{
"path": "imageletter/proguard-rules.pro",
"chars": 1296,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in D:"
},
{
"path": "imageletter/src/main/AndroidManifest.xml",
"chars": 89,
"preview": "<manifest package=\"com.github.akashandroid90.imageletter\">\n\n <application/>\n</manifest>\n"
},
{
"path": "imageletter/src/main/java/com/github/akashandroid90/imageletter/MaterialLetterIcon.java",
"chars": 4992,
"preview": "package com.github.akashandroid90.imageletter;\n\nimport android.content.Context;\nimport android.content.res.ColorStateLis"
},
{
"path": "imageletter/src/main/java/com/github/akashandroid90/imageletter/RoundedImageViewWithBorder.java",
"chars": 9042,
"preview": "package com.github.akashandroid90.imageletter;\n\nimport android.content.Context;\nimport android.content.res.ColorStateLis"
},
{
"path": "imageletter/src/main/java/com/github/akashandroid90/imageletter/TintableImageView.java",
"chars": 2245,
"preview": "package com.github.akashandroid90.imageletter;\n\nimport android.content.Context;\nimport android.content.res.ColorStateLis"
},
{
"path": "imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/RoundedDrawable.java",
"chars": 13156,
"preview": "package com.github.akashandroid90.imageletter.drawable;\n\nimport android.content.res.ColorStateList;\nimport android.graph"
},
{
"path": "imageletter/src/main/java/com/github/akashandroid90/imageletter/drawable/TextDrawable.java",
"chars": 8553,
"preview": "package com.github.akashandroid90.imageletter.drawable;\n\nimport android.graphics.Canvas;\nimport android.graphics.Color;\n"
},
{
"path": "imageletter/src/main/res/values/attrs.xml",
"chars": 1004,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <declare-styleable name=\"RoundedImageView\">\n <attr name=\"corner_"
},
{
"path": "settings.gradle",
"chars": 31,
"preview": "include ':app', ':imageletter'\n"
}
]
About this extraction
This page contains the full source code of the akashandroid90/ImageLetterIcon GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 32 files (83.0 KB), approximately 20.0k tokens, and a symbol index with 160 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.