PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 24 → Suggestion code Java: Extract Marca Model Celular/Tablet
Suggestion code Java: Extract Marca Model Celular/Tablet
Débuté par adrianoboller, 03 oct. 2014 16:03 - 3 réponses
Membre enregistré
3 007 messages
Popularité : +89 (91 votes)
Posté le 03 octobre 2014 - 16:03
Suggestion code: Model Celular

CODE EXAMPLE

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.*;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import android.provider.Settings.Secure;

public static String getDeviceName() {

String manufacturer = android.os.Build.MANUFACTURER;
String model = android.os.Build.MODEL;
String brand = android.os.Build.BRAND;
String product = android.os.Build.PRODUCT;
String board = android.os.Build.BOARD;
String bootloader = android.os.Build.BOOTLOADER;
String cpu_abi = android.os.Build.CPU_ABI;
String cpu_abi2 = android.os.Build.CPU_ABI2;
String device = android.os.Build.DEVICE;
String display = android.os.Build.DISPLAY;
String fingerprint = android.os.Build.FINGERPRINT;
String hardware = android.os.Build.HARDWARE;
String host = android.os.Build.HOST;
String id = android.os.Build.ID;
String radio = android.os.Build.RADIO;
String serial = android.os.Build.SERIAL;
String tags = android.os.Build.TAGS;
String type = android.os.Build.TYPE;
String user = android.os.Build.USER;

if (model.startsWith(manufacturer)) {
return (model);
} else {
String MarcaModeloCelular = "manufacturer: " + (manufacturer) + "; model: " + (model) + "; brand: " + (brand) + "; product: " + (product) + "; board:" + (board) + "; bootloader: " + (bootloader) + "; cpu_abi: " + (cpu_abi) + "; cpu_abi2: " + (cpu_abi2) + "; device: " + (device) + "; display: " + (display) + "; fingerprint: " + (fingerprint) + "; hardware: " + (hardware) + "; host: " + (host) + "; id: " + (id) + "; radio: " + (radio) + "; serial: " + (serial) + "; tags: " + (tags) + "; type: " + (type) + "; user: " + (user);

MarcaModeloCelular = MarcaModeloCelular.toUpperCase();

return MarcaModeloCelular;
}
}
Membre enregistré
3 007 messages
Popularité : +89 (91 votes)
Posté le 03 octobre 2014 - 16:04
Button in Form Windev Mobile:

Info(getDeviceName())
Membre enregistré
3 007 messages
Popularité : +89 (91 votes)
Posté le 03 octobre 2014 - 16:08
PROCEDURE ResolucaoTela()

// Horizontal resolution of the screen
ResHorizRes is int = SysXRes()
gloResHorizRes = ResHorizRes

// Vertical resolution of the screen
ResVertRes is int = SysYRes()
gloResVertRes = ResVertRes

Retorno is string = ResHorizRes +"X"+ ResVertRes

W = gloResHorizRes
H = gloResVertRes

IF H = 1920 AND W = 1080 THEN //s4
gnCentroY = 1530
gnCentroYinitial = 1050
ELSE IF H = 800 AND W = 480 THEN // mini
gnCentroY = 605
gnCentroYinitial = 525
ELSE IF H = 800 AND W = 1280 THEN // tablet 1171 419
gnCentroY = 1070
gnCentroYinitial = 319
END

RESULT(Retorno)
Membre enregistré
3 007 messages
Popularité : +89 (91 votes)
Posté le 03 octobre 2014 - 16:08
/////////////////////////////////////////////////////////
ResolucaoTela()
//Verifica modelo de celular = MOTO G = XT1033
MODELO is string = getDeviceName() //Funcao Java
//Info(MODELO) //
IF PositionOccurrence(MODELO,"MANUFACTURER: MOTOROLA; MODEL: XT1033",firstRank,FromBeginning) > 0 THEN // MOTO G

//info("Esse aparelho é um Moto G")

//Tela
WIN_Menu..Height = H - 150 // Janbela

nInicio is int = 73

nFinal is int = 365

Media is int = (nInicio + nFinal) / 6

//Botoes
IMG_Cadastro..Y = nInicio
IMG_Agendamento..Y = nInicio + (Media * 1)
IMG_Favoritos..Y = nInicio + (Media * 2)
IMG_Historico..Y = nInicio + (Media * 3)
IMG_Pesquisa..Y = nInicio + (Media * 4)
IMG_Site..Y = nInicio + (Media * 5)
IMG_Email..Y = nFinal

//Textos
BTN_Cadastro..Y = nInicio
BTN_Agendamento..Y = nInicio + (Media * 1)
BTN_Favoritos..Y = nInicio + (Media * 2)
BTN_Historico..Y = nInicio + (Media * 3)
BTN_Pesquisa..Y = nInicio + (Media * 4)
BTN_Site..Y = nInicio + (Media * 5)
BTN_Email..Y = nFinal

END
/////////////////////////////////////////////////////////