-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e60d163
commit 9b5edf6
Showing
51 changed files
with
2,484 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+3.61 KB
masterpacklib/src/main/res/drawable-hdpi/socialview_ic_mention_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.21 KB
masterpacklib/src/main/res/drawable-mdpi/socialview_ic_mention_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.63 KB
masterpacklib/src/main/res/drawable-xhdpi/socialview_ic_mention_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.55 KB
masterpacklib/src/main/res/drawable-xxhdpi/socialview_ic_mention_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.46 KB
masterpacklib/src/main/res/drawable-xxxhdpi/socialview_ic_mention_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
plugins { | ||
id 'com.android.library' | ||
} | ||
|
||
android { | ||
namespace 'bd.com.bangal.commons' | ||
compileSdk 33 | ||
|
||
defaultConfig { | ||
minSdk 23 | ||
targetSdk 33 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.6.0' | ||
implementation 'com.google.android.material:material:1.8.0' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
implementation 'com.squareup.picasso:picasso:2.8' | ||
implementation 'com.github.bumptech.glide:glide:3.7.0' | ||
implementation project(path: ':socialviewcore') | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
socialviewcommons/src/androidTest/java/bd/com/bangal/commons/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package bd.com.bangal.commons; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("bd.com.bangal.commons.test", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
48 changes: 48 additions & 0 deletions
48
socialviewcommons/src/main/java/bd/com/bangal/commons/Hashtag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package bd.com.bangal.commons; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
/** Simple optional hashtag data class, use when there is no custom hashtag class. */ | ||
public class Hashtag implements Hashtagable { | ||
private final CharSequence id; | ||
private final int count; | ||
|
||
public Hashtag(@NonNull CharSequence hashtag) { | ||
this(hashtag, -1); | ||
} | ||
|
||
public Hashtag(@NonNull CharSequence hashtag, int count) { | ||
this.id = hashtag; | ||
this.count = count; | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
return obj instanceof Hashtag && ((Hashtag) obj).id == id; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return id.hashCode(); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String toString() { | ||
return id.toString(); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@NonNull | ||
@Override | ||
public CharSequence getId() { | ||
return id; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public int getCount() { | ||
return count; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
socialviewcommons/src/main/java/bd/com/bangal/commons/HashtagArrayAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package bd.com.bangal.commons; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.annotation.PluralsRes; | ||
|
||
/** | ||
* Default adapter for displaying hashtag in {@link SocialAutoCompleteTextView}. Note that this | ||
* adapter is completely optional, any adapter extending {@link android.widget.ArrayAdapter} can be | ||
* attached to {@link SocialAutoCompleteTextView}. | ||
*/ | ||
public class HashtagArrayAdapter<T extends Hashtagable> extends SocialArrayAdapter<T> { | ||
private final int countPluralRes; | ||
|
||
public HashtagArrayAdapter(@NonNull Context context) { | ||
this(context, R.plurals.posts); | ||
} | ||
|
||
public HashtagArrayAdapter(@NonNull Context context, @PluralsRes int countPluralRes) { | ||
super(context, R.layout.socialview_layout_hashtag, R.id.socialview_hashtag); | ||
this.countPluralRes = countPluralRes; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
@SuppressWarnings("unchecked") | ||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { | ||
final ViewHolder holder; | ||
if (convertView == null) { | ||
convertView = | ||
LayoutInflater.from(getContext()) | ||
.inflate(R.layout.socialview_layout_hashtag, parent, false); | ||
holder = new ViewHolder(convertView); | ||
convertView.setTag(holder); | ||
} else { | ||
holder = (ViewHolder) convertView.getTag(); | ||
} | ||
final T item = getItem(position); | ||
if (item != null) { | ||
holder.hashtagView.setText(item.getId()); | ||
|
||
if (item.getCount() > 0) { | ||
holder.countView.setVisibility(View.VISIBLE); | ||
final int count = item.getCount(); | ||
holder.countView.setText( | ||
getContext().getResources().getQuantityString(countPluralRes, count, count)); | ||
} else { | ||
holder.countView.setVisibility(View.GONE); | ||
} | ||
} | ||
return convertView; | ||
} | ||
|
||
private static class ViewHolder { | ||
private final TextView hashtagView; | ||
private final TextView countView; | ||
|
||
ViewHolder(View itemView) { | ||
hashtagView = itemView.findViewById(R.id.socialview_hashtag); | ||
countView = itemView.findViewById(R.id.socialview_hashtag_count); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
socialviewcommons/src/main/java/bd/com/bangal/commons/Hashtagable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package bd.com.bangal.commons; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
/** | ||
* Abstract hashtag to be used with {@link bd.com.bangal.commons.HashtagArrayAdapter}. | ||
*/ | ||
public interface Hashtagable { | ||
/** Unique id of this hashtag. */ | ||
@NonNull | ||
CharSequence getId(); | ||
|
||
/** Optional count, located right to hashtag name. */ | ||
int getCount(); | ||
} |
63 changes: 63 additions & 0 deletions
63
socialviewcommons/src/main/java/bd/com/bangal/commons/Mention.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package bd.com.bangal.commons; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
/** Simple optional mention data class, use when there is no custom mention class. */ | ||
public class Mention implements Mentionable { | ||
private final CharSequence username; | ||
private final CharSequence displayname; | ||
private final Object avatar; | ||
|
||
public Mention(@NonNull CharSequence username) { | ||
this(username, null); | ||
} | ||
|
||
public Mention(@NonNull CharSequence username, @Nullable CharSequence displayname) { | ||
this(username, displayname, null); | ||
} | ||
|
||
public Mention( | ||
@NonNull CharSequence username, @Nullable CharSequence displayname, @Nullable Object avatar) { | ||
this.username = username; | ||
this.displayname = displayname; | ||
this.avatar = avatar; | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
return obj instanceof Mention && ((Mention) obj).username == username; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return username.hashCode(); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String toString() { | ||
return username.toString(); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@NonNull | ||
@Override | ||
public CharSequence getUsername() { | ||
return username; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Nullable | ||
@Override | ||
public CharSequence getDisplayname() { | ||
return displayname; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Nullable | ||
@Override | ||
public Object getAvatar() { | ||
return avatar; | ||
} | ||
} |
Oops, something went wrong.