Skip to content

Commit

Permalink
Merge pull request #4 from TanishMoral11/main
Browse files Browse the repository at this point in the history
Create UI
  • Loading branch information
TanishMoral11 authored Jul 16, 2024
2 parents 37a9d42 + 3a3c1c0 commit 263fd97
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ android {
"proguard-rules.pro"
)
}
buildFeatures{
viewBinding = true
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/example/randommemes/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.randommemes.databinding.ActivityMainBinding
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

class MainActivity : AppCompatActivity() {

//https://meme-api.com/gimme
lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
enableEdgeToEdge()
setContentView(R.layout.activity_main)
setContentView(binding.root)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
Expand Down
35 changes: 27 additions & 8 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">

<ImageView
android:id="@+id/memeImage"
android:layout_height="350dp"
android:layout_width="match_parent"
android:scaleType="centerCrop"
/>

<TextView
android:layout_width="wrap_content"
android:id="@+id/memeAuthor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:gravity="end"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/memeTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
/>

<Button
android:id="@+id/btnNewMeme"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="New Meme" />
</LinearLayout>

0 comments on commit 263fd97

Please sign in to comment.