Skip to content

Commit

Permalink
Update with Add Social Edit Text
Browse files Browse the repository at this point in the history
  • Loading branch information
n3o-d4rk3r committed Feb 20, 2023
1 parent e60d163 commit 9b5edf6
Show file tree
Hide file tree
Showing 51 changed files with 2,484 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:3.7.0'
/* Start of Custom Implementation Lib */
implementation project(path: ':masterpacklib')
implementation project(path: ':socialviewcommons')
implementation project(path: ':socialviewcore')
/* End of Custom Implementation Lib */
}
28 changes: 0 additions & 28 deletions app/src/main/java/bd/com/bangal/bangalmasterpack/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,5 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val videoRecordButton = findViewById<CameraVideoButton>(R.id.button)
videoRecordButton.setVideoDuration(10000)
videoRecordButton.actionListener = object : CameraVideoButton.ActionListener {
override fun onCancelled() {
Log.v("TEST", "onCancelled")
}

override fun onStartRecord() {
Log.v("TEST", "onStartRecord")
}

override fun onEndRecord() {
Log.v("TEST", "onEndRecord")
}

override fun onDurationTooShortError() {
Log.v("TEST", "onDurationTooShortError")
}

override fun onSingleTap() {
Log.v("TEST", "onSingleTap")
}

}

Handler().postDelayed(Runnable {
videoRecordButton.cancelRecording()
}, 5000)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,5 @@ class VideoActivity : AppCompatActivity() {
}

}

Handler().postDelayed(Runnable {
videoRecordButton.cancelRecording()
}, 5000)
}
}
2 changes: 1 addition & 1 deletion masterpacklib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ afterEvaluate {
release(MavenPublication) {
groupId = 'com.github.n3o-d4rk3r'
artifactId = 'masterpacklib'
version = '1.4'
version = '1.5'
artifact(bundleReleaseAar)
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions masterpacklib/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
<string name="uev_title">Title</string>
<string name="uev_desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</string>
<string name="uev_host">https://github.com/n3o-d4rk3r</string>

<string name="mention">Mention</string>
</resources>
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ dependencyResolutionManagement {
rootProject.name = "BangalMasterPack"
include ':app'
include ':masterpacklib'
include ':socialviewcommons'
include ':socialviewcore'
1 change: 1 addition & 0 deletions socialviewcommons/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions socialviewcommons/build.gradle
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.
21 changes: 21 additions & 0 deletions socialviewcommons/proguard-rules.pro
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
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());
}
}
4 changes: 4 additions & 0 deletions socialviewcommons/src/main/AndroidManifest.xml
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 socialviewcommons/src/main/java/bd/com/bangal/commons/Hashtag.java
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;
}
}
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);
}
}
}
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 socialviewcommons/src/main/java/bd/com/bangal/commons/Mention.java
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;
}
}
Loading

0 comments on commit 9b5edf6

Please sign in to comment.