This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest> | |
<project name="SubhrajyotiSen/private_whyred" path="device/xiaomi/whyred" remote="private" revision="audio" /> | |
<project | |
name= "SubhrajyotiSen/whyred" | |
path= "kernel/xiaomi/whyred" | |
remote="github" revision="pie" /> | |
<project | |
name= "LineageOS/android_packages_resources_devicesettings" |
This file contains hidden or 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
var amount = 100.0 | |
val installment = 100.0 | |
entryList.add(Entry(0f, 100f)) // initial investment | |
for (i in 1 until dataPoints.size) { | |
val diff = (dataPoints[i].price - dataPoints[i - 1].price) / dataPoints[i - 1].price | |
amount += (amount * diff) | |
if (i != dataPoints.size - 1) | |
amount += installment | |
entryList.add(Entry(i.toFloat(), amount.toFloat())) |
This file contains hidden or 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
#include<bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,n,a) for(int i=a;i<=n;i++) | |
#define FORN(i,n,a) for(int i=a;i<n;i++) | |
typedef long long ll; | |
int main() { | |
ios_base::sync_with_stdio(false); |
This file contains hidden or 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
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.RecyclerViewHolder> { | |
private List<BorrowModel> borrowModelList; | |
private View.OnLongClickListener longClickListener; | |
public RecyclerViewAdapter(List<BorrowModel> borrowModelList, View.OnLongClickListener longClickListener) { | |
this.borrowModelList = borrowModelList; | |
this.longClickListener = longClickListener; | |
} |
This file contains hidden or 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
public class MainActivity extends AppCompatActivity implements View.OnLongClickListener { | |
private BorrowedListViewModel viewModel; | |
private RecyclerViewAdapter recyclerViewAdapter; | |
private RecyclerView recyclerView; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains hidden or 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
public class BorrowedListViewModel extends AndroidViewModel { | |
private final LiveData<List<BorrowModel>> itemAndPersonList; | |
private AppDatabase appDatabase; | |
public BorrowedListViewModel(Application application) { | |
super(application); |
This file contains hidden or 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
@Database(entities = {BorrowModel.class}, version = 1) | |
public abstract class AppDatabase extends RoomDatabase { | |
private static AppDatabase INSTANCE; | |
public static AppDatabase getDatabase(Context context) { | |
if (INSTANCE == null) { | |
INSTANCE = | |
Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, "borrow_db") | |
.build(); |
This file contains hidden or 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
@Dao | |
@TypeConverters(DateConverter.class) | |
public interface BorrowModelDao { | |
@Query("select * from BorrowModel") | |
LiveData<List<BorrowModel>> getAllBorrowedItems(); | |
@Query("select * from BorrowModel where id = :id") | |
BorrowModel getItembyId(String id); |
This file contains hidden or 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
import java.util.Date; | |
class DateConverter { | |
@TypeConverter | |
public static Date toDate(Long timestamp) { | |
return timestamp == null ? null : new Date(timestamp); | |
} | |
@TypeConverter | |
public static Long toTimestamp(Date date) { |
This file contains hidden or 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
import java.util.Date; | |
@Entity | |
public class BorrowModel { | |
@PrimaryKey(autoGenerate = true) | |
public int id; | |
private String itemName; | |
private String personName; | |
@TypeConverters(DateConverter.class) | |
private Date borrowDate; |