Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed Mar 31, 2015
1 parent 0a779fa commit 656a9ce
Show file tree
Hide file tree
Showing 101 changed files with 8,571 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
66 changes: 66 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}

dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.14.7'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

repositories {
maven { url 'http://download.crashlytics.com/maven' }
}


def gitSha() {
return 'git rev-parse --short HEAD'.execute().text.trim()
}

//def buildTime() {
// def df = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss'Z'")
// df.setTimeZone(TimeZone.getTimeZone("GMT+1"))
// return df.format(new Date())
//}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "eu.thedarken.rootvalidator"
minSdkVersion 10
targetSdkVersion 22
versionCode 21
versionName "2.0.1"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
applicationVariants.all { variant ->
if (variant.buildType.name == "release") {
variant.outputs.each { output ->
def file = output.outputFile
output.outputFile = new File(file.parent, "RootValidator-v" + defaultConfig.versionName + "-" + defaultConfig.versionCode + "-" + gitSha() + ".apk")
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.melnykov:floatingactionbutton:1.1.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.crashlytics.android:crashlytics:1.1.13'
compile 'com.google.android.gms:play-services-ads:7.0.0'

}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/darken/android-sdks/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package eu.thedarken.rootvalidator;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
47 changes: 47 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="eu.thedarken.rootvalidator"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>

<!-- Include required permissions for Google Mobile Ads to run-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


<supports-screens android:anyDensity="true"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>

<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!--Include the AdActivity configChanges and theme. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"/>

<meta-data
android:name="com.crashlytics.ApiKey"
android:value="170f4b968d80af623123e062354e39d736b3420d"/>
</application>

</manifest>
3 changes: 3 additions & 0 deletions app/src/main/assets/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#v2.0.1
- Fixed crash when trying to open links without a browser installed
- Updated gradle, buildtools and libraries
70 changes: 70 additions & 0 deletions app/src/main/java/eu/thedarken/rootvalidator/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package eu.thedarken.rootvalidator;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.FrameLayout;

import com.crashlytics.android.Crashlytics;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

import java.io.File;

public class MainActivity extends ActionBarActivity {
private Fragment mFragment;
private AdView mAdView;
private FrameLayout mAdContainer;
private static final String FILE_NO_ADS = "no_ads";

public String getFragmentClass() {
return ValidatorFragment.class.getName();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Crashlytics.start(this);
setContentView(R.layout.activity_mainactivity_layout);
mFragment = getSupportFragmentManager().findFragmentByTag(getFragmentClass());
if (mFragment == null) {
mFragment = Fragment.instantiate(this, getFragmentClass());
getSupportFragmentManager().beginTransaction().replace(R.id.content, mFragment, getFragmentClass()).commit();
}
mAdContainer = (FrameLayout) findViewById(R.id.fl_ad_container);
File noAdsFile = new File(getExternalFilesDir(null), FILE_NO_ADS);
if (!noAdsFile.exists()) {
mAdContainer.setVisibility(View.VISIBLE);
mAdView = (AdView) findViewById(R.id.adv_banner);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("C34CF836138E576F0C3CC8BBF6B19388")
.build();
mAdView.loadAd(adRequest);
} else {
mAdContainer.setVisibility(View.GONE);
}
}

@Override
protected void onResume() {
if (mAdView != null)
mAdView.resume();
super.onResume();
}

@Override
protected void onPause() {
if (mAdView != null)
mAdView.pause();
super.onPause();
}

@Override
protected void onDestroy() {
if (mAdView != null)
mAdView.destroy();
super.onDestroy();
}
}
111 changes: 111 additions & 0 deletions app/src/main/java/eu/thedarken/rootvalidator/RVAdapter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package eu.thedarken.rootvalidator;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;

import de.hdodenhof.circleimageview.CircleImageView;
import eu.thedarken.rootvalidator.tests.BP;
import eu.thedarken.rootvalidator.tests.TestInfo;

/**
* Created by darken on 13.02.2015.
*/
public class RVAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final ArrayList<TestInfo> mData;
private static final int NORMAL_TYPE = 0;

public RVAdapter(ArrayList<TestInfo> data) {
mData = data;
}

public ArrayList<TestInfo> getData() {
return mData;
}

@Override
public int getItemViewType(int position) {
return NORMAL_TYPE;
}

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
switch (viewType) {
case NORMAL_TYPE: {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_info_line, parent, false);
return new RVInfoHolder(v);
}
default: {
return null;
}
}
}

@Override
public int getItemCount() {
return mData.size();
}

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (getItemViewType(position) == NORMAL_TYPE) {
TestInfo info = mData.get(position);
RVInfoHolder infoHolder = (RVInfoHolder) holder;
infoHolder.inject(info);
}
}

class RVInfoHolder extends RecyclerView.ViewHolder {
private CircleImageView mCircularImageView;
private TextView mTitle;
private LinearLayout mPointsContainer;
private ImageView mExpandIcon;

public RVInfoHolder(View itemView) {
super(itemView);
mCircularImageView = (CircleImageView) itemView.findViewById(R.id.civ_icon);
mTitle = (TextView) itemView.findViewById(R.id.tv_title);
mPointsContainer = (LinearLayout) itemView.findViewById(R.id.ll_points);
mExpandIcon = (ImageView) itemView.findViewById(R.id.iv_expand_button);
}

private Context getContext() {
return itemView.getContext();
}

public void inject(TestInfo info) {
mCircularImageView.setImageDrawable(info.getIcon(getContext()));
mTitle.setText(info.getPrimaryInfo(getContext()));
if (info.getCriterias(getContext()).isEmpty()) {
mExpandIcon.setVisibility(View.GONE);
mPointsContainer.setVisibility(View.GONE);
itemView.setOnClickListener(null);
} else {
mExpandIcon.setVisibility(View.VISIBLE);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPointsContainer.setVisibility(mPointsContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
mExpandIcon.setImageResource(mPointsContainer.getVisibility() == View.VISIBLE ? R.drawable.ic_expand_less_white_24dp : R.drawable.ic_expand_more_white_24dp);
}
});
mPointsContainer.removeAllViews();
for (BP bp : info.getCriterias(getContext())) {
View bpLine = LayoutInflater.from(getContext()).inflate(R.layout.view_bp, mPointsContainer, false);
TextView text = (TextView) bpLine.findViewById(R.id.tv_bp_text);
CircleImageView point = (CircleImageView) bpLine.findViewById(R.id.civ_bp_icon);
text.setText(bp.getText());
point.setImageDrawable(bp.getPoint());
mPointsContainer.addView(bpLine);
}
}
}
}
}
Loading

0 comments on commit 656a9ce

Please sign in to comment.