function Utils() { } Utils.prototype = { constructor: Utils, isElementInView: function (element, fullyInView) { var pageTop = $(window).scrollTop(); var pageBottom = pageTop + $(window).height(); var elementTop = $(element).offset().top; var elementBottom = elementTop + $(element).height(); if (fullyInView === true) { return ((pageTop < elementTop) && (pageBottom > elementBottom)); } else { return ((elementTop <= pageBottom) && (elementBottom >= pageTop)); } } }; var Utils = new Utils();
public class Main extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Utils util = new Utils(this); util.startTest(); } @Override protected void onActivityResult(int arg0, int arg1, Intent arg2) { Toast.makeText(this, "onActivityResult called", Toast.LENGTH_LONG).show(); super.onActivityResult(arg0, arg1, arg2); } }
private static volatile Utils _instance = null; public static Utils Instance() { if (_instance == null) { synchronized (Utils.class) { _instance = new Utils(); } } return _instance; }
var App = function() { this.utils = new Utils(); this.someProperty = 'Lorem'; this.init(); }; App.prototype = { init: function(){ this.bindEvents(); this.utils.resizeElement(...); } }
var App = function(utils) { this.utils = utils; this.someProperty = 'Lorem'; this.init(); }; App.prototype = { init: function(){ this.bindEvents(); this.utils.resizeElement(...); } } var u = new Utils(); var a = new App(u);
private Activity activity; ... BookMarksBaseAdapter (Activity a, ArrayList<bookMark> d) { activity = a; data=d; inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); utils = new Utils(); db = new Databasehandler(a); }
public static void main(final String[] arguments) throws IOException { final String fileName = "logging.properties"; final InputStream propertiesStream = Utils.class.getResourceAsStream(fileName); //final InputStream propertiesStream = new FileInputStream("path to file"); LogManager.getLogManager().readConfiguration(propertiesStream); new Utils().logging(); System.out.println(); // No handlers for this logger directly, but four for its parent. System.out.println("Logging handlers:"); for (final Handler handler : logger.getParent().getHandlers()) System.out.println("###" + handler.getClass().getName() + "-" + handler.getLevel()); }
while (excellentCsvReader.readRecord()) { ... String[] tagsOfTheCurrentPictureAsAnArray = tagsOfTheCurrentPicture.split(","); for (String x : tagsOfTheCurrentPictureAsAnArray) { myTags.add(x); } ... } Utils y = new Utils(); myConnections.addAll(y.getListOfLinks(tagsOfTheCurrentPictureAsAnArray));
public class MyHandler { public void someMethod() { Utils utils = new Utils(10); System.out.println("Should be 1 : " + utils.someMethod()); } }
Utils utils = new Utils(); utils.buildNotification(<context argument goes in here>);
Utils mUtils = new Utils(); ((App) getApplication).inject(mUtils); mUtils.showLog();
Utils util = new Utils(); util.DoSomething(myObject);
String url="https://eventfo.com.au/index.php/userapi/api/eventdetaildownload/eventid/162/accesskey/534ccbcc10ab2/deviceId/85d2a504b2be7af4/deviceType/Android"; try { new Utils().downloadEventData(MainActivity.this,zipFile, unzipLocation, url); } catch (Exception e) {
/** * Reads properties that inherit from three locations. Properties are first * defined in the system resource location (i.e. in the CLASSPATH). These * default properties must exist. Properties optionally defined in the user * properties location (WekaPackageManager.PROPERTIES_DIR) override default * settings. Properties defined in the current directory (optional) override * all these settings. * * @param resourceName the location of the resource that should be loaded. * e.g.: "weka/core/Utils.props". (The use of hardcoded forward * slashes here is OK - see jdk1.1/docs/guide/misc/resources.html) * This routine will also look for the file (in this case) * "Utils.props" in the users home directory and the current * directory. * @return the Properties * @exception Exception if no default properties are defined, or if an error * occurs reading the properties files. */ public static Properties readProperties(String resourceName) throws Exception { Utils utils = new Utils(); return readProperties(resourceName, utils.getClass().getClassLoader()); }
/** * Reads properties that inherit from three locations. Properties are first * defined in the system resource location (i.e. in the CLASSPATH). These * default properties must exist. Properties optionally defined in the user * properties location (WekaPackageManager.PROPERTIES_DIR) override default * settings. Properties defined in the current directory (optional) override * all these settings. * * @param resourceName the location of the resource that should be loaded. * e.g.: "weka/core/Utils.props". (The use of hardcoded forward * slashes here is OK - see jdk1.1/docs/guide/misc/resources.html) * This routine will also look for the file (in this case) * "Utils.props" in the users home directory and the current * directory. * @return the Properties * @exception Exception if no default properties are defined, or if an error * occurs reading the properties files. */ public static Properties readProperties(String resourceName) throws Exception { Utils utils = new Utils(); return readProperties(resourceName, utils.getClass().getClassLoader()); }
question.new Utils().execute(question.new TestAction(), question.new TestCallBack());
public void run() { try { new Utils().checkShortcuts( context ); } catch( Exception e ) { Log.e("pweb", "Exception in " + CheckShortcutsTask.class, e);
Utils mUtils = new Utils(); mUtils.activateVibration(); mUtils.playRingTone(); mUtils.setVolume(volumeLevel);
listener.setFailureCallBack(this, "setNoLocation"); manager.requestLocationUpdates( new Utils().getCurrentPlaceLocationProvider(manager), 0, 0, listener);
utils=new Utils(this); InitilizeGridLayout(); imagePaths=utils.getFilePaths();