Skip to content

Instantly share code, notes, and snippets.

View Rohit-554's full-sized avatar
🎯
Focusing

Jadu Rohit-554

🎯
Focusing
View GitHub Profile
@Rohit-554
Rohit-554 / languageItemData.kt
Last active September 10, 2023 10:24
languageItemData.kt
@Root(name = "item")
data class ItemData(
//use var instead of val and set required = false
@field:Element(name = "date_created", required = false)
var dateCreated: String = "",
@field:Element(name = "language", required = false)
var language: String = "",
@field:Element(name = "country", required = false)
import org.simpleframework.xml.Element
import org.simpleframework.xml.ElementList
import org.simpleframework.xml.Root
@Root(name = "list")
data class languageDto(
@field:ElementList(entry = "item", inline = true)
var items: List<ItemData> = mutableListOf()
)
<list>
<item>
<date_created>2023-09-10</date_created>
<language>English</language>
<country>United States</country>
</item>
<item>
<date_created>2023-08-15</date_created>
<language>Spanish</language>
<country>Spain</country>
@Rohit-554
Rohit-554 / MainActivity.kt
Created July 7, 2023 11:21
SearchPdfFilesWithPermisson
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
checkPermission()
displayPdfFiles(this)
}
fun displayPdfFiles(context: Context) {
@Rohit-554
Rohit-554 / Lucky Wheel with onclick implementation (working)
Created June 28, 2023 12:50
This is for implementing the lucky wheel and getting the desired answer
package com.apphub.ea3.ui.features.earnCash
import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
@Rohit-554
Rohit-554 / LuckyWheelLogicImplementation
Created June 28, 2023 12:48
This is for implementing with ontouch listener and although it might not show the currect result
private fun startSpinner() {
isAnimationRunning = true
mSpinRevolution = 3600f
mSpinDuration = 5000
when {
(count in 30..59) -> {
mSpinDuration = 1000
mSpinRevolution = (3600 * 2).toFloat()
}
@Rohit-554
Rohit-554 / comparables.java
Created March 25, 2023 18:48
This is comparables, this interfaces compares different objects of the class based on the type of object we give, like in this case age
import java.util.*;;
public class comparable implements Comparable<comparable> {
private String name;
private int age;
public comparable(String name, int age) {
this.name = name;
this.age = age;
}
import java.util.*;;
public class BriefExampleGC<T> {
private List<T> items;
public BriefExampleGC() {
this.items = new ArrayList<>();
}
public void add(T item) {
this.items.add(item);
public class GenricMethod {
public void printList(String []s){
for(int i=0;i<s.length;i++){
System.out.println(s[i]);
}
}
public <T> void printlist(T []s){
for( T x :s){
System.out.println(x);
interface name {
String getName();
}
interface age {
double getage();
}
interface country{
String getcountry();