Revision e4854e54
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/external/RubikNetwork.java | ||
---|---|---|
29 | 29 |
import java.security.MessageDigest; |
30 | 30 |
import java.security.NoSuchAlgorithmException; |
31 | 31 |
|
32 |
import android.app.Activity; |
|
32 | 33 |
import android.content.Context; |
33 | 34 |
import android.content.pm.PackageInfo; |
34 | 35 |
import android.content.pm.PackageManager; |
35 | 36 |
import android.graphics.Bitmap; |
36 | 37 |
import android.graphics.BitmapFactory; |
37 | 38 |
|
38 |
import androidx.fragment.app.FragmentActivity; |
|
39 |
|
|
40 | 39 |
import org.distorted.library.main.DistortedLibrary; |
41 | 40 |
import org.distorted.objectlib.json.JsonWriter; |
42 | 41 |
import org.distorted.objects.RubikObjectList; |
... | ... | |
529 | 528 |
|
530 | 529 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
531 | 530 |
|
532 |
private void figureOutVersion(FragmentActivity act)
|
|
531 |
private void figureOutVersion(Activity act) |
|
533 | 532 |
{ |
534 |
try |
|
535 |
{ |
|
536 |
PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0); |
|
537 |
mVersion = pInfo.versionName; |
|
538 |
} |
|
539 |
catch (PackageManager.NameNotFoundException e) |
|
533 |
if( mVersion==null ) |
|
540 | 534 |
{ |
541 |
mVersion = "0.9.2"; |
|
535 |
try |
|
536 |
{ |
|
537 |
PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0); |
|
538 |
mVersion = pInfo.versionName; |
|
539 |
} |
|
540 |
catch (PackageManager.NameNotFoundException e) |
|
541 |
{ |
|
542 |
mVersion = "0.9.2"; |
|
543 |
} |
|
542 | 544 |
} |
543 | 545 |
} |
544 | 546 |
|
... | ... | |
829 | 831 |
|
830 | 832 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
831 | 833 |
|
832 |
public void download(final ScoresReceiver receiver, final FragmentActivity act)
|
|
834 |
public void download(final ScoresReceiver receiver, final Activity act) |
|
833 | 835 |
{ |
834 | 836 |
initializeStatics(); |
835 | 837 |
figureOutVersion(act); |
... | ... | |
847 | 849 |
|
848 | 850 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
849 | 851 |
|
850 |
public void submit(ScoresReceiver receiver, final FragmentActivity act)
|
|
852 |
public void submit(ScoresReceiver receiver, final Activity act) |
|
851 | 853 |
{ |
852 | 854 |
initializeStatics(); |
853 | 855 |
figureOutVersion(act); |
... | ... | |
865 | 867 |
|
866 | 868 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
867 | 869 |
|
868 |
public void debug() |
|
870 |
public void debug(final Activity act)
|
|
869 | 871 |
{ |
870 | 872 |
initializeStatics(); |
873 |
figureOutVersion(act); |
|
871 | 874 |
mDebugState = DEBUG_RUNNING; |
872 | 875 |
|
873 | 876 |
Thread thread = new Thread() |
... | ... | |
883 | 886 |
|
884 | 887 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
885 | 888 |
|
886 |
public void suspicious(final String suspicious) |
|
889 |
public void suspicious(final String suspicious, final Activity act)
|
|
887 | 890 |
{ |
888 | 891 |
initializeStatics(); |
892 |
figureOutVersion(act); |
|
889 | 893 |
|
890 | 894 |
Thread thread = new Thread() |
891 | 895 |
{ |
Also available in: Unified diff
FigureOutVersion before calling debugs.cgi !