Example usage for java.util Locale CANADA

List of usage examples for java.util Locale CANADA

Introduction

In this page you can find the example usage for java.util Locale CANADA.

Prototype

Locale CANADA

To view the source code for java.util Locale CANADA.

Click Source Link

Document

Useful constant for country.

Usage

From source file:com.cmput301w15t15.travelclaimsapp.activitys.EditClaimActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.edit_claim);
    sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.CANADA);

    GeoLocationController.initializeLocationManager(this.getApplicationContext());

    claimStartDate = (EditText) findViewById(R.id.Claim_Start_Date);
    claimEndDate = (EditText) findViewById(R.id.Claim_Finish_Date);
    claimNameInput = (EditText) findViewById(R.id.Edit_Claim_Name2);
    destListView = (ListView) findViewById(R.id.DestinationList2);
    addDestButton = (Button) findViewById(R.id.AddDestinationButton2);
    addTagButton = (Button) findViewById(R.id.AddTagButton2);
    tagListView = (ListView) findViewById(R.id.TagList2);
    claimList = ClaimListController.getClaimList();

    //get the claim name passed with the intent 
    String claimName = getIntent().getExtras().getString("claimName");
    theClaim = claimList.getClaim(claimName);
    dests = theClaim.getDestinationList();
    tags = theClaim.getTagList();/*from ww w .  j  a  va2s .c  o m*/

    //create adaptors and set them 
    tagAdaptor = new TagListAdaptor(this, R.layout.tag_list_adaptor, tags.toArrayList());
    destAdaptor = new DestinationListAdaptor(this, R.layout.dest_list_adaptor, dests.toArrayList());
    destListView.setAdapter(destAdaptor);
    tagListView.setAdapter(tagAdaptor);

    //register listviews for the context menu popup
    registerForContextMenu(findViewById(R.id.DestinationList2));
    registerForContextMenu(findViewById(R.id.TagList2));
}

From source file:org.jcurl.demo.tactics.JCurlShotPlanner.java

public static void main(final String[] args) {
    // for debugging reasons only:
    Locale.setDefault(Locale.CANADA);
    launch(JCurlShotPlanner.class, args);
}

From source file:com.janoz.usenet.searchers.impl.NzbsOrgConnectorImpl.java

private List<NZB> fetchFeed(Collection<NameValuePair> params) throws SearchException, DOMException {
    THROTTLER.throttle();//from   ww w  .j  a  v  a 2  s .  c om
    Document document = null;
    try {
        List<NameValuePair> qparams = new ArrayList<NameValuePair>();
        qparams.addAll(params);
        qparams.add(new BasicNameValuePair("dl", "1"));
        URI uri = getUri("rss.php", qparams);
        synchronized (builderSemaphore) {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setValidating(false);
            DocumentBuilder builder = factory.newDocumentBuilder();
            int attempts = RETRY_ATTEMPTS;
            boolean retry;
            do
                try {
                    retry = false;
                    document = builder.parse(uri.toString());
                } catch (IOException ioe) {
                    if (attempts == 0
                            || !ioe.getMessage().startsWith("Server returned HTTP response code: 503")) {
                        throw ioe;
                    } else {
                        attempts--;
                        retry = true;
                        THROTTLER.throttleBig();
                    }
                }
            while (retry);
        }
    } catch (IOException ioe) {
        throw new SearchException("Error connecting to Nzbs.org.", ioe);
    } catch (SAXException se) {
        throw new SearchException("Error parsing rss from Nzbs.org.", se);
    } catch (ParserConfigurationException pce) {
        throw new SearchException("Error configuring XML parser.", pce);
    } catch (URISyntaxException e) {
        throw new SearchException("Error parsing URI.", e);
    }
    Node rss = document.getFirstChild();
    if (!"rss".equalsIgnoreCase(rss.getNodeName())) {
        throw new SearchException("Result was not RSS but " + rss.getNodeName());
    }
    Node channel = rss.getFirstChild();
    while (channel != null && "#text".equals(channel.getNodeName())) {
        channel = channel.getNextSibling();
    }
    NodeList list = channel.getChildNodes();
    DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.CANADA);
    List<NZB> result = new ArrayList<NZB>();
    UrlBasedSupplier supplier = new UrlBasedSupplier();
    supplier.setThrottler(THROTTLER);
    for (int i = 0; i < list.getLength(); i++) {
        Node n = list.item(i);
        if ("item".equals(n.getNodeName())) {
            LazyNZB nzb = new LazyNZB("tmpName", supplier);
            try {
                for (int j = 0; j < n.getChildNodes().getLength(); j++) {
                    Node n2 = n.getChildNodes().item(j);
                    if ("title".equalsIgnoreCase(n2.getNodeName())) {
                        nzb.setName(n2.getTextContent());
                        nzb.setFilename(Util.saveFileName(n2.getTextContent()) + ".nzb");
                    }
                    if ("pubdate".equalsIgnoreCase(n2.getNodeName())) {
                        nzb.setPostDate(df.parse(n2.getTextContent()));
                    }
                    if ("link".equalsIgnoreCase(n2.getNodeName())) {
                        nzb.setUrl(n2.getTextContent());
                    }
                }
                result.add(nzb);
            } catch (ParseException e) {
                LOG.info("Skipping " + nzb.getName() + " because of date error.", e);
            }
        }
    }
    THROTTLER.setThrottleForNextAction();
    return result;
}

