-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
17 changed files
with
206 additions
and
9 deletions.
There are no files selected for viewing
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,74 @@ | ||
package com.equipo22.agenda | ||
|
||
import android.graphics.drawable.AnimationDrawable | ||
import android.os.Bundle | ||
import android.os.Handler | ||
import android.os.Looper | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.LinearLayout | ||
import android.widget.Toast | ||
import androidx.core.content.res.ResourcesCompat | ||
import androidx.core.view.isVisible | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.button.MaterialButton | ||
import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||
|
||
|
||
class AdsFragment : Fragment() { | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
val view = inflater.inflate(R.layout.fragment_ads, container, false) | ||
|
||
val btnPaid = view.findViewById<MaterialButton>(R.id.btnPaid) | ||
val LinearAds = view.findViewById<LinearLayout>(R.id.LinearAds) | ||
|
||
|
||
loop() | ||
|
||
|
||
btnPaid.setOnClickListener { | ||
|
||
MaterialAlertDialogBuilder(requireActivity()) | ||
.setTitle(resources.getString(R.string.compra_dialog_title)) | ||
.setMessage( | ||
resources.getString( | ||
R.string.compra_dialog | ||
) | ||
) | ||
.setPositiveButton(resources.getString(R.string.accept)) { dialog, which -> | ||
Toast.makeText(requireActivity(),getString(R.string.paidOut), Toast.LENGTH_SHORT).show() | ||
LinearAds.visibility=View.GONE | ||
} | ||
.setNegativeButton(resources.getString(R.string.btnCancel)) { dialog, which -> | ||
} | ||
.show() | ||
|
||
} | ||
return view | ||
} | ||
|
||
fun loop(){ | ||
Handler(Looper.getMainLooper()).postDelayed({ | ||
anuncios((0..2).random()) | ||
loop() | ||
}, 3000) | ||
} | ||
fun anuncios(n:Int){ | ||
val imageAds = view?.findViewById<ImageView>(R.id.imageAds) | ||
when(n){ | ||
0->imageAds?.setImageResource(R.drawable.ads_becas) | ||
1 ->imageAds?.setImageResource(R.drawable.ads_mexico) | ||
2 -> imageAds?.setImageResource(R.drawable.ads_sale) | ||
else ->imageAds?.setImageResource(R.drawable.ads_becas) | ||
} | ||
} | ||
|
||
|
||
} |
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,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="fill_parent" | ||
android:orientation="horizontal" | ||
android:layout_height="100dp" | ||
tools:context=".AdsFragment" | ||
android:background="@color/white" | ||
android:id="@+id/LinearAds"> | ||
|
||
<ImageView | ||
android:id="@+id/imageAds" | ||
android:layout_width="271dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1" | ||
android:src="@drawable/ads_becas" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/btnPaid" | ||
style="@style/ChronoMasterTheme.Button" | ||
android:layout_gravity="center" | ||
android:layout_weight="1" | ||
android:text="@string/adsButton" /> | ||
|
||
</LinearLayout> |
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,6 @@ | ||
<resources> | ||
<string name="adsButton">Quitar anuncios</string> | ||
<string name="compra_dialog_title">Eliminar anuncios</string> | ||
<string name="compra_dialog">¿Está seguro que desea comprar la version premium por $10?</string> | ||
<string name="paidOut">Gracias por su compra</string> | ||
</resources> |
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
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.
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 |
---|---|---|
@@ -1,6 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout | ||
android:id="@+id/fragment_container" | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:android="http://schemas.android.com/apk/res/android" /> | ||
xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<FrameLayout | ||
android:id="@+id/fragment_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:layout_editor_absoluteX="0dp" /> | ||
|
||
<fragment | ||
android:id="@+id/fragmentAds" | ||
class="com.equipo22.agenda.AdsFragment" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent"/> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="fill_parent" | ||
android:orientation="horizontal" | ||
android:layout_height="wrap_content" | ||
tools:context=".tareas.TareaManagementActivity"> | ||
|
||
</LinearLayout> | ||
|
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
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 com.equipo22.agenda | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.LinearLayout | ||
import android.widget.Toast | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.button.MaterialButton | ||
|
||
|
||
|
||
class AdsFragment : Fragment() { | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
return inflater.inflate(R.layout.fragment_ads, container, false) | ||
|
||
} | ||
} |
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="fill_parent" | ||
android:orientation="horizontal" | ||
android:layout_height="100dp" | ||
tools:context=".tareas.TareaManagementActivity"> | ||
|
||
</LinearLayout> |
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 @@ | ||
<resources> | ||
<string name="adsButton">Quitar anuncios</string> | ||
<string name="paidOut">Gracias por su compra</string> | ||
</resources> |