Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F13790138
CodiceErrore.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
CodiceErrore.java
View Options
package
it.approu.dizionario.funzioniutili
;
import
android.content.res.Resources
;
import
android.util.Log
;
import
java.util.HashMap
;
import
it.approu.dizionario.R
;
public
class
CodiceErrore
{
private
Codice
enumerativo
=
Codice
.
ERRORE_GENERICO
;
private
int
num_errore
;
private
HashMap
<
CodiceErrore
.
Codice
,
String
>
mappaEnumErrore
=
new
HashMap
<
CodiceErrore
.
Codice
,
String
>();
public
enum
Codice
{
ERRORE_GENERICO
,
NESSUN_RISULTATO
,
CERCA_UNA_PAROLA_ALLA_VOLTA
,
LINGUE_NON_VALIDE
,
ERRORE_CONNESSIONE
,
NESSUNA_PAROLA_INSERITA
};
public
CodiceErrore
(
String
errore
,
Resources
res
)
{
mappaEnumErrore
.
put
(
Codice
.
ERRORE_GENERICO
,
res
.
getString
(
R
.
string
.
errore_generico
));
mappaEnumErrore
.
put
(
Codice
.
NESSUN_RISULTATO
,
res
.
getString
(
R
.
string
.
errore_nessun_risultato
));
mappaEnumErrore
.
put
(
Codice
.
CERCA_UNA_PAROLA_ALLA_VOLTA
,
res
.
getString
(
R
.
string
.
errore_cerca_una_parola_alla_volta
));
mappaEnumErrore
.
put
(
Codice
.
LINGUE_NON_VALIDE
,
res
.
getString
(
R
.
string
.
errore_lingue_non_valide
));
mappaEnumErrore
.
put
(
Codice
.
ERRORE_CONNESSIONE
,
res
.
getString
(
R
.
string
.
errore_connessione
));
mappaEnumErrore
.
put
(
Codice
.
NESSUNA_PAROLA_INSERITA
,
res
.
getString
(
R
.
string
.
errore_nessuna_parola_inserita
));
Log
.
d
(
"errore ricevuto"
,
errore
);
int
num
=
0
;
if
(
errore
.
matches
(
"[0-9]+"
))
{
num
=
Integer
.
parseInt
(
errore
);
}
else
{
num
=-
1
;
}
this
.
num_errore
=
num
;
this
.
enumerativo
=
this
.
daNumAEnum
(
num
);
}
public
CodiceErrore
(
Integer
err
)
{
this
.
num_errore
=
err
;
this
.
enumerativo
=
this
.
daNumAEnum
(
err
);
}
private
CodiceErrore
.
Codice
daNumAEnum
(
Integer
err
)
{
Codice
enumerativoLocale
;
switch
(
err
)
{
case
0
:
enumerativoLocale
=
Codice
.
ERRORE_GENERICO
;
break
;
case
1
:
enumerativoLocale
=
Codice
.
NESSUN_RISULTATO
;
break
;
case
2
:
enumerativoLocale
=
Codice
.
CERCA_UNA_PAROLA_ALLA_VOLTA
;
break
;
case
3
:
enumerativoLocale
=
Codice
.
LINGUE_NON_VALIDE
;
break
;
case
4
:
enumerativoLocale
=
Codice
.
ERRORE_CONNESSIONE
;
break
;
case
5
:
enumerativoLocale
=
Codice
.
NESSUNA_PAROLA_INSERITA
;
break
;
default
:
num_errore
=
0
;
enumerativoLocale
=
Codice
.
ERRORE_CONNESSIONE
;
break
;
}
return
enumerativoLocale
;
}
public
String
getStringDescription
()
{
return
mappaEnumErrore
.
get
(
this
.
enumerativo
);
}
public
Codice
getEnumCodice
()
{
return
this
.
enumerativo
;
}
public
int
getCodiceInt
()
{
return
this
.
num_errore
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Thu, Aug 27, 14:36 (19 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2084911
Default Alt Text
CodiceErrore.java (2 KB)
Attached To
Mode
R35 Appröu Android
Attached
Detach File
Event Timeline