Commits

Juha Kuitunen committed d7a1608

hard coded strings to xml, part 1 of n

Comments (0)

Files changed (4)

res/values/strings.xml

         <item>critical</item>
         <item>blocker</item>
     </string-array>
+    <string name="AsyncErrorMSG">There was a problem retrieving and/or processing data from Bitbucket.org. Checking your data connectivity and trying again might help.</string>
+    <string name="oops">Oops.</string>
+    <string name="no_branches">No branches found.</string>
+    <string name="no_changesets_error">This repository may have no changesets yet, or another error happened.</string>
+    <string name="changeset">Changeset:</string>
 </resources>

src/com/saibotd/bitbeaker/ChangesetActivity.java

 	private String slug;
 	private String owner;
 
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.changeset);
-        
-        Bundle b = getIntent().getExtras();
-        owner = b.getString("owner");
-        slug = b.getString("slug");
-        try {
+	public void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.changeset);
+
+		Bundle b = getIntent().getExtras();
+		owner = b.getString("owner");
+		slug = b.getString("slug");
+		try {
 			mData = new JSONObject(b.getString("data"));
 		} catch (JSONException e) {
 			// TODO Auto-generated catch block
 		}
 		ActionBar actionBar = getSupportActionBar();
 		setTitle(slug);
-        actionBar.setSubtitle("Changeset: " + changeset_id);
-        setSupportProgressBarIndeterminateVisibility(false);
-    }
+		actionBar.setSubtitle(this.getString(R.string.changeset) + " " + changeset_id);
+		setSupportProgressBarIndeterminateVisibility(false);
+	}
     
     @Override
    	public boolean onCreateOptionsMenu(Menu menu) {

src/com/saibotd/bitbeaker/MyActivity.java

 		System.setProperty("http.keepAlive", "false");
 		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
 	}
-	
+
 	@Override
 	public boolean onOptionsItemSelected(MenuItem item) {
 		switch (item.getItemId()) {
 
 	protected class AsyncLoader extends AsyncTask<String, Integer, String> {
 
-		private String errorMSG = "There was a problem retrieving and/or processing data from Bitbucket.org. Checking your data connectivity and trying again might help.";
+		private String errorMSG = getResources().getString(R.string.AsyncErrorMSG);
 		
 		@Override
 		protected String doInBackground(String... params) {
 			if(result.equals("Fail")){
 				try {
 					alertDialog = new AlertDialog.Builder(MyActivity.this).create();
-					alertDialog.setTitle("Oops.");
+					alertDialog.setTitle(R.string.oops);
 					alertDialog.setMessage(errorMSG);
 					alertDialog.show();
 				} catch (Exception e) {}

src/com/saibotd/bitbeaker/RepositoryActivity.java

     }
     
     private void listBranches() {
-		new AsyncBranchesLoader().execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/" + slug + "/branches", null, "No branches found.");
+		new AsyncBranchesLoader().execute("https://api.bitbucket.org/1.0/repositories/" + owner + "/" + slug + "/branches", null, this.getString(R.string.no_branches));
 	}
     
     protected class AsyncBranchesLoader extends AsyncLoader {
 				e.printStackTrace();
 			}
 			AsyncLoader asyncLoader2 = new AsyncLoader();
-	        asyncLoader2.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/changesets/", null, "This repository may have no changesets yet, or another error happened.");
+			asyncLoader2.execute("https://api.bitbucket.org/1.0/repositories/"+ owner +"/"+ slug +"/changesets/", null, this.getString(R.string.no_changesets_error));
 		} else {
 			findViewById(R.id.changeset_loading).setVisibility(View.GONE);
 			ListView listView = (ListView) findViewById(R.id.repository_changesets);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.