Skip to content

Commit

Permalink
Version 0.1.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m1d0v committed Mar 6, 2018
2 parents 0789bd9 + da1baec commit 664622b
Show file tree
Hide file tree
Showing 71 changed files with 1,567 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ google-services.json
freeline.py
freeline/
freeline_project_description.json

.DS_Store
49 changes: 49 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
27 changes: 27 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.vladislav.menu"
minSdkVersion 19
targetSdkVersion 26
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# 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 *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.vladislav.menu;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.example.vladislav.menu", appContext.getPackageName());
}
}
25 changes: 25 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.vladislav.menu"
android:versionCode="1"
android:versionName="0.1.0-alpha">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MenuActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/src/main/java/com/example/vladislav/BasePresenter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.vladislav;

public interface BasePresenter {

void start();

}
23 changes: 23 additions & 0 deletions app/src/main/java/com/example/vladislav/BaseView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.vladislav;

public interface BaseView<T> {

void setPresenter(T presenter);

}
14 changes: 14 additions & 0 deletions app/src/main/java/com/example/vladislav/data/CryptoRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.vladislav.data;

import java.util.List;

/**
* Created by d3m1d0v on 04.03.2018.
*/

public interface CryptoRepository {

List<CurrencyBaseInfo> getAllCurrenciesInfo();

void updateCurrenciesInfo();
}
51 changes: 51 additions & 0 deletions app/src/main/java/com/example/vladislav/data/CurrencyBaseInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.vladislav.data;

import java.math.RoundingMode;
import java.text.DecimalFormat;

/**
* Created by d3m1d0v on 04.03.2018.
*/

public class CurrencyBaseInfo {

private static final String FORMAT = "#.###";
private static final DecimalFormat FORMATTER;

static {
FORMATTER = new DecimalFormat();
FORMATTER.setRoundingMode(RoundingMode.CEILING);
}

private String name;
private float price;
private float change;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getPriceValue() {
return "$" + FORMATTER.format(price);
}

public void setPrice(float price) {
this.price = price;
}

public String getChangeValue() {
String value = FORMATTER.format(change);
value = Float.parseFloat(value) > 0 ? '+' + value : value;
value = value + '%';

return value;
}

public void setChange(float change) {
this.change = change;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.example.vladislav.data;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
* Created by d3m1d0v on 04.03.2018.
*/

public class TestCryptoRepository implements CryptoRepository {

private static TestCryptoRepository INSTANCE;

private List<CurrencyBaseInfo> currencies;
private String[] currenciesName = {
"Bitcoin",
"Ethereum",
"Ripple",
"Bitcoin Cash",
"Litecoin",
"NEO",
"Cardano",
"Stellar",
"EOS",
"Monero",
"IOTA",
"Dash",
"NEM",
"TRON",
"Zcash",
"GOLOS"
};

private TestCryptoRepository() {
currencies = new ArrayList<>(currenciesName.length);
updateCurrenciesInfo();
}

public static TestCryptoRepository getInstance() {
if (INSTANCE == null){
INSTANCE = new TestCryptoRepository();
}
return INSTANCE;
}

@Override
public List<CurrencyBaseInfo> getAllCurrenciesInfo() {
return currencies;
}

@Override
public void updateCurrenciesInfo() {
currencies.clear();

for (String name: currenciesName) {
CurrencyBaseInfo info = new CurrencyBaseInfo();
info.setName(name);
info.setPrice(genPriceValue());
info.setChange(genChangeValue());
currencies.add(info);
}
}

private float genPriceValue() {
float leftLimit = 0.1F;
float rightLimit = 1000F;
float generatedFloat = leftLimit + new Random().nextFloat() * (rightLimit - leftLimit);
return generatedFloat;
}

private float genChangeValue() {
float leftLimit = -10F;
float rightLimit = 10F;
float generatedFloat = leftLimit + new Random().nextFloat() * (rightLimit - leftLimit);
return generatedFloat;
}
}
Loading

0 comments on commit 664622b

Please sign in to comment.