Example usage for java.util Locale KOREA

List of usage examples for java.util Locale KOREA

Introduction

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

Prototype

Locale KOREA

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:com.inducesmile.androidtabwithswipe.RecoBackgroundMonitoringService.java

private void popupNotification(String msg) {
    Log.i("BackMonitoringService", "popupNotification()");
    String currentTime = new SimpleDateFormat("HH:mm:ss", Locale.KOREA).format(new Date());
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    Intent intent = new Intent(RecoBackgroundMonitoringService.this, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent content = PendingIntent.getActivity(RecoBackgroundMonitoringService.this, 0, intent, 0);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.o2)
            .setTicker("")
            .setContentTitle(" ?   ? !")
            .setContentText(" ?    .").setContentIntent(content)
            .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
            .setLights(0xffffffff, 500, 500);

    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    builder.setStyle(inboxStyle);/*www  .j  a v  a2  s. c o m*/
    nm.notify(mNotificationID, builder.build());
    mNotificationID = (mNotificationID - 1) % 1000 + 9000;
}

From source file:io.netty.example.file.FileServerHandler.java

protected String getMonth() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMM", Locale.KOREA);
    Date currentTime = new Date();
    String dMonth = formatter.format(currentTime);
    return dMonth;
}

From source file:com.example.seonoh2.smarttoliet01.beacon.RecoBackgroundMonitoringService.java

private void popupNotification(String msg) {
    Log.i("BackMonitoringService", "popupNotification()");
    String currentTime = new SimpleDateFormat("HH:mm:ss", Locale.KOREA).format(new Date());
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher).setContentTitle(msg + " " + currentTime).setContentText(msg);

    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    builder.setStyle(inboxStyle);/*  w w w  . j  a  v a  2 s . c  o  m*/
    nm.notify(mNotificationID, builder.build());
    mNotificationID = (mNotificationID - 1) % 1000 + 9000;
}

From source file:com.hangulo.powercontact.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // supprot two pane mode
    mTwoPane = getResources().getBoolean(R.bool.two_pane); // two_pane mode check

    // Analytics tracking start
    ((AnalyticsApplication) getApplication()).startTracking();

    // use toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
    setSupportActionBar(toolbar); // ?  

    // setting left drawer
    setleftMenuDrawer(toolbar);// ww w .  j av  a2 s  .com

    mTopFrameLayout = (FrameLayout) findViewById(R.id.top_frame_layout); //   ?
    mTopLayout = (android.support.design.widget.AppBarLayout) findViewById(R.id.layout_toolbar); //  ?? ?
    mProgressCircle = (ProgressBar) findViewById(R.id.loading_circle); // loading circle

    //  ?? ?  ?? . (? ? .)
    mGeocoder = new Geocoder(this, Locale.KOREA); //  public Geocoder (Context context, Locale locale) // why korea??? -=--> ? ?. ? ??.

    mTextDemoMode = (TextView) findViewById(R.id.text_demo_mode);
    mMakeDemoButton = (FloatingActionButton) findViewById(R.id.fab_make_demo);
    mMakeDemoButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            makeDemoData(200);
            getSupportLoaderManager().restartLoader(Constants.POWERCONTACT_LOADER, null, MainActivity.this); // reset Loader

        }
    });

    readDefaultSettings(mPowerContactSettings); //  ? ?. (? ??  .)

    if (savedInstanceState != null) { // ? ? ? ....
        // If we're restoring state after this fragment was recreated then
        // retrieve previous search term and previously selected search
        // result.

        mSearchKeyword = savedInstanceState.getString(QUERY_KEY);
        mPreviousSearchKeyword = mSearchKeyword; // ?
        mPowerContactSettings = savedInstanceState.getParcelable(POWER_CONTACT_SETTINGS_KEY);
        demoCreated = savedInstanceState.getBoolean(DEMO_CREATED_KEY);

        // https://developers.google.com/android/guides/api-client
        mResolvingError = savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false);
        mIsExpandedFragment = savedInstanceState.getBoolean("IS_EXPANDED", false); //  ? ? ?
        // Update the value of mCurrentLocation from the Bundle and update the UI to show the
        // correct latitude and longitude.
        if (savedInstanceState.keySet().contains(LOCATION_KEY)) {
            // Since LOCATION_KEY was found in the Bundle, we can be sure that mCurrentLocation
            // is not null.
            mCurrentLocation = savedInstanceState.getParcelable(LOCATION_KEY);
        }

        // Update the value of mLastUpdateTime from the Bundle and update the UI.
        if (savedInstanceState.keySet().contains(LAST_UPDATED_TIME_STRING_KEY)) {
            mLastUpdateTime = savedInstanceState.getString(LAST_UPDATED_TIME_STRING_KEY);
        }
    }

    Intent intent = getIntent();

    if (intent != null) {
        FROM_WIDGET = intent.getBooleanExtra(Constants.FROM_WIDGET_KEY, false);

        if (FROM_WIDGET) {
            Log.v(LOG_TAG, "From Widget distance");
            setDistance(0.0f); // distance all
            mPowerContactSettings.setDemoMode(false);
        }

    }
    //  ? ??

    toggleDemoMode(mPowerContactSettings.isDemoMode()); // demo mode false!

    buildGoogleApiClient(); //   

    // https://github.com/umano/AndroidSlidingUpPanel/blob/master/demo/src/com/sothree/slidinguppanel/demo/DemoActivity.java
    mMapFragment = (MapViewFragment) getSupportFragmentManager().findFragmentByTag(TAG_FRAGMENT_PANE1);
    mListFragment = (ContactsListFragment) getSupportFragmentManager().findFragmentByTag(TAG_FRAGMENT_PANE2);
    if (mMapFragment == null)
        mMapFragment = new MapViewFragment();

    if (mListFragment == null)
        mListFragment = new ContactsListFragment();

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.contact_map_view_container, mMapFragment, TAG_FRAGMENT_PANE1).commit();
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.contact_list_view_container, mListFragment, TAG_FRAGMENT_PANE2).commit();

}

