This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void setUpWebView() | |
{ | |
mWebView = new WebView(getContext()); | |
mWebView.setVerticalScrollBarEnabled(false); | |
mWebView.setHorizontalScrollBarEnabled(false); | |
mWebView.setWebViewClient(new FbDialog.FbWebViewClient()); | |
mWebView.getSettings().setJavaScriptEnabled(true); | |
mWebView.loadUrl(mUrl); | |
mWebView.setLayoutParams(FILL); | |
mContent.addView(mWebView); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void invokePlay( Boolean loop ) | |
{ | |
Boolean playing = ( mp.isLooping() || mp.isPlaying() ); | |
if ( playing ) | |
{ | |
mp.pause(); | |
mp.setLooping(loop); | |
mp.seekTo(0); | |
mp.start(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void clearState() { | |
Editor editor = m_prefs.edit(); | |
editor.remove(PREF_FIRSTRUN); | |
editor.remove(PREF_DONE_REV); | |
editor.remove(PREF_TODO_REV); | |
editor.remove(PREF_NEED_TO_PUSH); | |
editor.commit(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onListItemClick (ListView listView, View view, int position, long id) { | |
super.onListItemClick(listView, view, position, id); | |
Editor editor = prefs.edit(); | |
editor.putInt("index", listView.getFirstVisiblePosition()); | |
editor.putInt("top", listView.getChildAt(0) == null ? 0 : listView.getChildAt(0).getTop()); | |
editor.commit(); | |
Object o = this.getListAdapter().getItem(position); | |
String testName = o.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Location getLatestLocation(final Context context) { | |
LocationManager manager = (LocationManager) context | |
.getSystemService(LOCATION_SERVICE); | |
Criteria criteria = new Criteria(); | |
criteria.setAccuracy(ACCURACY_FINE); | |
String provider = manager.getBestProvider(criteria, true); | |
Location bestLocation; | |
if (provider != null) | |
bestLocation = manager.getLastKnownLocation(provider); | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public PushMessage(String jsonMessage) throws PreyException{ | |
try { | |
JSONObject jsonObj = new JSONObject(jsonMessage); | |
JSONObject data = jsonObj.getJSONObject("data"); | |
this.event = jsonObj.getString("event"); | |
this.type = data.getString("type"); | |
this.body = data.getString("body"); | |
} catch (JSONException e) { | |
throw new PreyException("Couldn't parse pushed json message"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
in = pAssetManager.open(pAssetPath); | |
BitmapFactory.decodeStream(in, null, decodeOptions); | |
} catch (final IOException e) { | |
Debug.e("Failed loading Bitmap in AssetBitmapTextureAtlasSource. AssetPath: " + pAssetPath, e); | |
} finally { | |
StreamUtils.close(in); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextView textView = (TextView)row.findViewById(android.R.id.text1); | |
float scale = activity.getResources().getDisplayMetrics().density; | |
boolean leftPadding = (parent.getTag().equals("right")); | |
boolean topPadding = (position == 0); | |
textView.setPadding((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(20 * scale) * (!leftPadding && topPadding ? 1 : 0), (int)(20 * scale), 0); | |
textView.setText(item); | |
textView.setTextColor(Color.BLACK); | |
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void startRecording(String file){ | |
if (!isRecording){ | |
saveFile=file; | |
recorder = new MediaRecorder(); | |
recorder.setAudioSource(MediaRecorder.AudioSource.MIC); | |
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); | |
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); | |
recorder.setOutputFile(this.recording); | |
try { | |
recorder.prepare(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void replyMessage(Context context, SmsMessage msg) { | |
SmsManager sms = SmsManager.getDefault(); | |
String message = msg.getMessageBody(); | |
sms.sendTextMessage(msg.getOriginatingAddress(), null, message, null, null); | |
} | |
} |
OlderNewer