4040public class MainActivity extends AppCompatActivity {
4141
4242 private AppCompatImageButton mSettings ;
43- private boolean mDeveloperMode = false ;
4443 private boolean mExit ;
4544 private Handler mHandler = new Handler ();
4645 private ViewPager mViewPager ;
@@ -163,29 +162,24 @@ private void settingsMenu() {
163162 kernel .add (Menu .NONE , 3 , Menu .NONE , getString (R .string .donations ));
164163 }
165164 }
166- if (mDeveloperMode ) {
167- SubMenu tools = menu .addSubMenu (Menu .NONE , 0 , Menu .NONE , getString (R .string .tools_developer ));
168- tools .add (Menu .NONE , 7 , Menu .NONE , getString (R .string .create_profile ));
169- tools .add (Menu .NONE , 8 , Menu .NONE , getString (R .string .create_config ));
170- if (KP .supported ()) {
171- tools .add (Menu .NONE , 12 , Menu .NONE , getString (R .string .edit_config ));
172- }
173- } else {
174- menu .add (Menu .NONE , 13 , Menu .NONE , getString (R .string .developer_mode )).setCheckable (true )
175- .setChecked (mDeveloperMode );
165+ SubMenu tools = menu .addSubMenu (Menu .NONE , 0 , Menu .NONE , getString (R .string .tools_developer ));
166+ tools .add (Menu .NONE , 4 , Menu .NONE , getString (R .string .create_profile ));
167+ tools .add (Menu .NONE , 5 , Menu .NONE , getString (R .string .create_config ));
168+ if (KP .supported ()) {
169+ tools .add (Menu .NONE , 6 , Menu .NONE , getString (R .string .edit_config ));
176170 }
177171 SubMenu app = menu .addSubMenu (Menu .NONE , 0 , Menu .NONE , getString (R .string .app_about ));
178- app .add (Menu .NONE , 15 , Menu .NONE , getString (R .string .share ));
179- app .add (Menu .NONE , 4 , Menu .NONE , getString (R .string .support ));
172+ app .add (Menu .NONE , 7 , Menu .NONE , getString (R .string .share ));
173+ app .add (Menu .NONE , 8 , Menu .NONE , getString (R .string .support ));
180174 app .add (Menu .NONE , 9 , Menu .NONE , getString (R .string .source_code ));
181- app .add (Menu .NONE , 16 , Menu .NONE , getString (R .string .documentation ));
182- app .add (Menu .NONE , 14 , Menu .NONE , getString (R .string .more_apps ));
183- app .add (Menu .NONE , 10 , Menu .NONE , getString (R .string .report_issue ));
184- app .add (Menu .NONE , 5 , Menu .NONE , getString (R .string .change_logs ));
175+ app .add (Menu .NONE , 10 , Menu .NONE , getString (R .string .documentation ));
176+ app .add (Menu .NONE , 11 , Menu .NONE , getString (R .string .more_apps ));
177+ app .add (Menu .NONE , 12 , Menu .NONE , getString (R .string .report_issue ));
178+ app .add (Menu .NONE , 13 , Menu .NONE , getString (R .string .change_logs ));
185179 if (Utils .isNotDonated (this )) {
186- app .add (Menu .NONE , 11 , Menu .NONE , getString (R .string .donations ));
180+ app .add (Menu .NONE , 14 , Menu .NONE , getString (R .string .donations ));
187181 }
188- app .add (Menu .NONE , 6 , Menu .NONE , getString (R .string .about ));
182+ app .add (Menu .NONE , 15 , Menu .NONE , getString (R .string .about ));
189183 popupMenu .setOnMenuItemClickListener (item -> {
190184 switch (item .getItemId ()) {
191185 case 0 :
@@ -205,64 +199,57 @@ private void settingsMenu() {
205199 launchURL (KP .getDonation ());
206200 break ;
207201 case 4 :
208- launchURL ("https://t.me/smartpack_kmanager" );
202+ Intent createProfile = new Intent (this , CreateProfileActivity .class );
203+ startActivity (createProfile );
209204 break ;
210205 case 5 :
211- changeLogDialogue (this );
206+ Intent createConfig = new Intent (this , CreateConfigActivity .class );
207+ startActivity (createConfig );
212208 break ;
213209 case 6 :
214- aboutDialogue (this );
210+ Intent editConfig = new Intent (this , EditConfigActivity .class );
211+ startActivity (editConfig );
215212 break ;
216213 case 7 :
217- Intent createProfile = new Intent (this , CreateProfileActivity .class );
218- startActivity (createProfile );
214+ Intent share = new Intent ();
215+ share .setAction (Intent .ACTION_SEND );
216+ share .putExtra (Intent .EXTRA_SUBJECT , getString (R .string .app_name ) + " " + BuildConfig .VERSION_NAME );
217+ share .putExtra (Intent .EXTRA_TEXT , getString (R .string .share_message ));
218+ share .setType ("text/plain" );
219+ Intent shareIntent = Intent .createChooser (share , null );
220+ startActivity (shareIntent );
219221 break ;
220222 case 8 :
221- Intent createConfig = new Intent (this , CreateConfigActivity .class );
222- startActivity (createConfig );
223+ launchURL ("https://t.me/smartpack_kmanager" );
223224 break ;
224225 case 9 :
225226 launchURL ("https://github.com/SmartPack/KernelProfiler/" );
226227 break ;
227228 case 10 :
228- launchURL ("https://github.com/SmartPack/KernelProfiler/issues/new " );
229+ launchURL ("https://github.com/SmartPack/KernelProfiler/wiki " );
229230 break ;
230231 case 11 :
232+ launchPS ("https://play.google.com/store/apps/dev?id=5836199813143882901" );
233+ break ;
234+ case 12 :
235+ launchURL ("https://github.com/SmartPack/KernelProfiler/issues/new" );
236+ break ;
237+ case 13 :
238+ changeLogDialogue (this );
239+ break ;
240+ case 14 :
231241 new AlertDialog .Builder (this )
232242 .setIcon (R .mipmap .ic_launcher )
233243 .setTitle (getString (R .string .support_developer ))
234244 .setMessage (getString (R .string .support_developer_message ))
235245 .setNeutralButton (getString (R .string .cancel ), (dialog1 , id1 ) -> {
236246 })
237- .setPositiveButton (getString (R .string .donation_app ), (dialogInterface , i ) -> {
238- Utils .launchUrl ("https://play.google.com/store/apps/details?id=com.smartpack.donate" , this );
239- })
247+ .setPositiveButton (getString (R .string .donation_app ), (dialogInterface , i ) -> launchPS (
248+ "https://play.google.com/store/apps/details?id=com.smartpack.donate" ))
240249 .show ();
241250 break ;
242- case 12 :
243- Intent editConfig = new Intent (this , EditConfigActivity .class );
244- startActivity (editConfig );
245- break ;
246- case 13 :
247- mDeveloperMode = true ;
248- Utils .snackbar (mViewPager , getString (R .string .developer_mode_message ));
249- break ;
250- case 14 :
251- Intent ps = new Intent (Intent .ACTION_VIEW );
252- ps .setData (Uri .parse ("https://play.google.com/store/apps/dev?id=5836199813143882901" ));
253- startActivity (ps );
254- break ;
255251 case 15 :
256- Intent share = new Intent ();
257- share .setAction (Intent .ACTION_SEND );
258- share .putExtra (Intent .EXTRA_SUBJECT , getString (R .string .app_name ) + " " + BuildConfig .VERSION_NAME );
259- share .putExtra (Intent .EXTRA_TEXT , getString (R .string .share_message ));
260- share .setType ("text/plain" );
261- Intent shareIntent = Intent .createChooser (share , null );
262- startActivity (shareIntent );
263- break ;
264- case 16 :
265- launchURL ("https://github.com/SmartPack/KernelProfiler/wiki" );
252+ aboutDialogue (this );
266253 break ;
267254 }
268255 return false ;
@@ -278,6 +265,16 @@ private void launchURL(String url) {
278265 }
279266 }
280267
268+ private void launchPS (String url ) {
269+ if (Utils .isNetworkUnavailable (this )) {
270+ Utils .snackbar (mViewPager , getString (R .string .no_internet ));
271+ } else {
272+ Intent intent = new Intent (Intent .ACTION_VIEW );
273+ intent .setData (Uri .parse (url ));
274+ startActivity (intent );
275+ }
276+ }
277+
281278 private void restartApp () {
282279 Intent intent = new Intent (this , MainActivity .class );
283280 intent .addFlags (Intent .FLAG_ACTIVITY_CLEAR_TOP );
0 commit comments