From source file:com.nbplus.vbroadlauncher.service.BroadcastChatHeadService.java

@Override
public void onInit(int status) {
    Log.d(TAG, "> TTS onInit()");

    if (status != TextToSpeech.SUCCESS) {
        Log.e(TAG, String.format("TextToSpeechManager.onInit(%d) fail!", status));
        Log.d(TAG, "   ??.... ? ??...");
        mText2Speech.shutdown();//w w  w .  j  av  a  2  s  . co  m
        mText2Speech = null;

        // TODO : ? ?????
    } else {
        int result = mText2Speech.setLanguage(Locale.KOREA);
        if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
            Log.e(TAG, String.format("TextToSpeech.setLanguage(%s) fail!", Locale.KOREA.getDisplayName()));

            // TODO : ? ?????
            mText2Speech.shutdown();
            mText2Speech = null;
        } else {
            mText2SpeechHandler.setTextToSpeechObject(mText2Speech);
            mText2SpeechHandler.play(mBroadcastData.getMessage());
        }
    }
}

From source file:com.ds.owl.dsdormitory.RecoBackgroundRangingService.java

private void popupNotification(String msg) {
    Log.i("BackRangingService", "popupNotification()");
    String currentTime = new SimpleDateFormat("HH:mm:ss", Locale.KOREA).format(new Date());
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher).setContentTitle(msg + " " + currentTime).setContentText(msg);

    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    builder.setStyle(inboxStyle);//w w  w .j a  v a  2  s .com
    nm.notify(mNotificationID, builder.build());
    mNotificationID = (mNotificationID - 1) % 1000 + 9000;

}

From source file:com.embedded.dgu.crimenotifier.MyRecoBackgroundRangingService.java

private void popupNotification(String msg) {
    Log.i("BackRangingService", "popupNotification()");
    String currentTime = new SimpleDateFormat("HH:mm:ss", Locale.KOREA).format(new Date());
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setSmallIcon(R.mipmap.ic_launcher)
            .setContentTitle(msg + " " + currentTime).setContentText(msg);

    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    builder.setStyle(inboxStyle);/*from   ww  w.  ja  v a2s.  co  m*/
    nm.notify(mNotificationID, builder.build());
    mNotificationID = (mNotificationID - 1) % 1000 + 9000;
}

From source file:com.a3did.partner.recosample.RecoBackgroundRangingService.java

private void popupNotification(String msg) {
    Log.i("BackRangingService", "popupNotification()");
    String currentTime = new SimpleDateFormat("HH:mm:ss", Locale.KOREA).format(new Date());
    NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.drawable.ic_launcher).setContentTitle(msg + " " + currentTime).setContentText(msg);

    NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
    builder.setStyle(inboxStyle);/*from w  ww  .  j a  va 2 s.c o m*/
    nm.notify(mNotificationID, builder.build());
    mNotificationID = (mNotificationID - 1) % 1000 + 9000;
}

From source file:com.mobile.system.db.abatis.AbatisService.java

