40
40
public class MainActivity extends AppCompatActivity {
41
41
42
42
private AppCompatImageButton mSettings ;
43
- private boolean mDeveloperMode = false ;
44
43
private boolean mExit ;
45
44
private Handler mHandler = new Handler ();
46
45
private ViewPager mViewPager ;
@@ -163,29 +162,24 @@ private void settingsMenu() {
163
162
kernel .add (Menu .NONE , 3 , Menu .NONE , getString (R .string .donations ));
164
163
}
165
164
}
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 ));
176
170
}
177
171
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 ));
180
174
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 ));
185
179
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 ));
187
181
}
188
- app .add (Menu .NONE , 6 , Menu .NONE , getString (R .string .about ));
182
+ app .add (Menu .NONE , 15 , Menu .NONE , getString (R .string .about ));
189
183
popupMenu .setOnMenuItemClickListener (item -> {
190
184
switch (item .getItemId ()) {
191
185
case 0 :
@@ -205,64 +199,57 @@ private void settingsMenu() {
205
199
launchURL (KP .getDonation ());
206
200
break ;
207
201
case 4 :
208
- launchURL ("https://t.me/smartpack_kmanager" );
202
+ Intent createProfile = new Intent (this , CreateProfileActivity .class );
203
+ startActivity (createProfile );
209
204
break ;
210
205
case 5 :
211
- changeLogDialogue (this );
206
+ Intent createConfig = new Intent (this , CreateConfigActivity .class );
207
+ startActivity (createConfig );
212
208
break ;
213
209
case 6 :
214
- aboutDialogue (this );
210
+ Intent editConfig = new Intent (this , EditConfigActivity .class );
211
+ startActivity (editConfig );
215
212
break ;
216
213
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 );
219
221
break ;
220
222
case 8 :
221
- Intent createConfig = new Intent (this , CreateConfigActivity .class );
222
- startActivity (createConfig );
223
+ launchURL ("https://t.me/smartpack_kmanager" );
223
224
break ;
224
225
case 9 :
225
226
launchURL ("https://github.com/SmartPack/KernelProfiler/" );
226
227
break ;
227
228
case 10 :
228
- launchURL ("https://github.com/SmartPack/KernelProfiler/issues/new " );
229
+ launchURL ("https://github.com/SmartPack/KernelProfiler/wiki " );
229
230
break ;
230
231
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 :
231
241
new AlertDialog .Builder (this )
232
242
.setIcon (R .mipmap .ic_launcher )
233
243
.setTitle (getString (R .string .support_developer ))
234
244
.setMessage (getString (R .string .support_developer_message ))
235
245
.setNeutralButton (getString (R .string .cancel ), (dialog1 , id1 ) -> {
236
246
})
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" ))
240
249
.show ();
241
250
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 ;
255
251
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 );
266
253
break ;
267
254
}
268
255
return false ;
@@ -278,6 +265,16 @@ private void launchURL(String url) {
278
265
}
279
266
}
280
267
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
+
281
278
private void restartApp () {
282
279
Intent intent = new Intent (this , MainActivity .class );
283
280
intent .addFlags (Intent .FLAG_ACTIVITY_CLEAR_TOP );
0 commit comments