Skip to content
This repository was archived by the owner on Dec 17, 2020. It is now read-only.

Commit 175d092

Browse files
committed
Added method to the library to obtain it's version.
1 parent d49073a commit 175d092

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

demo/src/main/java/org/neotech/app/retainabletasksdemo/activity/Main.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.neotech.app.retainabletasksdemo.R;
2222
import org.neotech.library.retainabletasks.Task;
2323
import org.neotech.library.retainabletasks.TaskAttach;
24+
import org.neotech.library.retainabletasks.TaskManager;
2425
import org.neotech.library.retainabletasks.TaskPostExecute;
2526
import org.neotech.library.retainabletasks.providers.TaskActivityCompat;
2627

@@ -40,6 +41,8 @@ protected void onCreate(Bundle savedInstanceState) {
4041
super.onCreate(savedInstanceState);
4142
setContentView(R.layout.activity_main);
4243

44+
getSupportActionBar().setSubtitle(getString(R.string.library_version, TaskManager.getVersionName()));
45+
4346
vSwitcher = (ViewSwitcher) findViewById(R.id.switcher);
4447
list = (ListView) findViewById(android.R.id.list);
4548

demo/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
<string name="menu_github">View on GitHub</string>
3434

35+
<string name="library_version">Library version: %1$s</string>
3536

3637
<string name="demo_fragments_title">Fragment TaskManager</string>
3738
<string name="demo_fragments_description">"<![CDATA[This demonstration shows how individual Fragments use the <code>TaskManager</code> class to start and manage <code>Tasks</code>. Each Fragment extends from the <code>TaskFragmentCompat</code> class, which means that each Fragment has it's own <code>TaskManager</code> instance. <code>Task</code> results are only delivered to the Fragment if it is currently attached to the Activity.]]>"</string>
@@ -45,7 +46,6 @@
4546
<string name="demo_annotations_title">Annotations example</string>
4647
<string name="demo_annotations_description">"<![CDATA[This demonstration shows an Activity which extends <code>TaskActivityCompat</code> and uses Annotations to receive <code>Task</code> lifecycle events like <code>onPostExecute</code>.]]>"</string>
4748

48-
4949
<string name="demo_serial_title">Serial execution</string>
5050
<string name="demo_serial_description">"<![CDATA[By default <code>Tasks</code> are executed using a parallel Executor. This demonstration shows how <code>Tasks</code> can be executed in serial using the <code>TaskManager.execute(Task, Callback, Executor)</code> method.]]>"</string>
5151

library/src/main/java/org/neotech/library/retainabletasks/TaskManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,12 @@ public static TaskManager getGlobalTaskManager(){
284284
return globalInstance;
285285
}
286286
}
287+
288+
/**
289+
* Returns the version of the library.
290+
* @return the version name of the library.
291+
*/
292+
public static String getVersionName(){
293+
return BuildConfig.VERSION_NAME;
294+
}
287295
}

0 commit comments

Comments
 (0)