5454
5555/**
5656 * @brief Placeholder activity for all the templates
57- *
57+ * <p/>
5858 * A placeholder activty in which all the templates are loaded and allows the user to enter respective template
5959 * data, generate and save projects, APKs and sharing options.
6060 */
@@ -72,6 +72,7 @@ public class TemplateEditor extends AppCompatActivity {
7272 private View selectedView = null ;
7373 private ToolkitApplication toolkit ;
7474 private String oldFileName ;
75+ private MaterialDialog mApkGenerationDialog ;
7576
7677
7778 /**
@@ -138,7 +139,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) {
138139 /**
139140 * @param adapter Adapter containing template data
140141 * @brief Populates ListView item by setting adapter to ListView. Also inflates Header View.
141- *
142+ * <p/>
142143 * Header view contains the editable author name and template title fields.
143144 */
144145 protected void populateListView (final BaseAdapter adapter ) {
@@ -323,7 +324,7 @@ public void onClick(DialogInterface dialog, int id) {
323324 break ;
324325 case R .id .save_apk :
325326 String savedFilePath = saveProject ();
326- if (savedFilePath == null || savedFilePath .length () == 0 ){
327+ if (savedFilePath == null || savedFilePath .length () == 0 ) {
327328 return ;
328329 }
329330 String keyPassword = getString (R .string .key_password );
@@ -332,16 +333,26 @@ public void onClick(DialogInterface dialog, int id) {
332333 KeyStoreDetails keyStoreDetails = new KeyStoreDetails ("TestKeyStore.jks" , keyPassword , aliasName , aliaspassword );
333334 SignerThread signer = new SignerThread (getApplicationContext (), selectedTemplate .getApkFilePath (), saveProject (), keyStoreDetails , selectedTemplate .getAssetsFilePath (), selectedTemplate .getAssetsFileName ());
334335
336+ mApkGenerationDialog = new MaterialDialog .Builder (TemplateEditor .this )
337+ .title (R .string .apk_progress_dialog )
338+ .content (R .string .apk_msg )
339+ .progress (true , 0 )
340+ .show ();
341+
335342 signer .setSignerThreadListener (new SignerThread .OnSignComplete () {
336343 @ Override
337344 public void onSuccess () {
338345 Log .d (TAG , "APK generated" );
346+ mApkGenerationDialog .dismiss ();
347+
339348 }
340349
341350 @ Override
342351 public void onFail (Exception e ) {
343352 if (e != null ) {
344353 e .printStackTrace ();
354+ mApkGenerationDialog .dismiss ();
355+ Toast .makeText (TemplateEditor .this , "Build unsuccessful" , Toast .LENGTH_SHORT ).show ();
345356 }
346357 }
347358 });
@@ -374,7 +385,7 @@ public void restoreSelectedView() {
374385
375386 /**
376387 * @brief Changes the color scheme when switching from normal mode to edit mode.
377- *
388+ * <p/>
378389 * Edit mode is triggered, when the list item is long pressed.
379390 */
380391 public void changeColorScheme () {
@@ -396,7 +407,7 @@ public void changeColorScheme() {
396407
397408 /**
398409 * @brief Restores the color scheme when switching from edit mode to normal mode.
399- *
410+ * <p/>
400411 * Edit mode is triggered, when the list item is long pressed.
401412 */
402413 public void restoreColorScheme () {
@@ -488,7 +499,7 @@ protected String saveProject() {
488499
489500 /**
490501 * @brief Start the simulator activity
491- *
502+ * <p/>
492503 * Start the simulator with the fragment returned by the selected template. Simulator is started as a new activity.
493504 */
494505 protected void startSimulator () {
@@ -507,7 +518,7 @@ protected void startSimulator() {
507518 /**
508519 * @param path Path of the existing .buildmlearn file
509520 * @brief Converts an existing .buildmlearn file to TemplateInterface Object
510- *
521+ * <p/>
511522 * This function is used in loading existing files to editor. Reads file at a given path, parse the
512523 * file and convert into and convert it into TemplateInterface object.
513524 */
0 commit comments