/**
  * Command button action save
  *
  * @param v
  */
 public void save_preferences(View v) {
   Preferences.getInstance().setWorkMode(set_cmd_connection_work.isChecked());
   Preferences.getInstance().setOnlineTileServer(set_txt_layer_online.getText().toString());
   Preferences.getInstance().setOfflineTileServer(set_txt_layer_offline.getText().toString());
   Preferences.getInstance().save();
   Toast.makeText(this, "Preferences saved", Toast.LENGTH_SHORT).show();
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_settings);
   try {
     // Load preferences
     Preferences.init(getSharedPreferences(Preferences.NAME, Context.MODE_PRIVATE));
     // Init controls
     set_cmd_connection_work = (Switch) findViewById(R.id.set_cmd_connection_work);
     set_txt_layer_online = (EditText) findViewById(R.id.set_txt_layer_online);
     set_txt_layer_offline = (EditText) findViewById(R.id.set_txt_layer_offline);
     // Load values
     set_cmd_connection_work.setChecked(Preferences.getInstance().getWorkMode());
     set_txt_layer_online.setText(Preferences.getInstance().getOnlineTileServer());
     set_txt_layer_offline.setText(Preferences.getInstance().getOfflineTileServer());
   } catch (Exception e) {
     Log.d("ACT", e.getMessage());
   }
 }