Commit 4566f882 by Przemyslaw Rossa

Init

0 parents
Showing 24 changed files with 677 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="AdTestMobile" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
</component>
</module>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.slimspots.mobile.adtestmobile"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Users\Przemysloaw\AppData\Local\Android\sdk/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 *;
#}
package com.slimspots.mobile.adtestmobile;
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);
}
}
\ No newline at end of file
/**
* Package
*/
package com.slimspots.mobile.droid.ads;
/**
* AdSize Enums
* Created by Jimmi Rossa jr@slimspots.com
*/
public enum AdSize
{
/**
* Unkown Size
*/
UNKNOWN,
/**
* Size 320 x 50
*/
TYPE320X50,
/**
* Size 320 x 100
*/
TYPE320X100,
/**
* Size 300 x 250
*/
TYPE300X250,
/**
* Size 468 x 60
*/
TYPE468X60,
/**
* Size 768 x 90
*/
TYPE728X90
}
/**
* Package
*/
package com.slimspots.mobile.droid.ads;
/**
* Created by Jimmi Rossa jr@slimspots.com
*/
public class SlimException extends Exception
{
/**
* Constructor
*/
public SlimException()
{
}
/**
* Constructor
* @param message
*/
public SlimException(String message)
{
super(message);
}
/**
* Constructor
* @param cause
*/
public SlimException(Throwable cause)
{
super(cause);
}
/**
* Constructor
* @param message
* @param cause
*/
public SlimException(String message, Throwable cause)
{
super(message, cause);
}
}
/**
* Package
*/
package com.slimspots.mobile.droid.ads;
/**
* Imports
*/
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
/**
* SlimImageCache for handle LRU Cache (only avalible at v4 and up)
* needed to builds Linker option is not SET!!!
* Created by Jimmi Rossa jr@slimspots.com
*/
public class SlimImageCache
{
/**
* Images Warehouse to hold all Images
*/
private LruCache<String, Bitmap> ImagesWarehouse;
/**
* Cache Singleton Instance
*/
private static SlimImageCache Cache;
/**
* Get Instance
* @return
*/
public static SlimImageCache GetInstance()
{
if(SlimImageCache.Cache == null)
{
SlimImageCache.Cache = new SlimImageCache();
}
return SlimImageCache.Cache;
}
/**
* Unitialize Cache
*/
public void UnitializeCache()
{
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() /1024);
final int cacheSize = maxMemory / 8;
System.out.println("cache size = "+cacheSize);
ImagesWarehouse = new LruCache<String, Bitmap>(cacheSize)
{
protected int sizeOf(String key, Bitmap value)
{
int bitmapByteCount = value.getRowBytes() * value.getHeight();
return bitmapByteCount / 1024;
}
};
}
/**
* Add Image To Warehouse
* @param key
* @param value
*/
public void AddImageToWarehouse(String key, Bitmap value)
{
if(ImagesWarehouse != null && ImagesWarehouse.get(key) == null)
{
try
{
ImagesWarehouse.put(key, value);
}
catch (Exception exception)
{
// TODO ERROR HANDLER
}
}
}
/**
* Get Image From Warehouse
* @param key
* @return
*/
public Bitmap GetImageFromWarehouse(String key)
{
if(key != null)
{
return ImagesWarehouse.get(key);
}
else
{
return null;
}
}
/**
* Remove Image From Warehouse
* @param key
*/
public void RemoveImageFromWarehouse(String key)
{
ImagesWarehouse.remove(key);
}
/**
* Clear Cache
*/
public void ClearCache()
{
if(ImagesWarehouse != null)
{
ImagesWarehouse.evictAll();
}
}
}
package com.slimspots.mobile.droid.ads;
/**
*
*/
public class SlimListener
{
// CURRENTY NOT IMPLEMENTED
}
/**
* Package
*/
package com.slimspots.mobile.droid.ads;
/**
* Imports
*/
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
import java.io.InputStream;
/**
* SlimTask (needed to run the Download Task in Background and don't freeze the UI)
*
* new SlimTask((ImageView) findViewById(R.id.yourImageView)).execute("???");
* Created by Jimmi Rossa jr@slimspots.com
*/
public class SlimTask extends AsyncTask<String, Void, Bitmap>
{
/**
* Android ImageView
*/
private ImageView Bitmap = null;
/**
* Constructor
* @param bitmap
*/
public SlimTask(ImageView bitmap)
{
if(bitmap == null)
{
// TODO THROW EXCEPTION
}
this.Bitmap = bitmap;
}
/**
* do In Background triggered from Async Task
* @param url
* @return
*/
protected Bitmap doInBackground(String[] url)
{
String urldisplay = url[0];
Bitmap bitmapObject = null;
try
{
InputStream in = new java.net.URL(urldisplay).openStream();
bitmapObject = BitmapFactory.decodeStream(in);
}
catch (Exception exception)
{
// TODO ERROR
}
return bitmapObject;
}
/**
* on Post Execute
* @param result
*/
protected void onPostExecute(Bitmap result)
{
this.Bitmap.setImageBitmap(result);
}
}
/**
* Package
*/
package com.slimspots.mobile.droid.ads;
/**
* Imports
*/
import android.app.Activity;
import android.view.View;
/**
* SlimView Initial Class
* Created by Jimmi Rossa jr@slimspots.com
*/
public class SlimView extends View
{
/**
* SlimView Instance
*/
private static SlimView Instance;
/**
* Parent Activity
*/
private Activity Parent = null;
/**
* AdSize
*/
private AdSize Size = AdSize.UNKNOWN;
/**
* Adspace Id
*/
private int AdspaceId = 0;
/**
* Private Constructor
* @param activity
*/
private SlimView (Activity activity)
{
super(activity);
if(activity == null)
{
//throw new SlimException("activity can't be empty!");
}
this.Parent = activity;
}
/**
* Create Singleton Instance
* @param activity
* @return
*/
public static SlimView Create (Activity activity)
{
if (SlimView.Instance == null)
{
SlimView.Instance = new SlimView(activity);
}
return SlimView.Instance;
}
/**
* Set Ad Size (see AdSize enum)
* @param size
*/
public void SetAdSize(AdSize size)
{
if(this.GetAdSize() == AdSize.UNKNOWN)
{
this.Size = size;
}
}
/**
* Set User Adspace Id
* @param adSpaceId
*/
public void SetAdspaceId(int adSpaceId)
{
if(this.AdspaceId == 0)
{
this.AdspaceId = adSpaceId;
}
}
/**
* Get current used AdSize
* @return
*/
public AdSize GetAdSize()
{
return this.Size;
}
/**
* Get the User Adspace Id
* @return
*/
public int GetAdspaceId()
{
return this.AdspaceId;
}
}
<uses-permission android:name="android.permission.INTERNET" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.slimspots.mobile.adtestmobile" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
/**
* Package
*/
package com.slimspots.mobile.adtestmobile;
/**
* Import
*/
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
/**
* Main Test Activity for SlimAds
*/
public class MainActivity extends AppCompatActivity
{
/**
* on Create
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* on Create Options Menu
* @param menu
* @return
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
/**
* on Options Item Selected
* @param item
* @return
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:id="@+id/mainView"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="@+id/action_settings" android:title="@string/action_settings"
android:orderInCategory="100" app:showAsAction="never" />
</menu>
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
<resources>
<string name="app_name">AdTestMobile</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!