From source file:com.example.michel.facetrack.FaceTrackerActivity.java

/**
 * Initializes the UI and initiates the creation of a face detector.
 *//*w  w  w . j  av  a2 s  . co  m*/
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
    if (rc == PackageManager.PERMISSION_GRANTED) {
        createCameraSource();
    } else {
        requestCameraPermission();
    }

    mTTS = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() {
        @Override
        public void onInit(int status) {
            if (status != TextToSpeech.ERROR) {
                mTTS.setLanguage(Locale.CANADA);
                //                    mTTS.setOnUtteranceCompletedListener(new TextToSpeech.OnUtteranceCompletedListener() {
                //                        @Override
                //                        public void onUtteranceCompleted(String utteranceId) {
                //                            startSpeechToText();
                //                        }
                //                    });
                String toSpeak = "Blind spot opened. What do you want?";
                mTTS.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
                waitStartSTT(8000);

            }

        }
    });

    /*mPreview.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        mCameraSource.takePicture(new CameraSource.ShutterCallback() {
            @Override
            public void onShutter() {
            
            }
        }, new CameraSource.PictureCallback() {
            @Override
            public void onPictureTaken(byte[] bytes) {
                String file_timestamp = Long.toString(System.currentTimeMillis());
                Log.e("File: ", Environment.getExternalStorageDirectory() + "/" + file_timestamp + ".jpg");
                final File file = new File(Environment.getExternalStorageDirectory() + "/" + file_timestamp + ".jpg");
                try {
                    save(bytes, file);
            
                    String toSpeak = "Image saved";
                    mTTS.speak(toSpeak, TextToSpeech.QUEUE_FLUSH, null);
                    Toast.makeText(FaceTrackerActivity.this, "Saved to " + Environment.getExternalStorageDirectory() + "/" + file_timestamp + ".jpg", Toast.LENGTH_SHORT).show();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            
            private void save(byte[] bytes, final File file) throws IOException {
                OutputStream output = null;
                try {
                    output = new FileOutputStream(file);
                    output.write(bytes);
                } finally {
                    if (null != output) {
                        output.close();
                    }
                }
                Float happiness = sendPhotoToAzure(file); // Sending a blob (photo) to the Azure Storage
                String photo_url = "https://blindspot.blob.core.windows.net/image/" + file.getName();
                Log.e("Photo_url : ", photo_url);
    //                        Float happiness = getHappiness(photo_url); // Call the Microsoft's Emotion API using the photo url
                Log.e("Happiness: ", Float.toString(happiness));
            }
        });
    }
    });*/

    lastFaceTime = System.currentTimeMillis();

}

From source file:com.robestone.hudson.compactcolumns.CompactColumnsTest.java

public void testLocalizeDate() {
    long time = 1277416568304L;
    doTestLocalizeDate(time, Locale.ENGLISH, "2:56 PM, 6/24/2010");
    doTestLocalizeDate(time, Locale.GERMAN, "14:56, 24.06.2010");
    doTestLocalizeDate(time, Locale.CANADA, "2:56 PM, 24/06/2010");
}

From source file:view.GanttView.java

public Calendar getStartDate(String startDate) {

    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.CANADA);
    try {//  ww  w.j a  v a 2s .  co  m
        cal.setTime(sdf.parse(startDate));
    } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } // all done

    return cal;
}

From source file:org.hdiv.web.servlet.view.freemarker.FreeMarkerViewTests.java

