-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
1,567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,5 @@ google-services.json | |
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/example/vladislav/menu/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
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
23
app/src/main/java/com/example/vladislav/BasePresenter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
14
app/src/main/java/com/example/vladislav/data/CryptoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
51
app/src/main/java/com/example/vladislav/data/CurrencyBaseInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
app/src/main/java/com/example/vladislav/data/TestCryptoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.