File tree Expand file tree Collapse file tree
java/org/buildmlearn/toolkit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public class ToolkitApplication extends Application {
1818
1919 private static String dir ;
2020
21- private boolean isExternalStorageAvailable = false ;
21+ private static boolean isExternalStorageAvailable = false ;
2222
2323 /**
2424 * @return Folder path
@@ -31,6 +31,10 @@ public static String getUnZipDir() {
3131 @ Override
3232 public void onCreate () {
3333 super .onCreate ();
34+ storagePathsValidate ();
35+ }
36+
37+ public void storagePathsValidate () {
3438 if (checkExternalStorage ()) {
3539 isExternalStorageAvailable = true ;
3640 dir = Environment .getExternalStorageDirectory ().getAbsolutePath ();
@@ -50,8 +54,6 @@ public void onCreate() {
5054 f .mkdirs ();
5155 }
5256 }
53-
54-
5557 }
5658
5759 /**
Original file line number Diff line number Diff line change 11package org .buildmlearn .toolkit .activity ;
2+
23import android .Manifest ;
34import android .app .ProgressDialog ;
45import android .content .Context ;
5556import java .io .IOException ;
5657import java .util .ArrayList ;
5758
58-
5959import javax .xml .parsers .DocumentBuilder ;
6060import javax .xml .parsers .DocumentBuilderFactory ;
6161import javax .xml .parsers .ParserConfigurationException ;
@@ -143,6 +143,22 @@ public void onClick(View v) {
143143 }
144144 }
145145
146+ @ Override
147+ public void onRequestPermissionsResult (int requestCode ,
148+ String permissions [], int [] grantResults ) {
149+ switch (requestCode ) {
150+ case PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE_RESULT : {
151+ if (grantResults .length > 0
152+ && grantResults [0 ] == PackageManager .PERMISSION_GRANTED ) {
153+ ToolkitApplication mToolkitApplication = new ToolkitApplication ();
154+ mToolkitApplication .storagePathsValidate ();
155+ }
156+ return ;
157+ }
158+
159+ }
160+ }
161+
146162 /**
147163 * {@inheritDoc}
148164 */
Original file line number Diff line number Diff line change 250250 <!-- Preference Data-->
251251
252252 <string name =" project_settings" >Project Settings</string >
253- <string name =" key_developer_mode" >debug_key</string >
254253 <string name =" developer_mode" >Developer Mode</string >
255254 <string name =" summary_developer_mode" >Developer mode disables publishing of Apk to BuildmLearn Store.</string >
256255 <string name =" title_user_name" >Enter your name</string >
Original file line number Diff line number Diff line change 22
33<PreferenceScreen xmlns : android =" http://schemas.android.com/apk/res/android" >
44
5- <PreferenceCategory android : title =" @string/project_settings" >
6-
7- <CheckBoxPreference
8- android : key =" @string/key_developer_mode"
9- android : summary =" @string/summary_developer_mode"
10- android : title =" @string/developer_mode" />
11-
12- </PreferenceCategory >
13-
145 <PreferenceCategory android : title =" @string/app_settings" >
156
167 <Preference
You can’t perform that action at this time.
0 commit comments