|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
WM Sports - Códigos Fontes - Versão 23 |
Débuté par BOLLER, 13 fév. 2018 22:30 - Aucune réponse |
| |
| | | |
|
| |
Membre enregistré 3 657 messages Popularité : +175 (223 votes) |
|
Posté le 13 février 2018 - 22:30 |
Prezados,
Abaixo os codigos do projeto WM Sports do Windev Mobile versão 23
Fontes
http://repository.windev.com/resource.awp…
http://repository.windev.com/resource.awp…
http://repository.windev.com/resource.awp…
Documentação em PDF
http://repository.windev.com/resource.awp…
COL_ANDROID
Procedure EconomieEnergieActive() : boolean
bRes is boolean
IF SysAndroidVersion(sysVersionApiLevel) >= 21 THEN bRes = JAVA_isPowerSaveMode() END
RESULT bRes
import android.view.View; import android.os.Build; import android.view.Window;
PUBLIC static void JAVA_ActionBarSupprimeOmbre(){
IF (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { View actionbar; Window window = getActiviteEnCours().getWindow(); View v = window.getDecorView(); int resId = getContexteApplication().getResources().getIdentifier("action_bar_container", "id", "android"); actionbar = v.findViewById(resId); IF (actionbar != Null){ actionbar.setElevation(0); } } }
import android.content.Intent; import android.provider.Settings;
PUBLIC static void JAVA_ActiveGPS(){ try { getActiviteEnCours().startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), 1); } catch(EXCEPTION e) { Log.e("WM Sports", e.toString()); } }
Procedure JAVA_ActiveGPSWL()
<Compile IF ConfigurationType=Android> JAVA_ActiveGPS() <END>
PUBLIC static boolean JAVA_ArreteFocusAudio(){ try{ IF (mAudioManager == Null){ RETURN False; } ELSE{ mAudioManager.abandonAudioFocus(afChangeListener); RETURN True; } } catch(EXCEPTION e) { RETURN False; } }
import android.graphics.Color; import android.graphics.PorterDuff; import java.lang.Exception; import android.widget.Switch; import android.content.res.ColorStateList; import android.view.ViewGroup; import android.view.View;
PUBLIC static boolean JAVA_ChangeCouleurInterrupteur(string sNomChamp,string sCouleur){ try{ SWITCH monswitch; int[][] states; int[] colorsThumb; int[] colorsTrack; ColorStateList myListThumb; ColorStateList myListTrack; states = new int[][] { new int[] { android.R.attr.state_checked }, new int[] { -android.R.attr.state_checked } }; colorsThumb = new int[] { Color.parseColor(sCouleur), Color.parseColor("#E8E8E8") }; colorsTrack = new int[] { Color.parseColor(sCouleur), Color.parseColor("#000000") }; myListThumb = new ColorStateList(states, colorsThumb); myListTrack = new ColorStateList(states, colorsTrack); ViewGroup viewGroup = (ViewGroup) getView(sNomChamp); IF (viewGroup == Null){ RETURN False; } for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); try{ monswitch = (SWITCH) child; monswitch.setThumbTintList(myListThumb); monswitch.setTrackTintList(myListTrack); } catch(EXCEPTION e) { Log.e("WM Sports",e.toString()); RETURN False; } } RETURN True; } catch(EXCEPTION e) { Log.e("WM Sports",e.toString()); RETURN False; }
}
import android.media.AudioManager; import android.content.Context;
PUBLIC static boolean JAVA_DemandeFocusAudio(){ try{ IF (mAudioManager == Null){ mAudioManager = (AudioManager) getContexteApplication().getSystemService(Context.AUDIO_SERVICE); } IF (mAudioManager == Null){ RETURN False; } int RESULT = mAudioManager.requestAudioFocus(afChangeListener,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK); IF (RESULT == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { RETURN True; } ELSE{ RETURN False; } } catch(EXCEPTION e) { RETURN False; } }
static AudioManager.OnAudioFocusChangeListener afChangeListener = new AudioManager.OnAudioFocusChangeListener() { PUBLIC void onAudioFocusChange(int focusChange) { IF (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) { } ELSE IF (focusChange == AudioManager.AUDIOFOCUS_GAIN) { } ELSE IF (focusChange == AudioManager.AUDIOFOCUS_LOSS) { mAudioManager.abandonAudioFocus(afChangeListener); } } };
PUBLIC static AudioManager mAudioManager;
import android.os.PowerManager; import android.os.Build;
PUBLIC static boolean JAVA_isPowerSaveMode(){ PowerManager powerManager = (PowerManager) getActiviteEnCours().getSystemService(Context.POWER_SERVICE); IF (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && powerManager.isPowerSaveMode()) { RETURN True; } RETURN False; }
import android.view.View; import android.os.Build;
PUBLIC static void JAVA_StatusBarChangeCouleurIcone(){
IF (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { View statusbar = getActiviteEnCours().getWindow().getDecorView(); statusbar.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } }
import android.media.ExifInterface; import java.lang.Exception; import android.graphics.*; import android.util.Log; import java.io.FileOutputStream;
PUBLIC static boolean JAVA_TraitePhotoExif(string sPhoto, string sPhotoDestination){ int nRotation = 0; boolean res = False; try{ ExifInterface m_exif = new ExifInterface(sPhoto); nRotation = (int)exifOrientationToDegrees(m_exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,ExifInterface.ORIENTATION_NORMAL)); BitmapFactory.Options bounds = new BitmapFactory.Options(); Bitmap sourceBitmap = BitmapFactory.decodeFile(sPhoto,bounds); IF (sourceBitmap == Null){ RETURN False; } Matrix matrix = new Matrix(); IF (nRotation > 0) { matrix.preRotate(nRotation); } int width = sourceBitmap.getWidth(); int height = sourceBitmap.getHeight(); Bitmap resizedBitmap = Bitmap.createBitmap(sourceBitmap, 0, 0, width, height, matrix, True); IF (resizedBitmap == Null){ RETURN False; } FileOutputStream out = new FileOutputStream(sPhotoDestination); res = resizedBitmap.compress(Bitmap.CompressFormat.JPEG , 100, out); sourceBitmap.recycle(); resizedBitmap.recycle(); resizedBitmap = Null; sourceBitmap = Null; RETURN res; } catch(EXCEPTION e) { Log.e("WM Sports",e.toString()); RETURN False; } }
PUBLIC static float exifOrientationToDegrees(int exifOrientation) { IF (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) { RETURN 90; } ELSE IF (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) { RETURN 180; } ELSE IF (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) { RETURN 270; } RETURN 0; }
Procedure SyntheseVocaleLitTexteFocus(sTExte is string)
<Compile IF ConfigurationType=Android> bResFocus is boolean bResFocus = JAVA_DemandeFocusAudio() <END>
SpeechSynthesisReadText(sTExte,True)
<Compile IF ConfigurationType=Android> IF bResFocus THEN JAVA_ArreteFocusAudio() <END>
CASE ERROR: JAVA_ArreteFocusAudio() CASE EXCEPTION: JAVA_ArreteFocusAudio()
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Message modifié, 13 février 2018 - 22:31 |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|