@Test
public void testFreeMarkerViewResolver() throws Exception {
    FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
    configurer.setConfiguration(new FreeMarkerTestConfiguration());

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(new MockServletContext());
    wac.getBeanFactory().registerSingleton("configurer", configurer);
    wac.refresh();//from  ww  w .j  a va  2  s .  c  o m

    FreeMarkerViewResolver vr = new FreeMarkerViewResolver();
    vr.setPrefix("prefix_");
    vr.setSuffix("_suffix");
    vr.setApplicationContext(wac);

    View view = vr.resolveViewName("test", Locale.CANADA);
    assertEquals("Correct view class", FreeMarkerView.class, view.getClass());
    assertEquals("Correct URL", "prefix_test_suffix", ((FreeMarkerView) view).getUrl());

    view = vr.resolveViewName("non-existing", Locale.CANADA);
    assertNull(view);

    view = vr.resolveViewName("redirect:myUrl", Locale.getDefault());
    assertEquals("Correct view class", RedirectView.class, view.getClass());
    assertEquals("Correct URL", "myUrl", ((RedirectView) view).getUrl());

    view = vr.resolveViewName("forward:myUrl", Locale.getDefault());
    assertEquals("Correct view class", InternalResourceView.class, view.getClass());
    assertEquals("Correct URL", "myUrl", ((InternalResourceView) view).getUrl());
}

From source file:hk.idv.kenson.jrconsole.Console.java

/**
 * /*  w w  w  .ja v a  2s. c  o m*/
 * @param localeString
 * @return
 */
private static Locale getLocale(String localeString) {
    if ("default".equals(localeString))
        return Locale.getDefault();
    if ("canada".equals(localeString))
        return Locale.CANADA;
    if ("canada_french".equals(localeString))
        return Locale.CANADA_FRENCH;
    if ("china".equals(localeString))
        return Locale.CHINA;
    if ("chinese".equals(localeString))
        return Locale.CHINESE;
    if ("english".equals(localeString))
        return Locale.ENGLISH;
    if ("franch".equals(localeString))
        return Locale.FRANCE;
    if ("german".equals(localeString))
        return Locale.GERMAN;
    if ("germany".equals(localeString))
        return Locale.GERMANY;
    if ("italian".equals(localeString))
        return Locale.ITALIAN;
    if ("italy".equals(localeString))
        return Locale.ITALY;
    if ("japan".equals(localeString))
        return Locale.JAPAN;
    if ("japanese".equals(localeString))
        return Locale.JAPANESE;
    if ("korea".equals(localeString))
        return Locale.KOREA;
    if ("korean".equals(localeString))
        return Locale.KOREAN;
    if ("prc".equals(localeString))
        return Locale.PRC;
    if ("simplified_chinese".equals(localeString))
        return Locale.SIMPLIFIED_CHINESE;
    if ("taiwan".equals(localeString))
        return Locale.TAIWAN;
    if ("traditional_chinese".equals(localeString))
        return Locale.TRADITIONAL_CHINESE;
    if ("uk".equals(localeString))
        return Locale.UK;
    if ("us".equals(localeString))
        return Locale.US;

    String parts[] = localeString.split("_", -1);
    if (parts.length == 1)
        return new Locale(parts[0]);
    else if (parts.length == 2)
        return new Locale(parts[0], parts[1]);
    else
        return new Locale(parts[0], parts[1], parts[2]);
}

From source file:ca.ualberta.cs.shoven_habittracker.MainActivity.java

public Integer setDateToday(TextView textView) {
    LocalDateTime now = new LocalDateTime(DateTimeZone.forID("Canada/Mountain"));
    textView.setText(now.toString("EEEE, MMMM dd, yyyy", Locale.CANADA));
    return now.getDayOfWeek() % 7;
}

From source file:com.dsi.ant.antplus.pluginsampler.geocache.Dialog_GeoProgramDevice.java

/**
 * Updates the last visit date and time display.
 *//*from w  ww  . jav a  2 s  .  c om*/
public void updateDateAndTime() {
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            SimpleDateFormat df = new SimpleDateFormat("d MMM yyyy", Locale.CANADA);
            df.setTimeZone(TimeZone.getTimeZone("UTC"));
            SimpleDateFormat tf = new SimpleDateFormat("h:mm a", Locale.CANADA);
            tf.setTimeZone(TimeZone.getTimeZone("UTC"));
            Date d = currentDisplayDatetime.getTime();
            textView_LastVisitDate.setText(df.format(d));
            textView_LastVisitTime.setText(tf.format(d));
        }
    });
}