/**
 * /* www  .j av a 2 s .  co m*/
 * @param jsonStr
 *            JSON String
 * @param beanClass
 *            Bean class
 * @param basePackage
 *            Base package name which includes all Bean classes
 * @return Object Bean
 * @throws Exception
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object parse(String jsonStr, Class beanClass, String basePackage) throws Exception {
    Object obj = null;
    JSONObject jsonObj = new JSONObject(jsonStr);
    // Check bean object
    if (beanClass == null) {
        Log.d(TAG, "Bean class is null");
        return null;
    }
    // Read Class member fields
    Field[] props = beanClass.getDeclaredFields();
    if (props == null || props.length == 0) {
        Log.d(TAG, "Class" + beanClass.getName() + " has no fields");
        return null;
    }
    // Create instance of this Bean class
    obj = beanClass.newInstance();
    // Set value of each member variable of this object
    for (int i = 0; i < props.length; i++) {
        String fieldName = props[i].getName();
        // Skip public and static fields
        if (props[i].getModifiers() == (Modifier.PUBLIC | Modifier.STATIC)) {
            continue;
        }
        // Date Type of Field
        Class type = props[i].getType();
        String typeName = type.getName();
        // Check for Custom type
        if (typeName.equals("int")) {
            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);
            // Set value
            try {
                m.invoke(obj, jsonObj.getInt(fieldName));
            } catch (Exception ex) {
                Log.d(TAG, ex.getMessage());
            }
        } else if (typeName.equals("long")) {
            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);
            // Set value
            try {
                m.invoke(obj, jsonObj.getLong(fieldName));
            } catch (Exception ex) {
                Log.d(TAG, ex.getMessage());
            }
        } else if (typeName.equals("java.lang.String")) {
            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);
            // Set value
            try {
                m.invoke(obj, jsonObj.getString(fieldName));
            } catch (Exception ex) {
                Log.d(TAG, ex.getMessage());
            }
        } else if (typeName.equals("double")) {
            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);
            // Set value
            try {
                m.invoke(obj, jsonObj.getDouble(fieldName));
            } catch (Exception ex) {
                Log.d(TAG, ex.getMessage());
            }
        } else if (typeName.equals("java.util.Date")) { // modify

            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);

            String dateString = jsonObj.getString(fieldName);
            dateString = dateString.replace(" KST", "");
            SimpleDateFormat genderFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.KOREA);
            // Set value
            try {
                Date afterDate = genderFormat.parse(dateString);
                m.invoke(obj, afterDate);
            } catch (Exception e) {
                Log.d(TAG, e.getMessage());
            }
        } else if (type.getName().equals(List.class.getName())
                || type.getName().equals(ArrayList.class.getName())) {
            // Find out the Generic
            String generic = props[i].getGenericType().toString();
            if (generic.indexOf("<") != -1) {
                String genericType = generic.substring(generic.lastIndexOf("<") + 1, generic.lastIndexOf(">"));
                if (genericType != null) {
                    JSONArray array = null;
                    try {
                        array = jsonObj.getJSONArray(fieldName);
                    } catch (Exception ex) {
                        Log.d(TAG, ex.getMessage());
                        array = null;
                    }
                    if (array == null) {
                        continue;
                    }
                    ArrayList arrayList = new ArrayList();
                    for (int j = 0; j < array.length(); j++) {
                        arrayList.add(parse(array.getJSONObject(j).toString(), Class.forName(genericType),
                                basePackage));
                    }
                    // Set value
                    Class[] parms = { type };
                    Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
                    m.setAccessible(true);
                    m.invoke(obj, arrayList);
                }
            } else {
                // No generic defined
                generic = null;
            }
        } else if (typeName.startsWith(basePackage)) {
            Class[] parms = { type };
            Method m = beanClass.getDeclaredMethod(getBeanMethodName(fieldName, 1), parms);
            m.setAccessible(true);
            // Set value
            try {
                JSONObject customObj = jsonObj.getJSONObject(fieldName);
                if (customObj != null) {
                    m.invoke(obj, parse(customObj.toString(), type, basePackage));
                }
            } catch (JSONException ex) {
                Log.d(TAG, ex.getMessage());
            }
        } else {
            // Skip
            Log.d(TAG, "Field " + fieldName + "#" + typeName + " is skip");
        }
    }
    return obj;
}

From source file:org.apache.zeppelin.zeppelin_spark_monitoring.SparkMonitoringInterpreter.java

/**
 * Get job information//  www.  jav a 2s.c  o  m
 * 
 * @param restUrl
 * @return Result of the get request
 */
