Skip to content

Commit

Permalink
Add built-in crypto algorithm list
Browse files Browse the repository at this point in the history
  • Loading branch information
IanField90 committed Jan 26, 2017
1 parent 2022014 commit ab72e3a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 19 deletions.
32 changes: 16 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'

android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
compileSdkVersion 25
buildToolsVersion '25.0.2'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -13,10 +13,10 @@ android {

defaultConfig {
minSdkVersion 9
targetSdkVersion 24
targetSdkVersion 25
applicationId 'uk.co.ianfield.devstat'
versionCode 14
versionName '2.2.1'
versionCode 15
versionName '2.3.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
Expand All @@ -41,13 +41,13 @@ android {
}

dependencies {
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:design:25.1.0'

compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'

provided 'javax.annotation:jsr250-api:1.0'
compile 'com.google.dagger:dagger:2.0.2'
Expand All @@ -60,11 +60,11 @@ dependencies {

androidTestCompile 'junit:junit:4.12'

androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.1'
androidTestCompile 'com.android.support:support-annotations:24.2.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
androidTestCompile 'com.android.support:support-annotations:25.1.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
// Set this dependency if you want to use Hamcrest matching
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/java/uk/co/ianfield/devstat/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class MainActivity extends AppCompatActivity {
private ArrayList<StatItem> screenStats;
private ArrayList<StatItem> softwareStats;
private ArrayList<StatItem> featureStats;
private ArrayList<StatItem> cryptoStats;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -82,12 +83,18 @@ protected void onCreate(Bundle savedInstanceState) {
// Features (some will dupe for now)
featureStats = helper.getFeatureList();

cryptoStats = helper.getCryptoList();

// This could probably be done better
ArrayList<ArrayList<StatItem>> statGroups = new ArrayList<>();
statGroups.addAll(Arrays.asList(screenStats, softwareStats, hardwareStats, featureStats));
statGroups.addAll(
Arrays.asList(screenStats, softwareStats, hardwareStats, featureStats, cryptoStats)
);

viewPager.setAdapter(new InformationPagerAdapter(getSupportFragmentManager(), this,
new int[]{R.string.title_screen_metrics, R.string.title_software, R.string.title_hardware, R.string.title_features},
new int[]{R.string.title_screen_metrics, R.string.title_software, R.string.title_hardware,
R.string.title_features, R.string.title_crypto
},
statGroups));

tabLayout.setupWithViewPager(viewPager);
Expand Down
23 changes: 23 additions & 0 deletions app/src/main/java/uk/co/ianfield/devstat/StatHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
import android.util.DisplayMetrics;
import android.util.Log;

import java.security.Provider;
import java.security.Security;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Set;

import uk.co.ianfield.devstat.model.StatItem;

Expand Down Expand Up @@ -283,6 +286,26 @@ private boolean isTelephonyEnabled() {
return (tm != null && tm.getSimState() == TelephonyManager.SIM_STATE_READY);
}

ArrayList<StatItem> getCryptoList() {
ArrayList<StatItem> cryptoList = new ArrayList<>();

for (Provider provider : Security.getProviders()) {
StatItem item = new StatItem();
item.setTitle(provider.getName());
String info = "";

Set<Provider.Service> services = provider.getServices();
for (Provider.Service service : services) {
info += service.getAlgorithm() + "\n";
}
info = info.substring(0, info.length() - 2);
item.setInfo(info);
cryptoList.add(item);
}

return cryptoList;
}

public enum Hardware {
MANUFACTURER,
MODEL,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
<string name="processors">Online Processors</string>

<string name="copied_to_clipboard">Copied to clipboard!</string>
<string name="title_crypto">Crypto</string>

</resources>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

classpath 'me.tatarka:gradle-retrolambda:3.3.0'
Expand Down

0 comments on commit ab72e3a

Please sign in to comment.