tag:blogger.com,1999:blog-30122556222541466402024-03-14T10:07:39.329-07:00Fabrizio Russo - BlogHome Page / Blog di Fabrizio Russo
Unknownnoreply@blogger.comBlogger41125tag:blogger.com,1999:blog-3012255622254146640.post-77902545495875322602019-10-14T03:01:00.002-07:002019-10-14T05:51:00.281-07:00Spiaggia di Punta Licosa (SA)<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GDxIq1e4Dc5Ugf361eTYBatwO8cMrMIg_Y4BKQjfvzT2tOMdycxHO71V7OIV0phIKP931KMBWtVg_-R0ro9e2C1XoMbYfdJ0PRMd8uRtJl_xYeH9tuMsNFeEfPeW3rFHdTSAw8QmknBA/s1600/20190812-DSC7227.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1067" data-original-width="1600" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GDxIq1e4Dc5Ugf361eTYBatwO8cMrMIg_Y4BKQjfvzT2tOMdycxHO71V7OIV0phIKP931KMBWtVg_-R0ro9e2C1XoMbYfdJ0PRMd8uRtJl_xYeH9tuMsNFeEfPeW3rFHdTSAw8QmknBA/s640/20190812-DSC7227.jpg" width="640" /></a></div>
<br />
<br />
<div style="text-align: center;">
Visualizza posizione in <a href="https://goo.gl/maps/JQzF7ERi7t7st3Mp8" target="_blank">Google Maps</a><br />
<br />
Questa spiaggia è immersa in una riserva naturale di difficile accesso perché appartiene ad un privato e di conseguenza non sempre è possibile accedervi per poter scattare delle fotografie.<br />
<br />
Ho fatto questa foto due anni fa ma quando l'ho lavorata mi sono reso conti di alcuni errori, ci ho riprovato l'anno successivo ma non sono riuscito ad accedere al sito.<br />
Fortunatamente quest'anno ho avuto modo di accedervi un paio di volte riscattandomi della foto sbagliata due anni prima.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-49438494012527718282018-07-17T00:18:00.001-07:002018-07-17T00:18:26.339-07:00Photography - Sony A7ii - Come effettuare un bracketing sicuro<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ZmRVbcRytB5I7T8Ygz2iyHrZmvTWnO1lWb_Crkkxgaew-IJ3lEIatPlkmTYVniEor53SHXL7m0yTj-ktGSh3_7A_VApNUgGHbpclPQgPOfjW0nSES3Ui2hnmFsmnuqDhcD69R_aVNfFn/s1600/hdrimg1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="601" data-original-width="900" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2ZmRVbcRytB5I7T8Ygz2iyHrZmvTWnO1lWb_Crkkxgaew-IJ3lEIatPlkmTYVniEor53SHXL7m0yTj-ktGSh3_7A_VApNUgGHbpclPQgPOfjW0nSES3Ui2hnmFsmnuqDhcD69R_aVNfFn/s200/hdrimg1.jpg" width="200" /></a></div>
Strano a dirsi ma in una fotocamera moderna come la sony Alpha 7 Mark II (ma vale anche nella A7 e nelle a6000, a6300 e a6500 mentre nella m3 vedremo se è cambiato qualcosa) la scelta di come effettuare il bracketing (esposizione multipla a forchetta) non è stata una scelta molto felice da parte dei progettisti. (Al contrrio di Nikon e Canon)<br />
<br />
<br />
<a name='more'></a><br /><br />
Dov'è il problema ?<br /><br />
<b>Il problema sta nel fatto che l'impostazione del bracketing è nello stesso menu (Drive Mode) della scelta tra lo scatto singolo o lo scatto continuo. </b><br />
La fotocamera consente la selezione tra due tipi di bracketing, quello singolo o quello continuo. Per ognuno dei due ci sono diverse impostazioni di default che fanno scegliere tra il numero di foto da scattare (3 o 5) e la forchetta di esposizione (da 0.3 stop fino a 2 stop).<br />
<br />
Supponiamo ad esempio di voler fare tre fotografie con una esposizione a forchetta di uno stop (la prima esposta a -1 Ev, la seconda ad esposizione corretta e la terza a +1 Ev)<br />
<br />
<br />
<ul>
<li>Se scegliamo SINGLE bracketing dovremo premere manualmente il pulsante di scatto tre volte, con buona probabilità di muovere la macchina tra uno scatto e l'altro)<br /></li>
<li>Se scegliamo CONTINUOUS bracketing dovremo mantenere il pulsante di scatto per tutta la durata dei tre scatti (e qui forse la probabilità di muovere la macchina addirittura aumenta).<br />Per fortuna, terminati i tre scatti, e continuando a premere il pulsante NON parte automaticamente un'altra sequenza.</li>
</ul>
<br />
In Canon e Nikon la scelta è stata diversa, il bracketing si imposta e poi si sceglie e poi si imposta un timer (2 o 10 secondi che a mio avviso sono un po' pochi ed un po' troppi) dopodichè la macchina effettua in autonomia i tre scatti in sequenza.<br />
<br />
Personalmente ritengo questa scelta molto sbagliata perché di fatto obbliga ad usare un controllo remoto (con cavo o ad infrarossi) per poter essere sicuri di non far muovere la macchina durante i tre scatti.<br />
<br />
Speriamo che nella A7M3 ci sia qualcosa di diverso,<br />
<br />
<br />
<br />
<b>Edit: </b>Nella sony a7 Mark III finalmente si sono svegliati ed hanno aggiunto questa importante funzione (bracketing with SELF-TIMER)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizZcihPvxu-GKqjIWq9lB2D3-2rFcCvoYnkvSyubxnUtZO31o1riCeuAetU4ej4XjlgQ7EM6YPa4oo_vgtf5-VTE8-A9Hmz2O9ehacYeL9rkb0l3pTWFotzpKvuB-jnjI9UyqZ927cd59z/s1600/Sony-a7RII-Menu-Self-TImer-Bracket.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="457" data-original-width="640" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizZcihPvxu-GKqjIWq9lB2D3-2rFcCvoYnkvSyubxnUtZO31o1riCeuAetU4ej4XjlgQ7EM6YPa4oo_vgtf5-VTE8-A9Hmz2O9ehacYeL9rkb0l3pTWFotzpKvuB-jnjI9UyqZ927cd59z/s320/Sony-a7RII-Menu-Self-TImer-Bracket.jpg" width="320" /></a></div>
Consentendo addirittura la scelta tra un tre tempi diversi (2, 5 e 10 secondi) dopo di chè partirà il bracketing.<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-56020851251526191222018-02-15T02:16:00.000-08:002018-07-03T02:25:48.083-07:00Canon 80D - Lunghe esposizione senza filtro ND<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;">A volte sara' capitato di voler fare una lunga esposizione (magari in pieno giorno) ma di non avere un filtro ND a disposizione, ecco una tecnica, per far fare </span><span style="background-color: white; box-sizing: border-box; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-weight: 700;">alla vostra fotocamera</span><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif;"> una lunga esposizione componendo insieme piu' scatti.</span><br />
<h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 30px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Un po' di teoria</h2>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Per effettuare una lunga esposizione è necessario un filtro ND che blocchi la luce in entrata nella fotocamera rendendo necessario, per mantenere la stessa esposizione, tempi di posa più lunghi.<br />
Mantendo una apertura dell'otturatore per un periodo di tempo prolungato, la luce che colpisce il sensore varia nel tempo ed il valore che il sensore restituisce alla fine dell'esposione è una media dei valori rilevati durante tutta l'esposizione.<br />
Per quei "punti fissi", cioè quei punti che non variano per tutta la durata dell'esposizione (tipo una roccia o una montagna) il valore medio è uguale al valore reale (essendo la media di valori sempre uguali), per quei punti in movimento (acqua, nuvole), il valore medio è variabile e per questo motivo si ha l'effetto soft (scia della nuovla, setosità dell'acqua) tipica delle lunghe esposizioni.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
<br />
<a name='more'></a><br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Quindi, se poterssimo fare N scatti della stessa scena in tempi diversi e successivamente farne un media, otterremmo lo stesso risultato ? <span style="box-sizing: border-box; font-weight: 700;">SI.</span><br />
E' proprio su questo che si basa la tecnica mostrata qui. far far fare alla fotocamera N scatti (nella canon 80D fino a 9 scatti) per poi crearne una versione in cui ogni punto sia la media dei punti delle N foto.</div>
<h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 30px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
In pratica</h2>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Con la canon 80D (ma anche su altre fotocamere dovrebbe esserci una impostazione simile) e' possibile scattare utilizzando da due a nove immagini e poi combinare gli scatti in una unica immagine. Per fare cio' si deve accedere al menu <span style="box-sizing: border-box; font-weight: 700;">Esposizione Multipla</span></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
<span style="box-sizing: border-box; font-weight: 700;"><br /></span></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
<span style="box-sizing: border-box; font-weight: 700;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTyAmh0Tct6HHrkS-_KwZAwvgai7r96qcjXiCahvZuKCcRLwxfCDdu53kOrxM9zQ4PopAHJCZ4M0VWjfjjDLRU0mIjl6hAHBI7sNQdNCBx_sl62S8zQEavM0DO0yfNyC8yu6L1Ow0j4A5i/s1600/image1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1070" data-original-width="1600" height="265" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTyAmh0Tct6HHrkS-_KwZAwvgai7r96qcjXiCahvZuKCcRLwxfCDdu53kOrxM9zQ4PopAHJCZ4M0VWjfjjDLRU0mIjl6hAHBI7sNQdNCBx_sl62S8zQEavM0DO0yfNyC8yu6L1Ow0j4A5i/s400/image1.jpg" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYYgUZtoLroF932O9N304Zk6iJe5A5Ar1odfue61p1YIsqChFNFKhzmppDycHe9dAA65IlcjOfGEmQxIYZCtTs_KDlQiXbZj061hWVxND-Y7nYcMz-45v3L8TFvUK1xbcAX_1WOExUPIr/s1600/image2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1083" data-original-width="1600" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYYgUZtoLroF932O9N304Zk6iJe5A5Ar1odfue61p1YIsqChFNFKhzmppDycHe9dAA65IlcjOfGEmQxIYZCtTs_KDlQiXbZj061hWVxND-Y7nYcMz-45v3L8TFvUK1xbcAX_1WOExUPIr/s400/image2.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
all'interno del quale si trovano diverse voci, ed in particolare:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">Esposiz. muultipla</span>: Attiva/Disattiva l'esposizione multipla</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">Contr.esp.multi.</span>: ()Controllo dell'esposizione multipla) può assumere due valori (Media e Additiva).<ul style="box-sizing: border-box; margin-bottom: 0px; margin-top: 0px;">
<li style="box-sizing: border-box;">Se si imposta il valore "Additiva" il valore assunto da un pixel sarà la somma dei valori assunti nelle singole immagini (quindi da utilizzare nel caso si volessa fare una "doppia esposizione") <br style="box-sizing: border-box;" /><i style="box-sizing: border-box;">Attenzione che in questo caso anche il livello di esposizione viene sommato, quindi bisogna sotto-esporre di mezzo stop per ogni foto utilizzata, quindi sottoesporre di uno stop per due foto, di uno stop e mezzo per tre foto, di due stop per quattro foto, ecc ecc.</i></li>
<li style="box-sizing: border-box;">Se si imposta il valore "media" il valore assunto da un pixel sarà la media dei pixed nelle singole immagini. <br style="box-sizing: border-box;" />In questo caso non e' necessario compensare l'esposizione.</li>
</ul>
<div style="box-sizing: border-box; margin-bottom: 10px;">
per avere l'effetto di una lunga esposizione il valore da impostare è "media".</div>
</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">N. di esposizioni</span>: Numero delle foto che si intende scattare e che faranno parte dell'immagine finale. Sulla Canon 80D si puo' andare da un minimo di due ad un massimo di 9.</li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box; font-weight: 700;">Continua esp.mul.</span>: (Continuare con l'esposizione multipla) - Serve ad indicare se mantenere impostata l'opzione di esposizione multipla solo per lo scatto corrente (1 scatto) oppure lasciarla anche per gli scatti successivi (continua). <br style="box-sizing: border-box;" />Se si imposta su "continua", sarà necessario disabilitare l'esposizione multipla manualmente utilizzando la prima voce di menu.</li>
</ul>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
<br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Una volta impostata la modalità di esposizione si può procedere con lo scatto. Ricordo che verrà salvata solo l'immagine finale (la fusione degli N scatti), ma per ogni scatto è possibile visualizzare (ed eventualmente cancellare) anche gli scatti intermedi. Al termine del primo scatto, comparirà nel live view un contantore che indica il numero di scatti e sarà necessario ripremere manulamente il pulsante di scatto per scattare la seconda foto (nel frattempo se si vuole si può procedere a cambiare esposizione o inquadratura).</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Il risultato finale (l'unico salvato sulla SD) sarò la fusione degli N scatti impostati.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
<br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; margin-bottom: 10px;">
Per fare una lunga esposizione, magari di giorno con luce solare, consiglio di mettere la macchina sul cavalletto, impostare gli ISO a 100, impostare la modalità di apertura di diaframma ed impostarlo a f/16 o successivi in modo che per ogni scatto la macchina deciderà il tempo necessario per lo scatto mantenendo correttamente esposta l'immagine.<br />
Ovviamente un controllo remoto per essere sicuri di non cambiare l'inquadratura tra uno scatto e l'altro.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-59330525368212389262017-02-07T02:52:00.000-08:002018-07-03T02:53:56.770-07:00SOAPUI - Validare un XML che contenga una sezione CDATA<br />
Durante la definizione di test case in soapUI potrebbe essere necessario inserire della logica di validazoine leggermente più complessa rispetto alla semplice presenza o meno di parti di testo<br />
<br />
Grazie agli script di validazione groovy è possibile inserire della logica di validazione custom.<br />
<br />
<br />
<a name='more'></a><br /><br />
Esempio<br />
<br />
<blockquote class="tr_bq">
import com.eviware.soapui.support.XmlHolder </blockquote>
<blockquote class="tr_bq">
def holder = new XmlHolder( messageExchange.responseContentAsXml )<br />
holder.namespaces["ns2"] = "http://this.is.my.namespace"<br />
def node = holder[ "//ns2:response/return/xmlMessageResponse" ] </blockquote>
<blockquote class="tr_bq">
assert node != null<br />
def descHolder = new XmlHolder( node )<br />
def esito = descHolder["//esitoElaborazione"]<br />
assert esito .length() == 2<br />
assert esito == 'OK'</blockquote>
<div>
<br />
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-15866971394366433512017-01-25T02:23:00.000-08:002018-07-03T02:26:46.775-07:00WSO2 - Custom Mediator per una chiamata HTTP Post<div style="text-align: justify;">
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">Ecco un modo semplice per effettuare una chiamate in modalità POST in WSO2 ESB</span><br />
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">Questo custom mediator implementa una chiamata ad un URL in modalita' POST passando una serie di parametri e ignorando la validita' del certificato SSL nel caso in cui la chiamata fosse in HTTPS.</span></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; text-align: justify;">
Il mediator per prendere i parametri da passare al server utilizza un prefisso da usare per verificare quali, tra i parametri nel contesto attuale, e' da inviare. Quindi se il come prefisso si utilizza "xyz" allora tutti i parametri del tipo "xyzParamName" saranno inviati (con chiave "ParamName"). Il mediator prevede alcuni parametri:</div>
<ul style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">url : URL a cui effettuare la chiamata POST</li>
<li style="box-sizing: border-box;">paramPrefix : Prefisso per cercare i parametri nel contesto</li>
<li style="box-sizing: border-box;">userAgent : (facoltativo) Lo userAgent con il quale presentarsi al server</li>
<li style="box-sizing: border-box;">output : (facoltativo) variabile da inserire nel contesto con l'output del servizio</li>
</ul>
<div>
<span style="color: #333333; font-family: helvetica neue, helvetica, arial, sans-serif;"><span style="font-size: 14px;"><a name='more'></a></span></span></div>
<h2 style="background-color: white; box-sizing: border-box; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 24px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Implementazione del mediator</h2>
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">L'implementazione del custom mediator e' la seguente:</span><br />
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br /></span>
<br />
<code></code><br />
<pre><code>
public class HttpPost extends AbstractMediator {
private String url = ""; // Endpoint da richiamare
private String payload = null; // Payload da passare (eventualmente) nel body della chiamata POST
private String paramPrefix = ""; // Prefisso dei parametri da passare in POST
private String output = null; // Nome della variabile dove memorizzare l'output
private String userAgent = null;
// Mappa dove parcheggiare i parametri della POST
private Properties httpParams = new Properties();
@SuppressWarnings("unchecked")
public boolean mediate(MessageContext mc) {
log.info("Calling " + getClass().getName() + " mediator: URL=" + getUrl());
String payload = (String) mc.getProperty(getPayload());
Set<string> keySet = mc.getPropertyKeySet();
for (String key : keySet) {
if (key.startsWith(paramPrefix)) {
String paramKey = key.substring(1 + paramPrefix.length());
String paramVal = (String)mc.getProperty(key);
httpParams.put(paramKey, paramVal);
log.info(" -- Param " + paramKey + " = " + paramVal);
}
}
log.info(" --> Body payload: " + (payload == null ? "empty" : payload));
if (httpParams.size() == 0) {
log.warn(" -- NO PARAMETERS FOUND FOR POST REQUEST !!");
}
try {
HttpClient httpClient = null;
if (url.toLowerCase().startsWith("https")) httpClient = getHttpClient();
else httpClient = new DefaultHttpClient();
org.apache.http.client.methods.HttpPost post = new org.apache.http.client.methods.HttpPost(url);
if (userAgent != null) post.setHeader("User-Agent", userAgent);
List<namevaluepair> urlParameters = new ArrayList<namevaluepair>();
for (Object pName : httpParams.keySet()) {
String pKey = (String) pName.toString();
urlParameters.add(new BasicNameValuePair(pKey, httpParams.getProperty(pKey)));
}
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = httpClient.execute(post);
HttpEntity result = response.getEntity();
log.info("Called endpoint - status : " + response.getStatusLine());
BufferedReader rd = new BufferedReader(new InputStreamReader(result.getContent()));
StringBuffer res = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
res.append(line);
}
log.info(" HTTP Response : " + res.toString());
if (output != null) {
mc.setProperty(output, res.toString());
}
} catch (Exception e) {
e.printStackTrace();
log.error("Exception invoking POST to " + url + ": " + e.getMessage());
}
return true;
}
private HttpClient getHttpClient() throws Exception {
SSLContextBuilder builder = SSLContexts.custom();
builder.loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
return true;
}
});
SSLContext sslContext = builder.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslContext, new X509HostnameVerifier() {
@Override
public void verify(String host, SSLSocket ssl)
throws java.io.IOException {}
@Override
public void verify(String host, X509Certificate cert)
throws SSLException {}
@Override
public void verify(String host, String[] cns, String[] subjectAlts)
throws SSLException {}
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
Registry socketFactoryRegistry =
RegistryBuilder. create()
.register("https", sslsf).build();
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry);
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();
return httpClient;
}
public String getUrl() { return url; }
public void setUrl(String url) { this.url = url; }
public String getPayload() { return payload; }
public void setPayload(String payload) { this.payload = payload; }
public String getParamPrefix() { return paramPrefix; }
public void setParamPrefix(String paramPrefix) { this.paramPrefix = paramPrefix; }
public void setOutput(String output) { this.output = output; }
public String getOutput() { return output; }
}
</namevaluepair></namevaluepair></string></code></pre>
<div>
<br /></div>
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;">Un esempio di invocazione del mediator e' la seguente:</span><br />
<div>
<span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px;"><br /></span></div>
<div>
<br />
<code></code><br />
<pre><code><property name="myTag.serviceName" scope="default" type="STRING" value="login">
<property name="myTag.userName" scope="default" type="STRING" value="frusso"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"myTag.serviceName"</span> <span class="hljs-attr" style="box-sizing: border-box;">scope</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"default"</span> <span class="hljs-attr" style="box-sizing: border-box;">type</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"STRING"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"login"</span>/><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"myTag.userName"</span> <span class="hljs-attr" style="box-sizing: border-box;">scope</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"default"</span> <span class="hljs-attr" style="box-sizing: border-box;">type</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"STRING"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"frusso"</span> /></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"myTag.password"</span> <span class="hljs-attr" style="box-sizing: border-box;">scope</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"default"</span> <span class="hljs-attr" style="box-sizing: border-box;">type</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"STRING"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"s3cret"</span> /></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">class</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"it.frusso.wso2.HttpPost"</span>></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"output"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"myTagOutput"</span> /></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"paramPrefix"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"myTag."</span> /></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">property</span> <span class="hljs-attr" style="box-sizing: border-box;">name</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"url"</span> <span class="hljs-attr" style="box-sizing: border-box;">value</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"http://SERVER_ENDPOINT"</span> /></span><span style="background-color: #f0f0f0; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;">
</span><span class="hljs-tag" style="box-sizing: border-box; color: #444444; font-family: "menlo" , "monaco" , "consolas" , "courier new" , monospace; font-size: 13px; white-space: pre-wrap;"></<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">class</span>></span>
<property name="myTag.password" scope="default" type="STRING" value="s3cret">
</property></property></property></code><code><property name="myTag.serviceName" scope="default" type="STRING" value="login"><property name="myTag.userName" scope="default" type="STRING" value="frusso"><property name="myTag.password" scope="default" type="STRING" value="s3cret"><class name="it.frusso.wso2.HttpPost">Che effettuera' l'invocazione del servizio passando in POST i parametri <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: normal;">serviceName</code><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; white-space: normal;"> , </span><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: normal;">userNmae</code><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; white-space: normal;"> e </span><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: normal;">password</code><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; white-space: normal;"> </span></class></property></property></property></code><code><property name="myTag.serviceName" scope="default" type="STRING" value="login"><property name="myTag.userName" scope="default" type="STRING" value="frusso"><property name="myTag.password" scope="default" type="STRING" value="s3cret"><class name="it.frusso.wso2.HttpPost"><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; white-space: normal;">ed inserira' l'output della chiamata nella variabile </span><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px; white-space: normal;">myTagOutput</code><span style="background-color: white; color: #333333; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; white-space: normal;"> (senza prefisso)</span></class></property></property></property></code><code><property name="myTag.serviceName" scope="default" type="STRING" value="login"><property name="myTag.userName" scope="default" type="STRING" value="frusso"><property name="myTag.password" scope="default" type="STRING" value="s3cret"><class name="it.frusso.wso2.HttpPost"> </class></property></property></property></code>
<code><property name="myTag.serviceName" scope="default" type="STRING" value="login"><property name="myTag.userName" scope="default" type="STRING" value="frusso"><property name="myTag.password" scope="default" type="STRING" value="s3cret"><class name="it.frusso.wso2.HttpPost"><property name="output" value="myTagOutput"> <property name="paramPrefix" value="myTag.">
<property name="url" value="http://SERVER_ENDPOINT">
</property></property></property></class>
</property></property></property></code></pre>
<br />
<br />
<br />
<br />
aaaaaa</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-21359183785088293562017-01-13T02:49:00.000-08:002018-07-16T23:21:40.283-07:00 Android - Autoincrementare il numero di build<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Se è necessario essere sicuri che ad ogni build venga generato un nuovo numero di build (numero incrementale), e' possibile inserire questo codice all'interno dello script gradle della propria applicazione android.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Lo scrip va inserito dopo la sezione 'android' e prima della sezione 'dependencis' del file build.gradle relativo all'app (non al progetto).</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<a name='more'></a><br />
<br />
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow: auto; padding: 9.5px; word-break: break-all; word-wrap: break-word;"><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;">
String buildFilePath = <span class="hljs-string" style="box-sizing: border-box; color: #880000;">"app/src/main/assets/build.prop"</span>;
File buildFile = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> File(buildFilePath);
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">if</span> (!buildFile.getParentFile().exists()) buildFile.getParentFile().mkdirs();
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">int</span> buildNumber = <span class="hljs-number" style="box-sizing: border-box; color: #880000;">0</span>;
Properties buildProp = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> Properties();
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">try</span> {
buildProp.load(<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> FileInputStream(buildFilePath))
buildNumber = Integer.parseInt(buildProp.getProperty(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"buildNumber"</span>));
buildNumber++;
} <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">catch</span> (Exception e) {
}
buildProp.setProperty(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"buildNumber"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #880000;">""</span> + buildNumber);
buildProp.setProperty(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"buildTimeStamp"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #880000;">""</span> + System.currentTimeMillis());
buildProp.setProperty(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"betaVersion"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #880000;">"true"</span>);
buildProp.setProperty(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"expirationDate"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #880000;">""</span> + (System.currentTimeMillis() + <span class="hljs-number" style="box-sizing: border-box; color: #880000;">90</span> * <span class="hljs-number" style="box-sizing: border-box; color: #880000;">3600000</span> * <span class="hljs-number" style="box-sizing: border-box; color: #880000;">24</span>));
buildProp.save(<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> FileOutputStream(buildFilePath), <span class="hljs-string" style="box-sizing: border-box; color: #880000;">""</span>);
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Questo fara' si che ad ogni lancio di build lo script leggera' il file <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">build.properties</code> direttamente dalla cartella assets del progetto (se la prima volta non c'e' provvede a crearla).<br />
La cartella assets (contrariamente alla cartella res) non viene compilata, quindi i files vengono lasciati inalterati dalle fasi successive di composizione dell' APK da parte del plugin gradle.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Successivamente, per poter leggere tale proprieta' all'interno dell'applicazione a run-time, e' sufficiente modificare la propria <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">Application</code> class in questo modo:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow: auto; padding: 9.5px; word-break: break-all; word-wrap: break-word;"><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;">
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">class</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">MyApplication</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">extends</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">android</span>.<span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">app</span>.<span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">Application</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">static</span> Properties buildProperties = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>;
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onCreate</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onCreate();
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// Add your code here, if you want</span>
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">try</span> {
InputStream buildIS = getAssets().open(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"build.prop"</span>);
buildProperties = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> Properties();
buildProperties.load(buildIS);
buildIS.close();
} <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">catch</span> (IOException e) {
Helper.error(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"Error loading build.prop"</span>, e);
}
}
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// ....</span>
}
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
In questo modo, allo start-up dell'applicazione l'intera properties viene memorizzata e conservata all'interno della classe <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">Application</code> in modo da poter essere acceduta velocemente da qualsiasi punto.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-47583057462940865942017-01-13T02:45:00.000-08:002018-07-03T02:48:31.280-07:00AppCompatPreferenceActivity - Preference vecchio stile<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Le nuove specifiche per l'implementazione delle activity per i settings consigliano di utilizzare gli header in modo da avere, sopratutto su un table, una ben chiara distinzione tra le varie sezioni delle configurazioni.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Nel caso di settings per uno smartphone pero' queste "separazioni" sono piuttosto scomode ed anche l'activity proposta da Android Studio non e' di facile customizzazione.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Ecco perche' questa classe che implementa, sempre sftuttando le nuove classi messe a disposizione dalle ultime versioni di android, una pagina di setting "vecchio stile", cioe' tutta in verticale ed eventualmente divisia in categorie (Categories).</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<a name='more'></a><br /><br />
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Prima di tutto e' necessario un file XML con all'interno le preferences che si intende mostrare</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
il file <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">preference.xml</code> da inserire nella cartella <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">res/xml</code> e' il seguente:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow: auto; padding: 9.5px; word-break: break-all; word-wrap: break-word;"><code class="html hljs xml" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;">
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">PreferenceScreen</span> <span class="hljs-attr" style="box-sizing: border-box;">xmlns:android</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"http://schemas.android.com/apk/res/android"</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">PreferenceCategory</span> <span class="hljs-attr" style="box-sizing: border-box;">android:title</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"General"</span> ></span>
<span class="hljs-tag" style="box-sizing: border-box;"><<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">Preference</span>
<span class="hljs-attr" style="box-sizing: border-box;">android:key</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"aboutPreference"</span>
<span class="hljs-attr" style="box-sizing: border-box;">android:title</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"About"</span> <span class="hljs-attr" style="box-sizing: border-box;">android:summary</span>=<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"About this application"</span> /></span>
<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">PreferenceCategory</span>></span>
<span class="hljs-tag" style="box-sizing: border-box;"></<span class="hljs-name" style="box-sizing: border-box; font-weight: bold;">PreferenceScreen</span>></span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
dove, a titolo di esempio, viene mostrata una singola prefereze all'interno di una getegoria. Da notare che le categorie assumono gia' il colore definito come 'accent' come da specifiche del <a href="https://material.io/guidelines/patterns/settings.html#settings-usage" style="background-color: transparent; box-sizing: border-box; color: #337ab7; text-decoration: none;" target="_blank">Marieal Design</a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Siccome attualmente Android non mette a disposizione una PreferenceActivity che estenda a AppCompatActivity, ho creato una classe che estenda da AppCompat ed utilizza un fragment per disegnare i settings.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Il Fragment e' imlementato come inner class in modo da mantenere l'unica di compilazione il piu' compatta (e portabile possibile).</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
La classe e' la seguente:</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
</div>
<pre style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow: auto; padding: 9.5px; word-break: break-all; word-wrap: break-word;"><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;">
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">class</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">AppCompatPreferenceActivity</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">extends</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">AppCompatActivity</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">private</span> AppCompatDelegate mDelegate;
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">private</span> MyPreferenceFragment myFragmentReference = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>;
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onCreate</span><span class="hljs-params" style="box-sizing: border-box;">(Bundle savedInstanceState)</span> </span>{
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onCreate(savedInstanceState);
myFragmentReference = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> MyPreferenceFragment();
getFragmentManager().beginTransaction()
.replace(android.R.id.content, myFragmentReference).commit();
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onPostCreate</span><span class="hljs-params" style="box-sizing: border-box;">(Bundle savedInstanceState)</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> ActionBar <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">getSupportActionBar</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> getDelegate().getSupportActionBar();
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">setSupportActionBar</span><span class="hljs-params" style="box-sizing: border-box;">(@Nullable Toolbar toolbar)</span> </span>{
getDelegate().setSupportActionBar(toolbar);
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> MenuInflater <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">getMenuInflater</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> getDelegate().getMenuInflater();
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">setContentView</span><span class="hljs-params" style="box-sizing: border-box;">(@LayoutRes <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">int</span> layoutResID)</span> </span>{
getDelegate().setContentView(layoutResID);
}
<span style="font-size: inherit;">
</span><span class="hljs-function" style="box-sizing: border-box; font-size: inherit;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">setContentView</span><span class="hljs-params" style="box-sizing: border-box;">(View view)</span> </span><span style="font-size: inherit;">{</span>
</code><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;"> getDelegate().setContentView(view);
}
<span style="font-size: inherit;">
</span><span class="hljs-function" style="box-sizing: border-box; font-size: inherit;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">setContentView</span><span class="hljs-params" style="box-sizing: border-box;">(View view, ViewGroup.LayoutParams params)</span> </span><span style="font-size: inherit;">{ </span>
</code><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;"> getDelegate().setContentView(view, params);
}
</code><code class="java hljs" style="background: rgb(240, 240, 240); border-radius: 0px; box-sizing: border-box; color: #444444; display: block; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; overflow-x: auto; padding: 0.5em; white-space: pre-wrap;"><span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;"> public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">addContentView</span><span class="hljs-params" style="box-sizing: border-box;">(View view, ViewGroup.LayoutParams params)</span> </span>{
getDelegate().addContentView(view, params);
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onPostResume</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onPostResume();
getDelegate().onPostResume();
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onTitleChanged</span><span class="hljs-params" style="box-sizing: border-box;">(CharSequence title, <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">int</span> color)</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onConfigurationChanged</span><span class="hljs-params" style="box-sizing: border-box;">(Configuration newConfig)</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onStop</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onStop();
getDelegate().onStop();
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onDestroy</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onDestroy();
getDelegate().onDestroy();
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">invalidateOptionsMenu</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
getDelegate().invalidateOptionsMenu();
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> AppCompatDelegate <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">getDelegate</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">if</span> (mDelegate == <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>) {
mDelegate = AppCompatDelegate.create(<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">this</span>, <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>);
}
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> mDelegate;
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onSaveInstanceState</span><span class="hljs-params" style="box-sizing: border-box;">(Bundle outState)</span> </span>{
outState.putString(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"WORKAROUND_FOR_BUG_19917_KEY"</span>, <span class="hljs-string" style="box-sizing: border-box; color: #880000;">"WORKAROUND_FOR_BUG_19917_VALUE"</span>);
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onSaveInstanceState(outState);
}
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// ---------------------------------------------------------------------------------</span>
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">/**
* PreferenceFragment per l'implementazione dei settings
*/</span>
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">static</span> <span class="hljs-class" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">class</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">MyPreferenceFragment</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">extends</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">PreferenceFragment</span> </span>{
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// Add here the rferences to your preferences in R.xml.preference.xml</span>
Preference aboutPreference = <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>;
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onSaveInstanceState</span><span class="hljs-params" style="box-sizing: border-box;">(Bundle outState)</span> </span>{
Logger.debug(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"Calling onSaveInstanceState in Fragment"</span>);
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// removed to fix the IllegalStateException</span>
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// super.onSaveInstanceState(outState);</span>
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> AppCompatPreferenceActivity <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">getSettingsActivity</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> (AppCompatPreferenceActivity)getActivity();
}
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">void</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onCreate</span><span class="hljs-params" style="box-sizing: border-box;">(Bundle savedInstanceState)</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">super</span>.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
setHasOptionsMenu(<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">true</span>);
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">final</span> SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
<span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// Add here reference to your preferences.</span>
aboutPreference= (Preference) findPreference(<span class="hljs-string" style="box-sizing: border-box; color: #880000;">"aboutPreference"</span>);
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">if</span> (aboutPreference != <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">null</span>) aboutPreference.setOnPreferenceClickListener(
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">new</span> Preference.OnPreferenceClickListener() {
<span class="hljs-meta" style="box-sizing: border-box; color: #1f7199;">@Override</span>
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">boolean</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">onPreferenceClick</span><span class="hljs-params" style="box-sizing: border-box;">(Preference preference)</span> </span>{
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> doAboutPrefence();
}
}
);
}
<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">private</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">boolean</span> <span class="hljs-title" style="box-sizing: border-box; color: #880000; font-weight: bold;">doAboutPrefence</span><span class="hljs-params" style="box-sizing: border-box;">()</span> </span>{
Toast.makeText(getActivity(), <span class="hljs-string" style="box-sizing: border-box; color: #880000;">"Application "</span> + getString(R.string.app_name), Toast.LENGTH_SHORT)
.show();
<span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">return</span> <span class="hljs-keyword" style="box-sizing: border-box; font-weight: bold;">true</span>;
}
} <span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// End of fragment</span>
} <span class="hljs-comment" style="box-sizing: border-box; color: #888888;">// End of class</span>
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Ho dovuto implementare alcuni work-around per risolvere qualche bug interno ed in particolare NON invocare il metodo super all'interno del metodo <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">onSaveInstanceState</code> def fragment e passare almeno un parametro nel meotodo <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">onSaveInstanceState</code> dell'activity contemitore.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Il risultato, volutamente semplice ma da usare come base di implementazione, e' il seguente.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNxoMxSXX_q7HQab1vxP0uz1YJvs-5Fsmv-MaduFe0icBciM_xkvw1ObElqKunapAaccDRfABxXXSIXD2iaLB6dMc8wpALiOLzpeDsyyeoMD189E0-lGZYTWbvmCHCn7Dbg-2OBAwDHU8K/s1600/example1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1468" data-original-width="810" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNxoMxSXX_q7HQab1vxP0uz1YJvs-5Fsmv-MaduFe0icBciM_xkvw1ObElqKunapAaccDRfABxXXSIXD2iaLB6dMc8wpALiOLzpeDsyyeoMD189E0-lGZYTWbvmCHCn7Dbg-2OBAwDHU8K/s320/example1.png" width="176" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
<br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
La fase vera e propria di implementazione e' nel metodo <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">onCreate</code> del fragment.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
<br /></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-63802229103789818322015-02-01T10:57:00.000-08:002015-02-01T10:57:01.235-08:00Libra Weight Manager<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV_hGpqeUn9cXtG9JVcwltSzev_0JMMq9t8H_mgMInXeQ2BwDzaBoxwAYejxZp3MkFrh-0x7RAEqGd_pCg5zy7EtgvNaTjc-yMJEljXKKrlb22FbXtz6bOLnKozP8UvhC4cEcvJphgEDxV/s1600/ic_lancher.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV_hGpqeUn9cXtG9JVcwltSzev_0JMMq9t8H_mgMInXeQ2BwDzaBoxwAYejxZp3MkFrh-0x7RAEqGd_pCg5zy7EtgvNaTjc-yMJEljXKKrlb22FbXtz6bOLnKozP8UvhC4cEcvJphgEDxV/s1600/ic_lancher.png" height="200" width="200" /></a></div>
<br />
Libra Weight Manager<br />
<br />
Nuova applicazione per tenere sotto controllo l'andamento del peso.<br />
<br />
E' sufficiente memorizzare ogni mattina il proprio peso (pochi click) per poter tenere sotto controllo l'andamento del proprio peso.<br />
<br />
<a href="https://play.google.com/store/apps/details?id=it.frusso.libra" target="_blank">Google Play Store</a> <a href="https://www.youtube.com/watch?v=Wyg67Jn2Tb8" target="_blank">Video YouTube</a><br />
<br />
<br />
<a name='more'></a><br /><br />
Oltre ad un grafico che riporta la storia (e l'andamento statistico) del proprio peso c'è (a differenza di altre applicazioni dove non ho trovato questa cosa) la lista con lo storico dettagliato.<br />
Nella lista non c'è solo il peso, ma anche la differenza rispetto alla pesata precedente e rispetto al valore iniziale e obiettivo (se tali valori vengono definite nelle impostazioni).<br />
<br />
Anche questa applicazione utilizza il Material Design come tema utilizzando anche un porting a versioni precedenti alla 5.0 di android.<br />
<br />
Funzionalità:<br />
<br />
<br />
<ol>
<li>Inserimento veloce del peso (di default viene mostrata l'ultima pesata con la possibilità di modificare per differenza (di solito pochi etti al giorno).</li>
<li>Possibilità di inserire più valori per un singolo giorno (anche questa non è presente in altre applicazioni)</li>
<li>Possibilità di inserire un valore per un giorno differente da oggi (qualcuno si è dimenticato di salvare una pesata ?)</li>
<li>Possibilità di cancellare le singole pesate ( versione pro)</li>
<li>Grafico a full-screen con possibilità di aggiungere dinamicamente il peso iniziale o obiettivo rispetto alle impostazioni generali</li>
<li>Export del grafico in formato PNG (verrà salvato nella galleria)</li>
<li>Export del grafico in formato CSV (savlato su <b>/sdcard/data/it.frusso.libra/export.csv</b> )</li>
<li>Import del grafico in formato CSV (versione pro)</li>
</ol>
<div>
La versione pro (acquistabile tramite in-app billing) rimuove anche la pubblicità</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Con lo sviluppo di questa app è stato anche utile per migliorare ulteriormente l'uso del material design ed a studiare le librerie per l'integrazione dei grafici e dell' in-app billing V3</div>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-27289348435307069372015-01-02T03:48:00.000-08:002015-01-02T03:49:31.533-08:00Major update to PasswordSafe PRO<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg4SQVPdLmlde-Pw7MRYyaLQgpVE9V2fWUASMyQZs3T0trF2ePQolgzMjn0RxNPkSEdz3MIu8Yzv2RETlmmcapXWxnGIOcGphyphenhyphenCfeWN3UvH3Jt9OrkBnuAXiWZz5bToahdg7csVBc4HbRK/s1600/icon512.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhg4SQVPdLmlde-Pw7MRYyaLQgpVE9V2fWUASMyQZs3T0trF2ePQolgzMjn0RxNPkSEdz3MIu8Yzv2RETlmmcapXWxnGIOcGphyphenhyphenCfeWN3UvH3Jt9OrkBnuAXiWZz5bToahdg7csVBc4HbRK/s1600/icon512.png" height="200" width="200" /></a></div>
<br />
Importante aggiornamento per PasswordSafe PRO<br />
<br />
Con l'ultimo aggiornamento (dicembre 2014) di PasswordSafe PRO è stato completamente adattato il layout seguendo le nuove linee guida di Google e creando un look and feel in stile Material Design<br />
<br />
E' stato inoltre rivista e rafforzata la logica dei backup e della crittografia interna del database.<br />
<br />
<br />
<a name='more'></a><br />
La copia di backup è ora abilitata di default e se rimane abilitata ad ogni avvio ed ad ogni modifica dei dati viene creata una copia di backup del database in formato XML (crittografato) e salvato su scheda SD (la scheda sd interna).<br />
La chiave di crittografia usata è la sequnza di sblocco dell'applicazione, quindi nel caso di un import/restore bisogna assicurarsi di avere la stessa sequenza di sblocco del backup.<br />
A tal fine anche il formato interno del backup è cambiato (quindi i vecchi backup potrebbero non andare più bene) per poter velocemente verificare se la firma della sequenza di sblocco coincide.<br />
<br />
Anche la chiave di cifratura usata per cifrare il database interno è stata potenziata.<br />
<br />
Per maggiori informazioni consultare la <a href="http://fabrizio-russo.blogspot.it/p/app-passwordsafe-pro.html" target="_blank">guida</a><br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-29439190034624987892014-11-06T01:39:00.000-08:002014-11-06T01:39:37.539-08:00Inbox vs GMail 5.0 - Guerra in casa google<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcN02OFOuo4f8PI_v7HraDw0_VNFzDAIrhYhyRIYX0kH4fsdn9lSbZU_q2fODDxz_6YYn5syHpaYbP8G2Q7kKE_9U7qaItmidXjMosh18ZihyphenhyphenQYTtgFW36huW00xyFC5hsb19Txdb-hQjy/s1600/Inbox_Vs_Gmail_3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcN02OFOuo4f8PI_v7HraDw0_VNFzDAIrhYhyRIYX0kH4fsdn9lSbZU_q2fODDxz_6YYn5syHpaYbP8G2Q7kKE_9U7qaItmidXjMosh18ZihyphenhyphenQYTtgFW36huW00xyFC5hsb19Txdb-hQjy/s1600/Inbox_Vs_Gmail_3.png" height="66" width="200" /></a></div>
Google recentemente ha rilasciato la versione aggiornata di GMail (5.0 con il material design) e Inbox il suo nuovo client di posta<br />
<br />
Queste le descrizioni ufficiali di entrambe le applicazione come riportate (ad oggi) dal play store:<br />
<br />
<b>Inbox</b> : <span style="background-color: whitesmoke; color: #333333; font-family: Roboto, Arial, sans-serif; font-size: 14px; line-height: 20px;">La tua casella di posta dovrebbe aiutarti a vivere e a lavorare meglio. Al contrario, spesso nasconde le cose importanti e provoca più stress che altro. Inbox, progettato dal team di Gmail, ti aiuta a tenere tutto in ordine e a trovare le cose che ti servono.</span><br />
<br />
<b>GMail</b> : <span style="background-color: whitesmoke; color: #333333; font-family: Roboto, Arial, sans-serif; font-size: 14px; line-height: 20px;">Gmail si basa sull'idea che l'email può essere più intuitiva, efficiente e utile. E magari anche divertente. Ricevi subito le tue email tramite notifiche push, leggi e rispondi alle tue conversazioni online e offline e cerca e trova qualsiasi email.</span><br />
<br />
Io ho ricevuto un invito di inbox e lo sto provando da alcuni giorni, ma ho notato come un prodotto che dovrebbe aiutare a migliorare l'esperienza email già ottima di gmail in realtà ha molti punti di sovrapposizione con gmail e quest'ultimo, con l'aggiornamento alla versione 5.0, oltre al material design, riprende moltissimo dall'applicazione inbox.<br />
I due prodotti si stanno fondendo ? C'è guerra in casa google ?<br />
<br />
<a name='more'></a><br /><br />
Innanzitutto quando si installa Inbox, l'account predefinito è quello di gmail, quindi al momento io ho due client per la stessa casella di posta (ma questo non è un problema, è giusto che sia così).<br />
<br />
Quando arriva una notifica, giustamente, sono due le applicazioni che mi notificano l'evento, aprendo la barra delle notifiche (nexus 5 - Kitkat), ho la seguente schermata.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy151GJR-Bqm3yA_9NBLQUeVfWtsz_fclO3DVU_aqTfezByC9ZjKLeCAwZW-aS-vV-Jy3B0N7YvmlbiRC2K5e9i3RUnK4eeeo3QJuMfFlJxPP2jbuXnYauirp4-LQF0yDvV1CPI2MSJ5QU/s1600/001-RicezioneEmailTwice.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy151GJR-Bqm3yA_9NBLQUeVfWtsz_fclO3DVU_aqTfezByC9ZjKLeCAwZW-aS-vV-Jy3B0N7YvmlbiRC2K5e9i3RUnK4eeeo3QJuMfFlJxPP2jbuXnYauirp4-LQF0yDvV1CPI2MSJ5QU/s1600/001-RicezioneEmailTwice.png" height="320" width="180" /></a></div>
Quella in alto è la notifica ricevuta dall'applicazione Inbox, mentre quella in basso quella di GMail.<br />
<br />
Entrambe hanno i pulsanti rapidi per poter effettuare delle operazioni veloci sulle email che arrivano. Io su gmail ho impostato tra le azioni veloci quella di cancellare una email. (Spesso mi arrivano email che neanche leggo).<br />
Su Inbox questa opzione non è presente, quindi per cancellare le email le devo aprire e poi premere il tasto di cancellazione (ma ci sara ?)<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Andiamo a vedere cosa succede quando apro l'email da uno dei due client di posta.<br />
<br />
Mettiamo a confronto la stessa email come viene vista dai due client di posta (il testo ovviamente è oscurato)<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-w17ybSjWYktKeOaGfVLSemJeUw11nshxHYD0XmcvqReQ1EKvLWKxgG6DFc-gWe-LDqYx33ydWOMBNVTu2xUf-D4yxGJzKcGkn9uUyzzKZguatso7PezmtYtO8JnQv8MVDO5tPhQOdew8/s1600/Screenshot_2014-11-06-09-33-08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-w17ybSjWYktKeOaGfVLSemJeUw11nshxHYD0XmcvqReQ1EKvLWKxgG6DFc-gWe-LDqYx33ydWOMBNVTu2xUf-D4yxGJzKcGkn9uUyzzKZguatso7PezmtYtO8JnQv8MVDO5tPhQOdew8/s1600/Screenshot_2014-11-06-09-33-08.png" height="320" width="180" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSGQyDXh8w5VfoP2fvBn-YMXaCRUtadG14KESzWKX9m8G-UlBrgVFnFHHSV1BOsaw4cWQfpLVnrTb2fBbZlqNsIbXP-W5Vr-p9UhAznBIytN8apNa1IRRSLTbAZC4I2B1OxuOOj_Vp-bR7/s1600/Screenshot_2014-11-06-09-32-52.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSGQyDXh8w5VfoP2fvBn-YMXaCRUtadG14KESzWKX9m8G-UlBrgVFnFHHSV1BOsaw4cWQfpLVnrTb2fBbZlqNsIbXP-W5Vr-p9UhAznBIytN8apNa1IRRSLTbAZC4I2B1OxuOOj_Vp-bR7/s1600/Screenshot_2014-11-06-09-32-52.png" height="320" width="180" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
A sinistra abbiamo GMail, mentre a destra abbiamo Inbox, osserviamo che:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
1) Il look delle due applicazioni è praticamente lo stesso (si vede anche nell'elenco delle email)</div>
<div class="separator" style="clear: both; text-align: left;">
2) Su GMail ci sono i pulsanti per Archivia, cancella, segna da leggere, ... </div>
<div class="separator" style="clear: both; text-align: left;">
3) Su Inbox ci sono i pulsanti per Appunta, posticipa?, Disattivare la conversazione, ... più un pulsante di risposta rapida in stile material design</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In entrambi c'è un menu a livello del mittente. Il menu contestuale di Inbox aggiunge le voci "Rispondi, Inoltra" (perchè il pulsante rispondi a tutti è in bella mostra in basso</div>
<div class="separator" style="clear: both; text-align: left;">
mentre in gMail ci sono le voci "Rispondi a tutti, Inoltra, Aggiungi a speciali, stampa" (la voce inoltre è di default con un pulsante accanto)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Riepilogando le voci sembrano esserci tutte, in entrambi i casi per rispondere basta premere un pulsante, si tratta di dare più o meno enfasi all'azione</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Quello che manca in InBox è il pulsante di cancellazione (la mia azione principale quando ricevo una email), per cancellare la email devo aprirla, selezionare il menù in alto e scegliere cancella. Un po' macchinoso se è una operazione che ho scelto come principale dato che la faccio più volte al giorno e spesso anche dall'orologio (android wear), cosa che con Inbox non posso fare dato che non è presente come azione.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Inoltre su Gmail ci sono (ancora) più opzioni</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Ma in fondo cambia la filosofia di utilizzo</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In gmail le mail si cancellano o archiviano (poi si va nelle mail archiviate e si recuperano o cancellano)</div>
<div class="separator" style="clear: both; text-align: left;">
In Inbox le email si "Contrassegnano come completate" e vanno a finire in una cartella apposita chiamata appunto "Completati".</div>
<div class="separator" style="clear: both; text-align: left;">
In realtà fanno la stessa cosa perché se completo una mail da Inbox e poi vado su gmail web la trovo tra le archiviate, quindi la funzione è la stessa solo che InBox consente di archiviare (scusate: completare) più mail contemporaneamente anche (e soprattutto) se raggruppate sotto la stessa categoria.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Ah, le categorie sono le stesse cose dei tag di gmail, sono che sono prefissate anche se ne possono aggiungere altre e sono più o meno quelle che si vedono come tab (per chi li ha abilitati) su gmail web e sono: Viaggi, Acquisti, Finanze, Social, Aggiornamenti, Forum, Promozioni.</div>
<div class="separator" style="clear: both; text-align: left;">
Al momento non ri-trovo la separazione a tag che avevo associato su gmail </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
NEWS: Mentre facevo delle prove con l'applicazione InBox per scrivere l'articolo, l'applicazione si anche bloccata e chiusa. Segno che c'è ancora da lavorare.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Beh, Inbox è all'inizio, mentre GMail vanta anni di esperienza.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Dobbiamo aspettare e capire se i due prodotti si affiancheranno o si integreranno.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-28270457910222130792014-11-05T05:19:00.001-08:002014-11-05T05:19:45.407-08:00Update : Clock & Calendar Widget +<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3P1HtAQQjKYOYa-y9tyCepu2m5UrKiSZX7-vySVWAF4Bt-nD0BnTnZt9zY8nVaivKZbky2V6cTTnB7o2OF-Jxw0JZx_MFr92W4ekD_AwBNdrZxKfebXl-0kOcZeHXm-uLww-BrS92XruW/s1600/2x-om5j3kndpc3j6876epr107fbr0.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3P1HtAQQjKYOYa-y9tyCepu2m5UrKiSZX7-vySVWAF4Bt-nD0BnTnZt9zY8nVaivKZbky2V6cTTnB7o2OF-Jxw0JZx_MFr92W4ekD_AwBNdrZxKfebXl-0kOcZeHXm-uLww-BrS92XruW/s1600/2x-om5j3kndpc3j6876epr107fbr0.png" /></a></div>
<h2>
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Clock & Calendar widget + - </b><b>Build n.31</b></span></h2>
<span style="font-family: Arial, Helvetica, sans-serif;">A new updated of widget is available on <a href="https://play.google.com/store/apps/details?id=it.frusso.clockcalendarplus">play store</a></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are more fix int this version</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Added option to select the location provider to use in weather settings</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">A better integration with the error reporter service (<a href="http://www.appbugtracker.com/">AppBugTracker</a>)</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Option to select which provider use to determiante the current location for weather info</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Fixed error related to themes when sdcard is not available</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Fixed bug when calendar events is not longer available (on samsung devices)</span></li>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: red; font-family: Arial, Helvetica, sans-serif;"><b>Important</b>:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are also few problems on samsung devices reported by some users. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">In same cases the widget looks as freezed, the clock and the toolbar don't works as expected.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">In this case (also other clocks widget have the same behaviour) check if your launcher has reported similar issues or you have some task killer too aggressive.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Screenshot</span>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLMBsIB3QHAH1jBCZ2SEg6B-FajK51JYHx5iM3tpnPC7Ya2DyX1bA7r_GCVcW5YrzSiHpqEeppNu8BSg3MAYNwap_m6z6_T3Ou8bTDPJCxBCQqcB1OU1yHt2vAuSEAq6OgDfhA8uzhKRTr/s1600/Samsung-Galaxy-Nexus.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLMBsIB3QHAH1jBCZ2SEg6B-FajK51JYHx5iM3tpnPC7Ya2DyX1bA7r_GCVcW5YrzSiHpqEeppNu8BSg3MAYNwap_m6z6_T3Ou8bTDPJCxBCQqcB1OU1yHt2vAuSEAq6OgDfhA8uzhKRTr/s1600/Samsung-Galaxy-Nexus.png" height="400" width="198" /></a></div>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-80813218503895948502014-09-25T13:20:00.000-07:002014-09-25T13:20:50.691-07:00MyPlaces - Memorizza i miei luoghi preferiti<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI7EnzZZiyGsTHvKYuwxZxuivoi7lZoR2_V2s5KtfSiS02MnKUTAi4uVXbGbzfUAGEDbONY4lhuSmIXJ-s7l9fFlRwBmSvgiv94mluqOWPpWSAOKBVTAm8s0wJCoX-U6JkVb5d8X55B8qA/s1600/ic_launcher.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiI7EnzZZiyGsTHvKYuwxZxuivoi7lZoR2_V2s5KtfSiS02MnKUTAi4uVXbGbzfUAGEDbONY4lhuSmIXJ-s7l9fFlRwBmSvgiv94mluqOWPpWSAOKBVTAm8s0wJCoX-U6JkVb5d8X55B8qA/s1600/ic_launcher.png" /></a></div>
MyPlaces è un'applicazione android che consente di recuperare la propria posizione utilizzando il GPS e le informazioni della rete (cella GPS o WiFi) e di recuperarne l'indirizzo.<br />
Una volta ottenuta la posizione è possibile salvarla e condividerla con chi si vuole.<br />
E' ovviamente possibile condividere anche condividere posizioni salvate in precedenza (ad esempio se volete inviare ad un amico la posizione del vostro pub preferito) o aprire google Maps per farvi portare in quella luogo.<br />
<br />
MyPlace è anche un esperimento di utilizzo del nuovo look & feel Material Design presentato da Google all' I/O 2014.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6MsUY_o7Zp1R2NcZbJOSgsx_wfvK0nunc4TPxCf7jUu48d_XjL-8MtP-KABmGvpmMBmfMdiA1tBDgeArKYiUJQademMVY74BuFFEnn_OclxIjZWaZq1BLDe8sHBLssVoIjL1ouJn3DdRs/s1600/myPlaces_screenshots.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6MsUY_o7Zp1R2NcZbJOSgsx_wfvK0nunc4TPxCf7jUu48d_XjL-8MtP-KABmGvpmMBmfMdiA1tBDgeArKYiUJQademMVY74BuFFEnn_OclxIjZWaZq1BLDe8sHBLssVoIjL1ouJn3DdRs/s1600/myPlaces_screenshots.png" height="200" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
Link al Play Store : <a href="https://play.google.com/store/apps/details?id=it.frusso.myplaces">My Places</a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-10873937239996339412014-07-20T13:31:00.000-07:002014-09-25T13:33:58.992-07:00Simple project for Android Watch Face<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0vZfu9QA8LQJwLhp8ttXLIt5Jx9XzNnS27NfAMF4ZMmrgYVEqgZaDp5wZuQ7d1Dx-UKwwwb400vrx7xdVREzyQIbtsm0UoktLsbZpo-9tOFgsetnpnVaUF-FXf_jCsgGl4919v2LUjDSm/s1600/screenshot1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0vZfu9QA8LQJwLhp8ttXLIt5Jx9XzNnS27NfAMF4ZMmrgYVEqgZaDp5wZuQ7d1Dx-UKwwwb400vrx7xdVREzyQIbtsm0UoktLsbZpo-9tOFgsetnpnVaUF-FXf_jCsgGl4919v2LUjDSm/s1600/screenshot1.png" height="180" width="200" /></a></div>
<br />
On <a href="https://github.com/jfabrix101/SquareWatchFace">github</a> i have released a basic template to develop a watch faces for android wear.<br />
To use it you will need the Android Studio and the Android 4.4W sdk. Latest version of ADT for eclipse don't support the wearable development<br />
<br />
<i>Note: Until now the official API to develop Android Wear Watch Faces aren't been released, so this is a workaroud.</i><br />
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-69469268282966297232014-07-20T07:37:00.001-07:002014-07-20T07:37:55.213-07:00Radar Custom ViewRilasciata su <a href="https://github.com/jfabrix101/RadarCustomVIew">github</a> una custom view android per la visualizzazione di un radar<br />
<br />
La custom view espone due metodi per attivare o disattivare l'animazione. L'effetto animazione ha anche una scia che simula l'effetto di trascinamento tipico dei fosfori verdi dei radar.<br />
<br />
<br />
<a name='more'></a><br /><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQc_IegtpJkeHstO0V5flrT-ggNndCUdHWKmKKAKLic9N_BMXWkU5wwfHsQdO99y4EygTCk0BlTsFns4IROPxpA7-_X-p0LhXaznowGj1z8Qlyf8nHzWXLw0CEs4HrFWucsg1tn6x8MLP/s1600/Screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQc_IegtpJkeHstO0V5flrT-ggNndCUdHWKmKKAKLic9N_BMXWkU5wwfHsQdO99y4EygTCk0BlTsFns4IROPxpA7-_X-p0LhXaznowGj1z8Qlyf8nHzWXLw0CEs4HrFWucsg1tn6x8MLP/s1600/Screenshot.png" height="320" width="180" /></a></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-29060822886269971682013-11-29T11:14:00.001-08:002013-11-29T11:24:22.860-08:00Creazione di una device folder per AOSP<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwKVBKzp2CmAwyktEBayjOQGpeUI5tRrRZKOGz3Goo1rkccGXjP5pDPNcIy4vRVfTwSf_98RHjT1yxUL-zERBzll7UnppboKmwGU_EWLl9Wiypa0T1K_tQi6ciH_2qqrNa4vbMoMU04Y8P/s1600/androids.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwKVBKzp2CmAwyktEBayjOQGpeUI5tRrRZKOGz3Goo1rkccGXjP5pDPNcIy4vRVfTwSf_98RHjT1yxUL-zERBzll7UnppboKmwGU_EWLl9Wiypa0T1K_tQi6ciH_2qqrNa4vbMoMU04Y8P/s1600/androids.gif" /></a></div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; text-align: justify; white-space: pre-wrap;">In questo post cercherò di illustrare i passi necessari alla creazione di una struttura di directory e dei file di configurazione per la compilazione di una rom AOSP. </span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; text-align: justify; white-space: pre-wrap;">La struttura è generica e va bene per qualsiasi dispositivo, ma per portare un caso concreto userò come riferimento i file necessari per la compilazione di una rom per lo zopo ZP990 con processore MTK6589T</span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; text-align: justify; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; text-align: justify; white-space: pre-wrap;"></span><br />
<a name='more'></a><br />
<span style="font-family: Arial; font-size: 15px; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Prerequisito</span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">: Si parte dal presupposto che siano stati scaricati i sorgenti AOSP e che si abbia tutto l’ambiente necessario alla build di una rom android. Per info su come scaricare i sorgenti e creare l'ambiente rimando al link ufficiale di android. <a href="http://source.android.com/source/building.html">Android source - Download and Building</a></span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">I passi da seguire sono:</span><br />
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<ol style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Creazione della struttura delle cartelle</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Creazione e configurazione dei file di build (makefile)</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: decimal; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Aggiunta delle direttiva di compilazione per </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">envsetup</span></div>
</li>
</ol>
<br />
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Trovate la struttura qui descritta su github al link</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<a href="https://github.com/jfabrix101/aosp_device_zopo_zp990">https://github.com/jfabrix101/aosp_device_zopo_zp990</a></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<h2>
<span style="background-color: transparent; font-size: 21px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="color: #274e13; font-family: Verdana, sans-serif;">Struttura delle cartelle</span></span></h2>
<span style="font-family: Arial; font-size: 15px; font-weight: normal; line-height: 1.15; white-space: pre-wrap;">Per prima cosa è necessario creare una cartella all’interno della distribuzione AOSP (che in seguito chiamerò <android_src>) che rappresenta il nostro device.</span><br />
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Per fare questo è necessario creare il path </span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><android_src> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/ device / </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><device_brand> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">/ </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><device_name></span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dove:</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b>android_src</b></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">> E’ la cartella dove è stato scaricata la distribuzione AOSP</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b>device_brand</b></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">> E’ il costruttore del vostro device (samsung, lg, google, zopo, …)</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b>device_name</b></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">> E’ il nome del device</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">quindi nel caso do uno ZOPO ZP990, la cartella potrà essere</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><android_src> / device / zopo / zp990</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<br /></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Successivamente è bene creare, all'interno della stessa cartella anche le cartelle</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">overlay</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - cartella per l'overlay delle risorse (vedi dopo)</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">packages</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - cartella con i pacchetti da compilare (nel caso di apk da aggiungere di cui si abbiano i sorgenti)</span></div>
</li>
<li dir="ltr" style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">prebuilds</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - cartella con i files da aggiungere alla distribuzione per i quali non si hanno a disposizione i sorgenti (apk o librerie di terze parti o proprietarie del device)</span></div>
</li>
</ul>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; font-family: Arial; font-size: 15px; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b><i><span style="color: red;">Note</span></i></b></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">: La cartella overlay serve a sostituire in fase di compilazone, delle risorse custom (immagini, xml, ecc ecc) a quelle presenti nella distribuzione ufficiale. Questo per evitare di dover fare n copie delle applicazioni solo per qualche definizione in fase di compilazione per device diversi. </span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ovviamente tutte e tre queste cartelle possono anche rimanere vuote nel caso non si vogliano aggiungere o modificare parti del sistema.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<h2 dir="ltr" style="line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;">
<span style="background-color: transparent; font-size: 21px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="color: #274e13; font-family: Verdana, sans-serif;">Creazione e configurazione dei makefile</span></span></h2>
<div>
<br /></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A questo punto, all'interno della cartella device è necessario creare alcuni files di compilazione (make files). Procedendo per ordine, dobbiamo creare:</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<h4 dir="ltr" style="line-height: 1.15; margin-bottom: 2pt; margin-top: 12pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Android.mk</span></h4>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Questo è il file di compilazione (estensione .mk) di default di Android ed è il file che viene chiamato dal processo di build quando si deve compilare una qualsiasi unità di compilazione sia esso una apk (tipo la posta o il launcher) che una una intera rom.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Al suo interno ci si trova una semplice definizione, che dice di lanciare tutti i file di compilazione (escluso se stesso ovviamente) che si trovano all'interno della directory. Il suo contenuto, a meno dei commenti e dei discaimer delle licenze è semplicemente:</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">LOCAL_PATH := $(call my-dir)</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">include $(call all-makefiles-under,$(LOCAL_PATH))</span></div>
</td></tr>
</tbody></table>
</div>
<span style="font-family: Arial; font-size: 15px; font-weight: bold; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; font-weight: bold; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; font-weight: bold; line-height: 1.15; white-space: pre-wrap;">AndroidProduct.mk</span><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Anche questo contiene una semplice definzione, indica qual'è il file di compilazione principale che deve essere eseguito per compilare il prodotto (di nuovo potrebbe trattarsi di un apk o di una intera rom).</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Il suo contenuto è semplicemente:</span></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_MAKEFILES := \<br class="kix-line-break" /> $(LOCAL_DIR)/full_zp990.mk</span></div>
</td></tr>
</tbody></table>
</div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">dove ovviamente "full_zp990.mk" è il build file che ci interessa !!!</span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<br />
<h2 dir="ltr" style="line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">BoardConfig.mk</span></h2>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Questo file di compilazione contiene le definizioni delle vriabili necessarie alla build. Tutte le variabili vengono definite in maniera generica dallo script di build principale, ma attraverso questo file è possibile ridefinire alcuni valori specifi per la nostra rom.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Il suo contenuto, generalmente è il seguente:</span></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">TARGET_ARCH := arm<br class="kix-line-break" />TARGET_ARCH_VARIANT=armv7-a-neon<br class="kix-line-break" /><br class="kix-line-break" />TARGET_NO_KERNEL := true<br class="kix-line-break" />TARGET_NO_BOOTLOADER := true<br class="kix-line-break" />TARGET_CPU_ABI := armeabi<br class="kix-line-break" />TARGET_CPU_VARIANT := cortex-a7</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">BOARD_USES_GENERIC_AUDIO := true<br class="kix-line-break" />USE_CAMERA_STUB := true</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dove i primi due parametri (TARGET_ARCH e TARGET_ARCH_VARIANT) indicano il tipo di processore e di architettura.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Gli altri due parametri (TARGET_NO_KERNEL a TARGET_NO_BOOTLOADER) inpostati a true stanno ad indicare che nel pacchetto finale NON devono essere inclusi il kernel ed il bootloader. (In questo caso è necessario perchè non essendo disponibili i sorgenti del kernel MTK, non possiamo procedere alla compilazione).</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I parametri TARGET_CPU_* servono ad indicare il tipo di cpu generica ed il tipo di variante (si potrebbe pensare alla famiglia di cpu e al tipo di processore)</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Da qui in poi possono essere sovrascritti tutti una serie di parametri per fare l'override dei parametri di build. Nell'esempio ce ne sono due che servono ad utilizzare driver generici per l'audio e uno stub della fotocamera</span></div>
<br />
<h2>
<span style="font-family: Arial; font-size: 15px; font-weight: bold; line-height: 1.15; white-space: pre-wrap;">full_<device_nam>.mk (full_zp990.mk)</span></h2>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Questo è il file principale per la compilazione della rom. Il suo nome dovrebbe essere uguale a quello della cartella (quindi <device_name> e sicuramente uguale a quanto indicato nel file AndroidProduct.mk</span></div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Il suo contenuto è il seguente:</span><br />
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># The gps config appropriate for this device</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$(call inherit-product, device/common/gps/gps_eu.mk)</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># full-languages (>= Android 4.2)</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$(call inherit-product, $(SRC_TARGET_DIR)/product/full.mk)</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># Inherit non-open-source blobs.</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">$(call inherit-product-if-exists, $(LOCAL_PATH)/vendor.mk)</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">DEVICE_PACKAGE_OVERLAYS := $(LOCAL_PATH)/overlay</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_PACKAGES +=</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_COPY_FILES := \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#PRODUCT_COPY_FILES += \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># $(LOCAL_PATH)/vold.fstab:system/etc/vold.fstab \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># $(LOCAL_PATH)/init.vsnet:system/bin/init.vsnet \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># $(LOCAL_PATH)/init.vsnet-down:system/bin/init.vsnet-down \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># $(LOCAL_PATH)/gps_brcm_conf.xml:system/etc/gps_brcm_conf.xml</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">#PRODUCT_COPY_FILES += \</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"># $(LOCAL_PATH)/prebuilt/wireless.ko:system/lib/modules/wireless.ko</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_NAME := full_zp990</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_DEVICE := zp990</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_BRAND := Android</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">PRODUCT_MODEL := Full Android on ZP990</span></div>
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></td></tr>
</tbody></table>
</div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Le prime tre direttive indicano di includere nella compilazione anche altre compilazione esterne quali ad esempio la configurazione del GPS per la zona europea, il file del linguaggio che da android 4.2 è diverso e contiene tutte le definizioni, e anche, nel caso ci fosse, la cartella vendor con risorse tipiche del device.</span><br />
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">La prima vera direttiva importante è quella relativa alla variabile DEVICE_PACKAGE_OVERLAYS che consente di specificare una directory che rappresenta la base per l’overlay delle risorse. Come detto in precedenza questa cartella è rappresentata dalla cartella overlay. Notare l’operatore di assegnazione della variabile ( := ) che sta ad indicare che questa variabile assume il valore indicato qui anche se eventualmente prima era stata già definita.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Successivamente troviamo la definizione della vriabile PRODUCT_PACKAGES che consente di specificare la (eventuale) cartella con i pacchetti da includere della distribuzione. Notare il valore di assegnazione della variabile ( += ) che sta ad indicare che in realtà questa variabile è stata già definita e qui andiamo (eventualmente) ad aggiungere altre definizioni.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ora è la volta della variabile PRODUCT_COPY_FILES che indica una serie di files da aggiungere alla distribuzione finale, indicando sia il path di origine che il path di destinazione all’interno del nostro pacchetto finale (la rom).</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ogni coppia sorgente/destinazione è separto da un carattere di due punti ( : ) e ogni coppia e separato da uno spazio (o da un a capo attraverso il carattere \ )</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Nell’esempio ce ne sono diversi esempi di definizioni commentate, infatti sempre attraverso l’operatore di assegnazone += possiamo aggiungere tutte le definizioni che vogliamo</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">La variabile PRODUCT_NAME indica il nome finale del prodotto (rom)</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">La variabile PRODUCT_DEVICE rappresenta il nome del device. Questo deve essere uguale a <</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">device_name</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">> perchè il sistema di build utilizza questa variabile per individuare il file /device/<BRAND>/<PRODUCT_DEVICE>/BoardConfig.mk.</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Normalmente quindi rappresenta il nome della cartella all’interno della quale si trova (in questo caso zp990)</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">La variabile PRODUCT_BRAND è relativamente nuova e serve a definire la tipologia di prodotto che si va a compilare. Di default ed a partire dalla versione 4.2 questo variabile assume il valore di “Android”.</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Il valore di questa variabile sarà presente all’interno del file build.prop sotto la voce “ro.product.brand”</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Infine questo valore (Android) viene utilizzato in fase di build per scegliere internamente cosa aggiungere alla compilazione finale. Quindi lasciatelo sempre uguale ad Android !!!. </span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">L’ultima variabile, PRODUCT_MODEL è il nome delladistribuzione. Questo valore viene visualizzato attraverso l’applicazione “Impostazioni” sotto la voce “About”.</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">E’ anche presente nel file Build.prop sotto la voce “ro.product.model”</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Per intenderci, è il valore tanto caro ai modder che cercano sempre di modificarlo inserendo il loro nome !!!.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<h2 dir="ltr" style="line-height: 1.15; margin-bottom: 4pt; margin-top: 18pt;">
<span style="background-color: transparent; font-size: 21px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="color: #274e13; font-family: Verdana, sans-serif;">Direttiva di compilazione (vendorsetup.sh)</span></span></h2>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Abbiamo quasi finito, dobbiamo solo dire alla distribuzione AOSP di compilare la nostra rom.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ricordiamo che per fare questo dobbiamo andare nella cartella AOSP (chiamata qui <android_src>) e dare il comando</span></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. build/envsetup</span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">lunch</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ma per dire alla distribuzione di includere anche il nostro device dobbiamo informare lo script “envsetup.sh” che esistiamo anche noi.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Siccome lo script non fa altro che ricorsivamente cercare in tutte le cartelle device/** un file che si chiama </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">vendorsetup.sh</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, dobbiamo crearne anche noi uno in cui registriamo il nostro device.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dobbiamo quindi creare un file </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">vendorsetup.sh</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> e dargli i permessi di esecuzione al cui interno dobbiamo mettere il seguente contenuto:</span></div>
<b style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr">
<table style="border-collapse: collapse; border: none; width: 624px;"><colgroup><col width="*"></col></colgroup><tbody>
<tr style="height: 0px;"><td style="border: 1px solid #000000; padding: 7px 7px 7px 7px; vertical-align: top;"><div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">add_lunch_combo full_zp990-userdebug</span></div>
</td></tr>
</tbody></table>
</div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">che significa di aggiungere al comando lunch anche il nostro file (full-zp990.mk) in modalità userdebug.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Esistono tre modalità di compilazione, ma la modalità userdebug aggiunge i permessi di root e abilita i livelli di debug (ADB) fondamentali per verificare che tutto funzioni. </span></div>
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In produzione (cioè quando si è sicuri che lar rom sia perfetta) si dovrebbe usare la modalità “eng”. Ma vi assicuro che che quasi tutte hanno la modalità userdebug, anche quelle ufficiali.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Finito.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lanciate la vostra compilazione ed al termine avrete nella cartella</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1; margin-bottom: 0pt; margin-top: 0pt; text-align: center;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><android_src> / out / target / product</span></div>
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">la vostra cartella <device_name> con all’interno i file delle rom (system.img)</span>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-3012255622254146640.post-67870111492117690802013-09-21T01:13:00.001-07:002013-09-21T01:13:58.934-07:00GIT - Sincronizzare un fork dal repository iniziale<br />
Spesso, una volta effettuato il fork di un progetto di interesse, si pone il problema di recuperare aggiornare il nostro fork con le modifiche effettuate sul repository di partenza (chiamato nel seguito upstream).<br />
Ecco di seguito alcuni passi per effettuare il merge del nosto repository con il repository upstream.<br />
<br />
<a name='more'></a>Una volta crato un fork di un progetto e scaricato in locle, dando il comando<br />
<br />
<pre class="shellcode">$ git branch
</pre>
<br />
comparirà il branch master che è la copia locale con la quale si sta lavorando. Dando il comando<br />
<br />
<pre class="shellcode">$ git remote
</pre>
<br />
comparirà "origin" che è il repository sul server legato alla copia locale.<br />
<br />
Per recuperare gli aggiornamenti effettuati sul repository di partenza (upstream), è necessario aggiungere un nuovo repository remoto ed indicare che si vuole tenere aggiornato il respository master. Il comando da dare è:<br />
<br />
<pre class="shellcode">$ git remote add --track master upstream git://xxx_link_repository_forkato.git
</pre>
<br />
dove <i>xxx_link_repository_forkato</i> è il link git al quale il repository upstream fa riferimento<br />
<br />
verificare con il comando "git remote" che il repository è stato aggunto<br />
<br />
A questo punto, ed ogni volta che sivorrà effettuare una sincronizzazione, bisogna recuperare tutte le modifiche dal branch originario (upstream)<br />
<br />
<pre class="shellcode">$ git fetch upstream
</pre>
<br />
Questo aggiungerà (od aggiornerà) un nuovo branch remoto (chimanto upstream/master) dal quale si potrà procedere con la sincronizzazione.<br />
<br />
Il comando<br />
<br />
<pre class="shellcode">$ git merge upstream/master
</pre>
<br />
effettuerà l'aggiornamento sul nostro master delle novità presenti sul repository originario.<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-38675826057845970012013-07-03T02:22:00.001-07:002013-07-03T13:33:51.621-07:00Root ZOPO ZP950+ v.16 GB<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlQT-XdKQUrKdQgdi61lm0UzBch8B2-DE4014uvg4pvsljHUYtW79YZbdaBdTN962SEYbIGJ8QDNHFOVBoKWlQuVASjYBEvENiOIstxvRMJMJFqRjRnKacEgOi50EE8FRI_W9swajOy_Go/s48/1372816462_gksu-root-terminal.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlQT-XdKQUrKdQgdi61lm0UzBch8B2-DE4014uvg4pvsljHUYtW79YZbdaBdTN962SEYbIGJ8QDNHFOVBoKWlQuVASjYBEvENiOIstxvRMJMJFqRjRnKacEgOi50EE8FRI_W9swajOy_Go/s48/1372816462_gksu-root-terminal.png" /></a></div>
Procedura per effettuare il root dello smartphone ZP950+ ver. 16GB basato su processore MTK6589T.<br />
<br />
<a href="http://fabrizio-russo.blogspot.it/p/root-zopo-zp950-ver-16-gb.html">Link</a><br />
<br />
per la guida all'installazione della recovery: <a href="http://fabrizio-russo.blogspot.it/p/cwm-zopo-zp950-16gb.html">Link</a>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-70969279856046526902013-06-12T07:05:00.001-07:002013-06-12T07:06:32.032-07:00Collegare ADB attraverso Bluetooth Per ragioni di sviluppo devo spesso collegare il dispositivo al pc in modo da poter pubblicare le applicazioni o andare in shell remota.<br />
Per fare questo è necessario sempre collegare il cavo, ma c'è anche la possibilità di poter effettuare il collegamento tramite bluetooth in modo da lasicare pc e telefono scollegati. Il collegamento è più lento ma in alcuni casi è più comodo.<br />
<br />
<b>Nota</b>: <i>Nella guida ho usato Ubunto 13.04 ed il GalaxyNexus 4.2.2 (CM 10.1) , la cosa dovrebbe essere simile anche per Windows e per altri dispositivi.</i><br />
<br />
I passi da seguire sono:<br />
<br />
<ol>
<li>Abilitare il bluetooth sul proprio disposivo e pc</li>
<li>Accoppiare i dispositivi</li>
<li>Stabile un collegamento tra il pc ed il device via Bluetooth PAN (Personal Area Network)</li>
<li>Abilitare ADB over Network tra le opzioni sviluppatore</li>
<li>Collegare il pc tramite ADB connect xxx.xxx.xxx.xxx</li>
</ol>
<br />
<a name='more'></a><br /><br />
<h3>
Passo 1 - Abilitare il bluetooth sul proprio disposivo e pc</h3>
Questo è sicuramente il passo più semplice e non ha bisogno di commenti<br />
<br />
<br />
<h3>
Passo 2 - Accoppiare i dispositivi</h3>
<h3>
</h3>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Sul telefono andare in Settings --> Bluetooth e rendere il disposivo rilevabile<br />
<br />
Da ubuntu accedere all'applet bluetooth (digitare bluetooth nella dashboard). Apparirà il pannello per aggiungere le connessioni bluetooth.<br />
Premere + per cercare un nuovo dispositivo<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNUJu3SVl_KM4TxBp1Or_aJF-CDTv7WgHRhati49LBu-z7REvslJbDEUhoUpRuoFBfRXv9aaKRCX08j_XjfVguphmrQchVkvmifIdyzuOybnxj24wW5vhk6NOkudiWbGcFjChyphenhyphen0OdlKTYi/s1600/ubuntu1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="158" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNUJu3SVl_KM4TxBp1Or_aJF-CDTv7WgHRhati49LBu-z7REvslJbDEUhoUpRuoFBfRXv9aaKRCX08j_XjfVguphmrQchVkvmifIdyzuOybnxj24wW5vhk6NOkudiWbGcFjChyphenhyphen0OdlKTYi/s320/ubuntu1.png" width="320" /></a></div>
<br />
<br />
Verranno individuati diversi dipositivi, quando compare il nostro telefono premere Continue<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2IfS5SldyGWY9xelZoZmYczHOGR5cxXnBPKFaM_qVH4_cFaQVybat41Fae8yPocwJqh_SpiiMTnVsu3fNbsrQggwMEUEa6if3Gr5Fe5AbSC2tdqOyJFQHS30gqqGakxIV_eXJj_zEEmlQ/s1600/ubuntu2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2IfS5SldyGWY9xelZoZmYczHOGR5cxXnBPKFaM_qVH4_cFaQVybat41Fae8yPocwJqh_SpiiMTnVsu3fNbsrQggwMEUEa6if3Gr5Fe5AbSC2tdqOyJFQHS30gqqGakxIV_eXJj_zEEmlQ/s320/ubuntu2.png" width="320" /></a></div>
<br />
<br />
Comparirà il codice di accoppiamento tra device e sul telefono una conferma. <br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc45F6Wg9g0bvL4DoptR6VTz71CswSWGcfQ3YI03glnQGmTqsPkR3cs1Ki2I5ymSuB01l4zvZiF0AMr4R76evvHnghgySjRFoYSLn83pG44OHcZOUPwAqWhhZy5ArRqb3CKlcpLdxwOJVR/s1600/ubuntu3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc45F6Wg9g0bvL4DoptR6VTz71CswSWGcfQ3YI03glnQGmTqsPkR3cs1Ki2I5ymSuB01l4zvZiF0AMr4R76evvHnghgySjRFoYSLn83pG44OHcZOUPwAqWhhZy5ArRqb3CKlcpLdxwOJVR/s320/ubuntu3.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
Dal telefono confermare e passare al punto successivo<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKij7WhPbx7QiRrdwhf_qe9R4ai_MdkPVneUvQPli0vlHifRd05FzjrF-BlRcQqVq0sJFx4HymX15Z4VO2TBcH1O_aMS3qY5ZOE3pY_qg4l1lsNdZjHJsWMVHT4k0vLhhBvIuS_AMMwTJr/s1600/ubuntu4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKij7WhPbx7QiRrdwhf_qe9R4ai_MdkPVneUvQPli0vlHifRd05FzjrF-BlRcQqVq0sJFx4HymX15Z4VO2TBcH1O_aMS3qY5ZOE3pY_qg4l1lsNdZjHJsWMVHT4k0vLhhBvIuS_AMMwTJr/s320/ubuntu4.png" width="320" /></a></div>
<br />
Qui selezionare anche l'opzione che ci consente anche di attivare un PAN tra il pc ed il telefono<br />
<br />
<br />
<br />
<h3>
Passo 4 - Abilitare ADB over Network tra le opzioni sviluppatore</h3>
Andare in Settings --> Opzioni sviluppatore e selezionare l'opzione "ADB over network", comparirà un messaggio di avvertimento in merito alla sicurezza, ma continuare.<br />
Terminata l'operazione sarà visibile il nome assegnato assegnato al dispositivo. (Nel nome c'è anche l'indirizzo IP assegnato)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCvPepYUN2W1yw3uECup_DQHXKbgMhPSfongdOBIhPKmXrmxRhn4jo3JlCYBQQ0qprnBGwerTYO3vcMeam25x-sAeCJeDLw2P52inUqInn_R3GvdrN_JrHGR8mI22jD-D8jjxIqtbkphWI/s1600/settings1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCvPepYUN2W1yw3uECup_DQHXKbgMhPSfongdOBIhPKmXrmxRhn4jo3JlCYBQQ0qprnBGwerTYO3vcMeam25x-sAeCJeDLw2P52inUqInn_R3GvdrN_JrHGR8mI22jD-D8jjxIqtbkphWI/s320/settings1.png" width="180" /></a></div>
<br />
<br />
<br />
<h3>
Passo 5 - Collegare il pc tramite ADB connect xxx.xxx.xxx.xxx</h3>
Aprire una shell linux e digitare il comando<br />
<br />
<pre class="shellcode"><code>
$ adb connect 192.168.133.223
</code></pre>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
ADB si collegherà al telefono<br />
<br />
Digitando il comando "adb device" verranno mostrati i device connessi<br />
<pre class="shellcode"><code> $ adb devices
List of devices attached
emulator-5554& device
192.168.133.223:5555 device
</code></pre>
<br />
(io ho anche un emulatore in esecuzione al momento del comando)<br />
<br />
Per testare il collegamento usare il comando<br />
<br />
<pre class="shellcode"><code>
$ adb shell 192.168.133.223:5555
</code></pre>
<br />
(In questo caso dovete indicare anche il numero della porta perchè fa parte del nome che il PAN ha associato al device).<br />
<br />
Da eclipse, ora è possiible eseguire il lancio delle applicazioni<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYp3i3TZmDsqIPvsoUaOhB3x1lb_bIQziwnU6cVtX3ldU4FZIGlA6r81dfqVUPt3x0cav9hKF6EdMHAMFPYsO35rmfihf9Qk0fRpfK7DAxRYV23K7hJQlkEZq_SP382OOZmIdAkpJgfrG0/s1600/eclipse1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="285" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYp3i3TZmDsqIPvsoUaOhB3x1lb_bIQziwnU6cVtX3ldU4FZIGlA6r81dfqVUPt3x0cav9hKF6EdMHAMFPYsO35rmfihf9Qk0fRpfK7DAxRYV23K7hJQlkEZq_SP382OOZmIdAkpJgfrG0/s320/eclipse1.png" width="320" /></a></div>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-25937669526446691042013-05-09T07:18:00.000-07:002013-05-09T07:18:01.993-07:00Linux - Installare il JDK Oracle su ubuntu<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" /></a></div>
Come si sa, le versioni di ubuntu escono senza il JDK di Oracle ed ogni volta è necessario cercare un PPA per poter installare il JDK.<br />
<br />
Con questo procedimento, non sarà più necessario, basterà scaricare il JDK per linux direttamente dal sito della Oracle (la versione in cui scrivo è la 1.7.0_21, scaricabile da qui <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">download JDK 1.7.0_21</a>).<br />
<br />
<br />
<a name='more'></a><br /><br />
Per ubuntu non è presente il file di installazione .deb, a questo punto dobbiamo scaricare la distribuzione .tar.gz (file jdk-7u21-linux-i586.tar.gz). Scaricate la versione a 32 o a 64 bit in base al vostro sistema.<br />
<br />
Vediamo quali sono i passi da seguire:<br />
<br />
1) Decomprimere il pacchetto<br />
<pre class="shellcode"><code>
tar xvf jdk-7u21-linux-i586.tar.gz
</code></pre>
<br />
2) Creare la cartella che conterrà le versioni di jdk e copiarci il JDK appena estratto<br />
<br />
<pre class="shellcode"><code>
sudo mkdir -p /usr/lib/jvm
sudo mv ./jdk1.7.0_21 /usr/lib/jvm/jdk1.7.0_21
</code></pre>
<br />
3) creare le configurazioni "alternative" per il nuovo JDK<br />
<pre class="shellcode"><code>
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_21/bin/javaws" 1
</code></pre>
<br />
questo farà si che nella cartella /usr/bin potranno essere creati i link alla nostra versione di JDK quando questa sarà "eletta" come default<br />
<br />
4) Aggiornare i permessi di esecuzione in modo che tutti possano eseguire java<br />
<br />
<pre class="shellcode"><code>
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0_21/
</code></pre><br />
5) Configurare la versione di default di java lanciando il comando<br />
<br />
<pre class="shellcode"><code>
sudo update-alternatives --config java
</code></pre>
<br />
Fatto !<br />
<br />
A questo punto, potete verificare l'installazione di java attraverso il ben noto comando:<br />
<br />
<pre class="shellcode"><code>
java -version
</code></pre>
<br />
<br />
;-)<br />
<br />
Fonte: <a href="http://askubuntu.com/questions/55848/how-do-i-install-oracle-java-jdk-7">askubuntu.com</a> <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br /><br />
<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-86324971786703298422013-04-15T01:17:00.000-07:002013-04-15T01:17:12.961-07:00Linux - Cancellare files più vecchi di una certa data<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" /></a></div>
Ecco un comando molto comodo per poter effettuare operazioni su files a partire da una certa data.<br />
<br />
L'opzione <i><b>newermt</b></i> del comando <i><b>find</b></i> consente di filtrare per i files più recenti di una certa data, usando il parametro <b><i>not</i></b> si può ottenere l'effetto inverso e cioè cercare i files che sono più vecchi di una data di riferimento.<br />
<br />
Attraverso il comando exec poi è possibile effettuare le operazioni sui files individuati, in questo caso, la cancellazione.<br />
<br />
Il comando diventa quindi:<br />
<br />
<pre class="shellcode"><code>
find . -name "*.pdf" -not -newermt "2013-03-26 1000" -exec rm {} \;
</code></pre>
<br />
<br />
Che cerca e cancella tutti i file PDF con data di creazione precedente al 26/03/2013 ore 10.00. :-)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-67017983514265906792013-03-13T06:45:00.001-07:002013-03-13T06:45:51.843-07:00Effettuare screenshots con Android 4.x<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidd_dyFpxvmvl_w-NH2xgOMl1cJqDXkZWuG0kItoeCUUOituLNQ2WrjQuYM1hYatELulRDWa7FfWX0Iww6pKhEcTQfUJzZBl7GgoDnuV9bLJWFyNBr9ndcMup5coqJ71V3pgreMrnMiCVA/s1600/LOGO_galaxyNexus.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidd_dyFpxvmvl_w-NH2xgOMl1cJqDXkZWuG0kItoeCUUOituLNQ2WrjQuYM1hYatELulRDWa7FfWX0Iww6pKhEcTQfUJzZBl7GgoDnuV9bLJWFyNBr9ndcMup5coqJ71V3pgreMrnMiCVA/s1600/LOGO_galaxyNexus.jpg" height="138" width="200" /></a></div>
Forse non tutti sanno che a partire da Android 4.0 e successivi è stata aggiunta la possibilità di effettuare gli screenshot dal proprio telefono senza la necessità di installare software particolari e senza i permessi di root.<br />
<br />
Per fare questo è sufficiente, una volta che ci si è posizionati sulla schermata da catturare, premere contemporanemente sia il tasto power che il tasto "volume down".<br />
Il telefono effettuerà uno screenshot, dandovene una breve preview e nella notification area vi apparirà il messaggio che lo screenshot è stato effetturato.<br />
<br />Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-3012255622254146640.post-60540873699682461592013-03-09T02:40:00.002-08:002013-03-09T02:43:05.023-08:00Effettuare chiamate POST in https<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg56VnovuycYB4j4hQiLfUqlVd7mL_YiodEZRrcnYavRdFcpr2pP2xFHpLzwBYC7Xp68keU5qwCqFWxNkviAczLkbt9SXnDLnKNPpG_Wz_AUW2SOh-ADWW1BdW3jmFy44M06ERDksBM9JkW/s1600/androids.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg56VnovuycYB4j4hQiLfUqlVd7mL_YiodEZRrcnYavRdFcpr2pP2xFHpLzwBYC7Xp68keU5qwCqFWxNkviAczLkbt9SXnDLnKNPpG_Wz_AUW2SOh-ADWW1BdW3jmFy44M06ERDksBM9JkW/s1600/androids.gif" /></a></div>
Effettuare chiamate POST in java on in Android è piuttosto semplice soprattutto se si utilizzano le API di apache per le chiamate HTTP.<br />
<br />
Per le chiamate HTTPS però c'è qualche difficoltà in più perchè è necessario (o meglio sarebbe necessario) gestire il certificato di connessione con il server.<br />
<br />
<a name='more'></a>Siccome mi sono trovato ad effettuare delle chiamate HTTPS (in particolare POST ma per il GET è lo stesso), ho pensato di condividere la soluzione.<br />
<br />
Il codice necessario per effettuare la chiamata in POST è raggruppato in questo metodo di helper.<br />
<br />
<script src="https://gist.github.com/jfabrix101/5123757.js"></script><br />
<br />
che fa utilizzo delle classi <b>SimpleSSLSocketFactory</b> e <b>SimpleX509TrustManager</b> per la gestione dei certificati SSL, scaricabili da questo indirizzo. <a href="https://github.com/jfabrix101/jfAndroid/tree/master/library/src/jfabrix101/lib/security/ssl">Link</a><br />
<br />
In pratica il funzionamento è il seguente:<br />
<br />
Neller righe da 2 a 4 si configurano i gestori dei protocolli. Per il protocollo HTTP si utilizza il gestore dei default, per il protocollo HTTP il gestore definito nella classe <span style="background-color: white; color: #333333; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: 12px; line-height: 16px; white-space: pre;">SimpleSSLSocketFactory</span> che non fa altro che accettare, senza effettuare alcuna verifica il certificato SSL del server.<br />
<br />
La classe <b>SimpleSSLSocketFactory</b> ignora la validità del certificato, dando per buono qualsiasi certificato (anche quelli self-signed). In questo modo non si avrà la sicurezza del chiamante ma solo la cifratura della connessione.<br />
<br />
Successivamente, nelle righe da 6 a 10, si configura la connessione e si ottiene il client http attraverso il quale effettuare la chiamata (android di default utilizza le Apache common HTTP, in java è necessario includere le librerie)<br />
<br />
Nelle righe da 17 a 24, semplicemente si impostano i parametri della chiamata HTTP (eventualmente ce ne fossero). Siccome è una chiamata in POST i parametri non possono essere passati nell'URL ma è necessario passarli separatamente, quindi ho previsto una mappa di parametri (da notare che in in questo semplice esempio la mappa <i>params</i> non deve essere null) attraverso la quale arricchire la richiesta per il passaggio dei parametri.<br />
<br />
Le ultime righe, da 26 a 36, effettuano la chiamata HTTP, estraggono il contenuto e lo restituiscono al chiamante.<br />
<br />
Il metodo, a parte il passaggio dei parametri, è facilmente adattabile anche alle chiamate di tipo GET<br />
<br />
<br />
<br />Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-3012255622254146640.post-24710601969586521422013-02-26T21:28:00.000-08:002013-02-26T21:32:14.628-08:00Linux - Installare LIbreOffice 4 su Ubuntu 12.10<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" /></a></div>
Il primo passo che dovremo fare per installare sul nostro ubuntu 12.10 la nuova versione di Libre Office, senza aspettare che gli aggiornamenti vengano proposti dal team di Canonical, è quello di disinstallare la vecchia versione di Libre Office presente nel proprio linux box con i comandi:<br />
<br />
<a name='more'></a><pre class="shellcode">sudo apt-get purge libreoffice-*
</pre>
<br />
<div style="background-color: white; color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 10px; margin-top: 10px; padding: 0px; text-align: justify;">
Sul sito ufficiale di <a href="http://libreoffice.org/" style="color: #454673; font-weight: 800; text-decoration: none;" target="_blank">Libre Office</a> scaricare i files di installazione selezionando <strong>Linux (deb)</strong> a 32 o a 64 bit (a seconda della propria installazione di Ubuntu dalla pagina di <a href="http://www.libreoffice.org/download/?nodetect" style="color: #454673; font-weight: 800; text-decoration: none;" target="_blank">download</a> e la propria lingua. Scaricare sia il file principale (main installer), che la lingua italiana (translated user interface) ed infine anche i files di aiuto (Libre Office Built-in help).<br />
Per la lingua itliana trovate tutto a questo <a href="http://www.libreoffice.org/download/?type=deb-x86&lang=it&version=4.0.0" target="_blank">link</a></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 10px; margin-top: 10px; padding: 0px; text-align: justify;">
Una volta scaricato il pacchetto (compresso tar.gz) eseguire le seguenti operazioni per installarlo:</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 10px; margin-top: 10px; padding: 0px; text-align: justify;">
<br />
<pre class="shellcode">tar zxvf LibreOffice_4.0.0_Linux_x86_deb.tar.gz
cd LibreOffice_4.0.0.3_Linux_x86_deb
cd DEBS
sudo dpkg -i *
sudo dpkg -i desktop-integration/*
cd ../..
</pre>
<br />
A questo punto Libre Office 4 è correttamente installato ma è in inglese.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 10px; margin-top: 10px; padding: 0px; text-align: justify;">
Decomprimiamo anche il langpack in italiano:<br />
<br />
<pre class="shellcode">tar zxvf LibreOffice_4.0.0_Linux_x86_deb_langpack_it.tar.gz
cd LibreOffice_4.0.0.3_Linux_x86_deb_langpack_it
cd DEBS
sudo dpkg -i *
cd ../..
</pre>
<br />
Decomprimiamo anche l’help pack:<br />
<br />
<pre class="shellcode"><code>tar zxvf LibreOffice_4.0.0_Linux_x86_deb_helppack_it.tar.gz
cd LibreOffice_4.0.0.3_Linux_x86_deb_helppack_it
cd DEBS
sudo dpkg -i *
cd ../..
</code></pre>
<div style="background-color: white; color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 20px; margin-bottom: 10px; margin-top: 10px; padding: 0px; text-align: justify;">
Ora la suite è completa di tutti i prodotti necessari al suo funzionamento. Per chi non volesse diventare matto con queste operazioni l’unica soluzione è attendere pazientemente che venga pubblicato da Ubuntu il relativo aggiornamento nei repository ufficiali.<br />
<br />
<div style="text-align: right;">
Fonte <a href="http://www.oculus.it/oculusblog/?p=945" target="_blank">OCULUS.IT</a></div>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-30657288748449762832013-02-13T11:10:00.002-08:002013-02-13T11:12:57.251-08:00Linux - Visualizzare l'albero delle directory<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJ2Zd4Lmg8MmkbhxvHmWvlmaV7NPL0BDgNa00dQ2Fbb187iH9GRzd243tcYy-BFIdZ-lolYSlSPlUJExen8QmuVa2Ts0oUCp3hQWomgZzeFF7CIHndK0VQxEnTfV0v9RGVHr_MnUJCAp0/s1600/images.jpg" /></a></div>
In linux esiste un comando, (a dire la verità molto comodo) per visualizzare l'intero albero delle directory a partire da una qualsiasi cartella.<br />
<br />
Questo comando si chiama tree e di default non è installato (almeno in ubuntu).<br />
Una volta installato è possibile dare il comando<br />
<br />
<a name='more'></a><br /><br />
<script class="brush: xml" type="syntaxhighlighter"><![CDATA[
tree
]]></script>
Per visualizzare tutte le directory e i file, oppure il comando<br />
<br />
<script class="brush: xml" type="syntaxhighlighter"><![CDATA[
tree -a
]]></script>
<br />
per visualizzare anche i file e le directory nascoste, oppure il comando<br />
<br />
<script class="brush: xml" type="syntaxhighlighter"><![CDATA[
tree -d
]]></script>
<br />
per visualizzare solo le cartelle. Ecco un esempio di output<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1VPvRedtVhxmQWEXQ6o-aCW_IGm23FXJr43sbW2wm4SMPQgROD7-IPhTXEHIpixJ4tQz7o5MwGur5wNX1s49DOhE8WLWoJ7Mr0L2KiH2GO_5Q3lCPbdzU78jtHcI93NmOQDbhht-ZRuBh/s1600/tree-example.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1VPvRedtVhxmQWEXQ6o-aCW_IGm23FXJr43sbW2wm4SMPQgROD7-IPhTXEHIpixJ4tQz7o5MwGur5wNX1s49DOhE8WLWoJ7Mr0L2KiH2GO_5Q3lCPbdzU78jtHcI93NmOQDbhht-ZRuBh/s320/tree-example.png" width="309" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
che ovviamente può anche essere reindirizzato verso un file per poterlo conservare.</div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3012255622254146640.post-89480082554681522952013-02-08T02:14:00.002-08:002013-02-08T03:45:27.485-08:00Tipologie di licenze open source<br />
Nel voler rilasciare una libreria di sviluppo software mi sono posto il problema di quale sia la miglior licenza da applicare.<br />
E' stata l'occasione per approfondire meglio un discorso lasciato sempre appeso e cioè quello di entrare nel merito delle varie tipologie di licenze open source che ci sono in giro.<br />
<br />
Ovviamente il tipo di licenza che si vuole adottare dipende dall'uso che si vuole lasciare agli utilizzatori della libreria. Una libreria (o un progetto software) dichiarato open source è in primo luogo pubblico, cioè tutti possono scaricarlo e guardarne il codice. Il passo successivo è limitare (o regolamentare) l'uso che si vuol lasciare all'utilizzatore della libreria.<br />
<a name='more'></a><br />
<br />
In questo caso, il termine "software libero" è più restrittivo che altro, paradossalmente io che voglio rilasciare un software in maniera open source mi sono trovato a dover scegliere quale tipo di libertà dare al codice. Che in fondo è un controsenso, se è libero è libero.<br />
<br />
Ma andiamo a vedere nel dettaglio quali sono le tipologie di licenza ad oggi disponibili e quali sono gli effetti (e gli obblighi) che danno.<br />
Ad oggi le maggiori tipologie di licenze open source sono:<br />
<br />
GNU GPL - (Generic Public Licenze) - ( <a href="http://it.wikipedia.org/wiki/GNU_GPL" target="_blank">http://it.wikipedia.org/wiki/GNU_GPL</a> )<br />
GNU LGPL - ( Lesser Generic Public Licenze) - ( <a href="http://it.wikipedia.org/wiki/GNU_LGPL">http://it.wikipedia.org/wiki/GNU_LGPL</a> )<br />
Creative Commons ( <a href="http://www.creativecommons.it/" target="_blank">http://www.creativecommons.it/</a> )<br />
Licenza Apache (<a href="http://it.wikipedia.org/wiki/Licenza_Apache" target="_blank">http://it.wikipedia.org/wiki/Licenza_Apache</a> )<br />
<br />
Ne esistono anche altre (MIT, BSD, ..) ma quelle citate sono le più diffure. Per un elenco comparativo consultare <a href="http://it.wikipedia.org/wiki/Comparazione_di_licenze_libere">http://it.wikipedia.org/wiki/Comparazione_di_licenze_libere</a><br />
<br />
Vediamo in dettaglio le quattro tipologie di licenze citate facendo una premessa: Ogni licenza open source prevede SEMPRE il diritto di attribuzione, cioè l'obbligo per chi usa e ridistribuisce il codice di far riferimento all'autore. ... E' il minimo sindacale.<br />
<br />
<h3>
Creative Commons </h3>
Questo tipo di licenze è la più moderna e la più versatile, consiste nel modulare i permessi che si vuole lasciare agli utilizzatori della libreria scegliendo (e componendo) la licenza su misura. Inoltre è disponibile anche in italiano il chè semplifica moltissimo la sua comprensione.<br />
E' possibile costruire la propria licenza rispondendo a poche semplici domande. ( <a href="http://creativecommons.org/choose/" target="_blank">link</a> )<br />
<br />
Innanzitutto bisogna decidere se si vuole consentire agli altri di apportare modifiche al proprio codice e se si vuole che queste modifiche siano rilasciate anch'esse sotto la stessa licenza. Altra domanda a cui rispondere è se si vuole che la proprio lavoro possa essere usato a fini commerciali (cioè se si vuole consetire l'uso in progetti aziendali).<br />
Rispondendo a queste tre domande si possono generare 6 tipi di licenze:<br />
<br />
<br />
<ul>
<li><span style="font-weight: bold;"><b>BY</b> - <i>Attribuzione</i> : </span>L'unico obbligo che hanno gli utilizzatori del software è quello di menzionare l'autore. Possono poi utilizzare il codice come meglio credeno, possono modificarlo, rilasciarlo sonotto un'altra licenza e possono usarlo a fini commrciali.</li>
<li><b>BY-ND</b> - <i>Attribuzione, Non opere derivate</i> : Gli utilizzatori del codice sotto questa licenza hanno l'obbligo di menzionale l'autore (attribuzione) e di non rilasciare opere derivate del lavoro. Possono modificarlo ed usarlo per fini commerciali</li>
<li><b>BY-NC-ND</b> - <i>Attribuzione, Non opere derivate, non commerciale</i> : Gli utilizzatori della libreria devono menzionare l'autore e non possono usare la libreria per scopi commerciali, non possono inoltre rilasciare versioni modificate del codice. Questa è la più restrittiva delle licenze, significa che l'autore sarà sempre l'unico detentore del codice, se si intende contribuire al progetto, bisogna inviare le modifiche all'autore che (se vorrà) potrà rilasciare nella sua libreria</li>
<li><b>BY-NC</b> - <i>Attribuzione, Non commerciale</i> : Gli utilizzatori della libreria non possono usare il codice per applicazioni commerciali ma possono modificarla e rilasciarla come meglio credono, sempre menzionando l'autore originale.</li>
<li><b>BY-SA</b> - Attribuzione, <i>Progaga la licenza</i> : Gli utilizzatori della libreria possono modificare il codice, usarlo per progetti commercialie ma se rilasciano una versione modificata della libreria sono obbligati a rilasciarla sotto la stessa licenza (BY-SA). Devono ovviamente sempre menzionare l'autore originale</li>
<li><b>BY-SA-NC</b> : <i>Attribuzione, Propaga licenza, Non commerciale</i> : Come nel caso precedente ma con il vincolo che la libreria (e le sue derivate a cui si propaga la stessa licenza) non possono essere usate per fini commerciali</li>
</ul>
<div>
<br />
<br />
La licenza creative commons è la più versatile di tutte e consente a tutti gli effetti di scegliere il modo in cui si vuole condividere il proprio lavoro. In realtà la licenza si applica a qualsiasi opera di ingegno (musica, testi, foto, video, ...) ma proprio per i progetti software non è consigliata.<br />
Attenzione: Non è consigliata, non è detto che non è applicabile. (<a href="http://www.creativecommons.it/faq#" target="_blank">link</a>)<br />
Questo perchè storicamente, le licenze per i software nascono prima e quindi sono più diffuse.<br />
<br />
<br />
<h3>
ASFL - Apache Software Foundation License</h3>
<div>
La licenza apache è la più libera tra tutte le licenze. ( <a href="http://it.wikipedia.org/wiki/Apache_License" target="_blank">link</a> ) </div>
<div>
Essa non impone alcun obbligo all'utilizzatore del codice, (a parte quello di menzionare l'autore che è cmq la base di ogni licenza).</div>
<div>
L'utilizzatore può quindi prendere il codice, usarlo per fini commerciali, modificarlo e pubblicare le modifiche sotto qualsiasi titpo di licenza.</div>
<div>
E' assimilabile al tipo di licenza BY della cretive commons.</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
GNU GPL</h3>
<div>
Questa tipo di licenza, anche se è quella storicamente più diffusa ed è adottata dal sistema operativo Linux, è quella a mio avviso più limitante.</div>
<div>
Infatti il codice sottoposto a questo tipo di licenza obbliga a chi lo utilizza non solo di rilasciare i sorgenti del prodotto anche se usato a fini commerciali ma anche di rilasciarli sotto la stesso tipo di licenza (GPL).</div>
<div>
Mentre da un punto di vista dello sviluppo di progetti open (quali ad esempio linux) sono il massimo, (cioè progetti nati open e che voglione rimanere sempre open) per una libreria software non è indicato. Si pensi se spring o hibernate fossero sviluppati sotto questo tipo di licenza, tutti i maggiori progetti software (anche commerciali) sarebbero obbligati a rilasciare i propri sorgenti.</div>
<div>
Questo tipo di licenza è paragonabile alla licenza BY-NC-SA della creative commons.</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
GNU LGPL</h3>
<div>
Questo tipo di licenza (inizialmente chiamato Library GPL e poi Lesser GPL) è una versione meno libera della licena GPL. Propio perchè inizialmente si chiamava "Library" è stata pensata per quelle librerie software che devono entrare a far parte di progetti più ampi e non possono propagare i vincoli di condivisione del codice.</div>
<div>
Quindi, analogamente alla GPL obbliga gli utilizzatori a rilasciare copie del progetto in maniera open source e sempre sotto LGPL (ma solo se lo vogliono) ma non di rilasciare i sorgenti dei progetti nei quali sono inclusi.</div>
<div>
Alcune delle maggiori libreria software (Spring, Hibernate ad esempio) sono rilasciate sotto questa forma di licenza, quindi è possibile usarle anche i prodotti commericiali senza essere obbligati a rilasciarne i sorgenti.</div>
<div>
Questa licenza è paragonabile alla BY-SA della creative commons.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Concludendo, quindi, se non si vuole usare la licenza creative commons, per lo sviluppo di una libreria software (che si intende far proseguire nella comunità e diffonderne al massimo l'utilizzo), le migliori libreri sono quella Apache dove si rilascia la libreria e poi ognuno fa quello che vuole o la LGPL dove ognuno la usa come gli pare ma se vuole può anche estenderla (forkarla) e contribuire al progetto in maniera indipendente lasciando però la libreria sempre sotto LGPL.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0