Friends, I have had problems with dolphin when it comes to managing folders that are synchronized with Google Drive: it crashes, crashes and stops working.
Nemo works very well, you don't pay or anything. How do I make it my default file manager?
Friends, I have had problems with dolphin when it comes to managing folders that are synchronized with Google Drive: it crashes, crashes and stops working.
Nemo works very well, you don't pay or anything. How do I make it my default file manager?
I am trying to make an alarm to be scheduled according to the data received from a DatePicker and a TimePicker in JetPack Compose, this is the current code:
class MainActivity : ComponentActivity() {
lateinit var navController: NavHostController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
navController = rememberNavController()
NotePadReminderTheme {
SetupNavGraph(navController = navController)
}
}
}
}
@RequiresApi(Build.VERSION_CODES.M)
fun createAlarm(context: Context,time:Long){
val alarmManager =context.getSystemService(Context.ALARM_SERVICE) as? AlarmManager
val intent =Intent(context, AlarmReceiver::class.java)
Log.d("receivedtime","time $time")
val pendingIntent = PendingIntent.getBroadcast(context, Date().seconds, intent, PendingIntent.FLAG_IMMUTABLE)
alarmManager?.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, time, pendingIntent)
Toast.makeText(context,"Alarma creada",Toast.LENGTH_LONG).show()
}
@RequiresApi(Build.VERSION_CODES.M)
@Composable
fun AddPage(navController: NavController, vm: TaskViewModel = viewModel()) {
val scope= rememberCoroutineScope()
val title = remember {
mutableStateOf("")
}
val description = remember {
mutableStateOf("")
}
val date = remember {
mutableStateOf("")
}
val time = Calendar.getInstance()
val iscompleted = remember {
mutableStateOf(false)
}
val context = LocalContext.current
Column(
modifier = Modifier
.fillMaxSize()
.padding(top = 30.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = "Agregar Tarea",
style = NoteTheme.typography.h1
)
RowOfThis(title, "Título", true)
RowOfThis(description, "Descripción", false)
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
DatePick(date)
}
Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
TimePick(time)
}
Button(
onClick = {
if (title.value.isNullOrBlank() || description.value.isNullOrBlank() ||
date.value.isNullOrBlank()
) {
Log.d("date","date:${date.value}")
Toast.makeText(context, "Por favor ingrese todos los datos", Toast.LENGTH_LONG)
.show()
return@Button
}
vm.task.value.title = title.value
vm.task.value.description = description.value
vm.task.value.date = date.value
vm.task.value.time = time.timeInMillis
Log.d("tmepickerreceived","date:${time.timeInMillis}")
scope.launch {
vm.createTask(context, vm.task.value)
createAlarm(context, time=time.timeInMillis). //here set the alarm ****************
Toast.makeText(context, "Tarea creada correctamente", Toast.LENGTH_LONG).show()
vm.resetTask()
}
},
colors = ButtonDefaults.buttonColors(backgroundColor = Color.Blue)
) {
Text(text = "Guardar", color = Color.White, style = NoteTheme.typography.subtitle)
}
}
}
@Composable
fun RowOfThis(value: MutableState<String>, label: String, single: Boolean) {
val focusManager = LocalFocusManager.current
Row(
modifier = Modifier
.fillMaxWidth()
.padding(10.dp)
) {
TextField(
modifier = Modifier
.fillMaxWidth()
.border(BorderStroke(width = 1.dp, color = Color.Black)),
singleLine = single,
maxLines = 3,
textStyle = NoteTheme.typography.body,
value = value.value, onValueChange = {
value.value = it
}, label = {
Text(
text = label, textAlign = TextAlign.Start,
color = Color.DarkGray,
style = NoteTheme.typography.subtitle
)
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.White),
keyboardActions = KeyboardActions(onNext =
{ focusManager.moveFocus((FocusDirection.Next)) })
)
}
}
@Composable
fun DatePick(mDate:MutableState<String>) {
val mContext = LocalContext.current
val mYear: Int
val mMonth: Int
val mDay: Int
val mCalendar = Calendar.getInstance()
mYear = mCalendar.get(Calendar.YEAR)
mMonth = mCalendar.get(Calendar.MONTH)
mDay = mCalendar.get(Calendar.DAY_OF_MONTH)
mCalendar.time = Date()
val mDatePickerDialog = DatePickerDialog(
mContext,
{ _: DatePicker, mYear: Int, mMonth: Int, mDayOfMonth: Int ->
mDate.value = "$mDayOfMonth/${mMonth + 1}/$mYear"
}, mYear, mMonth, mDay
)
mDatePickerDialog.datePicker.minDate=Date().time
Log.d("datepicker","dateset:${mDate.value}")
Button(modifier = Modifier
.padding(7.dp)
.fillMaxWidth(0.5f), onClick = {
mDatePickerDialog.show()
}, colors = ButtonDefaults.buttonColors(backgroundColor = Color(0XFF227093))) {
Text(text = "Seleccionar fecha",
color = Color.White, style = NoteTheme.typography.subtitle)
}
Text(text = "${mDate.value}",style = NoteTheme.typography.caption, fontSize = 22.sp, color = Color(0XFF227093))
}
@Composable
fun TimePick(mCalendar:Calendar) {
val mContext = LocalContext.current
val mHour = mCalendar[Calendar.HOUR_OF_DAY]
val mMinute = mCalendar[Calendar.MINUTE]
val mTime = remember { mutableStateOf("") }
val mTimePickerDialog = TimePickerDialog(
mContext,
{_, mHour : Int, mMinute: Int ->
mTime.value = "$mHour:$mMinute"
}, mHour, mMinute, false
)
Log.d("tmepicker","time:${mCalendar.timeInMillis}")
Button(modifier = Modifier
.padding(7.dp)
.fillMaxWidth(0.5f), onClick = {
mTimePickerDialog.show()
}, colors = ButtonDefaults.buttonColors(backgroundColor = Color(0XFF2c2c54))) {
Text(text = "Seleccionar hora",
color = Color.White, style = NoteTheme.typography.subtitle)
}
Text(text = "${mTime.value}",style = NoteTheme.typography.caption, fontSize = 22.sp, color = Color(0XFF2c2c54))
}
However, the problem I have is that when the alarm is configured, that is, when I call the setExactAndAllowWhileIdle() method, the alarm is executed once and it should not be so, but at the time and date of the data sent (time). Any idea why this happens??
I am studying networks and a question has arisen regarding IP addressing.
IP addresses are class A, B and C mainly.
Please someone explain to me what I'm doing wrong...
Hello I am learning to use Reactjs so I need guidance to pass this code that I have in javascript to my app in reactjs
This is the code I have in javascript:
const data_api = await fetch(url, requestOptions)
const res = await data_api.json();
const res_data = res.data
const arr = Object.entries(res_data);
const arr1 = Object.keys(arr[1][1])
let boton = ``;
arr1.forEach((el) => {
boton += `
<div class='containerGame'>
<button>${el}</button>
</div> `
});
document.getElementById('container').innerHTML = boton;
This is where I need to do the same thing I did in javascript.
Reactjs file:
import React, { useEffect, useState } from 'react';
import { getData } from '../functions/functions';
const CreateReport = () => {
const [data, setData] = useState(null);
useEffect(() => {
getData(setData)
}, [])
return (
<div>
</div>
)
}
export default CreateReport;
This is my file where I consume the api that I am exporting to my file in Reactjs
export const getData = (state) => {
const config = {
method: 'get',
url: 'http://xxxxxxxxxxxxxx/cubo/api/ventas?empresa=63&periodo=202202',
headers: {
'token': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}
};
axios(config)
.then(response => state(response.data.data))
.catch(error => console.error(error));
}
Grateful if you can guide me or provide resources.
I have an array1 of keys that give me the keys of the values that I must concatenate from array2 being the expected value, which I return
flatternArrayToString() --> ['aaabbb', 'dddeee', 'iiijjj']
let array1 =['keya','keyb']
let array2 = [{keya:'aaa', keyb: 'bbb', keyc: 'ccc' },{keya:'ddd', keyb: 'eee', keyc: 'hhh'},{keya:'iii', keyb: 'jjj', keyc: 'kkk'}]
I'm trying to make a unb method that concatenates both values, but I can't
flatternArrayToString() {
let array = [];
for (let element of array2) {
for (let key of array1) {
array.push(element[key])
}
}
}