Skip to content

Commit

Permalink
Project Back.
Browse files Browse the repository at this point in the history
  • Loading branch information
w9jds committed Mar 13, 2016
1 parent 27e3ef9 commit b82ef10
Show file tree
Hide file tree
Showing 104 changed files with 6,693 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Jeremy Shore

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# MarketBot
This is an open source Android application that allows the user to search the market, along with buy and sell orders.

It is quick and responsive, so you don't have to worry about that slow SDE bloating the APK.

I used Android Material design standards and made sure it uses as many transitions as possible to make it a smooth and enjoyable experience.

Make sure to tap on the market orders, because they open to give you more info, like range and location.

# Future
I have also been working on adding it a "bot" feature that tracks specific items in specific regions of space and notify you when the price of buy or sell orders pass your threshold. Along with that I added network caching so you can still use quite a bit of it in offline mode, and working on building it into the database so it if quicker and requires internet only for specific calls to update info or ones not stored.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
compileSdkVersion 'android-N'
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.w9jds.marketbot"
minSdkVersion 21
minSdkVersion 'N'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

debugCompile 'com.facebook.stetho:stetho:1.1.1'
debugCompile 'com.facebook.stetho:stetho-okhttp:1.1.1'
debugCompile 'com.facebook.stetho:stetho-urlconnection:1.1.1'

compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:palette-v7:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:design:23.2.0'

apt 'com.google.dagger:dagger-compiler:2.0.2'
compile 'com.google.dagger:dagger:2.0.2'
provided 'org.glassfish:javax.annotation:10.0-b28'

compile 'org.mod4j.org.apache.commons:lang:2.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile project(path: ':eveapi')
}
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/JeremyShore/Library/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 *;
#}
13 changes: 13 additions & 0 deletions app/src/androidTest/java/com/w9jds/marketbot/ApplicationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.w9jds.marketbot;

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);
}
}
9 changes: 9 additions & 0 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<manifest package="com.w9jds.marketbot"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
tools:replace="android:name"
android:name=".DebugMarketBot"/>

</manifest>
23 changes: 23 additions & 0 deletions app/src/debug/java/com/w9jds/marketbot/DebugMarketBot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.w9jds.marketbot;

import android.app.Application;

import com.facebook.stetho.Stetho;

/**
* Created by w9jds on 3/13/2016.
*/
public class DebugMarketBot extends Application {

@Override
public void onCreate() {
super.onCreate();

Stetho.initialize(
Stetho.newInitializerBuilder(this)
.enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
.build());

}
}
35 changes: 35 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.w9jds.marketbot">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:name=".classes.MarketBot"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/MarketBot">

<activity
android:name=".activities.MainActivity"
android:theme="@style/MarketBot.Activities.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".activities.ItemActivity"
android:theme="@style/MarketBot.Activities.ItemActivity">

</activity>

</application>

</manifest>
155 changes: 155 additions & 0 deletions app/src/main/java/com/w9jds/marketbot/activities/ItemActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package com.w9jds.marketbot.activities;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Spinner;

import com.w9jds.eveapi.Models.MarketItemBase;
import com.w9jds.eveapi.Models.Region;
import com.w9jds.eveapi.Models.Type;
import com.w9jds.marketbot.R;
import com.w9jds.marketbot.adapters.OrdersTabAdapter;
import com.w9jds.marketbot.adapters.RegionAdapter;
import com.w9jds.marketbot.data.BaseDataManager;
import com.w9jds.marketbot.data.DataManager;
import com.w9jds.marketbot.ui.fragments.OrdersTab;

import java.util.HashMap;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
* Created by Jeremy Shore on 2/22/16.
*/
public class ItemActivity extends AppCompatActivity implements BaseDataManager.DataLoadingCallbacks, AdapterView.OnItemSelectedListener {

@Bind(R.id.region_spinner)
Spinner regionSpinner;

@Bind(R.id.content_pager)
ViewPager pager;

@Bind(R.id.sliding_tabs)
TabLayout tabLayout;

private ActionBar actionBar;
private DataManager dataManager;
private Type currentType;
private RegionAdapter regionAdapter;
private OrdersTabAdapter tabAdapter;

private HashMap<Integer, OrdersTab> orderTabs = new HashMap<>();

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_market_item);
ButterKnife.bind(this);

Toolbar toolbar = ButterKnife.findById(this, R.id.main_toolbar);

setSupportActionBar(toolbar);
actionBar = getSupportActionBar();

if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
}

currentType = getIntent().getParcelableExtra("currentType");
regionAdapter = new RegionAdapter(this);
// dataManager = new DataManager(this, getApplication()) {
// @Override
// public void onDataLoaded(List<? extends MarketItemBase> data) {
// if (data.size() > 0) {
// if (data.get(0) instanceof Region) {
// regionAdapter.addAllItems(data);
//
// regionSpinner.setSelection(regionAdapter.getPositionfromId(10000002), true);
// }
// }
// }
//
// @Override
// public void onDataLoaded(Object data) {
// // never fired
// }
// };

regionSpinner.setAdapter(regionAdapter);
regionSpinner.setOnItemSelectedListener(this);

tabAdapter = new OrdersTabAdapter(getSupportFragmentManager(), this, currentType.getId());
pager.setOffscreenPageLimit(4);
pager.setAdapter(tabAdapter);
tabLayout.setupWithViewPager(pager);

tabLayout.setTabsFromPagerAdapter(tabAdapter);

dataManager.loadRegions();
}

public String getCurrentTypeIcon() {
return currentType.getIconLink();
}

public String getCurrentTypeName() {
return currentType.getName();
}

@Override
public boolean onNavigateUp() {
finishAfterTransition();
return true;
}

@Override
public void dataStartedLoading() {

}

@Override
public void dataFinishedLoading() {

}

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Region region = (Region) regionAdapter.getItem(position);

for (OrdersTab tab : orderTabs.values()) {
tab.updateOrdersList(region, currentType);
}
}

public void addOrdersFragment(int position, OrdersTab tab) {
orderTabs.put(position, tab);
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
Loading

0 comments on commit b82ef10

Please sign in to comment.