summaryrefslogblamecommitdiffstats
path: root/app/src/main/java/com/xc3fff0e/xmanager/MainActivity.java
blob: 20619d16a5b56123d1f4c503d9eb4dadea76bbaa (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877

                               
                                             
                                                 
                              





                            
                              
                           
                                    


                        
                             




                                 
                          
                    
                   



                                    

                                                                                

                                 
                              
                                













                                                        



                                                          




                                                        

                                      



                                                        
                                  





                                              




                                            

                                                         












                                                                             



                                           

                                    






                                                                                   
                                                 
                                              
                                                        







                                             
                                                 
                                                 


                                          

                                         


                                                 

                                                      

















                                                     




































                                                    







                                                  


























































































































                                                                                               

                                                                             

                                                                                                       

                                           





                                                                                         




                                                        



                                                              
                                                 
                                                                     



















                                                                                                                                                                             
                                                                                             
                                                                                       
                                                                                                   







                                                                                   
                                                                                           
                                                                                           


                                                                             

                                                                           


                                                                                           

                                                                                                     

















                                                                                                   




































                                                                                                 







                                                                                                 
















































































































                                                                                                




                                                                                                            



                                                                           


                                                                                                   

                                                                              

                                                                     
                                                                    
                                                                  















                                                                                                                                                                            





























                                                                                                                                                                             













                                                                                                                                                                                                                                                         





























































































                                                                                                                                                                                                                     






































                                                                                                                                                                                                        


                                                                                        


                                                                                                                

                                                                                 

                                                                        
                                                                     

                                                                  











































                                                                                                                                                                                                                                  









                                                                                                                                                                      







                                                                                                                             


























                                                                                                       


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                























                                                                                                                                 


                                                                                                                                                                        










                                                                                               


                                                                                                                                                                                










                                                                                                       


                                                                                                                                                                                        










                                                                                                               


                                                                                                                                                                                                










                                                                                                                       


                                                                                                                                                                                                        










                                                                                                                               


                                                                                                                                                                                                                










                                                                                                                                       


                                                                                                                                                                                                                        










                                                                                                                                                                                    


                                                                                                                                                                                                                                

















                                                                                                                                 
                                                                             
                                  







                                                                                                                     
                                 















                                                                                                       



                                                                        
                                             



























                                                                                                                                                                                             
                                                                                                                     


































































                                                                                                                                                                                             



                                                                                                                                                                                                 
                                                                                       

                                               
                                                                                      


                                                                                                                































                                                                                                                                                                                             
                                                                                                                     


































































                                                                                                                                                                                             



                                                                                                                                                                                                 
                                                                                       

                                               
                                                                                      


                                                                                                                






















                                                                                                            







                                                                                                                                                                     












                                                                                                                                                                                 







                                                                                                                                                                           












                                                                                                                                                                                            







                                                                                                                                                                          


















































                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                    


















                                                                                                                    
                                                                                                                                                                                                         



























                                                                                                                       







                                                                                                                                                                  























































































                                                                                                                                                                                                                                                                                                                                                                                                                                                              


                                                                                                  

                                                                               








                                                                                      
                                                                                                                  

                                                                  
                                                                                          














                                                                                                                                                                     
                                                                                         





















                                                                                                                                                                     
                                                                                          












                                                                                                
                                                                         






                                                                               
                                                                                                          



































































































































































                                                                                                                                                                     













                                                                                                                                                                                                










































































































                                                                                                                                                                     
                                                                           















































































                                                                                                                                                                     
                                                                           






























                                                                                                                                             
         












                                                                                           
                 
























                                                                          
                                                                                                                                                                











                                               
                                       









































                                                                                                                                                                                                 
                                                                                               



                                              
                                                                        


















                                                                                                                                                   
                                                                                                                                                      









































































                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                            






                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                              



                                                                                                                                                                                                                          


                                                                                                                                                               














































                                                                                                                                                                                                                                                                                                                                                                                                                                 


                                                                                                                                                               




































                                                                                                                                                                                                                                                                 
                                       


                                                                                                                                                 


                                                                                                                          





                                                                                                        
                                         








                                                                                                                                                 
                                   

















































                                                                                                               




















                                                                                                                                                                                                               





                                                              













                                                                                                                                                                                                                   










































































                                                                                                                                                                               
                                                                                                                                


                                                                                                                     
                                                                                                                    



                                                                          
                                                                                    



















                                                                                                                                                                     
                                                                                         





                                                                                               
                                                                                                                                


                                                                                                                     
                                                                                                                    





                                                                                                                               


                                                                                                                                                    
                                                                                                                                                    





                                                                                                                                                               
                                                                                                                                                                                          








                                                                                                                                                                                     
                                                                                                                                                    



                                                                                                          
                                                                                                                    



                                                                          




























































                                                                                                                                                                     




                                                                                                




















                                                                                                                                                                                             



                                                                                    








                                                                                                                                                            
                                                                         














                                                                                                                                                                     





























                                                                                                                                                                     
                                                                                                                          










































































                                                                                                                                                                     
                                                                               
                                                                            
                                                                                 



                                                                        





                                                                                                                                                            














                                                                                                                                                                             

                                                                  














































































































































































































































































                                                                                                                                                                                                               




                          
                                  
















                                                                                                                                                             








                                                                                                                                                                                                                                 
                                                                          



                                                                                                                                                                                                                                 
                                                                          
                                                                                           
                                                                  
                                                                                     
                                                                  
































                                                                                                                                      







































                                                                                                                                                                                    
                                        




























                                                                                                                                                                              
                                                                               












































































































                                                                                                                                                                                                                                                                                                                   


                                                                                                                                                               














































                                                                                                                                                                                                                                                                                                                                                                                                                                 


                                                                                                                                                               




































                                                                                                                                                                                                                                                                 
                                  




                                                
                                                                  















































































































































































































                                                                                                                                                                               
                                          




















                                                                                                                                                              
                                      


































                                                                                                         
                                      





                                                                                                         
                                                                  


                                                                                                         
                                                                  




                                                                                                         























                                                                                                          


          
                                      


















































                                                                                                         
                                      






























                                                                                                          
                                      






















                                                                                                         
                                          





                                                                                        
                                                                                                                 












































                                                                                              
                                      


                                                             
                                                        







                                                                       

                                                                  


          


                                                                         
                              


                                                                                                      
                                                  






                                                                                                                                                                     
                                                          





                                                                                             
                                                                  

                                                                                               

                                                                                            




                                                                                                                                
                                                                          
                                                                    
                                                          

                                                                                    
                                          

                                                                                                
                                          

                                                                                                       
                                                  














                                                                                                                                                                     
                                                                  

                                                                                               
                                                                                  





                                                                                                                                





                                                                                                                               




















                                                                                                                                                                                          



                                                                                                          
                                                                                                                    

                                                                          
                                                          















                                                                                                                                                                     
                                                          


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                 









                                                                                                                                 
                                      
















                                                                                        





































                                                                                                                           
package com.xc3fff0e.xmanager;

import com.xc3fff0e.xmanager.SplashActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.annotation.*;
import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.content.*;
import android.content.res.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.media.*;
import android.net.*;
import android.text.*;
import android.text.style.*;
import android.util.*;
import android.webkit.*;
import android.animation.*;
import android.view.animation.*;
import java.util.*;
import java.util.regex.*;
import java.text.*;
import org.json.*;
import java.util.HashMap;
import java.util.ArrayList;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener;
import android.widget.TextView;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.app.AlertDialog;
import android.content.DialogInterface;
import java.util.Timer;
import java.util.TimerTask;
import android.content.Intent;
import android.net.Uri;
import android.app.Activity;
import android.content.SharedPreferences;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.GenericTypeIndicator;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.messaging.FirebaseMessaging;
import androidx.core.content.FileProvider;
import java.io.File;
import android.widget.CompoundButton;
import android.view.View;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import android.text.Editable;
import android.text.TextWatcher;
import android.graphics.Typeface;
import android.content.ClipData;
import android.content.ClipboardManager;
import com.wuyr.rippleanimation.*;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.DialogFragment;
import androidx.core.content.ContextCompat;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.content.pm.PackageManager;


public class MainActivity extends  AppCompatActivity  { 
	
	private Timer _timer = new Timer();
	private FirebaseDatabase _firebase = FirebaseDatabase.getInstance();
	
	private String SUB_A = "";
	private String SUB_B = "";
	private String SUB_X = "";
	private String SUB_Y = "";
	private double CHECK = 0;
	private String Latest_Version = "";
	private String Current_Version = "";
	private String Package_Name = "";
	private HashMap<String, Object> Versions = new HashMap<>();
	private String Regular_Title = "";
	private String Regular_Link = "";
	private String Amoled_Title = "";
	private String Amoled_Link = "";
	private String PATH = "";
	private String ACCENT = "";
	
	private ArrayList<HashMap<String, Object>> listdata = new ArrayList<>();
	private ArrayList<HashMap<String, Object>> Versions_1 = new ArrayList<>();
	private ArrayList<HashMap<String, Object>> others = new ArrayList<>();
	
	private LinearLayout box_header;
	private LinearLayout main_body_optimization;
	private ScrollView main_scroll_settings;
	private ScrollView main_scroll_about;
	private SwipeRefreshLayout main_refresh_layout;
	private TextView title_header;
	private LinearLayout box_header_tab;
	private LinearLayout box_switch;
	private LinearLayout box_update;
	private ImageView icon_switch;
	private ImageView icon_update;
	private TextView hidden_download;
	private TextView app_changelogs;
	private LinearLayout main_body_settings;
	private LinearLayout box_settings_close;
	private LinearLayout main_box_8;
	private LinearLayout main_box_11;
	private LinearLayout main_box_12;
	private LinearLayout main_box_7;
	private LinearLayout main_box_5;
	private LinearLayout main_box_9;
	private LinearLayout main_box_10;
	private LinearLayout box_reset_settings;
	private LinearLayout box_settings_icon_close;
	private ImageView settings_icon_close;
	private LinearLayout box_8_sub_1;
	private LinearLayout box_8_sub_2;
	private TextView list_auto_refresh;
	private LinearLayout box_list_auto_refresh;
	private Switch list_auto_refresh_switch;
	private TextView list_auto_refresh_info;
	private LinearLayout box_11_sub_1;
	private LinearLayout box_11_sub_2;
	private TextView force_auto_install;
	private LinearLayout box_force_auto_install;
	private Switch force_auto_install_switch;
	private TextView force_auto_install_info;
	private LinearLayout box_12_sub_1;
	private LinearLayout box_12_sub_2;
	private TextView copy_url_mode;
	private LinearLayout box_copy_url_mode;
	private Switch copy_url_mode_switch;
	private TextView copy_file_url_mode_info;
	private LinearLayout box_7_sub_1;
	private TextView navigation_bar;
	private LinearLayout box_navigation_switch;
	private Switch navigation_switch;
	private LinearLayout box_5_sub_1;
	private LinearLayout box_5_sub_2;
	private TextView theme;
	private LinearLayout box_theme_switch;
	private Switch theme_switch;
	private LinearLayout box_theme_0;
	private LinearLayout box_theme_1;
	private LinearLayout box_theme_2;
	private LinearLayout box_theme_3;
	private LinearLayout box_theme_4;
	private LinearLayout box_theme_5;
	private LinearLayout box_theme_6;
	private TextView green_theme;
	private LinearLayout box_green_switch;
	private Switch green_switch;
	private TextView purple_theme;
	private LinearLayout box_purple_switch;
	private Switch purple_switch;
	private TextView red_theme;
	private LinearLayout box_red_switch;
	private Switch red_switch;
	private TextView blue_theme;
	private LinearLayout box_blue_switch;
	private Switch blue_switch;
	private TextView orange_theme;
	private LinearLayout box_orange_switch;
	private Switch orange_switch;
	private TextView yellow_theme;
	private LinearLayout box_yellow_switch;
	private Switch yellow_switch;
	private TextView gray_theme;
	private LinearLayout box_gray_switch;
	private Switch gray_switch;
	private LinearLayout box_9_sub_1;
	private LinearLayout box_9_sub_2;
	private TextView apk_location;
	private EditText apk_path_location;
	private TextView apk_location_info;
	private LinearLayout box_10_sub_1;
	private TextView clear_directory_folders;
	private TextView reset_settings;
	private LinearLayout main_body_about;
	private LinearLayout box_about_close;
	private LinearLayout box_about_header;
	private LinearLayout box_about_sub;
	private LinearLayout box_about_1;
	private LinearLayout box_about_2;
	private LinearLayout box_about_3;
	private LinearLayout box_about_4;
	private LinearLayout box_about_5;
	private LinearLayout box_about_6;
	private LinearLayout box_about_7;
	private TextView contributors_1;
	private LinearLayout box_icon_close;
	private ImageView icon_close;
	private TextView title_about;
	private TextView app_version;
	private TextView sub_title;
	private TextView developer_manager;
	private TextView developer_1;
	private TextView developer_spotify;
	private TextView developer_2;
	private TextView support_team;
	private TextView support_1;
	private TextView mod_testers;
	private TextView testers_1;
	private TextView mobilism_team;
	private TextView mobilism_1;
	private TextView forum_team;
	private TextView forum_1;
	private TextView manager_team;
	private TextView manager_1;
	private LinearLayout main_body;
	private LinearLayout main_box_1;
	private LinearLayout main_box_2;
	private LinearLayout main_box_6;
	private LinearLayout box_sub_header;
	private LinearLayout main_box_4;
	private LinearLayout box_1;
	private LinearLayout box_2;
	private ListView list_menu_1;
	private TextView title_1;
	private LinearLayout box_1_sub;
	private TextView sub_text_1;
	private TextView sub_1;
	private TextView sub_text_2;
	private TextView sub_2;
	private LinearLayout box_switch_1;
	private Switch version_switch_1;
	private LinearLayout box_3;
	private LinearLayout box_4;
	private ListView list_menu_2;
	private TextView title_2;
	private LinearLayout box_3_sub;
	private TextView sub_text_3;
	private TextView sub_3;
	private TextView sub_text_4;
	private TextView sub_4;
	private LinearLayout box_switch_2;
	private Switch version_switch_2;
	private LinearLayout box_6_sub_1;
	private LinearLayout box_6_sub_2;
	private TextView changelogs;
	private LinearLayout box_changelogs;
	private Switch changelogs_switch;
	private LinearLayout box_changelogs_1;
	private TextView changelogs_x;
	private LinearLayout box_sub_1;
	private LinearLayout box_sub_2;
	private TextView title_sub;
	private LinearLayout box_cpu;
	private TextView device_cpu;
	private TextView cpu;
	private LinearLayout box_uninstall;
	private LinearLayout box_settings;
	private LinearLayout box_cache;
	private LinearLayout box_open;
	private ImageView icon_uninstall;
	private ImageView icon_settings;
	private ImageView icon_cache;
	private ImageView icon_open;
	private LinearLayout box_source;
	private LinearLayout box_support;
	private LinearLayout box_donate;
	private LinearLayout box_about;
	private TextView source;
	private ImageView icon_source;
	private TextView support;
	private ImageView icon_support;
	private TextView donate;
	private ImageView icon_donate;
	private TextView about;
	private ImageView icon_about;
	
	private AlertDialog.Builder Clear_Cache;
	private AlertDialog.Builder Clear_Cache_Done;
	private TimerTask Timer;
	private Intent Support = new Intent();
	private AlertDialog.Builder Donation;
	private Intent Donate = new Intent();
	private AlertDialog.Builder Mod_Features;
	private AlertDialog.Builder Selected_Spotify;
	private AlertDialog.Builder Download_Spotify;
	private AlertDialog.Builder Mod_Info;
	private AlertDialog.Builder Credits;
	private SharedPreferences SUB_1;
	private SharedPreferences SUB_2;
	private AlertDialog.Builder Success_Download;
	private SharedPreferences ON_SCREEN;
	private AlertDialog.Builder Restart;
	private AlertDialog.Builder Restart_Finished;
	private SharedPreferences THEME;
	private SharedPreferences DESC_X;
	private RequestNetwork Connection;
	private RequestNetwork.RequestListener _Connection_request_listener;
	private DatabaseReference Version = _firebase.getReference("Version");
	private ChildEventListener _Version_child_listener;
	private AlertDialog.Builder Update_Authorized;
	private AlertDialog.Builder Update_Unauthorized;
	private AlertDialog.Builder Update_Latest;
	private DatabaseReference xManager_Update = _firebase.getReference("xManager_Update");
	private ChildEventListener _xManager_Update_child_listener;
	private DatabaseReference Mod_Changelogs = _firebase.getReference("Mod_Changelogs");
	private ChildEventListener _Mod_Changelogs_child_listener;
	
	private OnCompleteListener xManager_Notification_onCompleteListener;
	private DatabaseReference xManager_Changelogs = _firebase.getReference("xManager_Changelogs");
	private ChildEventListener _xManager_Changelogs_child_listener;
	private FileProvider FileProvider;
	private File File_Fixer;
	private Intent Source = new Intent();
	private DatabaseReference Regular_Mod = _firebase.getReference("Regular_Mod");
	private ChildEventListener _Regular_Mod_child_listener;
	private DatabaseReference Amoled_Black = _firebase.getReference("Amoled_Black");
	private ChildEventListener _Amoled_Black_child_listener;
	private SharedPreferences NAVIGATION_BAR;
	private SharedPreferences LIST_REFRESH;
	private SharedPreferences APK_PATH;
	private SharedPreferences FORCE_INSTALL;
	private SharedPreferences FORCE_INSTALL_UPDATE;
	private SharedPreferences COPY_URL_MODE;
	@Override
	protected void onCreate(Bundle _savedInstanceState) {
		super.onCreate(_savedInstanceState);
		setContentView(R.layout.main);
		initialize(_savedInstanceState);
		com.google.firebase.FirebaseApp.initializeApp(this);
		if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED
		|| ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
			ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1000);
		}
		else {
			initializeLogic();
		}
	}
	@Override
	public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
		super.onRequestPermissionsResult(requestCode, permissions, grantResults);
		if (requestCode == 1000) {
			initializeLogic();
		}
	}
	
	private void initialize(Bundle _savedInstanceState) {
		
		box_header = (LinearLayout) findViewById(R.id.box_header);
		main_body_optimization = (LinearLayout) findViewById(R.id.main_body_optimization);
		main_scroll_settings = (ScrollView) findViewById(R.id.main_scroll_settings);
		main_scroll_about = (ScrollView) findViewById(R.id.main_scroll_about);
		main_refresh_layout = (SwipeRefreshLayout) findViewById(R.id.main_refresh_layout);
		title_header = (TextView) findViewById(R.id.title_header);
		box_header_tab = (LinearLayout) findViewById(R.id.box_header_tab);
		box_switch = (LinearLayout) findViewById(R.id.box_switch);
		box_update = (LinearLayout) findViewById(R.id.box_update);
		icon_switch = (ImageView) findViewById(R.id.icon_switch);
		icon_update = (ImageView) findViewById(R.id.icon_update);
		hidden_download = (TextView) findViewById(R.id.hidden_download);
		app_changelogs = (TextView) findViewById(R.id.app_changelogs);
		main_body_settings = (LinearLayout) findViewById(R.id.main_body_settings);
		box_settings_close = (LinearLayout) findViewById(R.id.box_settings_close);
		main_box_8 = (LinearLayout) findViewById(R.id.main_box_8);
		main_box_11 = (LinearLayout) findViewById(R.id.main_box_11);
		main_box_12 = (LinearLayout) findViewById(R.id.main_box_12);
		main_box_7 = (LinearLayout) findViewById(R.id.main_box_7);
		main_box_5 = (LinearLayout) findViewById(R.id.main_box_5);
		main_box_9 = (LinearLayout) findViewById(R.id.main_box_9);
		main_box_10 = (LinearLayout) findViewById(R.id.main_box_10);
		box_reset_settings = (LinearLayout) findViewById(R.id.box_reset_settings);
		box_settings_icon_close = (LinearLayout) findViewById(R.id.box_settings_icon_close);
		settings_icon_close = (ImageView) findViewById(R.id.settings_icon_close);
		box_8_sub_1 = (LinearLayout) findViewById(R.id.box_8_sub_1);
		box_8_sub_2 = (LinearLayout) findViewById(R.id.box_8_sub_2);
		list_auto_refresh = (TextView) findViewById(R.id.list_auto_refresh);
		box_list_auto_refresh = (LinearLayout) findViewById(R.id.box_list_auto_refresh);
		list_auto_refresh_switch = (Switch) findViewById(R.id.list_auto_refresh_switch);
		list_auto_refresh_info = (TextView) findViewById(R.id.list_auto_refresh_info);
		box_11_sub_1 = (LinearLayout) findViewById(R.id.box_11_sub_1);
		box_11_sub_2 = (LinearLayout) findViewById(R.id.box_11_sub_2);
		force_auto_install = (TextView) findViewById(R.id.force_auto_install);
		box_force_auto_install = (LinearLayout) findViewById(R.id.box_force_auto_install);
		force_auto_install_switch = (Switch) findViewById(R.id.force_auto_install_switch);
		force_auto_install_info = (TextView) findViewById(R.id.force_auto_install_info);
		box_12_sub_1 = (LinearLayout) findViewById(R.id.box_12_sub_1);
		box_12_sub_2 = (LinearLayout) findViewById(R.id.box_12_sub_2);
		copy_url_mode = (TextView) findViewById(R.id.copy_url_mode);
		box_copy_url_mode = (LinearLayout) findViewById(R.id.box_copy_url_mode);
		copy_url_mode_switch = (Switch) findViewById(R.id.copy_url_mode_switch);
		copy_file_url_mode_info = (TextView) findViewById(R.id.copy_file_url_mode_info);
		box_7_sub_1 = (LinearLayout) findViewById(R.id.box_7_sub_1);
		navigation_bar = (TextView) findViewById(R.id.navigation_bar);
		box_navigation_switch = (LinearLayout) findViewById(R.id.box_navigation_switch);
		navigation_switch = (Switch) findViewById(R.id.navigation_switch);
		box_5_sub_1 = (LinearLayout) findViewById(R.id.box_5_sub_1);
		box_5_sub_2 = (LinearLayout) findViewById(R.id.box_5_sub_2);
		theme = (TextView) findViewById(R.id.theme);
		box_theme_switch = (LinearLayout) findViewById(R.id.box_theme_switch);
		theme_switch = (Switch) findViewById(R.id.theme_switch);
		box_theme_0 = (LinearLayout) findViewById(R.id.box_theme_0);
		box_theme_1 = (LinearLayout) findViewById(R.id.box_theme_1);
		box_theme_2 = (LinearLayout) findViewById(R.id.box_theme_2);
		box_theme_3 = (LinearLayout) findViewById(R.id.box_theme_3);
		box_theme_4 = (LinearLayout) findViewById(R.id.box_theme_4);
		box_theme_5 = (LinearLayout) findViewById(R.id.box_theme_5);
		box_theme_6 = (LinearLayout) findViewById(R.id.box_theme_6);
		green_theme = (TextView) findViewById(R.id.green_theme);
		box_green_switch = (LinearLayout) findViewById(R.id.box_green_switch);
		green_switch = (Switch) findViewById(R.id.green_switch);
		purple_theme = (TextView) findViewById(R.id.purple_theme);
		box_purple_switch = (LinearLayout) findViewById(R.id.box_purple_switch);
		purple_switch = (Switch) findViewById(R.id.purple_switch);
		red_theme = (TextView) findViewById(R.id.red_theme);
		box_red_switch = (LinearLayout) findViewById(R.id.box_red_switch);
		red_switch = (Switch) findViewById(R.id.red_switch);
		blue_theme = (TextView) findViewById(R.id.blue_theme);
		box_blue_switch = (LinearLayout) findViewById(R.id.box_blue_switch);
		blue_switch = (Switch) findViewById(R.id.blue_switch);
		orange_theme = (TextView) findViewById(R.id.orange_theme);
		box_orange_switch = (LinearLayout) findViewById(R.id.box_orange_switch);
		orange_switch = (Switch) findViewById(R.id.orange_switch);
		yellow_theme = (TextView) findViewById(R.id.yellow_theme);
		box_yellow_switch = (LinearLayout) findViewById(R.id.box_yellow_switch);
		yellow_switch = (Switch) findViewById(R.id.yellow_switch);
		gray_theme = (TextView) findViewById(R.id.gray_theme);
		box_gray_switch = (LinearLayout) findViewById(R.id.box_gray_switch);
		gray_switch = (Switch) findViewById(R.id.gray_switch);
		box_9_sub_1 = (LinearLayout) findViewById(R.id.box_9_sub_1);
		box_9_sub_2 = (LinearLayout) findViewById(R.id.box_9_sub_2);
		apk_location = (TextView) findViewById(R.id.apk_location);
		apk_path_location = (EditText) findViewById(R.id.apk_path_location);
		apk_location_info = (TextView) findViewById(R.id.apk_location_info);
		box_10_sub_1 = (LinearLayout) findViewById(R.id.box_10_sub_1);
		clear_directory_folders = (TextView) findViewById(R.id.clear_directory_folders);
		reset_settings = (TextView) findViewById(R.id.reset_settings);
		main_body_about = (LinearLayout) findViewById(R.id.main_body_about);
		box_about_close = (LinearLayout) findViewById(R.id.box_about_close);
		box_about_header = (LinearLayout) findViewById(R.id.box_about_header);
		box_about_sub = (LinearLayout) findViewById(R.id.box_about_sub);
		box_about_1 = (LinearLayout) findViewById(R.id.box_about_1);
		box_about_2 = (LinearLayout) findViewById(R.id.box_about_2);
		box_about_3 = (LinearLayout) findViewById(R.id.box_about_3);
		box_about_4 = (LinearLayout) findViewById(R.id.box_about_4);
		box_about_5 = (LinearLayout) findViewById(R.id.box_about_5);
		box_about_6 = (LinearLayout) findViewById(R.id.box_about_6);
		box_about_7 = (LinearLayout) findViewById(R.id.box_about_7);
		contributors_1 = (TextView) findViewById(R.id.contributors_1);
		box_icon_close = (LinearLayout) findViewById(R.id.box_icon_close);
		icon_close = (ImageView) findViewById(R.id.icon_close);
		title_about = (TextView) findViewById(R.id.title_about);
		app_version = (TextView) findViewById(R.id.app_version);
		sub_title = (TextView) findViewById(R.id.sub_title);
		developer_manager = (TextView) findViewById(R.id.developer_manager);
		developer_1 = (TextView) findViewById(R.id.developer_1);
		developer_spotify = (TextView) findViewById(R.id.developer_spotify);
		developer_2 = (TextView) findViewById(R.id.developer_2);
		support_team = (TextView) findViewById(R.id.support_team);
		support_1 = (TextView) findViewById(R.id.support_1);
		mod_testers = (TextView) findViewById(R.id.mod_testers);
		testers_1 = (TextView) findViewById(R.id.testers_1);
		mobilism_team = (TextView) findViewById(R.id.mobilism_team);
		mobilism_1 = (TextView) findViewById(R.id.mobilism_1);
		forum_team = (TextView) findViewById(R.id.forum_team);
		forum_1 = (TextView) findViewById(R.id.forum_1);
		manager_team = (TextView) findViewById(R.id.manager_team);
		manager_1 = (TextView) findViewById(R.id.manager_1);
		main_body = (LinearLayout) findViewById(R.id.main_body);
		main_box_1 = (LinearLayout) findViewById(R.id.main_box_1);
		main_box_2 = (LinearLayout) findViewById(R.id.main_box_2);
		main_box_6 = (LinearLayout) findViewById(R.id.main_box_6);
		box_sub_header = (LinearLayout) findViewById(R.id.box_sub_header);
		main_box_4 = (LinearLayout) findViewById(R.id.main_box_4);
		box_1 = (LinearLayout) findViewById(R.id.box_1);
		box_2 = (LinearLayout) findViewById(R.id.box_2);
		list_menu_1 = (ListView) findViewById(R.id.list_menu_1);
		title_1 = (TextView) findViewById(R.id.title_1);
		box_1_sub = (LinearLayout) findViewById(R.id.box_1_sub);
		sub_text_1 = (TextView) findViewById(R.id.sub_text_1);
		sub_1 = (TextView) findViewById(R.id.sub_1);
		sub_text_2 = (TextView) findViewById(R.id.sub_text_2);
		sub_2 = (TextView) findViewById(R.id.sub_2);
		box_switch_1 = (LinearLayout) findViewById(R.id.box_switch_1);
		version_switch_1 = (Switch) findViewById(R.id.version_switch_1);
		box_3 = (LinearLayout) findViewById(R.id.box_3);
		box_4 = (LinearLayout) findViewById(R.id.box_4);
		list_menu_2 = (ListView) findViewById(R.id.list_menu_2);
		title_2 = (TextView) findViewById(R.id.title_2);
		box_3_sub = (LinearLayout) findViewById(R.id.box_3_sub);
		sub_text_3 = (TextView) findViewById(R.id.sub_text_3);
		sub_3 = (TextView) findViewById(R.id.sub_3);
		sub_text_4 = (TextView) findViewById(R.id.sub_text_4);
		sub_4 = (TextView) findViewById(R.id.sub_4);
		box_switch_2 = (LinearLayout) findViewById(R.id.box_switch_2);
		version_switch_2 = (Switch) findViewById(R.id.version_switch_2);
		box_6_sub_1 = (LinearLayout) findViewById(R.id.box_6_sub_1);
		box_6_sub_2 = (LinearLayout) findViewById(R.id.box_6_sub_2);
		changelogs = (TextView) findViewById(R.id.changelogs);
		box_changelogs = (LinearLayout) findViewById(R.id.box_changelogs);
		changelogs_switch = (Switch) findViewById(R.id.changelogs_switch);
		box_changelogs_1 = (LinearLayout) findViewById(R.id.box_changelogs_1);
		changelogs_x = (TextView) findViewById(R.id.changelogs_x);
		box_sub_1 = (LinearLayout) findViewById(R.id.box_sub_1);
		box_sub_2 = (LinearLayout) findViewById(R.id.box_sub_2);
		title_sub = (TextView) findViewById(R.id.title_sub);
		box_cpu = (LinearLayout) findViewById(R.id.box_cpu);
		device_cpu = (TextView) findViewById(R.id.device_cpu);
		cpu = (TextView) findViewById(R.id.cpu);
		box_uninstall = (LinearLayout) findViewById(R.id.box_uninstall);
		box_settings = (LinearLayout) findViewById(R.id.box_settings);
		box_cache = (LinearLayout) findViewById(R.id.box_cache);
		box_open = (LinearLayout) findViewById(R.id.box_open);
		icon_uninstall = (ImageView) findViewById(R.id.icon_uninstall);
		icon_settings = (ImageView) findViewById(R.id.icon_settings);
		icon_cache = (ImageView) findViewById(R.id.icon_cache);
		icon_open = (ImageView) findViewById(R.id.icon_open);
		box_source = (LinearLayout) findViewById(R.id.box_source);
		box_support = (LinearLayout) findViewById(R.id.box_support);
		box_donate = (LinearLayout) findViewById(R.id.box_donate);
		box_about = (LinearLayout) findViewById(R.id.box_about);
		source = (TextView) findViewById(R.id.source);
		icon_source = (ImageView) findViewById(R.id.icon_source);
		support = (TextView) findViewById(R.id.support);
		icon_support = (ImageView) findViewById(R.id.icon_support);
		donate = (TextView) findViewById(R.id.donate);
		icon_donate = (ImageView) findViewById(R.id.icon_donate);
		about = (TextView) findViewById(R.id.about);
		icon_about = (ImageView) findViewById(R.id.icon_about);
		Clear_Cache = new AlertDialog.Builder(this);
		Clear_Cache_Done = new AlertDialog.Builder(this);
		Donation = new AlertDialog.Builder(this);
		Mod_Features = new AlertDialog.Builder(this);
		Selected_Spotify = new AlertDialog.Builder(this);
		Download_Spotify = new AlertDialog.Builder(this);
		Mod_Info = new AlertDialog.Builder(this);
		Credits = new AlertDialog.Builder(this);
		SUB_1 = getSharedPreferences("SUB_1", Activity.MODE_PRIVATE);
		SUB_2 = getSharedPreferences("SUB_2", Activity.MODE_PRIVATE);
		Success_Download = new AlertDialog.Builder(this);
		ON_SCREEN = getSharedPreferences("ON_SCREEN", Activity.MODE_PRIVATE);
		Restart = new AlertDialog.Builder(this);
		Restart_Finished = new AlertDialog.Builder(this);
		THEME = getSharedPreferences("THEME", Activity.MODE_PRIVATE);
		DESC_X = getSharedPreferences("DESC_X", Activity.MODE_PRIVATE);
		Connection = new RequestNetwork(this);
		Update_Authorized = new AlertDialog.Builder(this);
		Update_Unauthorized = new AlertDialog.Builder(this);
		Update_Latest = new AlertDialog.Builder(this);
		NAVIGATION_BAR = getSharedPreferences("NAVIGATION_BAR", Activity.MODE_PRIVATE);
		LIST_REFRESH = getSharedPreferences("LIST_REFRESH", Activity.MODE_PRIVATE);
		APK_PATH = getSharedPreferences("APK_PATH", Activity.MODE_PRIVATE);
		FORCE_INSTALL = getSharedPreferences("FORCE_INSTALL", Activity.MODE_PRIVATE);
		FORCE_INSTALL_UPDATE = getSharedPreferences("FORCE_INSTALL_UPDATE", Activity.MODE_PRIVATE);
		COPY_URL_MODE = getSharedPreferences("COPY_URL_MODE", Activity.MODE_PRIVATE);
		
		box_switch.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				RippleAnimation.create(box_switch).setDuration((long)700).start();
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.VISIBLE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.GONE);
				box_update.setVisibility(View.GONE);
				box_switch.setVisibility(View.GONE);
				apk_path_location.setEnabled(true);
				title_header.setText("Settings");
				if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("X") && FORCE_INSTALL_UPDATE.getString("FORCE_INSTALL_UPDATE", "").equals("XX")) {
					force_auto_install_switch.setChecked(true);
				}
				else {
					if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("Y") && FORCE_INSTALL.getString("FORCE_INSTALL_UPDATE", "").equals("YY")) {
						force_auto_install_switch.setChecked(false);
					}
				}
				if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_ON")) {
					copy_url_mode_switch.setChecked(true);
				}
				else {
					if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_OFF")) {
						copy_url_mode_switch.setChecked(false);
					}
				}
				_Animation_1();
			}
		});
		
		box_update.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					Version.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							Versions_1 = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									Versions_1.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							Latest_Version = Versions_1.get((int)0).get("V").toString();
							if (Double.parseDouble(Latest_Version) > Double.parseDouble(Current_Version)) {
								try {
									_RequiredDialog(Update_Authorized, false);
									Update_Authorized.setTitle("NEW MANAGER UPDATE");
									Update_Authorized.setPositiveButton("DOWNLOAD UPDATE", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											try {
												_RequiredDialog(Update_Authorized, true);
												if (FORCE_INSTALL_UPDATE.getString("FORCE_INSTALL_UPDATE", "").equals("XX")) {
													_Download_Update_Install(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/");
												}
												else {
													if (FORCE_INSTALL_UPDATE.getString("FORCE_INSTALL_UPDATE", "").equals("YY")) {
														_Download_Update(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/");
													}
												}
												_Update_Remover();
											}
											catch(Exception e) {
											}
											Timer = new TimerTask() {
												@Override
												public void run() {
													runOnUiThread(new Runnable() {
														@Override
														public void run() {
															_Hide_Navigation();
														}
													});
												}
											};
											_timer.schedule(Timer, (int)(100));
										}
									});
									Update_Authorized.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											_RequiredDialog(Update_Authorized, true);
											Timer = new TimerTask() {
												@Override
												public void run() {
													runOnUiThread(new Runnable() {
														@Override
														public void run() {
															_Hide_Navigation();
														}
													});
												}
											};
											_timer.schedule(Timer, (int)(100));
										}
									});
									Update_Authorized.create().show();
								}
								catch(Exception e) {
								}
							}
							else {
								if (Double.parseDouble(Current_Version) > Double.parseDouble(Latest_Version)) {
									Version.child("App").child("V").setValue(Current_Version);
								}
								else {
									try {
										xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
											@Override
											public void onDataChange(DataSnapshot _dataSnapshot) {
												listdata = new ArrayList<>();
												try {
													GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
													for (DataSnapshot _data : _dataSnapshot.getChildren()) {
														HashMap<String, Object> _map = _data.getValue(_ind);
														listdata.add(_map);
													}
												}
												catch (Exception _e) {
													_e.printStackTrace();
												}
												xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
											}
											@Override
											public void onCancelled(DatabaseError _databaseError) {
											}
										});
										Update_Latest.setTitle("xManager v".concat(app_version.getText().toString().concat(" (Latest)")));
										Update_Latest.setMessage(app_changelogs.getText().toString());
										Update_Latest.create().show();
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														_Hide_Navigation();
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(100));
									}
									catch(Exception e) {
									}
								}
							}
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
				}
				catch(Exception e) {
				}
			}
		});
		
		main_box_10.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/") && FileUtil.isExistFile(apk_path_location.getText().toString())) {
					FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/");
					FileUtil.deleteFile(apk_path_location.getText().toString());
					SketchwareUtil.CustomToast(getApplicationContext(), "Successfully deleted", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
				else {
					if (!(FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/") && FileUtil.isExistFile(apk_path_location.getText().toString()))) {
						SketchwareUtil.CustomToast(getApplicationContext(), "Directory folders not found or deleted", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
					}
				}
			}
		});
		
		box_reset_settings.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				version_switch_1.setChecked(false);
				version_switch_2.setChecked(false);
				changelogs_switch.setChecked(false);
				list_auto_refresh_switch.setChecked(false);
				force_auto_install_switch.setChecked(false);
				copy_url_mode_switch.setChecked(false);
				navigation_switch.setChecked(false);
				theme_switch.setChecked(false);
				green_switch.setChecked(false);
				purple_switch.setChecked(false);
				red_switch.setChecked(false);
				blue_switch.setChecked(false);
				orange_switch.setChecked(false);
				yellow_switch.setChecked(false);
				gray_switch.setChecked(false);
				apk_path_location.setText("/storage/emulated/0/xManager/");
				SketchwareUtil.CustomToast(getApplicationContext(), "Back to default settings", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
		});
		
		box_settings_icon_close.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				RippleAnimation.create(box_settings_icon_close).setDuration((long)700).start();
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.VISIBLE);
				box_update.setVisibility(View.VISIBLE);
				box_switch.setVisibility(View.VISIBLE);
				apk_path_location.setEnabled(false);
				title_header.setText("xManager");
				_Animation_0();
				_Url_Mode();
			}
		});
		
		list_auto_refresh_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					LIST_REFRESH.edit().putString("UPDATE", "ON").commit();
				}
				else {
					LIST_REFRESH.edit().putString("UPDATE", "OFF").commit();
					SketchwareUtil.CustomToast(getApplicationContext(), "NOTE: You can manually refresh the list by pulling down on the main screen", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
			}
		});
		
		force_auto_install_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					FORCE_INSTALL.edit().putString("FORCE_INSTALL", "X").commit();
					FORCE_INSTALL_UPDATE.edit().putString("FORCE_INSTALL_UPDATE", "XX").commit();
				}
				else {
					FORCE_INSTALL.edit().putString("FORCE_INSTALL", "Y").commit();
					FORCE_INSTALL_UPDATE.edit().putString("FORCE_INSTALL_UPDATE", "YY").commit();
				}
			}
		});
		
		copy_url_mode_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					COPY_URL_MODE.edit().putString("COPY_URL_MODE", "URL_ON").commit();
					SketchwareUtil.CustomToast(getApplicationContext(), "URL MODE ACTIVATED", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
				else {
					COPY_URL_MODE.edit().putString("COPY_URL_MODE", "URL_OFF").commit();
				}
			}
		});
		
		navigation_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					NAVIGATION_BAR.edit().putString("NAVIGATION", "1").commit();
					getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
				}
				else {
					NAVIGATION_BAR.edit().putString("NAVIGATION", "0").commit();
					getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
					
					if (Build.VERSION.SDK_INT >= 21) {
						getWindow().setNavigationBarColor(Color.parseColor("#212121"));
					}
				}
			}
		});
		
		theme_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					box_5_sub_2.setVisibility(View.VISIBLE);
					version_switch_1.setChecked(false);
					version_switch_2.setChecked(false);
					changelogs_switch.setChecked(false);
					_Animation_3();
				}
				else {
					box_5_sub_2.setVisibility(View.GONE);
				}
			}
		});
		
		green_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "1").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
					green_switch.setChecked(true);
					purple_switch.setChecked(false);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		purple_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "2").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
					green_switch.setChecked(false);
					purple_switch.setChecked(true);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (green_switch.isChecked()) {
						THEME.edit().putString("THEME", "1").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
						green_switch.setChecked(true);
						purple_switch.setChecked(false);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		red_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "3").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
					green_switch.setChecked(false);
					purple_switch.setChecked(false);
					red_switch.setChecked(true);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (green_switch.isChecked()) {
							THEME.edit().putString("THEME", "1").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
							green_switch.setChecked(true);
							purple_switch.setChecked(false);
							red_switch.setChecked(false);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		blue_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "4").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
					green_switch.setChecked(false);
					purple_switch.setChecked(false);
					red_switch.setChecked(false);
					blue_switch.setChecked(true);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (green_switch.isChecked()) {
								THEME.edit().putString("THEME", "1").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
								green_switch.setChecked(true);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(false);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		orange_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "5").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
					green_switch.setChecked(false);
					purple_switch.setChecked(false);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(true);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (green_switch.isChecked()) {
									THEME.edit().putString("THEME", "1").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
									green_switch.setChecked(true);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(false);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		yellow_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "6").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
					green_switch.setChecked(false);
					purple_switch.setChecked(false);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(true);
					gray_switch.setChecked(false);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (green_switch.isChecked()) {
										THEME.edit().putString("THEME", "1").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
										green_switch.setChecked(true);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(false);
										gray_switch.setChecked(false);
									}
									else {
										if (gray_switch.isChecked()) {
											THEME.edit().putString("THEME", "7").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
											green_switch.setChecked(false);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(true);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		gray_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					THEME.edit().putString("THEME", "7").commit();
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
					main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
					main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
					green_switch.setChecked(false);
					purple_switch.setChecked(false);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(true);
				}
				else {
					if (purple_switch.isChecked()) {
						THEME.edit().putString("THEME", "2").commit();
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
						green_switch.setChecked(false);
						purple_switch.setChecked(true);
						red_switch.setChecked(false);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (red_switch.isChecked()) {
							THEME.edit().putString("THEME", "3").commit();
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(true);
							blue_switch.setChecked(false);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (blue_switch.isChecked()) {
								THEME.edit().putString("THEME", "4").commit();
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(true);
								orange_switch.setChecked(false);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (orange_switch.isChecked()) {
									THEME.edit().putString("THEME", "5").commit();
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(true);
									yellow_switch.setChecked(false);
									gray_switch.setChecked(false);
								}
								else {
									if (yellow_switch.isChecked()) {
										THEME.edit().putString("THEME", "6").commit();
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(true);
										gray_switch.setChecked(false);
									}
									else {
										if (green_switch.isChecked()) {
											THEME.edit().putString("THEME", "1").commit();
											main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
											main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
											main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
											green_switch.setChecked(true);
											purple_switch.setChecked(false);
											red_switch.setChecked(false);
											blue_switch.setChecked(false);
											orange_switch.setChecked(false);
											yellow_switch.setChecked(false);
											gray_switch.setChecked(false);
										}
										else {
											if (!(green_switch.isChecked() && (purple_switch.isChecked() && red_switch.isChecked()))) {
												THEME.edit().putString("THEME", "0").commit();
												main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_about.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												main_scroll_settings.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
												green_switch.setChecked(false);
												purple_switch.setChecked(false);
												red_switch.setChecked(false);
												blue_switch.setChecked(false);
												orange_switch.setChecked(false);
												yellow_switch.setChecked(false);
												gray_switch.setChecked(false);
											}
										}
									}
								}
							}
						}
					}
				}
			}
		});
		
		apk_path_location.addTextChangedListener(new TextWatcher() {
			@Override
			public void onTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) {
				final String _charSeq = _param1.toString();
				PATH = _charSeq;
				_Default_Path();
			}
			
			@Override
			public void beforeTextChanged(CharSequence _param1, int _param2, int _param3, int _param4) {
				
			}
			
			@Override
			public void afterTextChanged(Editable _param1) {
				
			}
		});
		
		box_icon_close.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				RippleAnimation.create(box_icon_close).setDuration((long)700).start();
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.VISIBLE);
				box_update.setVisibility(View.VISIBLE);
				box_switch.setVisibility(View.VISIBLE);
				title_header.setText("xManager");
				_Animation_0();
				_Url_Mode();
			}
		});
		
		version_switch_1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				try {
					if (_isChecked) {
						try {
							version_switch_2.setChecked(false);
							changelogs_switch.setChecked(false);
							theme_switch.setChecked(false);
							list_menu_1.setVisibility(View.VISIBLE);
							Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									listdata = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											listdata.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									sub_1.setText(SUB_1.getString("SUB_1", ""));
									list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
									((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							Version.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									Version.addChildEventListener(_Version_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
						}
						catch(Exception e) {
							SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Fetching failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
						}
						main_refresh_layout.setEnabled(false);
					}
					else {
						main_refresh_layout.setEnabled(true);
						list_menu_1.setVisibility(View.GONE);
						list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
						((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
					}
				}
				catch(Exception e) {
				}
			}
		});
		
		version_switch_2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				try {
					if (_isChecked) {
						try {
							version_switch_1.setChecked(false);
							changelogs_switch.setChecked(false);
							theme_switch.setChecked(false);
							list_menu_2.setVisibility(View.VISIBLE);
							Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									listdata = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											listdata.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									sub_3.setText(SUB_2.getString("SUB_2", ""));
									list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
									((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
							Version.addListenerForSingleValueEvent(new ValueEventListener() {
								@Override
								public void onDataChange(DataSnapshot _dataSnapshot) {
									others = new ArrayList<>();
									try {
										GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
										for (DataSnapshot _data : _dataSnapshot.getChildren()) {
											HashMap<String, Object> _map = _data.getValue(_ind);
											others.add(_map);
										}
									}
									catch (Exception _e) {
										_e.printStackTrace();
									}
									Version.addChildEventListener(_Version_child_listener);
								}
								@Override
								public void onCancelled(DatabaseError _databaseError) {
								}
							});
						}
						catch(Exception e) {
							SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Fetching failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
						}
						main_refresh_layout.setEnabled(false);
					}
					else {
						main_refresh_layout.setEnabled(true);
						list_menu_2.setVisibility(View.GONE);
						list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
						((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
					}
				}
				catch(Exception e) {
				}
			}
		});
		
		changelogs_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton _param1, boolean _param2)  {
				final boolean _isChecked = _param2;
				if (_isChecked) {
					box_6_sub_2.setVisibility(View.VISIBLE);
					version_switch_1.setChecked(false);
					version_switch_2.setChecked(false);
					theme_switch.setChecked(false);
				}
				else {
					box_6_sub_2.setVisibility(View.GONE);
				}
			}
		});
		
		box_uninstall.setOnLongClickListener(new View.OnLongClickListener() {
			 @Override
				public boolean onLongClick(View _view) {
				SketchwareUtil.CustomToast(getApplicationContext(), "Uninstall spotify app", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				return true;
				}
			 });
		
		box_uninstall.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:com.spotify.music")); 
					startActivity(intent);
				}
				catch(Exception e) {
					SketchwareUtil.CustomToast(getApplicationContext(), "Application not installed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
			}
		});
		
		box_settings.setOnLongClickListener(new View.OnLongClickListener() {
			 @Override
				public boolean onLongClick(View _view) {
				SketchwareUtil.CustomToast(getApplicationContext(), "Open spotify's app settings", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				return true;
				}
			 });
		
		box_settings.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:com.spotify.music")); 
					startActivity(intent);
				}
				catch(Exception e) {
					SketchwareUtil.CustomToast(getApplicationContext(), "Application not installed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
			}
		});
		
		box_cache.setOnLongClickListener(new View.OnLongClickListener() {
			 @Override
				public boolean onLongClick(View _view) {
				SketchwareUtil.CustomToast(getApplicationContext(), "Clear offline cached datas", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				return true;
				}
			 });
		
		box_cache.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					_RequiredDialog(Clear_Cache, false);
					Clear_Cache.setTitle("CLEAR CACHE");
					Clear_Cache.setMessage("This will erase all the downloaded songs, albums and playlists including offline cached datas from the original or modified spotify app. Would you like to continue?");
					Clear_Cache.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface _dialog, int _which) {
							_RequiredDialog(Clear_Cache, true);
							if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.spotify.music/")) {
								FileUtil.deleteFile("/storage/emulated/0/Android/data/com.spotify.music/");
								final ProgressDialog prog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
								
								prog.setMax(100);
								prog.setMessage("Deleting Spotify's directory folder...");
								prog.setIndeterminate(true);
								prog.setCancelable(false);
								if (!MainActivity.this.isFinishing()) {
									prog.show();
								}
								Timer = new TimerTask() {
									@Override
									public void run() {
										runOnUiThread(new Runnable() {
											@Override
											public void run() {
												_RequiredDialog(Clear_Cache_Done, false);
												Clear_Cache_Done.setTitle("DIRECTORY FILES DELETED");
												Clear_Cache_Done.setMessage("Kindly relogin your Spotify account to restore the settings.");
												Clear_Cache_Done.setPositiveButton("GOT IT, THANKS!", new DialogInterface.OnClickListener() {
													@Override
													public void onClick(DialogInterface _dialog, int _which) {
														_RequiredDialog(Clear_Cache_Done, true);
													}
												});
												Clear_Cache_Done.create().show();
												prog.dismiss();
												Timer = new TimerTask() {
													@Override
													public void run() {
														runOnUiThread(new Runnable() {
															@Override
															public void run() {
																_Hide_Navigation();
															}
														});
													}
												};
												_timer.schedule(Timer, (int)(100));
												SketchwareUtil.CustomToast(getApplicationContext(), "Successfully deleted", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
											}
										});
									}
								};
								_timer.schedule(Timer, (int)(3000));
							}
							else {
								Timer = new TimerTask() {
									@Override
									public void run() {
										runOnUiThread(new Runnable() {
											@Override
											public void run() {
												_Hide_Navigation();
											}
										});
									}
								};
								_timer.schedule(Timer, (int)(100));
								SketchwareUtil.CustomToast(getApplicationContext(), "Directory files are empty", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
							}
						}
					});
					Clear_Cache.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface _dialog, int _which) {
							_RequiredDialog(Clear_Cache, true);
							Timer = new TimerTask() {
								@Override
								public void run() {
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											_Hide_Navigation();
										}
									});
								}
							};
							_timer.schedule(Timer, (int)(100));
						}
					});
					Clear_Cache.create().show();
				}
				catch(Exception e) {
				}
			}
		});
		
		box_open.setOnLongClickListener(new View.OnLongClickListener() {
			 @Override
				public boolean onLongClick(View _view) {
				SketchwareUtil.CustomToast(getApplicationContext(), "Launch spotify app", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				return true;
				}
			 });
		
		box_open.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				String packageName = "com.spotify.music"; 
				
				Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
				if(intent == null) {
					
					try {
						intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
					} catch (Exception e) {
						SketchwareUtil.CustomToast(getApplicationContext(), "Application not installed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
					}
				}
				startActivity(intent);
			}
		});
		
		box_source.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					Source.setAction(Intent.ACTION_VIEW);
					Source.setData(Uri.parse("https://github.com/xManager-v2/xManager-Spotify"));
					startActivity(Source);
				}
				catch(Exception e) {
				}
			}
		});
		
		box_support.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					Support.setAction(Intent.ACTION_VIEW);
					Support.setData(Uri.parse("https://t.me/SpotifyModSupport"));
					startActivity(Support);
				}
				catch(Exception e) {
				}
			}
		});
		
		box_donate.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				try {
					_RequiredDialog(Donation, false);
					Donation.setTitle("SHOW YOUR SUPPORT");
					Donation.setMessage("We are a non-profit, non-corporate and non-compromised team. People like you encourage us to create an app to make things much easier especially from downloading to installing.\n\nWe are pouring all of our time and best efforts just to make things right and perfect. We will do our best to support this app as long as we could.\n\nAny amount will help and be very much appreciated!");
					Donation.setPositiveButton("DONATE", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface _dialog, int _which) {
							_RequiredDialog(Donation, true);
							Donate.setAction(Intent.ACTION_VIEW);
							Donate.setData(Uri.parse("https://www.paypal.me/mrvnce"));
							startActivity(Donate);
						}
					});
					Donation.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface _dialog, int _which) {
							_RequiredDialog(Donation, true);
							Timer = new TimerTask() {
								@Override
								public void run() {
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											_Hide_Navigation();
										}
									});
								}
							};
							_timer.schedule(Timer, (int)(100));
						}
					});
					Donation.create().show();
				}
				catch(Exception e) {
				}
			}
		});
		
		box_about.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View _view) {
				RippleAnimation.create(box_about).setDuration((long)700).start();
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.VISIBLE);
				main_refresh_layout.setVisibility(View.GONE);
				box_update.setVisibility(View.GONE);
				box_switch.setVisibility(View.GONE);
				title_header.setText("About");
				_Animation_2();
			}
		});
		
		_Connection_request_listener = new RequestNetwork.RequestListener() {
			@Override
			public void onResponse(String _param1, String _param2, HashMap<String, Object> _param3) {
				final String _tag = _param1;
				final String _response = _param2;
				final HashMap<String, Object> _responseHeaders = _param3;
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_1.setText(SUB_1.getString("SUB_1", ""));
						main_refresh_layout.setRefreshing(true);
						main_body.setEnabled(false);
						main_body.setAlpha((float)(0.65d));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_3.setText(SUB_2.getString("SUB_2", ""));
						main_refresh_layout.setRefreshing(false);
						main_body.setEnabled(true);
						main_body.setAlpha((float)(1.0d));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onErrorResponse(String _param1, String _param2) {
				final String _tag = _param1;
				final String _message = _param2;
				main_refresh_layout.setRefreshing(true);
				main_body.setAlpha((float)(0.65d));
				Timer = new TimerTask() {
					@Override
					public void run() {
						runOnUiThread(new Runnable() {
							@Override
							public void run() {
								main_refresh_layout.setRefreshing(false);
								main_body.setAlpha((float)(1.0d));
							}
						});
					}
				};
				_timer.schedule(Timer, (int)(700));
			}
		};
		
		_Version_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		Version.addChildEventListener(_Version_child_listener);
		
		_xManager_Update_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				xManager_Update.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						hidden_download.setText(_childValue.get("Links").toString());
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		xManager_Update.addChildEventListener(_xManager_Update_child_listener);
		
		_Mod_Changelogs_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						changelogs_x.setText(_childValue.get("Changelogs").toString());
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
		
		xManager_Notification_onCompleteListener = new OnCompleteListener<InstanceIdResult>() {
			@Override
			public void onComplete(Task<InstanceIdResult> task) {
				final boolean _success = task.isSuccessful();
				final String _token = task.getResult().getToken();
				final String _errorMessage = task.getException() != null ? task.getException().getMessage() : "";
				try {
				}
				catch(Exception e) {
					SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Failed to receive notification", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
				}
			}
		};
		
		_xManager_Changelogs_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						app_changelogs.setText(_childValue.get("App_Changelogs").toString());
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
		
		_Regular_Mod_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						listdata.add(_childValue);
						list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
						((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						listdata.add(_childValue);
						list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
						((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		Regular_Mod.addChildEventListener(_Regular_Mod_child_listener);
		
		_Amoled_Black_child_listener = new ChildEventListener() {
			@Override
			public void onChildAdded(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						listdata.add(_childValue);
						list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
						((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildChanged(DataSnapshot _param1, String _param2) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						listdata.add(_childValue);
						list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
						((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
			}
			
			@Override
			public void onChildMoved(DataSnapshot _param1, String _param2) {
				
			}
			
			@Override
			public void onChildRemoved(DataSnapshot _param1) {
				GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
				final String _childKey = _param1.getKey();
				final HashMap<String, Object> _childValue = _param1.getValue(_ind);
				
			}
			
			@Override
			public void onCancelled(DatabaseError _param1) {
				final int _errorCode = _param1.getCode();
				final String _errorMessage = _param1.getMessage();
				
			}
		};
		Amoled_Black.addChildEventListener(_Amoled_Black_child_listener);
	}
	
	private void initializeLogic() {
		try {
			_Dark_Navigation();
			_Informations();
			_Animation_0();
			_Model_UI();
		}
		catch(Exception e) {
		}
	}
	
	@Override
	protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) {
		
		super.onActivityResult(_requestCode, _resultCode, _data);
		
		switch (_requestCode) {
			
			default:
			break;
		}
	}
	
	@Override
	public void onBackPressed() {
		if (CHECK == 0) {
			CHECK = 1;
			Timer = new TimerTask() {
				@Override
				public void run() {
					runOnUiThread(new Runnable() {
						@Override
						public void run() {
							CHECK = 0;
						}
					});
				}
			};
			_timer.schedule(Timer, (int)(1000));
			SketchwareUtil.CustomToast(getApplicationContext(), "Press back again to exit", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
		}
		else {
			finishAndRemoveTask();
			finishAffinity();
		}
	}
	
	@Override
	public void onResume() {
		super.onResume();
		_Hide_Navigation();
	}
	public void _Informations () {
		sub_2.setText("N/A");
		cpu.setText("N/A");
		Timer = new TimerTask() {
			@Override
			public void run() {
				runOnUiThread(new Runnable() {
					@Override
					public void run() {
						String uri = "com.spotify.music";
						android.content.pm.PackageManager pm = getPackageManager();
						
						try {
							android.content.pm.PackageInfo pInfo = pm.getPackageInfo(uri, android.content.pm.PackageManager.GET_ACTIVITIES);
							String version = pInfo.versionName;
							sub_2.setText(version);
							sub_4.setText(version);
							
						}
						catch (Exception e) {
							SketchwareUtil.CustomToast(getApplicationContext(), "Application not installed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
						}
						String app = "com.xc3fff0e.xmanager";
						android.content.pm.PackageManager ver = getPackageManager();
						
						try {
							android.content.pm.PackageInfo pInfo = ver.getPackageInfo(app, android.content.pm.PackageManager.GET_ACTIVITIES);
							String version = pInfo.versionName;
							app_version.setText(version);
							
						}
						catch (Exception e) {
							SketchwareUtil.CustomToast(getApplicationContext(), "Application not installed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
						}
						cpu.setText(Build.CPU_ABI);
					}
				});
			}
		};
		_timer.schedule(Timer, (int)(750));
	}
	
	
	public void _RequiredDialog (final AlertDialog.Builder _Dialog, final boolean _True) {
		_Dialog.setCancelable(_True);
	}
	
	
	public void _Download (final String _url, final String _path) {
		try {
			FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext()));
			
			android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
			android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
			if (networkInfo != null && networkInfo.isConnected()) {
				
				
				final String urlDownload = _url;
				
				DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload));
				
				final String fileName = URLUtil.guessFileName(urlDownload, null, null);
				
				request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
				
				request.setMimeType("application/vnd.android.package-archive");
				
				request.allowScanningByMediaScanner();
					request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "Spotify Mod (Official).apk");
				
				final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
				
				final long downloadId = manager.enqueue(request);
				
				final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
				prog.setMax(100);
				prog.setIndeterminate(false);
				prog.setCancelable(false);
				prog.setCanceledOnTouchOutside(false);
				prog.setTitle("DOWNLOADING FILE...");
				new Thread(new Runnable() {
					
					@Override
					public void run() {
						
						boolean downloading = true;
						
						while (downloading) {
							
							DownloadManager.Query q = new DownloadManager.Query();
							
							q.setFilterById(downloadId);
							
							android.database.Cursor cursor = manager.query(q);
							
							if (cursor != null) { 
								  if (cursor.moveToFirst()) {
									
									int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
									
									int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) {
										
										downloading = false;
										
									}
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) {
										
										runOnUiThread(new Runnable() {
											public void run() { 
												
												SketchwareUtil.CustomToast(getApplicationContext(), "The file or link is currently unavailable. Please try again later.", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
											}
										});
										prog.cancel();
										break;
										
									}
									
									final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total);
									
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											
											prog.setTitle("DOWNLOADING FILE...");
											prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
											prog.setProgress(dl_progress);
											prog.setMax(100);
											prog.show();
											
											if (dl_progress == prog.getMax()) {
												
												Timer = new TimerTask() {
														@Override
														public void run() {
																runOnUiThread(new Runnable() {
																		@Override
																		public void run() {
																
																try {
																	FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk", apk_path_location.getText().toString().concat("Spotify Mod (Official).apk"));
																}
																catch(Exception e) {
																	SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Copying failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																}
																
																_RequiredDialog(Success_Download, false);
																Success_Download.setTitle("SUCCESSFULLY DOWNLOADED");
																Success_Download.setMessage("FILE DIRECTORY:\n<".concat(apk_path_location.getText().toString().concat(">")));
																Success_Download.setPositiveButton("INSTALL NOW", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																		
																		if(android.os.Build.VERSION.SDK_INT >= 29){
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				
																				intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																				 
																				intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																			
																		} else {
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																				Timer = new TimerTask() {
																						@Override
																						public void run() {
																								runOnUiThread(new Runnable() {
																										@Override
																										public void run() {
																												_Hide_Navigation();
																										}
																								});
																						}
																				};
																				_timer.schedule(Timer, (int)(100));
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																		}
																	}
																});
																Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																});
																Success_Download.create().show();
																SketchwareUtil.CustomToast(getApplicationContext(), "Download Complete", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																		}
																});
														}
												};
												_timer.schedule(Timer, (int)(1500));
											}
										} });
									   }
								    cursor.close();
								     }
						} } }).start();
				
			} else {
				SketchwareUtil.CustomToast(getApplicationContext(), "No Internet Connection", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
		}
		catch(Exception e) {
		}
	}
	
	
	public void _File_Remover () {
		if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")) {
			FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk");
		}
		if (FileUtil.isExistFile(apk_path_location.getText().toString().concat("Spotify Mod (Official).apk"))) {
			FileUtil.deleteFile(apk_path_location.getText().toString().concat("Spotify Mod (Official).apk"));
		}
		if (FileUtil.isExistFile("/storage/emulated/0/xManager/Spotify Mod (Official).apk")) {
			FileUtil.deleteFile("/storage/emulated/0/xManager/Spotify Mod (Official).apk");
		}
	}
	
	
	public void _Update_Remover () {
		if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")) {
			FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk");
		}
		if (FileUtil.isExistFile("/storage/emulated/0/xManager/Update/xManager Update.apk")) {
			FileUtil.deleteFile("/storage/emulated/0/xManager/Update/xManager Update.apk");
		}
	}
	
	
	public void _Model_UI () {
		title_header.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		title_sub.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		title_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		title_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		sub_text_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_text_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_text_3.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_3.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_text_4.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		sub_4.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		title_sub.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		device_cpu.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		cpu.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		support.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		donate.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		about.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		source.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		version_switch_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		version_switch_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		green_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		purple_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		red_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		blue_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		orange_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		yellow_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		gray_theme.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		title_about.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		developer_manager.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		developer_spotify.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		support_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		mod_testers.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		mobilism_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		forum_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		manager_team.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		developer_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		developer_2.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		support_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		testers_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		mobilism_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 0);
		forum_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		manager_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		contributors_1.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		changelogs.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		changelogs_x.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		sub_title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		app_version.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		navigation_bar.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		list_auto_refresh.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		list_auto_refresh_info.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		apk_location_info.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		apk_location.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		reset_settings.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		clear_directory_folders.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		force_auto_install.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		force_auto_install_info.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		copy_url_mode.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		copy_file_url_mode_info.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
		box_sub_header.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_1.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_2.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_5.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_6.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_7.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_8.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_9.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_10.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_11.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		main_box_12.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		list_menu_1.setVisibility(View.GONE);
		list_menu_2.setVisibility(View.GONE);
		box_5_sub_2.setVisibility(View.GONE);
		box_6_sub_2.setVisibility(View.GONE);
		list_menu_1.smoothScrollToPosition((int)(0));
		list_menu_2.smoothScrollToPosition((int)(0));
		box_support.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_donate.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_source.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_header.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF1DB954));
		box_about_1.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_2.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_3.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_4.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_5.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_6.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_7.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF212121));
		box_about_sub.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF2962FF));
		box_reset_settings.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)25, 0xFF424242));
		if (!ON_SCREEN.getString("ON_SCREEN", "").equals("ON_SCREEN")) {
			try {
				final ProgressDialog prog_0 = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
				
				prog_0.setMax(100);
				prog_0.setMessage("Initial optimization. Please wait...");
				prog_0.setIndeterminate(true);
				prog_0.setCancelable(false);
				if (!MainActivity.this.isFinishing()){
					prog_0.show();
				}
				Timer = new TimerTask() {
					@Override
					public void run() {
						runOnUiThread(new Runnable() {
							@Override
							public void run() {
								prog_0.dismiss();
								final ProgressDialog prog_1 = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
								
								prog_1.setMax(100);
								prog_1.setMessage("Relaunching...");
								prog_1.setIndeterminate(true);
								prog_1.setCancelable(false);
								prog_1.show();
								
								if (!MainActivity.this.isFinishing()){
									return;
								}
								Timer = new TimerTask() {
									@Override
									public void run() {
										runOnUiThread(new Runnable() {
											@Override
											public void run() {
												prog_1.dismiss();
											}
										});
									}
								};
								_timer.schedule(Timer, (int)(9000));
							}
						});
					}
				};
				_timer.schedule(Timer, (int)(8000));
				if (FileUtil.isExistFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/")) {
					FileUtil.deleteFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/");
				}
				if (FileUtil.isExistFile("/storage/emulated/0/xManager/")) {
					FileUtil.deleteFile("/storage/emulated/0/xManager/");
				}
				main_body.setEnabled(false);
				main_body.setAlpha((float)(0.65d));
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_1.setText(SUB_1.getString("SUB_1", ""));
						Timer = new TimerTask() {
							@Override
							public void run() {
								runOnUiThread(new Runnable() {
									@Override
									public void run() {
										list_menu_1.smoothScrollToPosition((int)(999));
										version_switch_1.setChecked(true);
										version_switch_2.setChecked(false);
										changelogs_switch.setChecked(false);
										main_body.setAlpha((float)(0.65d));
									}
								});
							}
						};
						_timer.schedule(Timer, (int)(300));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_3.setText(SUB_2.getString("SUB_2", ""));
						main_refresh_layout.setRefreshing(true);
						Timer = new TimerTask() {
							@Override
							public void run() {
								runOnUiThread(new Runnable() {
									@Override
									public void run() {
										list_menu_2.smoothScrollToPosition((int)(999));
										version_switch_1.setChecked(false);
										version_switch_2.setChecked(true);
										changelogs_switch.setChecked(false);
										main_body.setAlpha((float)(0.65d));
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														version_switch_1.setChecked(false);
														version_switch_2.setChecked(false);
														changelogs_switch.setChecked(true);
														main_body.setAlpha((float)(0.65d));
														Timer = new TimerTask() {
															@Override
															public void run() {
																runOnUiThread(new Runnable() {
																	@Override
																	public void run() {
																		main_refresh_layout.setRefreshing(false);
																		version_switch_1.setChecked(false);
																		version_switch_2.setChecked(false);
																		changelogs_switch.setChecked(false);
																		main_body.setEnabled(true);
																		main_body.setAlpha((float)(1.0d));
																	}
																});
															}
														};
														_timer.schedule(Timer, (int)(900));
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(800));
									}
								});
							}
						};
						_timer.schedule(Timer, (int)(800));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Version.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Version.addChildEventListener(_Version_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Timer = new TimerTask() {
					@Override
					public void run() {
						runOnUiThread(new Runnable() {
							@Override
							public void run() {
								ON_SCREEN.edit().putString("ON_SCREEN", "ON_SCREEN").commit();
								try {
									Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName() ); 
									
									intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
									intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
									startActivity(intent);
								}
								catch (Exception e) {
								}
							}
						});
					}
				};
				_timer.schedule(Timer, (int)(10000));
				main_body_optimization.setVisibility(View.VISIBLE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.GONE);
				box_switch.setVisibility(View.GONE);
				box_update.setVisibility(View.GONE);
				Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener);
			}
			catch(Exception e) {
			}
		}
		else {
			try {
				main_refresh_layout.setRefreshing(true);
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_1.setText(SUB_1.getString("SUB_1", ""));
						list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
						((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
						main_body.setEnabled(false);
						main_body.setAlpha((float)(0.65d));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_3.setText(SUB_2.getString("SUB_2", ""));
						Timer = new TimerTask() {
							@Override
							public void run() {
								runOnUiThread(new Runnable() {
									@Override
									public void run() {
										main_refresh_layout.setRefreshing(false);
										list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
										((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
										main_body.setEnabled(true);
										main_body.setAlpha((float)(1.0d));
									}
								});
							}
						};
						_timer.schedule(Timer, (int)(800));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Version.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Version.addChildEventListener(_Version_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.VISIBLE);
				box_update.setVisibility(View.VISIBLE);
				box_switch.setVisibility(View.VISIBLE);
				icon_update.setAlpha((float)(1.0d));
				icon_switch.setAlpha((float)(1.0d));
				Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener);
				_Updater();
			}
			catch(Exception e) {
			}
		}
		main_refresh_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
			@Override
			public void onRefresh() {
				try {
					main_body.setEnabled(false);
					main_refresh_layout.setRefreshing(true);
					Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							listdata = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									listdata.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							sub_1.setText(SUB_1.getString("SUB_1", ""));
							Timer = new TimerTask() {
								@Override
								public void run() {
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											list_menu_1.smoothScrollToPosition((int)(999));
											version_switch_1.setChecked(true);
											version_switch_2.setChecked(false);
											changelogs_switch.setChecked(false);
											main_body.setAlpha((float)(0.65d));
										}
									});
								}
							};
							_timer.schedule(Timer, (int)(300));
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							listdata = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									listdata.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							sub_3.setText(SUB_2.getString("SUB_2", ""));
							main_refresh_layout.setRefreshing(true);
							Timer = new TimerTask() {
								@Override
								public void run() {
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											list_menu_2.smoothScrollToPosition((int)(999));
											version_switch_1.setChecked(false);
											version_switch_2.setChecked(true);
											changelogs_switch.setChecked(false);
											main_body.setAlpha((float)(0.65d));
											Timer = new TimerTask() {
												@Override
												public void run() {
													runOnUiThread(new Runnable() {
														@Override
														public void run() {
															version_switch_1.setChecked(false);
															version_switch_2.setChecked(false);
															changelogs_switch.setChecked(true);
															main_body.setAlpha((float)(0.65d));
															Timer = new TimerTask() {
																@Override
																public void run() {
																	runOnUiThread(new Runnable() {
																		@Override
																		public void run() {
																			main_refresh_layout.setRefreshing(false);
																			version_switch_1.setChecked(false);
																			version_switch_2.setChecked(false);
																			changelogs_switch.setChecked(false);
																			main_body.setEnabled(true);
																			main_body.setAlpha((float)(1.0d));
																		}
																	});
																}
															};
															_timer.schedule(Timer, (int)(900));
														}
													});
												}
											};
											_timer.schedule(Timer, (int)(800));
										}
									});
								}
							};
							_timer.schedule(Timer, (int)(800));
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Version.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							Version.addChildEventListener(_Version_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener);
					_Animation_4();
				}
				catch(Exception e) {
				}
			}
		});
		apk_path_location.setText(APK_PATH.getString("PATH", ""));
		if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
			Window w =MainActivity.this.getWindow();
			w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
			w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.setStatusBarColor(0xFF212121);
		}
		CHECK = 0;
		_Update_Remover();
		_Updater_Check();
		_Animation_5();
		_List_Updater();
		_Theme_UI();
		_Effects();
		_Url_Mode();
	}
	
	
	public void _Theme_UI () {
		if (THEME.getString("THEME", "").equals("0")) {
			main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF000000}));
			green_switch.setChecked(false);
			purple_switch.setChecked(false);
			red_switch.setChecked(false);
			blue_switch.setChecked(false);
			orange_switch.setChecked(false);
			yellow_switch.setChecked(false);
			gray_switch.setChecked(false);
		}
		else {
			if (THEME.getString("THEME", "").equals("1")) {
				main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF1DB954}));
				green_switch.setChecked(true);
				purple_switch.setChecked(false);
				red_switch.setChecked(false);
				blue_switch.setChecked(false);
				orange_switch.setChecked(false);
				yellow_switch.setChecked(false);
				gray_switch.setChecked(false);
			}
			else {
				if (THEME.getString("THEME", "").equals("2")) {
					main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFAA00FF}));
					green_switch.setChecked(false);
					purple_switch.setChecked(true);
					red_switch.setChecked(false);
					blue_switch.setChecked(false);
					orange_switch.setChecked(false);
					yellow_switch.setChecked(false);
					gray_switch.setChecked(false);
				}
				else {
					if (THEME.getString("THEME", "").equals("3")) {
						main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFD50000}));
						green_switch.setChecked(false);
						purple_switch.setChecked(false);
						red_switch.setChecked(true);
						blue_switch.setChecked(false);
						orange_switch.setChecked(false);
						yellow_switch.setChecked(false);
						gray_switch.setChecked(false);
					}
					else {
						if (THEME.getString("THEME", "").equals("4")) {
							main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF2962FF}));
							green_switch.setChecked(false);
							purple_switch.setChecked(false);
							red_switch.setChecked(false);
							blue_switch.setChecked(true);
							orange_switch.setChecked(false);
							yellow_switch.setChecked(false);
							gray_switch.setChecked(false);
						}
						else {
							if (THEME.getString("THEME", "").equals("5")) {
								main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFF6D00}));
								green_switch.setChecked(false);
								purple_switch.setChecked(false);
								red_switch.setChecked(false);
								blue_switch.setChecked(false);
								orange_switch.setChecked(true);
								yellow_switch.setChecked(false);
								gray_switch.setChecked(false);
							}
							else {
								if (THEME.getString("THEME", "").equals("6")) {
									main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFFFFD600}));
									green_switch.setChecked(false);
									purple_switch.setChecked(false);
									red_switch.setChecked(false);
									blue_switch.setChecked(false);
									orange_switch.setChecked(false);
									yellow_switch.setChecked(true);
									gray_switch.setChecked(false);
								}
								else {
									if (THEME.getString("THEME", "").equals("7")) {
										main_refresh_layout.setBackground(new GradientDrawable(GradientDrawable.Orientation.BR_TL,new int[] {0xFF000000,0xFF616161}));
										green_switch.setChecked(false);
										purple_switch.setChecked(false);
										red_switch.setChecked(false);
										blue_switch.setChecked(false);
										orange_switch.setChecked(false);
										yellow_switch.setChecked(false);
										gray_switch.setChecked(true);
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	
	public void _Updater () {
		try {
			Version.addListenerForSingleValueEvent(new ValueEventListener() {
				@Override
				public void onDataChange(DataSnapshot _dataSnapshot) {
					Versions_1 = new ArrayList<>();
					try {
						GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
						for (DataSnapshot _data : _dataSnapshot.getChildren()) {
							HashMap<String, Object> _map = _data.getValue(_ind);
							Versions_1.add(_map);
						}
					}
					catch (Exception _e) {
						_e.printStackTrace();
					}
					Latest_Version = Versions_1.get((int)0).get("V").toString();
					if (Double.parseDouble(Latest_Version) > Double.parseDouble(Current_Version)) {
						_RequiredDialog(Update_Authorized, false);
						Update_Authorized.setTitle("NEW MANAGER UPDATE");
						Update_Authorized.setPositiveButton("DOWNLOAD UPDATE", new DialogInterface.OnClickListener() {
							@Override
							public void onClick(DialogInterface _dialog, int _which) {
								try {
									_RequiredDialog(Update_Authorized, true);
									if (FORCE_INSTALL_UPDATE.getString("FORCE_INSTALL_UPDATE", "").equals("XX")) {
										_Download_Update_Install(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/");
									}
									else {
										if (FORCE_INSTALL_UPDATE.getString("FORCE_INSTALL_UPDATE", "").equals("YY")) {
											_Download_Update(hidden_download.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/");
										}
									}
									_Update_Remover();
								}
								catch(Exception e) {
								}
								Timer = new TimerTask() {
									@Override
									public void run() {
										runOnUiThread(new Runnable() {
											@Override
											public void run() {
												_Hide_Navigation();
											}
										});
									}
								};
								_timer.schedule(Timer, (int)(100));
							}
						});
						Update_Authorized.setNeutralButton("NOT NOW", new DialogInterface.OnClickListener() {
							@Override
							public void onClick(DialogInterface _dialog, int _which) {
								_RequiredDialog(Update_Authorized, true);
								Timer = new TimerTask() {
									@Override
									public void run() {
										runOnUiThread(new Runnable() {
											@Override
											public void run() {
												_Hide_Navigation();
											}
										});
									}
								};
								_timer.schedule(Timer, (int)(100));
							}
						});
						Update_Authorized.create().show();
					}
					else {
						if (Double.parseDouble(Current_Version) > Double.parseDouble(Latest_Version)) {
							try {
								main_body_optimization.setVisibility(View.VISIBLE);
								box_header.setVisibility(View.GONE);
								main_body_settings.setVisibility(View.GONE);
								main_scroll_about.setVisibility(View.GONE);
								main_refresh_layout.setVisibility(View.GONE);
								_RequiredDialog(Update_Unauthorized, false);
								Update_Unauthorized.setTitle("MAINTENANCE");
								Update_Unauthorized.setMessage("xManager is currently unavailable right now. Kindly check the application later.");
								Update_Unauthorized.setPositiveButton("THANKS!", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface _dialog, int _which) {
										_RequiredDialog(Update_Unauthorized, true);
										finishAndRemoveTask();
										finishAffinity();
									}
								});
								Update_Unauthorized.create().show();
							}
							catch(Exception e) {
							}
						}
						else {
							Version.child("App").child("V").setValue(Current_Version);
						}
					}
				}
				@Override
				public void onCancelled(DatabaseError _databaseError) {
				}
			});
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Updater_Check () {
		try {
			Package_Name = "com.xc3fff0e.xmanager";
			try {
				android.content.pm.PackageInfo pinfo = getPackageManager().getPackageInfo(Package_Name, android.content.pm.PackageManager.GET_ACTIVITIES);
				Current_Version = pinfo.versionName;
			}
			catch (Exception e) {
				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Version unidentified", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
			DatabaseReference rootRef = _firebase.getReference(); rootRef.child("version").addListenerForSingleValueEvent(new ValueEventListener() {
				@Override
				public void onDataChange(DataSnapshot snapshot) {
					if (snapshot.exists()) {
						
					} else {
						Versions = new HashMap<>();
						Versions.put("V", Current_Version);
						Versions.clear();
						Version.child("App").updateChildren(Versions);
					} }
				@Override
				public void onCancelled(DatabaseError _error) {
				} });
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Download_Update (final String _url, final String _path) {
		try {
			FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext()));
			
			android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
			android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
			if (networkInfo != null && networkInfo.isConnected()) {
				
				
				final String urlDownload = _url;
				
				DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload));
				
				final String fileName = URLUtil.guessFileName(urlDownload, null, null);
				
				request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
				
				request.setMimeType("application/vnd.android.package-archive");
				
				request.allowScanningByMediaScanner();
				
				request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "/Update/xManager Update.apk");
				
				final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
				
				final long downloadId = manager.enqueue(request);
				
				final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
				prog.setMax(100);
				prog.setIndeterminate(false);
				prog.setCancelable(false);
				prog.setCanceledOnTouchOutside(false);
				prog.setTitle("DOWNLOADING FILE...");
				new Thread(new Runnable() {
					
					@Override
					public void run() {
						
						boolean downloading = true;
						
						while (downloading) {
							
							DownloadManager.Query q = new DownloadManager.Query();
							
							q.setFilterById(downloadId);
							
							android.database.Cursor cursor = manager.query(q);
							
							if (cursor != null) { 
								  if (cursor.moveToFirst()) {
									
									int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
									
									int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) {
										
										downloading = false;
										
									}
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) {
										
										runOnUiThread(new Runnable() {
											public void run() { 
												
												SketchwareUtil.CustomToast(getApplicationContext(), "The file or link is currently unavailable. Please try again later.", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
											}
										});
										prog.cancel();
										break;
										
									}
									
									final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total);
									
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											
											prog.setTitle("DOWNLOADING FILE...");
											prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
											prog.setProgress(dl_progress);
											prog.setMax(100);
											prog.show();
											
											if (dl_progress == prog.getMax()) {
												
												Timer = new TimerTask() {
														@Override
														public void run() {
																runOnUiThread(new Runnable() {
																		@Override
																		public void run() {
																
																try {
																	FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/xManager Update.apk", "/storage/emulated/0/xManager/Update/xManager Update.apk");
																	prog.dismiss();
																}
																catch(Exception e) {
																	SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Copying failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																}
																
																_RequiredDialog(Success_Download, false);
																Success_Download.setTitle("SUCCESSFULLY DOWNLOADED");
																Success_Download.setMessage("FILE DIRECTORY:\n</storage/emulated/0/xManager/Update/>");
																Success_Download.setPositiveButton("INSTALL UPDATE", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																		
																		if(android.os.Build.VERSION.SDK_INT >= 29){
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				
																				intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																				 
																				intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																			
																		} else {
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																				Timer = new TimerTask() {
																						@Override
																						public void run() {
																								runOnUiThread(new Runnable() {
																										@Override
																										public void run() {
																												_Hide_Navigation();
																										}
																								});
																						}
																				};
																				_timer.schedule(Timer, (int)(100));
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																		}
																	}
																});
																Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																});
																Success_Download.create().show();
																SketchwareUtil.CustomToast(getApplicationContext(), "Download Complete", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																		}
																});
														}
												};
												_timer.schedule(Timer, (int)(1500));
											}
										} });
									   }
								    cursor.close();
								     }
						} } }).start();
				
			} else {
				SketchwareUtil.CustomToast(getApplicationContext(), "No Internet Connection", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Effects () {
		_Ripple(box_update, "#9E9E9E");
		_Ripple(box_switch, "#9E9E9E");
	}
	
	
	public void _Ripple (final View _view, final String _c) {
		_view.setBackground(Drawables.getSelectableDrawableFor(Color.parseColor(_c)));
		_view.setClickable(true);
		
	}
	
	public static class Drawables {
		    public static android.graphics.drawable.Drawable getSelectableDrawableFor(int color) {
			        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
				            android.graphics.drawable.StateListDrawable stateListDrawable = new android.graphics.drawable.StateListDrawable();
				            stateListDrawable.addState(
				                new int[]{android.R.attr.state_pressed},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#ffffff"))
				            );
				            stateListDrawable.addState(
				                new int[]{android.R.attr.state_focused},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"))
				            );
				            stateListDrawable.addState(
				                new int[]{},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"))
				            );
				            return stateListDrawable;
				        } else {
				            android.content.res.ColorStateList pressedColor = android.content.res.ColorStateList.valueOf(color);
				            android.graphics.drawable.ColorDrawable defaultColor = new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"));
				            
				android.graphics.drawable.Drawable rippleColor = getRippleColor(color);
				            return new android.graphics.drawable.RippleDrawable(
				                pressedColor,
				                defaultColor,
				                rippleColor
				            );
				        }
			    }
		
		    private static android.graphics.drawable.Drawable getRippleColor(int color) {
			        float[] outerRadii = new float[8];
			        Arrays.fill(outerRadii, 0);
			        android.graphics.drawable.shapes.RoundRectShape r = new android.graphics.drawable.shapes.RoundRectShape(outerRadii, null, null);
			        
			android.graphics.drawable.ShapeDrawable shapeDrawable = new 
			android.graphics.drawable.ShapeDrawable(r);
			        shapeDrawable.getPaint().setColor(color);
			        return shapeDrawable;
			    }
		 
		    private static int lightenOrDarken(int color, double fraction) {
			        if (canLighten(color, fraction)) {
				            return lighten(color, fraction);
				        } else {
				            return darken(color, fraction);
				        }
			    }
		 
		    private static int lighten(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        red = lightenColor(red, fraction);
			        green = lightenColor(green, fraction);
			        blue = lightenColor(blue, fraction);
			        int alpha = Color.alpha(color);
			        return Color.argb(alpha, red, green, blue);
			    }
		 
		    private static int darken(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        red = darkenColor(red, fraction);
			        green = darkenColor(green, fraction);
			        blue = darkenColor(blue, fraction);
			        int alpha = Color.alpha(color);
			 
			        return Color.argb(alpha, red, green, blue);
			    }
		 
		    private static boolean canLighten(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        return canLightenComponent(red, fraction)
			            && canLightenComponent(green, fraction)
			            && canLightenComponent(blue, fraction);
			    }
		 
		    private static boolean canLightenComponent(int colorComponent, double fraction) {
			        int red = Color.red(colorComponent);
			        int green = Color.green(colorComponent);
			        int blue = Color.blue(colorComponent);
			        return red + (red * fraction) < 255
			            && green + (green * fraction) < 255
			            && blue + (blue * fraction) < 255;
			    }
		 
		    private static int darkenColor(int color, double fraction) {
			        return (int) Math.max(color - (color * fraction), 0);
			    }
		 
		    private static int lightenColor(int color, double fraction) {
			        return (int) Math.min(color + (color * fraction), 255);
			    }
	}
	public static class CircleDrawables {
		    public static android.graphics.drawable.Drawable getSelectableDrawableFor(int color) {
			        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
				            android.graphics.drawable.StateListDrawable stateListDrawable = new android.graphics.drawable.StateListDrawable();
				            stateListDrawable.addState(
				                new int[]{android.R.attr.state_pressed},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#ffffff"))
				            );
				            stateListDrawable.addState(
				                new int[]{android.R.attr.state_focused},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"))
				            );
				            stateListDrawable.addState(
				                new int[]{},
				                new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"))
				            );
				            return stateListDrawable;
				        } else {
				            android.content.res.ColorStateList pressedColor = android.content.res.ColorStateList.valueOf(color);
				            android.graphics.drawable.ColorDrawable defaultColor = new android.graphics.drawable.ColorDrawable(Color.parseColor("#00ffffff"));
				            
				android.graphics.drawable.Drawable rippleColor = getRippleColor(color);
				            return new android.graphics.drawable.RippleDrawable(
				                pressedColor,
				                defaultColor,
				                rippleColor
				            );
				        }
			    }
		
		    private static android.graphics.drawable.Drawable getRippleColor(int color) {
			        float[] outerRadii = new float[180];
			        Arrays.fill(outerRadii, 80);
			        android.graphics.drawable.shapes.RoundRectShape r = new android.graphics.drawable.shapes.RoundRectShape(outerRadii, null, null);
			        
			android.graphics.drawable.ShapeDrawable shapeDrawable = new 
			android.graphics.drawable.ShapeDrawable(r);
			        shapeDrawable.getPaint().setColor(color);
			        return shapeDrawable;
			    }
		 
		    private static int lightenOrDarken(int color, double fraction) {
			        if (canLighten(color, fraction)) {
				            return lighten(color, fraction);
				        } else {
				            return darken(color, fraction);
				        }
			    }
		 
		    private static int lighten(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        red = lightenColor(red, fraction);
			        green = lightenColor(green, fraction);
			        blue = lightenColor(blue, fraction);
			        int alpha = Color.alpha(color);
			        return Color.argb(alpha, red, green, blue);
			    }
		 
		    private static int darken(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        red = darkenColor(red, fraction);
			        green = darkenColor(green, fraction);
			        blue = darkenColor(blue, fraction);
			        int alpha = Color.alpha(color);
			 
			        return Color.argb(alpha, red, green, blue);
			    }
		 
		    private static boolean canLighten(int color, double fraction) {
			        int red = Color.red(color);
			        int green = Color.green(color);
			        int blue = Color.blue(color);
			        return canLightenComponent(red, fraction)
			            && canLightenComponent(green, fraction)
			            && canLightenComponent(blue, fraction);
			    }
		 
		    private static boolean canLightenComponent(int colorComponent, double fraction) {
			        int red = Color.red(colorComponent);
			        int green = Color.green(colorComponent);
			        int blue = Color.blue(colorComponent);
			        return red + (red * fraction) < 255
			            && green + (green * fraction) < 255
			            && blue + (blue * fraction) < 255;
			    }
		 
		    private static int darkenColor(int color, double fraction) {
			        return (int) Math.max(color - (color * fraction), 0);
			    }
		 
		    private static int lightenColor(int color, double fraction) {
			        return (int) Math.min(color + (color * fraction), 255);
		}
	}
	
	public void drawableclass() {
		
		
	}
	
	
	public void _Hide_Navigation () {
		try {
			if (NAVIGATION_BAR.getString("NAVIGATION", "").equals("1")) {
				getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
				navigation_switch.setChecked(true);
			}
			else {
				if (NAVIGATION_BAR.getString("NAVIGATION", "").equals("0")) {
					getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
					
					if (Build.VERSION.SDK_INT >= 21) {
						getWindow().setNavigationBarColor(Color.parseColor("#212121"));
					}
					navigation_switch.setChecked(false);
				}
			}
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Animation_0 () {
		Animation a;
		a = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		a.setDuration(200); main_box_1.startAnimation(a);
		a = null;
		Animation b;
		b = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		b.setDuration(300); main_box_2.startAnimation(b);
		b = null;
		Animation c;
		c = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		c.setDuration(400); main_box_6.startAnimation(c);
		c = null;
		Animation d;
		d = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		d.setDuration(500); box_sub_header.startAnimation(d);
		d = null;
		Animation e;
		e = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		e.setDuration(600); main_box_4.startAnimation(e);
		e = null;
		Animation f;
		f = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		f.setDuration(300); title_header.startAnimation(f);
		f = null;
		Animation g;
		g = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		g.setDuration(400); box_switch.startAnimation(g);
		g = null;
		Animation h;
		h = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		h.setDuration(500); box_update.startAnimation(h);
		h = null;
	}
	
	
	public void _Animation_1 () {
		Animation i;
		i = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		i.setDuration(200); box_settings_close.startAnimation(i);
		i = null;
		Animation j;
		j = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		j.setDuration(600); main_box_7.startAnimation(j);
		j = null;
		Animation k;
		k = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		k.setDuration(700); main_box_5.startAnimation(k);
		k = null;
		Animation l;
		l = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		l.setDuration(300); title_header.startAnimation(l);
		l = null;
		Animation z;
		z = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		z.setDuration(300); main_box_8.startAnimation(z);
		z = null;
		Animation hh;
		hh = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		hh.setDuration(800); main_box_9.startAnimation(hh);
		hh = null;
		Animation ii;
		ii = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		ii.setDuration(900); main_box_10.startAnimation(ii);
		ii = null;
		Animation jj;
		jj = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		jj.setDuration(1000); box_reset_settings.startAnimation(jj);
		jj = null;
		Animation kk;
		kk = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		kk.setDuration(400); main_box_11.startAnimation(kk);
		kk = null;
		Animation ll;
		ll = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		ll.setDuration(500); main_box_12.startAnimation(ll);
		ll = null;
	}
	
	
	public void _Animation_2 () {
		Animation m;
		m = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		m.setDuration(200); box_about_close.startAnimation(m);
		m = null;
		Animation n;
		n = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		n.setDuration(300); box_about_header.startAnimation(n);
		n = null;
		Animation o;
		o = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		o.setDuration(400); sub_title.startAnimation(o);
		o = null;
		Animation p;
		p = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		p.setDuration(500); box_about_1.startAnimation(p);
		p = null;
		Animation q;
		q = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		q.setDuration(600); box_about_2.startAnimation(q);
		q = null;
		Animation r;
		r = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		r.setDuration(700); box_about_3.startAnimation(r);
		r = null;
		Animation s;
		s = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		s.setDuration(800); box_about_4.startAnimation(s);
		s = null;
		Animation t;
		t = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		t.setDuration(900); box_about_5.startAnimation(t);
		t = null;
		Animation u;
		u = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		u.setDuration(1000); box_about_6.startAnimation(u);
		u = null;
		Animation v;
		v = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		v.setDuration(1100); box_about_7.startAnimation(v);
		v = null;
		Animation w;
		w = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		w.setDuration(1200); contributors_1.startAnimation(w);
		w = null;
		Animation x;
		x = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		x.setDuration(300); title_header.startAnimation(x);
		x = null;
	}
	
	
	public void _Animation_3 () {
		Animation aa;
		aa = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		aa.setDuration(200); box_theme_0.startAnimation(aa);
		aa = null;
		Animation bb;
		bb = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		bb.setDuration(300); box_theme_1.startAnimation(bb);
		bb = null;
		Animation cc;
		cc = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		cc.setDuration(400); box_theme_2.startAnimation(cc);
		cc = null;
		Animation dd;
		dd = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		dd.setDuration(500); box_theme_3.startAnimation(dd);
		dd = null;
		Animation ee;
		ee = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		ee.setDuration(600); box_theme_4.startAnimation(ee);
		ee = null;
		Animation ff;
		ff = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		ff.setDuration(700); box_theme_5.startAnimation(ff);
		ff = null;
		Animation gg;
		gg = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		gg.setDuration(800); box_theme_6.startAnimation(gg);
		gg = null;
	}
	
	
	public void _Animation_4 () {
		Animation a;
		a = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		a.setDuration(200); main_box_1.startAnimation(a);
		a = null;
		Animation b;
		b = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		b.setDuration(300); main_box_2.startAnimation(b);
		b = null;
		Animation c;
		c = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		c.setDuration(400); main_box_6.startAnimation(c);
		c = null;
		Animation d;
		d = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		d.setDuration(500); box_sub_header.startAnimation(d);
		d = null;
		Animation e;
		e = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
		e.setDuration(600); main_box_4.startAnimation(e);
		e = null;
	}
	
	
	public void _Dark_Navigation () {
		if (Build.VERSION.SDK_INT >= 21) {
			getWindow().setNavigationBarColor(Color.parseColor("#212121"));
		}
	}
	
	
	public void _Linear_Animation (final boolean _clickanim, final double _animDuration, final View _view) {
		_view.setOnTouchListener(new View.OnTouchListener() {
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				switch (event.getAction()){
					case MotionEvent.ACTION_DOWN:{
						ObjectAnimator scaleX = new ObjectAnimator();
						scaleX.setTarget(_view);
						scaleX.setPropertyName("scaleX");
						scaleX.setFloatValues(0.9f);
						scaleX.setDuration((int)_animDuration);
						scaleX.start();
						
						ObjectAnimator scaleY = new ObjectAnimator();
						scaleY.setTarget(_view);
						scaleY.setPropertyName("scaleY");
						scaleY.setFloatValues(0.9f);
						scaleY.setDuration((int)_animDuration);
						scaleY.start();
						break;
					}
					case MotionEvent.ACTION_UP:{
						
						ObjectAnimator scaleX = new ObjectAnimator();
						scaleX.setTarget(_view);
						scaleX.setPropertyName("scaleX");
						scaleX.setFloatValues((float)1);
						scaleX.setDuration((int)_animDuration);
						scaleX.start();
						
						ObjectAnimator scaleY = new ObjectAnimator();
						scaleY.setTarget(_view);
						scaleY.setPropertyName("scaleY");
						scaleY.setFloatValues((float)1);
						scaleY.setDuration((int)_animDuration);
						scaleY.start();
						
						break;
					}
				}
				return false;
			}
		});
	}
	
	
	public void _Animation_5 () {
		_Linear_Animation(true, 200, box_uninstall);
		_Linear_Animation(true, 200, box_settings);
		_Linear_Animation(true, 200, box_cache);
		_Linear_Animation(true, 200, box_open);
		_Linear_Animation(true, 200, box_source);
		_Linear_Animation(true, 200, box_support);
		_Linear_Animation(true, 200, box_donate);
		_Linear_Animation(true, 200, box_about);
		_Linear_Animation(true, 200, box_switch);
		_Linear_Animation(true, 200, box_update);
		_Linear_Animation(true, 200, box_icon_close);
		_Linear_Animation(true, 200, box_settings_icon_close);
		_Linear_Animation(true, 200, main_box_10);
		_Linear_Animation(true, 200, box_reset_settings);
	}
	
	
	public void _List_Updater () {
		if (LIST_REFRESH.getString("UPDATE", "").equals("ON")) {
			list_auto_refresh_switch.setChecked(true);
			try {
				main_body.setEnabled(false);
				main_refresh_layout.setRefreshing(true);
				Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_1.setText(SUB_1.getString("SUB_1", ""));
						Timer = new TimerTask() {
							@Override
							public void run() {
								runOnUiThread(new Runnable() {
									@Override
									public void run() {
										list_menu_1.smoothScrollToPosition((int)(999));
										version_switch_1.setChecked(true);
										version_switch_2.setChecked(false);
										changelogs_switch.setChecked(false);
										main_body.setAlpha((float)(0.65d));
									}
								});
							}
						};
						_timer.schedule(Timer, (int)(300));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						listdata = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								listdata.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						sub_3.setText(SUB_2.getString("SUB_2", ""));
						main_refresh_layout.setRefreshing(true);
						Timer = new TimerTask() {
							@Override
							public void run() {
								runOnUiThread(new Runnable() {
									@Override
									public void run() {
										list_menu_2.smoothScrollToPosition((int)(999));
										version_switch_1.setChecked(false);
										version_switch_2.setChecked(true);
										changelogs_switch.setChecked(false);
										main_body.setAlpha((float)(0.65d));
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														version_switch_1.setChecked(false);
														version_switch_2.setChecked(false);
														changelogs_switch.setChecked(true);
														main_body.setAlpha((float)(0.65d));
														Timer = new TimerTask() {
															@Override
															public void run() {
																runOnUiThread(new Runnable() {
																	@Override
																	public void run() {
																		main_refresh_layout.setRefreshing(false);
																		version_switch_1.setChecked(false);
																		version_switch_2.setChecked(false);
																		changelogs_switch.setChecked(false);
																		main_body.setEnabled(true);
																		main_body.setAlpha((float)(1.0d));
																	}
																});
															}
														};
														_timer.schedule(Timer, (int)(900));
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(800));
									}
								});
							}
						};
						_timer.schedule(Timer, (int)(800));
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Version.addListenerForSingleValueEvent(new ValueEventListener() {
					@Override
					public void onDataChange(DataSnapshot _dataSnapshot) {
						others = new ArrayList<>();
						try {
							GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
							for (DataSnapshot _data : _dataSnapshot.getChildren()) {
								HashMap<String, Object> _map = _data.getValue(_ind);
								others.add(_map);
							}
						}
						catch (Exception _e) {
							_e.printStackTrace();
						}
						Version.addChildEventListener(_Version_child_listener);
					}
					@Override
					public void onCancelled(DatabaseError _databaseError) {
					}
				});
				Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener);
				main_body_optimization.setVisibility(View.GONE);
				main_scroll_settings.setVisibility(View.GONE);
				main_scroll_about.setVisibility(View.GONE);
				main_refresh_layout.setVisibility(View.VISIBLE);
				box_update.setVisibility(View.VISIBLE);
				box_switch.setVisibility(View.VISIBLE);
				icon_update.setAlpha((float)(1.0d));
				icon_switch.setAlpha((float)(1.0d));
			}
			catch(Exception e) {
			}
		}
		else {
			if (LIST_REFRESH.getString("UPDATE", "").equals("OFF")) {
				list_auto_refresh_switch.setChecked(false);
				try {
					Regular_Mod.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							listdata = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									listdata.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							sub_1.setText(SUB_1.getString("SUB_1", ""));
							main_refresh_layout.setRefreshing(true);
							list_menu_1.setAdapter(new List_menu_1Adapter(listdata));
							((BaseAdapter)list_menu_1.getAdapter()).notifyDataSetChanged();
							main_body.setEnabled(false);
							main_body.setAlpha((float)(0.65d));
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Amoled_Black.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							listdata = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									listdata.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							sub_3.setText(SUB_2.getString("SUB_2", ""));
							Timer = new TimerTask() {
								@Override
								public void run() {
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											main_refresh_layout.setRefreshing(false);
											list_menu_2.setAdapter(new List_menu_2Adapter(listdata));
											((BaseAdapter)list_menu_2.getAdapter()).notifyDataSetChanged();
											main_body.setEnabled(true);
											main_body.setAlpha((float)(1.0d));
										}
									});
								}
							};
							_timer.schedule(Timer, (int)(800));
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					xManager_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							xManager_Changelogs.addChildEventListener(_xManager_Changelogs_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							Mod_Changelogs.addChildEventListener(_Mod_Changelogs_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					Version.addListenerForSingleValueEvent(new ValueEventListener() {
						@Override
						public void onDataChange(DataSnapshot _dataSnapshot) {
							others = new ArrayList<>();
							try {
								GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {};
								for (DataSnapshot _data : _dataSnapshot.getChildren()) {
									HashMap<String, Object> _map = _data.getValue(_ind);
									others.add(_map);
								}
							}
							catch (Exception _e) {
								_e.printStackTrace();
							}
							Version.addChildEventListener(_Version_child_listener);
						}
						@Override
						public void onCancelled(DatabaseError _databaseError) {
						}
					});
					main_body_optimization.setVisibility(View.GONE);
					main_scroll_settings.setVisibility(View.GONE);
					main_scroll_about.setVisibility(View.GONE);
					main_refresh_layout.setVisibility(View.VISIBLE);
					box_update.setVisibility(View.VISIBLE);
					box_switch.setVisibility(View.VISIBLE);
					icon_update.setAlpha((float)(1.0d));
					icon_switch.setAlpha((float)(1.0d));
					main_refresh_layout.setRefreshing(false);
					Connection.startRequestNetwork(RequestNetworkController.GET, "https://spotify.com", "PAWN!", _Connection_request_listener);
					_Updater();
				}
				catch(Exception e) {
				}
			}
		}
	}
	
	
	public void _Default_Path () {
		if (PATH.equals("")) {
			apk_path_location.setText("/storage/emulated/0/xManager/");
		}
		else {
			APK_PATH.edit().putString("PATH", apk_path_location.getText().toString()).commit();
		}
	}
	
	
	public void _Download_Install (final String _url, final String _path) {
		try {
			FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext()));
			
			android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
			android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
			if (networkInfo != null && networkInfo.isConnected()) {
				
				
				final String urlDownload = _url;
				
				DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload));
				
				final String fileName = URLUtil.guessFileName(urlDownload, null, null);
				
				request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
				
				request.setMimeType("application/vnd.android.package-archive");
				
				request.allowScanningByMediaScanner();
					request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "Spotify Mod (Official).apk");
				
				final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
				
				final long downloadId = manager.enqueue(request);
				
				final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
				prog.setMax(100);
				prog.setIndeterminate(false);
				prog.setCancelable(false);
				prog.setCanceledOnTouchOutside(false);
				prog.setTitle("DOWNLOADING FILE...");
				new Thread(new Runnable() {
					
					@Override
					public void run() {
						
						boolean downloading = true;
						
						while (downloading) {
							
							DownloadManager.Query q = new DownloadManager.Query();
							
							q.setFilterById(downloadId);
							
							android.database.Cursor cursor = manager.query(q);
							
							if (cursor != null) { 
								  if (cursor.moveToFirst()) {
									
									int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
									
									int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) {
										
										downloading = false;
										
									}
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) {
										
										runOnUiThread(new Runnable() {
											public void run() { 
												
												SketchwareUtil.CustomToast(getApplicationContext(), "The file or link is currently unavailable. Please try again later.", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
											}
										});
										prog.cancel();
										break;
										
									}
									
									final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total);
									
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											
											prog.setTitle("DOWNLOADING FILE...");
											prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
											prog.setProgress(dl_progress);
											prog.setMax(100);
											prog.show();
											
											if (dl_progress == prog.getMax()) {
												
												Timer = new TimerTask() {
														@Override
														public void run() {
																runOnUiThread(new Runnable() {
																		@Override
																		public void run() {
																
																try {
																	FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk", apk_path_location.getText().toString().concat("Spotify Mod (Official).apk"));
																}
																catch(Exception e) {
																	SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Copying failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																}
																
																_RequiredDialog(Success_Download, false);
																Success_Download.setTitle("SUCCESSFULLY DOWNLOADED");
																Success_Download.setMessage("FILE DIRECTORY:\n<".concat(apk_path_location.getText().toString().concat(">")));
																Success_Download.setPositiveButton("INSTALL NOW", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																		
																		if(android.os.Build.VERSION.SDK_INT >= 29){
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				
																				intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																				 
																				intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																			
																		} else {
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																				Timer = new TimerTask() {
																						@Override
																						public void run() {
																								runOnUiThread(new Runnable() {
																										@Override
																										public void run() {
																												_Hide_Navigation();
																										}
																								});
																						}
																				};
																				_timer.schedule(Timer, (int)(100));
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																		}
																	}
																});
																Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																});
																
																prog.cancel();
																
																Success_Download.create().dismiss();
																
																StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																
																if(android.os.Build.VERSION.SDK_INT >= 29){
																	
																	try {
																		Intent intent = new Intent(Intent.ACTION_VIEW);
																		
																		intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																		 
																		intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																		
																		startActivity(intent);
																	}
																	catch(Exception e) {
																		SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																	}
																	
																} else {
																	
																	try {
																		Intent intent = new Intent(Intent.ACTION_VIEW);
																		intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Spotify Mod (Official).apk")), "application/vnd.android.package-archive");
																		
																		startActivity(intent);
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																	catch(Exception e) {
																		SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																	}
																}
																		}
																});
														}
												};
												_timer.schedule(Timer, (int)(1500));
											}
										} });
									   }
								    cursor.close();
								     }
						} } }).start();
				
			} else {
				SketchwareUtil.CustomToast(getApplicationContext(), "No Internet Connection", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Download_Update_Install (final String _url, final String _path) {
		try {
			FileUtil.makeDir(FileUtil.getPackageDataDir(getApplicationContext()));
			
			android.net.ConnectivityManager connMgr = (android.net.ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
			android.net.NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
			if (networkInfo != null && networkInfo.isConnected()) {
				
				
				final String urlDownload = _url;
				
				DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlDownload));
				
				final String fileName = URLUtil.guessFileName(urlDownload, null, null);
				
				request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
				
				request.setMimeType("application/vnd.android.package-archive");
				
				request.allowScanningByMediaScanner();
				
				request.setDestinationInExternalFilesDir(this,Environment.DIRECTORY_DOWNLOADS, "/Update/xManager Update.apk");
				
				final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
				
				final long downloadId = manager.enqueue(request);
				
				final ProgressDialog prog = new ProgressDialog(this, ProgressDialog.THEME_DEVICE_DEFAULT_DARK);
				prog.setMax(100);
				prog.setIndeterminate(false);
				prog.setCancelable(false);
				prog.setCanceledOnTouchOutside(false);
				prog.setTitle("DOWNLOADING FILE...");
				new Thread(new Runnable() {
					
					@Override
					public void run() {
						
						boolean downloading = true;
						
						while (downloading) {
							
							DownloadManager.Query q = new DownloadManager.Query();
							
							q.setFilterById(downloadId);
							
							android.database.Cursor cursor = manager.query(q);
							
							if (cursor != null) { 
								  if (cursor.moveToFirst()) {
									
									int bytes_downloaded = cursor.getInt(cursor .getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
									
									int bytes_total = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_SUCCESSFUL) {
										
										downloading = false;
										
									}
									
									if (cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)) == DownloadManager.STATUS_FAILED) {
										
										runOnUiThread(new Runnable() {
											public void run() { 
												
												SketchwareUtil.CustomToast(getApplicationContext(), "The file or link is currently unavailable. Please try again later.", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
											}
										});
										prog.cancel();
										break;
										
									}
									
									final int dl_progress = (int) ((bytes_downloaded * 100l) / bytes_total);
									
									runOnUiThread(new Runnable() {
										@Override
										public void run() {
											
											prog.setTitle("DOWNLOADING FILE...");
											prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
											prog.setProgress(dl_progress);
											prog.setMax(100);
											prog.show();
											
											if (dl_progress == prog.getMax()) {
												
												Timer = new TimerTask() {
														@Override
														public void run() {
																runOnUiThread(new Runnable() {
																		@Override
																		public void run() {
																
																try {
																	FileUtil.copyFile("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/xManager Update.apk", "/storage/emulated/0/xManager/Update/xManager Update.apk");
																	prog.dismiss();
																}
																catch(Exception e) {
																	SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Copying failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																}
																
																_RequiredDialog(Success_Download, false);
																Success_Download.setTitle("SUCCESSFULLY DOWNLOADED");
																Success_Download.setMessage("FILE DIRECTORY:\n</storage/emulated/0/xManager/Update/>");
																Success_Download.setPositiveButton("INSTALL UPDATE", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																		
																		if(android.os.Build.VERSION.SDK_INT >= 29){
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				
																				intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																				 
																				intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																			
																		} else {
																			
																			try {
																				Intent intent = new Intent(Intent.ACTION_VIEW);
																				intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																				
																				startActivity(intent);
																				Timer = new TimerTask() {
																						@Override
																						public void run() {
																								runOnUiThread(new Runnable() {
																										@Override
																										public void run() {
																												_Hide_Navigation();
																										}
																								});
																						}
																				};
																				_timer.schedule(Timer, (int)(100));
																			}
																			catch(Exception e) {
																				SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																			}
																		}
																	}
																});
																Success_Download.setNeutralButton("LATER", new DialogInterface.OnClickListener() {
																		@Override
																		public void onClick(DialogInterface _dialog, int _which) {
																				_RequiredDialog(Success_Download, true);
																		
																		prog.cancel();
																		
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																});
																
																prog.cancel();
																
																Success_Download.create().dismiss();
																
																StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());
																
																if(android.os.Build.VERSION.SDK_INT >= 29){
																	
																	try {
																		Intent intent = new Intent(Intent.ACTION_VIEW);
																		
																		intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
																		 
																		intent.setDataAndType(FileProvider.getUriForFile(MainActivity.this, "com.xc3fff0e.xmanager.provider", new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																		
																		startActivity(intent);
																	}
																	catch(Exception e) {
																		SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																	}
																	
																} else {
																	
																	try {
																		Intent intent = new Intent(Intent.ACTION_VIEW);
																		intent.setDataAndType(Uri.fromFile(new File("/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/Update/xManager Update.apk")), "application/vnd.android.package-archive");
																		
																		startActivity(intent);
																		Timer = new TimerTask() {
																				@Override
																				public void run() {
																						runOnUiThread(new Runnable() {
																								@Override
																								public void run() {
																										_Hide_Navigation();
																								}
																						});
																				}
																		};
																		_timer.schedule(Timer, (int)(100));
																	}
																	catch(Exception e) {
																		SketchwareUtil.CustomToast(getApplicationContext(), "Null 404: Installation failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
																	}
																}
																		}
																});
														}
												};
												_timer.schedule(Timer, (int)(1500));
											}
										} });
									   }
								    cursor.close();
								     }
						} } }).start();
				
			} else {
				SketchwareUtil.CustomToast(getApplicationContext(), "No Internet Connection", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
			}
		}
		catch(Exception e) {
		}
	}
	
	
	public void _Url_Mode () {
		if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_ON")) {
			copy_url_mode_switch.setChecked(true);
			title_header.setText("xManager (UM)");
		}
		else {
			if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_OFF")) {
				copy_url_mode_switch.setChecked(false);
				title_header.setText("xManager");
			}
		}
	}
	
	
	public class List_menu_1Adapter extends BaseAdapter {
		ArrayList<HashMap<String, Object>> _data;
		public List_menu_1Adapter(ArrayList<HashMap<String, Object>> _arr) {
			_data = _arr;
		}
		
		@Override
		public int getCount() {
			return _data.size();
		}
		
		@Override
		public HashMap<String, Object> getItem(int _index) {
			return _data.get(_index);
		}
		
		@Override
		public long getItemId(int _index) {
			return _index;
		}
		@Override
		public View getView(final int _position, View _v, ViewGroup _container) {
			LayoutInflater _inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			View _view = _v;
			if (_view == null) {
				_view = _inflater.inflate(R.layout.list_menu_1, null);
			}
			
			final LinearLayout box = (LinearLayout) _view.findViewById(R.id.box);
			final TextView link = (TextView) _view.findViewById(R.id.link);
			final ImageView icon = (ImageView) _view.findViewById(R.id.icon);
			final TextView title = (TextView) _view.findViewById(R.id.title);
			
			try {
				title.setVisibility(View.VISIBLE);
				link.setVisibility(View.GONE);
				title.setText(listdata.get((int)(listdata.size() - 1) - _position).get("title").toString().replace("-", "."));
				link.setText(listdata.get((int)(listdata.size() - 1) - _position).get("link").toString());
				title.setText(title.getText().toString().replace("(Armeabi.v7a)", "(Armeabi-v7a)"));
				title.setText(title.getText().toString().replace("(Arm64.v8a)", "(Arm64-v8a)"));
				title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
				if ((_position == 0) && title.getText().toString().contains("(Armeabi-v7a)")) {
					SUB_A = title.getText().toString().replace("Spotify v", " ");
					SUB_B = SUB_A.replace("(Armeabi-v7a)", " ");
				}
				else {
					if ((_position == 0) && title.getText().toString().contains("(Arm64-v8a)")) {
						SUB_A = title.getText().toString().replace("Spotify v", " ");
						SUB_B = SUB_A.replace("(Arm64-v8a)", " ");
					}
				}
				SUB_1.edit().putString("SUB_1", SUB_B).commit();
				box.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View _view) {
						if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_OFF")) {
							_RequiredDialog(Selected_Spotify, false);
							Selected_Spotify.setTitle(title.getText().toString());
							Selected_Spotify.setMessage("You selected this modified version. Do you want to continue?");
							Selected_Spotify.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface _dialog, int _which) {
									_RequiredDialog(Selected_Spotify, true);
									_RequiredDialog(Download_Spotify, false);
									Download_Spotify.setTitle("DOWNLOAD READY");
									Download_Spotify.setMessage("Downloading this modified apk will overwrite the previous file located at the application's external file directory.");
									Download_Spotify.setPositiveButton("DOWNLOAD", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											try {
												_RequiredDialog(Download_Spotify, true);
												if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("X")) {
													_Download_Install(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/");
												}
												else {
													if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("Y")) {
														_Download(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/");
													}
												}
												_File_Remover();
											}
											catch(Exception e) {
											}
										}
									});
									Download_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											_RequiredDialog(Download_Spotify, true);
											Timer = new TimerTask() {
												@Override
												public void run() {
													runOnUiThread(new Runnable() {
														@Override
														public void run() {
															_Hide_Navigation();
														}
													});
												}
											};
											_timer.schedule(Timer, (int)(100));
										}
									});
									Download_Spotify.create().show();
								}
							});
							Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface _dialog, int _which) {
									_RequiredDialog(Selected_Spotify, true);
									Timer = new TimerTask() {
										@Override
										public void run() {
											runOnUiThread(new Runnable() {
												@Override
												public void run() {
													_Hide_Navigation();
												}
											});
										}
									};
									_timer.schedule(Timer, (int)(100));
								}
							});
							Selected_Spotify.create().show();
							FileUtil.makeDir("/storage/emulated/0/xManager");
							FileUtil.makeDir("/storage/emulated/0/xManager/Update");
						}
						else {
							if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_ON")) {
								_RequiredDialog(Selected_Spotify, false);
								Selected_Spotify.setTitle(title.getText().toString());
								Selected_Spotify.setMessage("You selected this modified version. Do you want to copy the url?");
								Selected_Spotify.setPositiveButton("COPY URL", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface _dialog, int _which) {
										try {
											_RequiredDialog(Selected_Spotify, true);
											((ClipboardManager) getSystemService(getApplicationContext().CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("clipboard", link.getText().toString()));
											SketchwareUtil.CustomToast(getApplicationContext(), "Url copied to clipboard", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
										}
										catch(Exception e) {
										}
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														_Hide_Navigation();
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(100));
									}
								});
								Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface _dialog, int _which) {
										_RequiredDialog(Selected_Spotify, true);
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														_Hide_Navigation();
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(100));
									}
								});
								Selected_Spotify.create().show();
								FileUtil.makeDir("/storage/emulated/0/xManager");
								FileUtil.makeDir("/storage/emulated/0/xManager/Update");
							}
						}
					}
				});
				Animation animation;
				animation = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
				animation.setDuration(200); box.startAnimation(animation);
				animation = null;
			}
			catch(Exception e) {
			}
			
			return _view;
		}
	}
	
	public class List_menu_2Adapter extends BaseAdapter {
		ArrayList<HashMap<String, Object>> _data;
		public List_menu_2Adapter(ArrayList<HashMap<String, Object>> _arr) {
			_data = _arr;
		}
		
		@Override
		public int getCount() {
			return _data.size();
		}
		
		@Override
		public HashMap<String, Object> getItem(int _index) {
			return _data.get(_index);
		}
		
		@Override
		public long getItemId(int _index) {
			return _index;
		}
		@Override
		public View getView(final int _position, View _v, ViewGroup _container) {
			LayoutInflater _inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			View _view = _v;
			if (_view == null) {
				_view = _inflater.inflate(R.layout.list_menu_2, null);
			}
			
			final LinearLayout box = (LinearLayout) _view.findViewById(R.id.box);
			final TextView link = (TextView) _view.findViewById(R.id.link);
			final ImageView icon = (ImageView) _view.findViewById(R.id.icon);
			final TextView title = (TextView) _view.findViewById(R.id.title);
			
			try {
				title.setVisibility(View.VISIBLE);
				link.setVisibility(View.GONE);
				title.setText(listdata.get((int)(listdata.size() - 1) - _position).get("title").toString().replace("-", "."));
				link.setText(listdata.get((int)(listdata.size() - 1) - _position).get("link").toString());
				title.setText(title.getText().toString().replace("(Armeabi.v7a)", "(Armeabi-v7a)"));
				title.setText(title.getText().toString().replace("(Arm64.v8a)", "(Arm64-v8a)"));
				title.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/base_font.ttf"), 1);
				if ((_position == 0) && title.getText().toString().contains("(Armeabi-v7a)")) {
					SUB_X = title.getText().toString().replace("Spotify v", " ");
					SUB_Y = SUB_X.replace("(Armeabi-v7a)", " ");
				}
				else {
					if ((_position == 0) && title.getText().toString().contains("(Arm64-v8a)")) {
						SUB_X = title.getText().toString().replace("Spotify v", " ");
						SUB_Y = SUB_X.replace("(Arm64-v8a)", " ");
					}
				}
				SUB_2.edit().putString("SUB_2", SUB_Y).commit();
				box.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View _view) {
						if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_OFF")) {
							_RequiredDialog(Selected_Spotify, false);
							Selected_Spotify.setTitle(title.getText().toString());
							Selected_Spotify.setMessage("You selected this modified version. Do you want to continue?");
							Selected_Spotify.setPositiveButton("CONTINUE", new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface _dialog, int _which) {
									_RequiredDialog(Selected_Spotify, true);
									_RequiredDialog(Download_Spotify, false);
									Download_Spotify.setTitle("DOWNLOAD READY");
									Download_Spotify.setMessage("Downloading this modified apk will overwrite the previous file located at the application's external file directory.");
									Download_Spotify.setPositiveButton("DOWNLOAD", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											try {
												_RequiredDialog(Download_Spotify, true);
												if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("X")) {
													_Download_Install(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/");
												}
												else {
													if (FORCE_INSTALL.getString("FORCE_INSTALL", "").equals("Y")) {
														_Download(link.getText().toString(), "/storage/emulated/0/Android/data/com.xc3fff0e.xmanager/files/Download/");
													}
												}
												_File_Remover();
											}
											catch(Exception e) {
											}
										}
									});
									Download_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
										@Override
										public void onClick(DialogInterface _dialog, int _which) {
											_RequiredDialog(Download_Spotify, true);
											Timer = new TimerTask() {
												@Override
												public void run() {
													runOnUiThread(new Runnable() {
														@Override
														public void run() {
															_Hide_Navigation();
														}
													});
												}
											};
											_timer.schedule(Timer, (int)(100));
										}
									});
									Download_Spotify.create().show();
								}
							});
							Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface _dialog, int _which) {
									_RequiredDialog(Selected_Spotify, true);
									Timer = new TimerTask() {
										@Override
										public void run() {
											runOnUiThread(new Runnable() {
												@Override
												public void run() {
													_Hide_Navigation();
												}
											});
										}
									};
									_timer.schedule(Timer, (int)(100));
								}
							});
							Selected_Spotify.create().show();
							FileUtil.makeDir("/storage/emulated/0/xManager");
							FileUtil.makeDir("/storage/emulated/0/xManager/Update");
						}
						else {
							if (COPY_URL_MODE.getString("COPY_URL_MODE", "").equals("URL_ON")) {
								_RequiredDialog(Selected_Spotify, false);
								Selected_Spotify.setTitle(title.getText().toString());
								Selected_Spotify.setMessage("You selected this modified version. Do you want to copy the url?");
								Selected_Spotify.setPositiveButton("COPY URL", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface _dialog, int _which) {
										try {
											_RequiredDialog(Selected_Spotify, true);
											((ClipboardManager) getSystemService(getApplicationContext().CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("clipboard", link.getText().toString()));
											SketchwareUtil.CustomToast(getApplicationContext(), "Url copied to clipboard", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);
										}
										catch(Exception e) {
										}
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														_Hide_Navigation();
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(100));
									}
								});
								Selected_Spotify.setNeutralButton("CANCEL", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface _dialog, int _which) {
										_RequiredDialog(Selected_Spotify, true);
										Timer = new TimerTask() {
											@Override
											public void run() {
												runOnUiThread(new Runnable() {
													@Override
													public void run() {
														_Hide_Navigation();
													}
												});
											}
										};
										_timer.schedule(Timer, (int)(100));
									}
								});
								Selected_Spotify.create().show();
								FileUtil.makeDir("/storage/emulated/0/xManager");
								FileUtil.makeDir("/storage/emulated/0/xManager/Update");
							}
						}
					}
				});
				Animation animation;
				animation = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.slide_in_left);
				animation.setDuration(200); box.startAnimation(animation);
				animation = null;
			}
			catch(Exception e) {
			}
			
			return _view;
		}
	}
	
	@Deprecated
	public void showMessage(String _s) {
		Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show();
	}
	
	@Deprecated
	public int getLocationX(View _v) {
		int _location[] = new int[2];
		_v.getLocationInWindow(_location);
		return _location[0];
	}
	
	@Deprecated
	public int getLocationY(View _v) {
		int _location[] = new int[2];
		_v.getLocationInWindow(_location);
		return _location[1];
	}
	
	@Deprecated
	public int getRandom(int _min, int _max) {
		Random random = new Random();
		return random.nextInt(_max - _min + 1) + _min;
	}
	
	@Deprecated
	public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list) {
		ArrayList<Double> _result = new ArrayList<Double>();
		SparseBooleanArray _arr = _list.getCheckedItemPositions();
		for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
			if (_arr.valueAt(_iIdx))
			_result.add((double)_arr.keyAt(_iIdx));
		}
		return _result;
	}
	
	@Deprecated
	public float getDip(int _input){
		return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics());
	}
	
	@Deprecated
	public int getDisplayWidthPixels(){
		return getResources().getDisplayMetrics().widthPixels;
	}
	
	@Deprecated
	public int getDisplayHeightPixels(){
		return getResources().getDisplayMetrics().heightPixels;
	}
	
}