private InterpreterResult getJobs(String restUrl) throws Exception {
    // connect to server and get response
    if (isMonitoringServerAvailable) {
        // first, get applications if not existed
        if (mapApplication.get(prefixKey) == null) {
            getApplications("/applications");
        }
        if (mapApplication.get(prefixKey) == null) {
            return new InterpreterResult(InterpreterResult.Code.ERROR, "Error get data from server");
        }

        // get jobs of first application
        SparkMonitoringApplication app = mapApplication.get(prefixKey);
        String applicationId = app.getId();

        // build rest url
        String[] urlItems = StringUtils.split(restUrl, "/");
        // case: /jobs/
        if (urlItems.length == 1) {
            restUrl = "/applications/" + applicationId + restUrl;
        } else if (urlItems.length >= 2) {
            String param = urlItems[1].trim();
            //case param in COMMANDS list
            if (COMMANDS.contains(param)) {
                restUrl = "/applications/" + applicationId + "/jobs/";
            }
            //case /jobs/<job_id>
            else {
                restUrl = "/applications/" + applicationId + restUrl;
            }
        }

        // data
        List<String> lsItem = new LinkedList<String>();
        // connect to server and get data
        CloseableHttpClient client = HttpClients.createDefault();
        String url = "http://" + host + ":" + port + "/api/v1" + restUrl;
        logger.info(url);
        HttpGet request = new HttpGet(url);
        CloseableHttpResponse response = null;
        try {
            response = client.execute(request);
            int code = response.getStatusLine().getStatusCode();
            if (code == HttpStatus.SC_OK) {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    BufferedReader reader = new BufferedReader(
                            new InputStreamReader(entity.getContent(), "UTF-8"));
                    // parse each line
                    String line = "";
                    while ((line = reader.readLine()) != null) {
                        // split by ":"
                        String[] items = line.split(":", 2);
                        if (items.length >= 2) {
                            lsItem.add(items[0].trim().replaceAll("\"", "").replaceAll(",", ""));
                            lsItem.add(items[1].trim().replaceAll("\"", "").replaceAll(",", ""));
                        }
                    }
                }
            }
        } catch (Exception e) {
            logger.info(e.getMessage());
            throw e;
        } finally {
            try {
                if (response != null) {
                    response.close();
                }
            } catch (IOException e) {
                logger.info(e.getMessage());
                throw e;
            }
        }
        int lsItemLength = lsItem.size();
        // create SparkMonitoringJob object
        List<SparkMonitoringJob> lsJob = new ArrayList<SparkMonitoringJob>();
        SparkMonitoringJob job = new SparkMonitoringJob();
        for (int i = 0; i < lsItemLength; i++) {
            String key = lsItem.get(i);
            String value = lsItem.get(++i);
            if ("jobId".equalsIgnoreCase(key)) {
                // start a new job
                job = new SparkMonitoringJob();
                job.setId(value);
            } else if ("name".equalsIgnoreCase(key)) {
                job.setName(value);
            } else if ("description".equalsIgnoreCase(key)) {
                job.setDescription(value);
            } else if ("submissionTime".equalsIgnoreCase(key)) {
                // convert dateTime to current locale
                String dateTimeFormat = sourceDateTimeFormat;
                SimpleDateFormat dateFm = new SimpleDateFormat(dateTimeFormat, Locale.US);
                try {
                    Date dateTime = dateFm.parse(value);
                    dateFm = new SimpleDateFormat(displayDateTimeFormat, Locale.KOREA);
                    job.setSubmissionTime(dateFm.format(dateTime));
                    job.setSubmisstionTimeMilis(dateTime.getTime());
                } catch (ParseException e) {
                }
            } else if ("completionTime".equalsIgnoreCase(key)) {
                // convert dateTime to current locale
                String dateTimeFormat = sourceDateTimeFormat;
                SimpleDateFormat dateFm = new SimpleDateFormat(dateTimeFormat, Locale.US);
                try {
                    Date dateTime = dateFm.parse(value);
                    dateFm = new SimpleDateFormat(displayDateTimeFormat, Locale.KOREA);
                    job.setCompletionTime(dateFm.format(dateTime));
                    job.setCompletionTimeMilis(dateTime.getTime());
                } catch (ParseException e) {
                }
            } else if ("status".equalsIgnoreCase(key)) {
                job.setStatus(value);
            } else if ("numTasks".equalsIgnoreCase(key)) {
                job.setNumTasks(Integer.parseInt(value));
            } else if ("numCompletedTasks".equalsIgnoreCase(key)) {
                job.setNumCompletedTasks(Integer.parseInt(value));
            } else if ("numFailedTasks".equalsIgnoreCase(key)) {
                job.setNumFailedTasks(Integer.parseInt(value));
                //add to list
                lsJob.add(job);
            }
        }
        // check if get job information or get statistic about jobs
        int urlItemLength = urlItems.length;
        if (urlItemLength == 1) {
            return getJobInformation(lsItem, lsJob);
        } else if (urlItemLength >= 2) {
            String command = urlItems[1];
            if (!COMMANDS.contains(command)) {
                return getJobInformation(lsItem, lsJob);
            } else {
                return getJobStatistic(urlItems, lsJob);
            }
        }

    }

    return new InterpreterResult(InterpreterResult.Code.ERROR, "Error get data from server");
}