Skip to content

Commit 9d03f10

Browse files
authored
Merge pull request #15 from Hrithik-3961/master
Implemented new Api requests
2 parents de76f6d + 99fef0b commit 9d03f10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1593
-1067
lines changed

android/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/deploymentTargetDropDown.xml

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/misc.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/app/build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ android {
4343

4444
dependencies {
4545

46+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
4647
def lifecycle_version = "2.3.1"
4748
def room_version = "2.3.0"
4849

@@ -55,26 +56,25 @@ dependencies {
5556
implementation "androidx.room:room-runtime:$room_version"
5657
kapt "androidx.room:room-compiler:$room_version"
5758

58-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
5960
implementation 'androidx.appcompat:appcompat:1.3.1'
6061
implementation 'com.google.android.material:material:1.4.0'
6162
implementation 'androidx.core:core-ktx:1.6.0'
62-
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
63+
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
6364

6465
implementation 'de.hdodenhof:circleimageview:3.1.0'
6566
implementation 'com.github.Cutta:TagView:1.3'
66-
implementation 'com.github.bumptech.glide:glide:4.11.0'
67-
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
67+
implementation 'com.github.bumptech.glide:glide:4.12.0'
68+
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
6869
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
69-
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
70+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
7071
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
72+
implementation 'com.github.mrmike:ok2curl:0.7.0'
7173
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
7274
implementation 'androidx.recyclerview:recyclerview:1.2.1'
7375
implementation 'androidx.cardview:cardview:1.0.0'
74-
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
75-
//noinspection GradleDependency
76-
implementation 'com.github.hydrated:SwipeRevealLayout:c55b6cb'
77-
implementation "com.airbnb.android:lottie:3.4.0"
76+
implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3'
77+
implementation "com.airbnb.android:lottie:3.7.0"
7878
implementation ('io.socket:socket.io-client:2.0.0') {
7979
exclude group: 'org.json', module: 'json'
8080
}

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<activity android:name=".LoginActivity" />
2828
<activity android:name=".RegisterActivity1" />
2929
<activity android:name=".RegisterActivity2" />
30-
<activity android:name=".TimeTable" />
30+
<activity android:name=".TimeTableActivity" />
3131
<activity android:name=".MainActivity" />
3232
<activity android:name=".UpdateProfileActivity" />
3333

android/app/src/main/java/com/codechef/ffds/Adapter.java

Lines changed: 0 additions & 97 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package com.codechef.ffds
2+
3+
import android.content.Context
4+
import android.content.res.Resources
5+
import android.graphics.Bitmap
6+
import android.graphics.BitmapFactory
7+
import android.net.Uri
8+
import android.view.LayoutInflater
9+
import android.view.View
10+
import android.view.ViewGroup
11+
import android.widget.Button
12+
import android.widget.TextView
13+
import androidx.recyclerview.widget.RecyclerView
14+
import com.bumptech.glide.Glide
15+
import de.hdodenhof.circleimageview.CircleImageView
16+
import java.util.*
17+
import java.util.concurrent.ExecutionException
18+
19+
class Adapter internal constructor(
20+
private val context: Context,
21+
private val matches: ArrayList<Profile>
22+
) : RecyclerView.Adapter<Adapter.ViewHolder>() {
23+
24+
private var mListener: OnItemClickListener? = null
25+
26+
interface OnItemClickListener {
27+
fun onShowProfileClicked(position: Int)
28+
}
29+
30+
fun setOnItemClickListener(listener: OnItemClickListener?) {
31+
mListener = listener
32+
}
33+
34+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
35+
val view = LayoutInflater.from(context).inflate(R.layout.matches_item_layout, parent, false)
36+
return ViewHolder(view, mListener)
37+
}
38+
39+
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
40+
holder.name.text = matches[position].name
41+
holder.bio.text = matches[position].bio
42+
val (url) = matches[position].userImage
43+
var bitmap: Bitmap? = null
44+
if (url.isEmpty()) bitmap =
45+
BitmapFactory.decodeResource(Resources.getSystem(), R.drawable.profile_image) else {
46+
try {
47+
bitmap = Glide.with(context).asBitmap().load(Uri.parse(url)).submit().get()
48+
} catch (e: ExecutionException) {
49+
e.printStackTrace()
50+
} catch (e: InterruptedException) {
51+
e.printStackTrace()
52+
}
53+
}
54+
holder.dp.setImageBitmap(bitmap)
55+
}
56+
57+
override fun getItemCount(): Int {
58+
return matches.size
59+
}
60+
61+
class ViewHolder(itemView: View, listener: OnItemClickListener?) :
62+
RecyclerView.ViewHolder(itemView) {
63+
64+
var name: TextView = itemView.findViewById(R.id.match_name)
65+
var bio: TextView = itemView.findViewById(R.id.match_bio)
66+
var showProfile: Button = itemView.findViewById(R.id.view_match)
67+
var dp: CircleImageView = itemView.findViewById(R.id.match_image)
68+
69+
init {
70+
showProfile.setOnClickListener {
71+
if (listener != null) {
72+
val position = absoluteAdapterPosition
73+
if (position != RecyclerView.NO_POSITION) listener.onShowProfileClicked(position)
74+
}
75+
}
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)